diff --git a/app/helpers/organizations_helper.rb b/app/helpers/organizations_helper.rb index 4c6089b51..a5a3d6aaa 100644 --- a/app/helpers/organizations_helper.rb +++ b/app/helpers/organizations_helper.rb @@ -66,11 +66,40 @@ module OrganizationsHelper def org_user_by_type obj case obj.act_type when "Message" + user = obj.act.author when "News" + user = obj.act.author when "HomeworkCommon" + user = obj.act.user when "Issue" + user = obj.act.author end + end + def org_title_by_type obj + case obj.act_type + when "Message" + user = obj.act.parent_id.nil? ? obj.act.subject : obj.act.parent.subject + when "News" + user = obj.act.title + when "HomeworkCommon" + user = obj.act.name + when "Issue" + user = obj.act.subject + end + end + + def org_content_by_type obj + case obj.act_type + when "Message" + user = obj.act.parent_id.nil? ? obj.act.content : obj.act.parent.content + when "News" + user = obj.act.description + when "HomeworkCommon" + user = obj.act.description + when "Issue" + user = obj.act.description + end end #排列下拉框 diff --git a/app/views/organizations/_org_custom_right1.html.erb b/app/views/organizations/_org_custom_right1.html.erb index 4fed81a6b..882c994cc 100644 --- a/app/views/organizations/_org_custom_right1.html.erb +++ b/app/views/organizations/_org_custom_right1.html.erb @@ -5,44 +5,32 @@ <% else %>
- <%= link_to message.author.show_name, user_path(message.author), :class => "por_hot_name fl", :target => "_blank" %> - : - <%=render :partial =>"organizations/organization_content_extension", :locals => {:user_activity_id => message.id, :content=> message.content, :maxheight => 40, :maxwordsnum => 28, :maxwidth => 0, :cl => ""} %> -
-<%= time_from_now(message.created_on) %> - -
-+ <%= link_to user.show_name, user_path(user), :class => "por_hot_name fl", :target => "_blank" %> + : + <% if obj.act_type = "Message" %> + <%= link_to title, board_message_path(obj.act.board.id, obj.act.id) %> + <% elsif obj.act_type = "News" %> + <%= link_to title, news_path(obj.act.id) %> + <% elsif obj.act_type = "HomeworkCommon" %> + <%= link_to title, student_work_index_url_in_org(obj.act.id) %> + <% elsif obj.act_type = "Issue" %> + <%= link_to title, issue_path(obj.act.id) %> + <% end %> +
+<%= time_from_now(obj.act.created_on) %> + +
+<%= content.to_s.html_safe%> -
-<% else %> -- - <%= content.to_s.html_safe%> - -
-<% end %> + +