redis_cache
sw 10 years ago
commit a881343db5

@ -15,11 +15,10 @@ class ActivityNotifysController < ApplicationController
end end
if( query != nil ) if( query != nil )
logger.info('xxoo')
limit = 10; limit = 10;
@obj_count = query.count(); @obj_count = query.count();
@obj_pages = Paginator.new @obj_count,limit,params['page'] @obj_pages = Paginator.new @obj_count,limit,params['page']
list = query.order('id desc').limit(limit).offset(@obj_pages.offset).all(); list = query.order('is_read,id desc').limit(limit).offset(@obj_pages.offset).all();
events=[]; events=[];
for item in list for item in list
event = item.activity; event = item.activity;
@ -29,7 +28,6 @@ class ActivityNotifysController < ApplicationController
end end
@events_by_day = events.group_by {|event| User.current.time_to_date(event.event_datetime)} @events_by_day = events.group_by {|event| User.current.time_to_date(event.event_datetime)}
@controller_name = 'ActivityNotifys' @controller_name = 'ActivityNotifys'
logger.info('aavv')
end end
respond_to do |format| respond_to do |format|
format.html {render :template => 'courses/show', :layout => 'base_courses'} format.html {render :template => 'courses/show', :layout => 'base_courses'}

@ -99,7 +99,7 @@ class MessagesController < ApplicationController
for teacher in teachers for teacher in teachers
if(teacher.user_id != User.current.id) if(teacher.user_id != User.current.id)
notify = ActivityNotify.new() notify = ActivityNotify.new()
if(@board.course_id>0) if(@board.course)
notify.activity_container_id = @board.course_id notify.activity_container_id = @board.course_id
notify.activity_container_type = 'Course' notify.activity_container_type = 'Course'
else else
@ -188,7 +188,7 @@ class MessagesController < ApplicationController
notifyto_arr.each do |k,user_id| notifyto_arr.each do |k,user_id|
if(user_id != User.current.id) if(user_id != User.current.id)
notify = ActivityNotify.new() notify = ActivityNotify.new()
if(@board.course_id>0) if(@board.course)
notify.activity_container_id = @board.course_id notify.activity_container_id = @board.course_id
notify.activity_container_type = 'Course' notify.activity_container_type = 'Course'
else else

@ -255,7 +255,9 @@ class UsersService
watcher.push(params[:user_id]) watcher.push(params[:user_id])
scope = scope.where("id not in (?)",watcher) scope = scope.where("id not in (?)",watcher)
end end
scope = scope.like(params[:name],search_by) #scope = scope.like(params[:name],search_by)
scope = scope.where("( LOWER(login) LIKE ? or LOWER(concat(lastname, firstname)) LIKE ? or LOWER(mail) LIKE ? )",
"%#{params[:name]}%","%#{params[:name]}%","%#{params[:name]}%")
end end
#modify by yutao 2015/5/18 没有params[:user_id]参数时去掉"id not in (?)"条件 end #modify by yutao 2015/5/18 没有params[:user_id]参数时去掉"id not in (?)"条件 end
else else

@ -3,7 +3,9 @@
<a class="fl about_me" href="<%=course_path(@course)%>"><%= l(:label_activity)%></a> <a class="fl about_me" href="<%=course_path(@course)%>"><%= l(:label_activity)%></a>
<h2 class="fl project_h2">与我相关</h2> <h2 class="fl project_h2">与我相关</h2>
<div class="fr mt10 mr5 c_grey02"> <div class="fr mt10 mr5 c_grey02">
<label class="mr5" style="cursor:pointer;" data-href="<%= course_activity_notifys_path(@course) %>/chang_read_flag" nhname='nh_act_link_all'>全部标为已读</label> <a class="c_dblue">
<label class="mr5" style="cursor:pointer;" data-href="<%= course_activity_notifys_path(@course) %>/chang_read_flag" nhname='nh_act_link_all'>全部标为已读</label>
</a>
</div> </div>
<% else %> <% else %>
<h2 class="fl project_h2"><%= l(:label_activity)%></h2> <h2 class="fl project_h2"><%= l(:label_activity)%></h2>
@ -35,7 +37,7 @@
:class => "problem_tit c_dblue fl fb",'data-type'=>e.event_type, :class => "problem_tit c_dblue fl fb",'data-type'=>e.event_type,
'data-notify-id'=>(e.respond_to?('get_notify_id') ? e.get_notify_id : ''),:nhname=>"nh_act_link", 'data-notify-id'=>(e.respond_to?('get_notify_id') ? e.get_notify_id : ''),:nhname=>"nh_act_link",
'data-href'=>(course_activity_notifys_path(@course)+"/chang_read_flag?an_id="+(e.respond_to?('get_notify_id') ? e.get_notify_id : '').to_s)%> 'data-href'=>(course_activity_notifys_path(@course)+"/chang_read_flag?an_id="+(e.respond_to?('get_notify_id') ? e.get_notify_id : '').to_s)%>
<%if @controller_name=='ActivityNotifys' && !e.get_notify_is_read%> <%if @controller_name=='ActivityNotifys' && e.get_notify_is_read!=1%>
<span nhname="nh_act_flag" class="ml10 fl"><img src="/images/new.png" width="35" height="15"/></span> <span nhname="nh_act_flag" class="ml10 fl"><img src="/images/new.png" width="35" height="15"/></span>
<%end%> <%end%>
<br /> <br />
@ -49,6 +51,8 @@
</div><!--课程动态 end--> </div><!--课程动态 end-->
<% end%> <% end%>
<% end%> <% end%>
<% elsif @controller_name=='ActivityNotifys' %>
<p class="nodata"><%= l(:label_no_data) %></p>
<% end%> <% end%>
<% if @obj_pages.next_page.nil? && @controller_name!='ActivityNotifys' %> <% if @obj_pages.next_page.nil? && @controller_name!='ActivityNotifys' %>
<div class="problem_main"> <div class="problem_main">

