This commit is contained in:
sw 2015-06-05 13:56:45 +08:00
commit a881343db5
6 changed files with 18 additions and 12 deletions

View File

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

View File

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

View File

@ -255,7 +255,9 @@ class UsersService
watcher.push(params[:user_id])
scope = scope.where("id not in (?)",watcher)
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
#modify by yutao 2015/5/18 没有params[:user_id]参数时去掉"id not in (?)"条件 end
else

View File

@ -3,7 +3,9 @@
<a class="fl about_me" href="<%=course_path(@course)%>"><%= l(:label_activity)%></a>
<h2 class="fl project_h2">与我相关</h2>
<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>
<% else %>
<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,
'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)%>
<%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>
<%end%>
<br />
@ -49,6 +51,8 @@
</div><!--课程动态 end-->
<% end%>
<% end%>
<% elsif @controller_name=='ActivityNotifys' %>
<p class="nodata"><%= l(:label_no_data) %></p>
<% end%>
<% if @obj_pages.next_page.nil? && @controller_name!='ActivityNotifys' %>
<div class="problem_main">

View File

@ -30,8 +30,8 @@
<td rowspan="2" >
<div class="project-search" style="float: right">
<!--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();" ) %>
<%= text_field_tag 'name', params[:name], :size => 30 %>
<%= 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, :placeholder=>'昵称/姓名/邮箱' %>
<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();"/>
<%#= submit_tag l(:label_search), :class => "enterprise", :name => nil %>

View File

@ -73,11 +73,13 @@ form #search_by
{
if($("#search_type").val() == "users")
{
$("#search_by").show();
$("#q").attr('placeholder','昵称/姓名/邮箱');
// $("#search_by").show();
}
else
{
$("#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;" %>
<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_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>
<%#= hidden_field_tag 'project_type', project_type %>
</div>