- <%= form_for(@admin_messages, :html => {:id =>'system_message-form'}) do |f| %>
+ <%= form_for(@admin_messages, :html => {:id =>'system_messages-form'}) do |f| %>
<%= f.kindeditor :description,:width=>'87%',:editor_id=>'system_message_editor' %>
@@ -40,7 +40,7 @@
function submit_message() {
if (system_message_length()) {
- $("#system_message-form").submit();
+ $("#system_messages-form").submit();
}
}
diff --git a/app/views/users/system_messages.html.erb b/app/views/users/system_messages.html.erb
new file mode 100644
index 000000000..495e05fc9
--- /dev/null
+++ b/app/views/users/system_messages.html.erb
@@ -0,0 +1,65 @@
+
+
+<% @sytem_messages.each do |sytem_message| %>
+
+
+
+ <%= link_to image_tag(url_to_avatar(sytem_message.user), :width => "50", :height => "50"), user_path(sytem_message.user_id), :alt => "用户头像" %>
+
+
+
+ Trustie平台 发布了
+ 系统消息
+
+
+ 系统消息系统消息系统消息系统消息
+
+
+
+ <%#= student_work_activity_submit_status(homework: activity) %>
+
+
截止时间:<%= sytem_message.created_at %>
+
+
+ <%= sytem_message.content.nil? ? sytem_message.description.html_safe : sytem_message.content.html_safe %>
+
+
+
+
+
+
+<% end %>
+
+ <%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%>
+
\ No newline at end of file
diff --git a/app/views/users/user_messages.html.erb b/app/views/users/user_messages.html.erb
index 376f7ab8e..300a34993 100644
--- a/app/views/users/user_messages.html.erb
+++ b/app/views/users/user_messages.html.erb
@@ -1,35 +1,35 @@
+
<%= title_for_message(params[:type]) %>
+
+ -
+
+ - <%= link_to "全部",user_message_path(User.current), :class => "resourcesGrey" %>
+ - <%= link_to "未读消息", user_message_path(User.current, :type => 'unviewed'), :class => "resourcesGrey" %>
+ - <%= link_to "用户申请", user_message_path(User.current, :type => 'apply'), :class => "resourcesGrey" %>
+ <%# 课程相关消息 %>
+ - <%= link_to "作业消息", user_message_path(User.current, :type => 'homework'), :class => "resourcesGrey" %>
+ - <%= link_to "课程讨论",user_message_path(User.current, :type => 'course_message'), :class => "resourcesGrey" %>
+ - <%= link_to "课程通知",user_message_path(User.current, :type => 'course_news'), :class => "resourcesGrey" %>
+
+
+
+
+ <%# 项目相关消息 %>
+ - <%= link_to "项目任务", user_message_path(User.current, :type => 'issue'), :class => "resourcesGrey" %>
+
+
+
+
+ <%# 项目相关消息 %>
+ - <%= link_to "贴吧帖子", user_message_path(User.current, :type => 'forum'), :class => "resourcesGrey" %>
+ <%# 系统贴吧 %>
+ - <%= link_to "用户留言",user_message_path(User.current, :type => 'user_feedback'), :class => "resourcesGrey" %>
+ <%# 系统消息 %>
+ - <%= link_to "系统消息", user_message_path(User.current, :type => 'system_messages'), :class => "resourcesGrey" %>
+
+
+
+
<% if @message_alls.count >0 || @user_system_messages.count >0 %>
@@ -42,30 +42,30 @@
<% end %>
<%# 系统消息 %>
- <% if params[:type] != 'system_messages' %>
- <% @user_system_messages.each do |usm| %>
-
- -
-
<%= image_tag("/images/logo.png", width: "30px", height: "30px", class: "mt3") %>
-
- -
- Trustie平台发布新消息:
-
- -
- 【系统消息】
-
- <%= link_to usm.content.nil? ? usm.description.html_safe : usm.content.html_safe, user_message_path(User.current, :type => "system_messages"),
- :id => "content_link_#{usm.id}",
- :onmouseover =>"message_titile_show($(this),event);",
- :onmouseout => "message_titile_hide($(this));"
- %>
-
-
- <%= usm.content.nil? ? usm.description.html_safe : usm.content.html_safe %>
-
- - <%= time_tag(usm.created_at).html_safe %>
-
- <% end %>
- <% end %>
+ <% if params[:type] != 'system_messages' %>
+ <% @user_system_messages.each do |usm| %>
+
+ -
+
<%= image_tag("/images/logo.png", width: "30px", height: "30px", class: "mt3") %>
+
+ -
+ Trustie平台发布新消息:
+
+ -
+ 【系统消息】
-
+ <%= link_to usm.content.nil? ? usm.description.html_safe : usm.content.html_safe, user_message_path(User.current, :type => "system_messages"),
+ :id => "content_link_#{usm.id}",
+ :onmouseover =>"message_titile_show($(this),event);",
+ :onmouseout => "message_titile_hide($(this));"
+ %>
+
+
+ <%= usm.content.nil? ? usm.description.html_safe : usm.content.html_safe %>
+
+ - <%= time_tag(usm.created_at).html_safe %>
+
+ <% end %>
+ <% end %>
<%# 课程消息 %>
<% unless @message_alls.nil? %>
<% @message_alls.each do |ma| %>
@@ -109,16 +109,16 @@
- <%=link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user) %>
- <%=link_to ma.course_message.user, user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %>">发布的作业:
- <% if ma.viewed == 0 %>
+ <% if ma.viewed == 0 %>
-
<%= link_to ma.course_message.name, student_work_index_path(:homework => ma.course_message.id), :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}", :title => "#{ma.course_message.name}" %>
- 截止时间快到了!
- <% else %>
+ <% else %>
-
<%= link_to ma.course_message.name, student_work_index_path(:homework => ma.course_message.id), :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}", :title => "#{ma.course_message.name}" %>
- <% end %>
+ <% end %>
- <%= time_tag(ma.created_at).html_safe %>
<% end %>
@@ -167,42 +167,42 @@
<%= time_tag(ma.created_at).html_safe %>
<% end %>
- <% if ma.course_message_type == "JournalsForMessage" %>
- <% if ma.course_message.jour_type == 'Course' %>
-
- -
- <%= link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user) %>
-
- - <%= link_to ma.course_message.user, user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %>
- ">发布了课程留言:
-
- -
- <%= link_to ma.course_message.notes.html_safe, course_feedback_path(:id => ma.course_id),
- :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
- :onmouseover => "message_titile_show($(this),event)",
- :onmouseout => "message_titile_hide($(this))" %>
-
-
- <%= ma.course_message.notes.html_safe %>
-
- - <%= time_tag(ma.created_at).html_safe %>
-
+ <% if ma.course_message_type == "JournalsForMessage" %>
+ <% if ma.course_message.jour_type == 'Course' %>
+
+ -
+ <%= link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user) %>
+
+ - <%= link_to ma.course_message.user, user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %>
+ ">发布了课程留言:
+
+ -
+ <%= link_to ma.course_message.notes.html_safe, course_feedback_path(:id => ma.course_id),
+ :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
+ :onmouseover => "message_titile_show($(this),event)",
+ :onmouseout => "message_titile_hide($(this))" %>
+
+
+ <%= ma.course_message.notes.html_safe %>
+
+ - <%= time_tag(ma.created_at).html_safe %>
+
- <% else %>
-
- <% end %>
- <% end %>
+ <% else %>
+
+ <% end %>
+ <% end %>
<% end %>
<% if ma.class == ForgeMessage %>
@@ -266,14 +266,14 @@
<% if ma.forge_message.parent_id.nil? %>
<%=link_to ma.forge_message.subject, project_boards_path(ma.forge_message.project,
- :parent_id => ma.forge_message.parent_id ? ma.forge_message.parent_id : ma.forge_message.id,
- :topic_id => ma.forge_message.id),:class=>"#{ma.viewed==0?"newsBlack":"newsGrey"}",
+ :parent_id => ma.forge_message.parent_id ? ma.forge_message.parent_id : ma.forge_message.id,
+ :topic_id => ma.forge_message.id),:class=>"#{ma.viewed==0?"newsBlack":"newsGrey"}",
:title => "#{ma.forge_message.subject.html_safe}" %>
<% else %>
<%=link_to ma.forge_message.content.html_safe, project_boards_path(ma.forge_message.project,
- :parent_id => ma.forge_message.parent_id ? ma.forge_message.parent_id : ma.forge_message.id,
- :topic_id => ma.forge_message.id),:class=>"#{ma.viewed==0?"newsBlack":"newsGrey"}",
+ :parent_id => ma.forge_message.parent_id ? ma.forge_message.parent_id : ma.forge_message.id,
+ :topic_id => ma.forge_message.id),:class=>"#{ma.viewed==0?"newsBlack":"newsGrey"}",
:onmouseover =>"message_titile_show($(this),event)",
:onmouseout => "message_titile_hide($(this))" %>
@@ -306,7 +306,7 @@
<%= link_to "#{ma.forge_message.comments.html_safe}",
{:controller => 'news', :action => 'show', :id => ma.forge_message.commented.id },:class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
- :title => "#{ma.forge_message.comments.html_safe}" %>
+ :title => "#{ma.forge_message.comments.html_safe}" %>
<%= time_tag(ma.created_at).html_safe %>
@@ -366,46 +366,46 @@
<% end %>
<% end %>
- <%# 系统消息 %>
- <% if ma.class == SystemMessage %>
-
- -
-
-
- <%=image_tag("/images/logo.png",width:"30px", height: "30px",class: "mt3")%>
-
-
-
- - Trustie平台发布新消息:
- 【系统消息】-
- <%= link_to ma.content.nil? ? ma.description.html_safe : ma.content.html_safe, user_message_path(User.current, :type => "system_messages"),
- :id => "content_link_#{ma.id}",
- :onmouseover =>"message_titile_show($(this),event);",
- :onmouseout => "message_titile_hide($(this));"
- %>
-
+ }
+ nh_show_btn();
+ });
+
-
- [展开]
-
-
-
- <%= ma.content.nil? ? ma.description.html_safe : ma.content.html_safe %>
-
- - <%= time_tag(ma.created_at).html_safe %>
-
- <% end %>
+
+ [展开]
+
+
+
+ <%= ma.content.nil? ? ma.description.html_safe : ma.content.html_safe %>
+
+
<%= time_tag(ma.created_at).html_safe %>
+
+ <% end %>
<% end %>
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%>
@@ -421,32 +421,32 @@
diff --git a/config/routes.rb b/config/routes.rb
index 103885292..e35c7ff3b 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -389,6 +389,7 @@ RedmineApp::Application.routes.draw do
match 'users/:id/user_projects', :to => 'users#user_projects', :via => :get
#消息
match 'users/:id/user_messages', :to => 'users#user_messages', :via => :get, :as => "user_message"
+ match 'users/:id/system_messages', :to => 'users#system_messages', :via => :get, :as => "system_messages"
#match 'users/:id/user_messages/:homework', :to => 'users#user_messages_homework', :via => :get, :as => "user_message_homewrok"
diff --git a/spec/factories/system_messages.rb b/spec/factories/system_messages.rb
index 7bcc27422..a95505cfd 100644
--- a/spec/factories/system_messages.rb
+++ b/spec/factories/system_messages.rb
@@ -1,5 +1,5 @@
FactoryGirl.define do
- factory :system_message do
+ factory :system_messages do
id 1
user_id 1
content "MyString"