Merge branch 'dev_hjq' of http://repository.trustie.net/xianbo/trustie2 into dev_hjq

This commit is contained in:
sw 2015-06-06 09:42:38 +08:00
commit cd631f8fdc
6 changed files with 39 additions and 14 deletions

View File

@ -6,6 +6,7 @@ class CoursesController < ApplicationController
helper :members helper :members
helper :words helper :words
helper :attachments helper :attachments
helper :activity_notifys
before_filter :auth_login1, :only => [:show, :feedback] before_filter :auth_login1, :only => [:show, :feedback]
menu_item :overview menu_item :overview

View File

@ -0,0 +1,7 @@
module ActivityNotifysHelper
def get_new_notify_count(container,type)
logger.info('xxoo')
query = ActivityNotify.where('activity_container_id=? and activity_container_type=? and notify_to=?',container.id,type,User.current.id);
return query.count()
end
end

View File

@ -1,7 +1,9 @@
<div class="project_r_h"> <div class="project_r_h">
<% if @controller_name=='ActivityNotifys' %> <% if @controller_name=='ActivityNotifys' %>
<a class="fl about_me" href="<%=course_path(@course)%>"><%= l(:label_activity)%></a> <a class="fl about_me" style="width:80px;" href="<%=course_path(@course)%>"><%= l(:label_activity)%></a>
<h2 class="fl project_h2">与我相关</h2> <h2 class="fl project_h2" style="width:100px;">与我相关
<span class="c_orange f12" style="display:none;">(<font id="new_notify_count"><%=get_new_notify_count(@course,'Course')%></font>)</span>
</h2>
<div class="fr mt10 mr5 c_grey02"> <div class="fr mt10 mr5 c_grey02">
<a class="c_dblue"> <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> <label class="mr5" style="cursor:pointer;" data-href="<%= course_activity_notifys_path(@course) %>/chang_read_flag" nhname='nh_act_link_all'>全部标为已读</label>
@ -10,7 +12,9 @@
<% else %> <% else %>
<h2 class="fl project_h2"><%= l(:label_activity)%></h2> <h2 class="fl project_h2"><%= l(:label_activity)%></h2>
<% if User.current.logged? %> <% if User.current.logged? %>
<a class="fl about_me" href="<%=course_activity_notifys_path(@course)%>">与我相关</a> <a class="fl about_me" href="<%=course_activity_notifys_path(@course)%>">与我相关
<span class="c_orange f12" style="display:none;">(<font id="new_notify_count"><%=get_new_notify_count(@course,'Course')%></font>)</span>
</a>
<% end %> <% end %>
<% end %> <% end %>
</div> </div>
@ -80,6 +84,14 @@
<script type="text/javascript"> <script type="text/javascript">
$(function(){ $(function(){
function nh_new_notify_count_show(){
var new_notify_count = $("#new_notify_count").html();
if(new_notify_count>0){
$("#new_notify_count").parent('span').show();
}else{
$("#new_notify_count").parent('span').hide();
}
}
$("div[nhname='container']").each(function(){ $("div[nhname='container']").each(function(){
var container = $(this); var container = $(this);
var btn = $("a[nhname='nh_act_link']",container); var btn = $("a[nhname='nh_act_link']",container);
@ -92,6 +104,8 @@
$.ajax({url:url,dataType:'text',success:function(data){ $.ajax({url:url,dataType:'text',success:function(data){
if(data == 'true'){ if(data == 'true'){
flag.remove(); flag.remove();
$("#new_notify_count").html($("#new_notify_count").html()-1);
nh_new_notify_count_show();
} }
}}); }});
} }
@ -104,8 +118,11 @@
$.ajax({url:url,dataType:'text',success:function(data){ $.ajax({url:url,dataType:'text',success:function(data){
if(data == 'true'){ if(data == 'true'){
$("span[nhname='nh_act_flag']").remove(); $("span[nhname='nh_act_flag']").remove();
$("#new_notify_count").html('0');
nh_new_notify_count_show();
} }
}}); }});
}); });
nh_new_notify_count_show();
}); });
</script> </script>

View File

