From b4732814e6174d07742c2b429021907e7944a923 Mon Sep 17 00:00:00 2001
From: yutao <283765470@qq.com>
Date: Fri, 5 Jun 2015 16:20:26 +0800
Subject: [PATCH 1/2] ...
---
app/controllers/courses_controller.rb | 1 +
app/helpers/activity_notifys_helper.rb | 7 +++++++
app/views/courses/show.html.erb | 23 ++++++++++++++++++++---
public/stylesheets/courses.css | 2 +-
4 files changed, 29 insertions(+), 4 deletions(-)
create mode 100644 app/helpers/activity_notifys_helper.rb
diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb
index 333ad77b1..e89f621c8 100644
--- a/app/controllers/courses_controller.rb
+++ b/app/controllers/courses_controller.rb
@@ -6,6 +6,7 @@ class CoursesController < ApplicationController
helper :members
helper :words
helper :attachments
+ helper :activity_notifys
before_filter :auth_login1, :only => [:show, :feedback]
menu_item :overview
diff --git a/app/helpers/activity_notifys_helper.rb b/app/helpers/activity_notifys_helper.rb
new file mode 100644
index 000000000..15fc43b54
--- /dev/null
+++ b/app/helpers/activity_notifys_helper.rb
@@ -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
\ No newline at end of file
diff --git a/app/views/courses/show.html.erb b/app/views/courses/show.html.erb
index 9bbe4ea5a..4fbf3ad43 100644
--- a/app/views/courses/show.html.erb
+++ b/app/views/courses/show.html.erb
@@ -1,7 +1,9 @@
<% if @controller_name=='ActivityNotifys' %>
-
<%= l(:label_activity)%>
-
与我相关
+
<%= l(:label_activity)%>
+
与我相关
+ (<%=get_new_notify_count(@course,'Course')%>)
+
@@ -80,6 +84,14 @@
\ No newline at end of file
diff --git a/public/stylesheets/courses.css b/public/stylesheets/courses.css
index bbc6f5b55..edb70075b 100644
--- a/public/stylesheets/courses.css
+++ b/public/stylesheets/courses.css
@@ -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;}
-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;}
From b1ce342b3d71d1bcbd8267bd3970e54337dc2170 Mon Sep 17 00:00:00 2001
From: huang
Date: Sat, 6 Jun 2015 09:44:23 +0800
Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BD=9C=E4=B8=9A?=
=?UTF-8?q?=E8=A1=A8=E4=BF=AE=E6=94=B9=E5=90=8E=E5=BC=95=E8=B5=B7=E7=9A=84?=
=?UTF-8?q?=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/mailer/send_for_user_activities.html.erb | 10 +++++-----
app/views/mailer/send_for_user_activities.text.erb | 10 +++++-----
2 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/app/views/mailer/send_for_user_activities.html.erb b/app/views/mailer/send_for_user_activities.html.erb
index e1712a15d..3d53acd5a 100644
--- a/app/views/mailer/send_for_user_activities.html.erb
+++ b/app/views/mailer/send_for_user_activities.html.erb
@@ -39,7 +39,7 @@
<% end %>
- <% if !@bids.first.nil? %>
+ <% unless @bids.empty? %>
<%= l(:label_homework_overview) %>(<%= @bids.count %>)
<% unless @bids.first.nil?%>
@@ -48,20 +48,20 @@
▪
[
- <%= 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",
:style=> " font-weight: bold; display:block; float:left; color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
]
- <%= 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;"%>
<%= l(:label_course_homework) %>
- <%= 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',
:style => "color:#5a5a5a; float:left; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
%>
- <%= format_time(bid.created_on) %>
+ <%= format_time(bid.created_at) %>
<% end %>
<% end %>
diff --git a/app/views/mailer/send_for_user_activities.text.erb b/app/views/mailer/send_for_user_activities.text.erb
index 2a2382301..669aca3d1 100644
--- a/app/views/mailer/send_for_user_activities.text.erb
+++ b/app/views/mailer/send_for_user_activities.text.erb
@@ -27,27 +27,27 @@
<% end %>
<% end %>
- <% if !@bids.first.nil? %>
+ <% unless @bids.empty? %>
<%= l(:label_homework_overview) %><%= @bids.count %>
<% unless @bids.first.nil?%>
<% @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) %>
- <%= 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 %>