From 048319ef8eca1444fa59afb9703b1da1150c9eac Mon Sep 17 00:00:00 2001 From: cxt Date: Wed, 26 Aug 2015 15:24:57 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=AA=E4=BA=BA=E4=B8=BB=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 8 +- app/views/users/_course_homework.html.erb | 2 +- app/views/users/_course_message.html.erb | 46 ++--- app/views/users/_course_news.html.erb | 61 +++---- app/views/users/_course_news_reply.html.erb | 177 +++++++++++++++++++ app/views/users/_course_poll.html.erb | 2 +- app/views/users/_project_issue.html.erb | 47 +++-- app/views/users/_project_message.html.erb | 181 ++++++++++---------- app/views/users/_user_activities.html.erb | 4 +- app/views/users/show.html.erb | 17 +- 10 files changed, 367 insertions(+), 178 deletions(-) create mode 100644 app/views/users/_course_news_reply.html.erb diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index a12fa37e4..e1e606f9c 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -556,6 +556,8 @@ class UsersController < ApplicationController @type = params[:type] user_project_ids = @user.projects.visible.empty? ? "(-1)" : "(" + @user.projects.visible.map{|project| project.id}.join(",") + ")" user_course_ids = @user.courses.visible.empty? ? "(-1)" : "(" + @user.courses.visible.map{|course| course.id}.join(",") + ")" + course_types = "('Message','News','HomeworkCommon')" + project_types = "('Message','Issue')" if @type case @type when "course_homework" @@ -564,14 +566,16 @@ class UsersController < ApplicationController @user_activities = UserActivity.where("container_type = 'Course' and container_id in #{user_course_ids} and act_type = 'News'").order('created_at desc').limit(10).offset(@page * 10) when "course_message" @user_activities = UserActivity.where("container_type = 'Course' and container_id in #{user_course_ids} and act_type = 'Message'").order('created_at desc').limit(10).offset(@page * 10) + when "course_poll" + @user_activities = UserActivity.where("container_type = 'Course' and container_id in #{user_course_ids} and act_type = 'Poll'").order('created_at desc').limit(10).offset(@page * 10) when "project_issue" @user_activities = UserActivity.where("container_type = 'Project' and container_id in #{user_project_ids} and act_type = 'Issue'").order('created_at desc').limit(10).offset(@page * 10) when "project_message" @user_activities = UserActivity.where("container_type = 'Project' and container_id in #{user_project_ids} and act_type = 'Message'").order('created_at desc').limit(10).offset(@page * 10) + else + @user_activities = UserActivity.where("(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}) or (container_type = 'Course' and container_id in #{user_course_ids}) and act_type in #{course_types}").order('created_at desc').limit(10).offset(@page * 10) end else - course_types = "('Message','News','HomeworkCommon')" - project_types = "('Message','Issue')" @user_activities = UserActivity.where("(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}) or (container_type = 'Course' and container_id in #{user_course_ids}) and act_type in #{course_types}").order('created_at desc').limit(10).offset(@page * 10) end # @user_activities = paginateHelper @user_activities,500 diff --git a/app/views/users/_course_homework.html.erb b/app/views/users/_course_homework.html.erb index d0b830740..5a74b6814 100644 --- a/app/views/users/_course_homework.html.erb +++ b/app/views/users/_course_homework.html.erb @@ -1,5 +1,5 @@
-
+
<%= link_to image_tag(url_to_avatar(activity.user), :width => "90", :height => "90"), user_path(activity.user_id), :alt => "用户头像" %>
diff --git a/app/views/users/_course_message.html.erb b/app/views/users/_course_message.html.erb index b6dfdbbe6..3d0c1b171 100644 --- a/app/views/users/_course_message.html.erb +++ b/app/views/users/_course_message.html.erb @@ -1,5 +1,5 @@
-
+
<%= link_to image_tag(url_to_avatar(activity.author), :width => "90", :height => "90"), user_path(activity.author_id), :alt => "用户头像" %>
@@ -37,16 +37,16 @@
-
+ + <!–删除–>
-
<%= reply.content.html_safe %>
+
<%#= reply.content.html_safe %>
- <% end %> - <% end %> -
+ <%# end %> + <%# end %> +
--> diff --git a/app/views/users/_course_news.html.erb b/app/views/users/_course_news.html.erb index 7cc5ef5df..044ce9c6e 100644 --- a/app/views/users/_course_news.html.erb +++ b/app/views/users/_course_news.html.erb @@ -1,5 +1,5 @@
-
+
<%= link_to image_tag(url_to_avatar(activity.author), :width => "90", :height => "90"), user_path(activity.author_id), :alt => "用户头像" %>
@@ -33,46 +33,49 @@
-
+ + <%# if comment.try(:author).try(:realname) == ' ' %> + <%#= link_to comment.try(:author), user_path(comment.author_id), :class => "newsBlue mr10 f14" %> + <%# else %> + <%#= link_to comment.try(:author).try(:realname), user_path(comment.author_id), :class => "newsBlue mr10 f14" %> + <%# end %> + <%#=format_date(comment.created_on)%> + <%#= link_to_if_authorized_course l(:button_delete), {:controller => 'comments', :action => 'destroy', :id => activity, :comment_id => comment}, + :data => {:confirm => l(:text_are_you_sure)}, :method => :delete, :title => l(:button_delete) %> + <!–删除–>
-
<%= comment.comments.html_safe %>
+
<%#= comment.comments.html_safe %>
- <% end %> - <% end %> - + <%# end %> + <%# end %> + --> \ No newline at end of file diff --git a/app/views/users/_course_news_reply.html.erb b/app/views/users/_course_news_reply.html.erb new file mode 100644 index 000000000..c3f8571be --- /dev/null +++ b/app/views/users/_course_news_reply.html.erb @@ -0,0 +1,177 @@ + +<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg' %> + +<% if @news.commentable? %> +
+