@ -39,7 +39,7 @@
<% end %> <% end %>
<!--课程作业--> <!--课程作业-->
<% if !@bids.first.nil? %> <% unless @bids.empty? %>
<ul class="wmail_ul" style="clear: both;margin-left:10px; border-bottom:1px dashed #cfcfcf; padding-bottom:15px; width:720px; margin-bottom:15px;"> <ul class="wmail_ul" style="clear: both;margin-left:10px; border-bottom:1px dashed #cfcfcf; padding-bottom:15px; width:720px; margin-bottom:15px;">
<h4 class="wmail_h4" style="color:#474646; font-size:14px; margin-bottom:5px;"><%= l(:label_homework_overview) %><span class="wmail_num" style="color:#fe3f0c; margin-left:5px; font-weight:normal;">(<%= @bids.count %>)</span></h4> <h4 class="wmail_h4" style="color:#474646; font-size:14px; margin-bottom:5px;"><%= l(:label_homework_overview) %><span class="wmail_num" style="color:#fe3f0c; margin-left:5px; font-weight:normal;">(<%= @bids.count %>)</span></h4>
<% unless @bids.first.nil?%> <% unless @bids.first.nil?%>
@ -48,20 +48,20 @@
<span class="wmail_dis" style="float:left; color:#000000; margin-right:5px;">▪</span> <span class="wmail_dis" style="float:left; color:#000000; margin-right:5px;">▪</span>
<span class="wmail_b" style="color:#1b55a7; font-weight:bold; float:left;">[</span> <span class="wmail_b" style="color:#1b55a7; font-weight:bold; float:left;">[</span>
<%= link_to truncate(bid.courses.first.name,length: 30,omission: '...'), course_url(bid.courses.first, :token => @token.value), <%= link_to truncate(bid.course.name,length: 30,omission: '...'), course_url(bid.course, :token => @token.value),
:class=> "wmail_column", :class=> "wmail_column",
:style=> " font-weight: bold; display:block; float:left; color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %> :style=> " font-weight: bold; display:block; float:left; color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
<span class="wmail_b" style="color:#1b55a7; font-weight:bold; float:left;">]</span> <span class="wmail_b" style="color:#1b55a7; font-weight:bold; float:left;">]</span>
<%= link_to bid.author, user_activities_url(bid.author,:token => @token.value), :class => "wmail_name", <%= link_to bid.user, user_activities_url(bid.user,:token => @token.value), :class => "wmail_name",
:style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%> :style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%>
<span class="wmail_txt" style="float:left; margin-right:5px;color:#6e6e6e;"><%= l(:label_course_homework) %></span> <span class="wmail_txt" style="float:left; margin-right:5px;color:#6e6e6e;"><%= l(:label_course_homework) %></span>
<%= link_to truncate(bid.name,length: 30,omission: '...'), course_for_bid_url(:id => bid.id,:token => @token.value), <%= link_to truncate(bid.name,length: 30,omission: '...'), student_work_index_path(:homework => bid.id,:token => @token.value),
:class => 'wmail_info', :class => 'wmail_info',
:style => "color:#5a5a5a; float:left; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" :style => "color:#5a5a5a; float:left; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
%> %>
<span class="wmail_date" style="color:#6e6e6e; float:right;display:block; margin-left:10px;"><%= format_time(bid.created_on) %></span> <span class="wmail_date" style="color:#6e6e6e; float:right;display:block; margin-left:10px;"><%= format_time(bid.created_at) %></span>
</li> </li>
<% end %> <% end %>
<% end %> <% end %>

View File

@ -27,27 +27,27 @@
<% end %> <% end %>
<% end %> <% end %>
<% if !@bids.first.nil? %> <% unless @bids.empty? %>
<%= l(:label_homework_overview) %><%= @bids.count %> <%= l(:label_homework_overview) %><%= @bids.count %>
<% unless @bids.first.nil?%> <% unless @bids.first.nil?%>
<% @bids.each do |bid| %> <% @bids.each do |bid| %>
[ [
<%= link_to truncate(bid.courses.first.name,length: 30,omission: '...'),course_url(bid.courses.first, :token => @token.value) <%= link_to truncate(bid.course.name,length: 30,omission: '...'),course_url(bid.course, :token => @token.value)
%> %>
] ]
<%= link_to bid.author, user_activities_url(bid.author,:token => @token.value) <%= link_to bid.user, user_activities_url(bid.user,:token => @token.value)
%> %>
<%= l(:label_course_homework) %> <%= l(:label_course_homework) %>
<%= link_to truncate(bid.name,length: 30,omission: '...'), course_for_bid_url(bid,:token => @token.value) <%= link_to truncate(bid.name, length: 30,omission: '...'), student_work_index_path(:homework => bid.id,:token => @token.value)
%> %>
<%= format_time(bid.created_on) %> <%= format_time(bid.created_at) %>
<% end %> <% end %>
<% end %> <% end %>

View File

@ -677,7 +677,7 @@ input#score{ width:40px;}
/* 与我相关 */ /* 与我相关 */
.new_icon{background:url(../images/new_icon.png) 0px 0px no-repeat; width:35px; height:15px; display:block;} .new_icon{background:url(../images/new_icon.png) 0px 0px no-repeat; width:35px; height:15px; display:block;}
a.about_me{ width:80px;text-align:center;font-size:16px; color:#64bdd9; margin:10px 0 0 10px;} a.about_me{text-align:center;font-size:16px; color:#64bdd9; margin:10px 0 0 10px;}
a:hover.about_me{ color:#0781b4;} a:hover.about_me{ color:#0781b4;}