From 51c2f595d1beb318fb3f1b7c86bee91a060bf12a Mon Sep 17 00:00:00 2001 From: cxt Date: Mon, 24 Aug 2015 17:45:09 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=AA=E4=BA=BA=E4=B8=BB=E9=A1=B5=E5=8A=A8?= =?UTF-8?q?=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 2 +- app/views/users/_course_homework.html.erb | 10 ++-- app/views/users/_course_message.html.erb | 63 ++++++++++++++--------- app/views/users/_course_news.html.erb | 26 +++++++++- app/views/users/_project_issue.html.erb | 31 +++++++++-- app/views/users/show.html.erb | 2 + 6 files changed, 98 insertions(+), 36 deletions(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index e6e4f96d7..4b874d3e3 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -537,7 +537,7 @@ class UsersController < ApplicationController #if @user == User.current @user_activities = UserActivity.where("(container_type='Course' and container_id in (select course_id FROM members WHERE user_id=#{@user.id})) or (container_type='Project' and container_id in (SELECT project_id FROM members WHERE user_id=#{@user.id}))").order('created_at desc') - + @user_activities = paginateHelper @user_activities,500 #SELECT * FROM user_activities WHERE (container_type='Course' AND container_id IN (SELECT course_id FROM members WHERE user_id=4)) OR (container_type='Project' AND container_id IN (SELECT project_id FROM members WHERE user_id=4)) #else #end diff --git a/app/views/users/_course_homework.html.erb b/app/views/users/_course_homework.html.erb index 2534cad9d..6eeae66f9 100644 --- a/app/views/users/_course_homework.html.erb +++ b/app/views/users/_course_homework.html.erb @@ -2,22 +2,22 @@
<%= link_to image_tag(url_to_avatar(activity.user), :width => "90", :height => "90"), user_path(activity.user_id), :alt => "用户头像" %> -
-
+
<% if activity.try(:user).try(:realname) == ' ' %> <%= link_to activity.try(:user), user_path(activity.user_id), :class => "newsBlue mr15" %> <% else %> <%= link_to activity.try(:user).try(:realname), user_path(activity.user_id), :class => "newsBlue mr15" %> <% end %> TO - <%= activity.course.name %>(课程名称) + <%= link_to activity.course.name.to_s+"(课程名称)", course_path(activity.course_id), :class => "newsBlue ml15" %>
+ <%= link_to activity.name.to_s+"(作业名称)", student_work_index_path(:homework => activity.id), :class => "postGrey" %> +
- 提交(<%= activity.student_works.count %>) + <%= link_to "提交("+activity.student_works.count.to_s+")", student_work_index_path(activity.id), :class=> "c_blue" %>
截止时间:<%= format_date(activity.end_time) %>
diff --git a/app/views/users/_course_message.html.erb b/app/views/users/_course_message.html.erb index 24078696f..c3af1c46e 100644 --- a/app/views/users/_course_message.html.erb +++ b/app/views/users/_course_message.html.erb @@ -1,21 +1,25 @@ -<% if activity.parent_id.nil? %>
- 用户头像 + <%= link_to image_tag(url_to_avatar(activity.author), :width => "90", :height => "90"), user_path(activity.author_id), :alt => "用户头像" %>
-
+
<% if activity.try(:author).try(:realname) == ' ' %> <%= link_to activity.try(:author), user_path(activity.author_id), :class => "newsBlue mr15" %> <% else %> <%= link_to activity.try(:author).try(:realname), user_path(activity.author_id), :class => "newsBlue mr15" %> <% end %> TO - <%= activity.course.name %>(课程讨论区) + <%= link_to activity.course.name.to_s+"(课程讨论区)", course_path(activity.course), :class => "newsBlue ml15 mr5" %>
+ <% if activity.parent_id.nil? %> + <%= link_to activity.subject.to_s.html_safe+"(讨论区内容)", course_boards_path(Board.where('id=?',activity.board_id).first.course_id), :class=> "postGrey" %> + <% else %> + <%= link_to activity.parent.subject.to_s.html_safe+"(讨论区内容)", course_boards_path(Board.where('id=?',activity.board_id).first.course_id), :class=> "postGrey" %> + <% end %> +
时间:<%= format_date(activity.created_on) %>
@@ -35,8 +39,14 @@
-
回复(<%=activity.replies_count %>)
-
2015-07-31
+
回复( + <% if activity.parent_id.nil? %> + <%=activity.replies_count %> + <% else %> + <%=activity.parent.replies_count %> + <% end %> + )
+
<%=format_date(activity.updated_on)%>
@@ -51,32 +61,35 @@
+ <% activity= activity.parent_id.nil? ? activity:activity.parent%> + <% activity.children.reorder("created_on desc").each do |reply| unless activity.children.nil?%>
- 用户头像 + <%= link_to image_tag(url_to_avatar(reply.author), :width => "45", :height => "45"), user_path(reply.author_id), :alt => "用户头像" %>
- 黄井泉 学生 - 2015-08-01删除 + <% if reply.try(:author).try(:realname) == ' ' %> + <%= link_to reply.try(:author), user_path(reply.author_id), :class => "newsBlue mr10 f14" %> + <% else %> + <%= link_to reply.try(:author).try(:realname), user_path(reply.author_id), :class => "newsBlue mr10 f14" %> + <% end %> + <%=format_date(reply.created_on)%> + <%= link_to( + l(:button_delete), + {:controller => 'messages', :action => 'destroy', :id => reply.id, :board_id => reply.board_id, :is_board => 'false'}, + :method => :post, + :data => {:confirm => l(:text_are_you_sure)}, + :title => l(:button_delete), + :class => 'replyGrey fr ml10' + ) if reply.course_destroyable_by?(User.current) %> +
-
很开心!
-
-
-
-
-
- 用户头像 -
-
-
- 陈正东 学生 - 2015-08-02删除 -
-
假期好热,没出去。
+
<%= reply.content.html_safe %>
+ <% end %> + <% end %>
-<% end %> \ No newline at end of file diff --git a/app/views/users/_course_news.html.erb b/app/views/users/_course_news.html.erb index 414ff79e8..8bef18c59 100644 --- a/app/views/users/_course_news.html.erb +++ b/app/views/users/_course_news.html.erb @@ -11,10 +11,12 @@ <% else %> <%= link_to activity.try(:author).try(:realname), user_path(activity.author_id), :class => "newsBlue mr15" %> <% end %> TO - <%= activity.course.name %>(课程名称) + <%= link_to activity.course.name.to_s+"(课程名称)", course_path(activity.course), :class => "newsBlue ml15" %> +
- <%= activity.title %>(通知标题)
+ <%=link_to activity.title.to_s+"(通知标题)", news_path(activity), :class=> "postGrey" %> +
发布时间:<%= format_date(activity.created_on) %>
@@ -33,4 +35,24 @@
+
+
+
回复(<%=activity.comments_count %>)
+
<%=format_date(activity.updated_on)%>
+ +
+
+ +
+
+ + + +
+
+ +
\ No newline at end of file diff --git a/app/views/users/_project_issue.html.erb b/app/views/users/_project_issue.html.erb index a998cfc24..3b0087bb4 100644 --- a/app/views/users/_project_issue.html.erb +++ b/app/views/users/_project_issue.html.erb @@ -20,13 +20,38 @@
时间:<%=format_date(activity.created_on) %>
-
(缺陷描述)<%=activity.description.html_safe %>
-
+
(缺陷描述)<%=activity.description.html_safe %>
+
+ <% if activity.attachments.any? %> + <% activity.attachments.each do |attachment| %> +
+

+

+ + <%= link_to_short_attachment attachment, :class => 'homepagePostFileAtt newsBlue', :download => true -%> + +
+ <% if attachment.is_text? %> + <%= link_to image_tag('magnifier.png'), + :controller => 'attachments', + :action => 'show', + :id => attachment, + :filename => attachment.filename %> + <% end %> + + <%= number_to_human_size attachment.filesize %> + +

+
+ <% end %> + <% end %> +
+