<%= l(:label_comment_add) %>

+ <%= form_tag({:controller => 'comments', :action => 'create', :id => @news}, :id => "add_comment_form") do %> +
+ <%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %> + <%= kindeditor_tag :comment, '',:height=>'100',:editor_id =>'comment_editor', :placeholder=>"最多250个字"%> +
+

+ + <%= l(:label_cancel_with_space) %> + + + <%= l(:label_comment_with_space) %> + +

+ <% end %> +
+<% end %> + +
+ + <%= form_for('new_form', :method => :post, + :url => {:controller => 'words', :action => 'leave_course_message'},:html => {:id=>'leave_message_form'}) do |f|%> + <%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %> + +

+ <% end %> +
+
+
+ 取  消 + + 发送 + +
+
+ +
+ + + + + diff --git a/app/views/users/_course_poll.html.erb b/app/views/users/_course_poll.html.erb index f76b6d0ae..01991d379 100644 --- a/app/views/users/_course_poll.html.erb +++ b/app/views/users/_course_poll.html.erb @@ -1,5 +1,5 @@
-
+
<%= link_to image_tag(url_to_avatar(activity.user), :width => "90", :height => "90"), user_path(activity.user_id), :alt => "用户头像" %> diff --git a/app/views/users/_project_issue.html.erb b/app/views/users/_project_issue.html.erb index 925625c28..6661043a7 100644 --- a/app/views/users/_project_issue.html.erb +++ b/app/views/users/_project_issue.html.erb @@ -1,6 +1,5 @@ -<% reply_links = authorize_for('issues', 'edit') -%>
-
+
<%= link_to image_tag(url_to_avatar(activity.author), :width => "90", :height => "90"), user_path(activity.author_id), :alt => "用户头像" %>
@@ -71,11 +70,11 @@
-
+ + #<!–删除–>
- <% if reply.details.any? %> - <% details_to_strings(reply.details).each do |string| %> -
<%=string %>
- <% end %> - <% else %> -
<%=reply.notes.html_safe %>
- <% end %> + <%# if reply.details.any? %> + <%# details_to_strings(reply.details).each do |string| %> +
<%#=string %>
+ <%# end %> + <%# else %> +
<%#=reply.notes.html_safe %>
+ <%# end %>
- <% end %> - <% end %> -
+ <%# end %> + <%# end %> +
-->
\ No newline at end of file diff --git a/app/views/users/_project_message.html.erb b/app/views/users/_project_message.html.erb index 248be6143..d9b87926c 100644 --- a/app/views/users/_project_message.html.erb +++ b/app/views/users/_project_message.html.erb @@ -1,96 +1,95 @@ - -
-
-
- <%= 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 - <%= link_to activity.project.name.to_s+"(项目讨论区)", project_path(activity.project), :class => "newsBlue ml15 mr5", :style=>"word-break:break-all"%> - -
-
- <% if activity.parent_id.nil? %> - <%= link_to activity.subject.to_s.html_safe+"(讨论区内容)", project_boards_path(Board.where('id=?',activity.board_id).first.project_id), :class=> "postGrey", :style=>"word-break:break-all" %> - <% else %> - <%= link_to activity.parent.subject.to_s.html_safe+"(讨论区内容)", project_boards_path(Board.where('id=?',activity.board_id).first.project_id), :class=> "postGrey", :style=>"word-break:break-all"%> - <% end %> -
-
-
时间:<%= format_date(activity.created_on) %>
-
- -
-
- <% end %> - <% end %> -
-
+ <%# end %> + <%# end %> + --> + diff --git a/app/views/users/_user_activities.html.erb b/app/views/users/_user_activities.html.erb index 60992c384..e0ae950c7 100644 --- a/app/views/users/_user_activities.html.erb +++ b/app/views/users/_user_activities.html.erb @@ -17,8 +17,8 @@ <%#= render :partial => 'course_attachment', :locals => {:activity => act, :user_activity => user_activity} %> <%# when 'JournalsForMessage' %> <%#= render :partial => 'course_journalsformessage', :locals => {:activity => act, :user_activity => user_activity} %> - <%# when 'Poll' %> - <%#= render :partial => 'course_poll', :locals => {:activity => act, :user_activity => user_activity} %> + <% when 'Poll' %> + <%= render :partial => 'course_poll', :locals => {:activity => act, :user_activity => user_activity} %> <% end %> <% end %> <% when 'Project' %> diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index d0e8351ee..78995ab76 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -26,22 +26,29 @@
  • 课程动态
  • <%= link_to "作业动态", {:controller => "users", :action => "show", :type => "course_homework"}, :class => "homepagePostTypeAssignment postTypeGrey"%>
  • -
  • <%= link_to "通知动态", {:controller => "users", :action => "show", :type => "course_news"}, :class => "homepagePostTypeAssignment postTypeGrey"%> +
  • <%= link_to "通知动态", {:controller => "users", :action => "show", :type => "course_news"}, :class => "homepagePostTypeNotice postTypeGrey"%> -
  • <%= link_to "论坛动态", {:controller => "users", :action => "show", :type => "course_message"}, :class => "homepagePostTypeAssignment postTypeGrey"%> - +
  • <%= link_to "论坛动态", {:controller => "users", :action => "show", :type => "course_message"}, :class => "homepagePostTypeForum postTypeGrey"%> +
  • <%= link_to "问卷动态", {:controller => "users", :action => "show", :type => "course_poll"}, :class => "homepagePostTypeQuiz postTypeGrey"%> +
  • +
  • + +