@ -30,8 +30,8 @@
<td rowspan="2" > <td rowspan="2" >
<div class="project-search" style="float: right"> <div class="project-search" style="float: right">
<!--label for="user_browse_label"><%#= l(:label_user_search_type) %></label--> <!--label for="user_browse_label"><%#= l(:label_user_search_type) %></label-->
<%= select_tag(:search_by,options_for_select([["昵称","0"],["姓名","1"],["邮箱","2"]],@search_by), :onchange => "searchByChange();" ) %> <%= select_tag(:search_by,options_for_select([["昵称","0"],["姓名","1"],["邮箱","2"]],@search_by), :onchange => "searchByChange();",:style=>'display:none;' ) %>
<%= text_field_tag 'name', params[:name], :size => 30 %> <%= text_field_tag 'name', params[:name], :size => 30, :placeholder=>'昵称/姓名/邮箱' %>
<input type="text" name="search_by_input" hidden="hidden;" id="search_by_input" value="0"> <input type="text" name="search_by_input" hidden="hidden;" id="search_by_input" value="0">
<input type="button" class="enterprise" value="<%= l(:label_search) %>" onclick="searchUser();"/> <input type="button" class="enterprise" value="<%= l(:label_search) %>" onclick="searchUser();"/>
<%#= submit_tag l(:label_search), :class => "enterprise", :name => nil %> <%#= submit_tag l(:label_search), :class => "enterprise", :name => nil %>

@ -73,11 +73,13 @@ form #search_by
{ {
if($("#search_type").val() == "users") if($("#search_type").val() == "users")
{ {
$("#search_by").show(); $("#q").attr('placeholder','昵称/姓名/邮箱');
// $("#search_by").show();
} }
else else
{ {
$("#search_by").hide(); $("#search_by").hide();
$("#q").attr('placeholder',"<%=l('welcome.search.information')%>");
} }
} }
@ -93,7 +95,7 @@ form #search_by
<%= text_field_tag :q, nil, :placeholder => l('welcome.search.information'), style:"float:left; width:185px;" %> <%= text_field_tag :q, nil, :placeholder => l('welcome.search.information'), style:"float:left; width:185px;" %>
<input type="text" name="search_by_input" style="display: none" id="search_by_input" value="0"> <input type="text" name="search_by_input" style="display: none" id="search_by_input" value="0">
<%= select_tag(:search_type, options_for_select(select_option), :onchange => "searchTypeChange();", :style => "float:right" ) %> <%= select_tag(:search_type, options_for_select(select_option), :onchange => "searchTypeChange();", :style => "float:right" ) %>
<%= select_tag(:search_by,options_for_select([[l('welcome.search.select.userinfo.nickname'),"0"],[l('welcome.search.select.userinfo.showname'),"1"],[l('welcome.search.select.userinfo.email'),"2"]]), :onchange => "searchByChange();",:style => "float:right" ) %> <%= select_tag(:search_by,options_for_select([[l('welcome.search.select.userinfo.nickname'),"0"],[l('welcome.search.select.userinfo.showname'),"1"],[l('welcome.search.select.userinfo.email'),"2"]]), :onchange => "searchByChange();",:style => "float:right;display:none;" ) %>
</div> </div>
<%#= hidden_field_tag 'project_type', project_type %> <%#= hidden_field_tag 'project_type', project_type %>
</div> </div>

Loading…
Cancel
Save