From e3d277163feca681c9c0a885ba22a3b3a0057e6c Mon Sep 17 00:00:00 2001 From: alan <547533434@qq.com> Date: Thu, 14 May 2015 16:59:43 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=AA=E4=BA=BA=E4=B8=BB?= =?UTF-8?q?=E9=A1=B5=E7=9A=84=E9=93=BE=E6=8E=A5=20Signed-off-by:=20alan=20?= =?UTF-8?q?<547533434@qq.com>?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/boards_controller.rb | 4 ++-- app/views/attachments/upload.js.erb | 15 ++++++++------- app/views/boards/_course_show.html.erb | 3 ++- app/views/boards/_edit.html.erb | 4 ++-- app/views/boards/_project_new_topic.html.erb | 2 +- app/views/courses/show.html.erb | 2 +- app/views/users/show.html.erb | 7 +++---- app/views/users/user_activities.html.erb | 8 +++++++- 8 files changed, 26 insertions(+), 19 deletions(-) diff --git a/app/controllers/boards_controller.rb b/app/controllers/boards_controller.rb index 03581d0c2..7ccfb0e10 100644 --- a/app/controllers/boards_controller.rb +++ b/app/controllers/boards_controller.rb @@ -80,7 +80,7 @@ class BoardsController < ApplicationController includes(:last_reply). limit(@topic_pages.per_page). offset(@topic_pages.offset). - order(sort_clause). + order("last_replies_messages.created_on desc"). preload(:author, {:last_reply => :author}). all elsif @course @@ -88,7 +88,7 @@ class BoardsController < ApplicationController includes(:last_reply). # limit(@topic_pages.per_page). # offset(@topic_pages.offset). - order(sort_clause). + order("last_replies_messages.created_on desc"). preload(:author, {:last_reply => :author}). all : [] @topics = paginateHelper board_topics,10 diff --git a/app/views/attachments/upload.js.erb b/app/views/attachments/upload.js.erb index 24256ccab..c3e7fc3ff 100644 --- a/app/views/attachments/upload.js.erb +++ b/app/views/attachments/upload.js.erb @@ -3,14 +3,15 @@ var fileSpan = $('#attachments_<%= j params[:attachment_id] %>'); fileSpan.hide(); alert("<%= escape_javascript @attachment.errors.full_messages.join(', ') %>"); <% else %> -$('', { type: 'hidden', name: 'attachments[<%= j params[:attachment_id] %>][token]' } ).val('<%= j @attachment.token %>').appendTo(fileSpan); fileSpan.find('a.remove-upload') - .attr({ - "data-remote": true, - "data-method": 'delete', - "href": '<%= j attachment_path(@attachment, :attachment_id => params[:attachment_id], :format => 'js') %>' - }) - .off('click'); + .attr({ + "data-remote": true, + "data-method": 'delete', + "href": '<%= j attachment_path(@attachment, :attachment_id => params[:attachment_id], :format => 'js') %>' + }) + .off('click'); +$('', { type: 'hidden', name: 'attachments[<%= j params[:attachment_id] %>][token]' } ).val('<%= j @attachment.token %>').appendTo(fileSpan); + //var divattach = fileSpan.find('div.div_attachments'); //divattach.html('<%= j(render :partial => 'tags/tagEx', :locals => {:obj => @attachment, :object_flag => "6"})%>'); <% end %> diff --git a/app/views/boards/_course_show.html.erb b/app/views/boards/_course_show.html.erb index 617b9428a..2d0bda162 100644 --- a/app/views/boards/_course_show.html.erb +++ b/app/views/boards/_course_show.html.erb @@ -100,7 +100,8 @@ <%= form_for reply, :as => :reply, :url => {:controller=>'messages',:action => 'reply', :id => topic.id, :board_id => topic.board_id, :is_board => 'true'}, :html => {:multipart => true, :id => 'message_form' + topic.id.to_s} do |f| %> <%= render :partial => 'form_project', :locals => {:f => f, :replying => true} %> - <%= l(:label_memo_create)%> + <%= toggle_link l(:button_cancel), "reply" + topic.id.to_s, :focus => 'message_content',:class => 'grey_btn fr ml10' %> + <%= l(:label_memo_create)%> <% end %>
diff --git a/app/views/boards/_edit.html.erb b/app/views/boards/_edit.html.erb index 46131ca51..0bb15b167 100644 --- a/app/views/boards/_edit.html.erb +++ b/app/views/boards/_edit.html.erb @@ -32,9 +32,9 @@ <%= render :partial => 'form_course', :locals => {:f => f, :replying => !topic.parent.nil?, :topic => topic} %> <%= l(:button_submit)%> - <%= link_to l(:button_cancel), board_message_url(topic.board,topic.root, :r => (topic.parent_id &&topic.id)), :class => "blue_btn grey_btn fl c_white" %> + <%= l(:button_cancel) %> - <% end %> + <% end %> <% end %> diff --git a/app/views/boards/_project_new_topic.html.erb b/app/views/boards/_project_new_topic.html.erb index 3f7c569e1..cab1bbb7b 100644 --- a/app/views/boards/_project_new_topic.html.erb +++ b/app/views/boards/_project_new_topic.html.erb @@ -4,7 +4,7 @@
  • <%= l(:button_cancel) %> - <%= l(:button_submit)%> + <%= l(:button_submit)%>
  • <% end %> \ No newline at end of file diff --git a/app/views/courses/show.html.erb b/app/views/courses/show.html.erb index 29e7f1097..cc3bb33f1 100644 --- a/app/views/courses/show.html.erb +++ b/app/views/courses/show.html.erb @@ -15,7 +15,7 @@   <%= l(:label_new_activity) %>: <%= link_to "#{eventToLanguageCourse(e.event_type, @course)} "<< format_activity_title(e.event_title), (e.event_type.eql?("attachment")&&e.container.kind_of?(Course)) ? course_files_path(e.container) : - (e.event_type.eql?("bid") ? homework_course_path(@course) : (e.event_type.eql?("message") ? course_boards_path(@course,:topic_id => e.id) : e.event_url)),:class => "problem_tit c_dblue fl fb"%> + (e.event_type.eql?("bid") ? homework_course_path(@course) : (e.event_type.eql?("message") || e.event_type.eql?("reply") ? course_boards_path(@course,:topic_id => e.id) : e.event_url)),:class => "problem_tit c_dblue fl fb"%>

    <%= e.event_description.html_safe %>
    diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index fe36b2cd1..6083b547c 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -323,10 +323,9 @@   <%= link_to format_activity_title("#{act.board.name}: #{act.subject}"), - {:controller => 'messages', - :action => 'show', - :board_id => act.board_id}.merge(act.parent_id.nil? ? {:id => act.id} : {:id => act.parent_id, :r => act.id, :anchor => "message-#{act.id}"}) %> - + act.board.project ? project_boards_path(act.board.project,:topic_id => act.id) : course_boards_path(act.board.course,:topic_id => act.id), + :class => "problem_tit fl fb " %> + <% else %> diff --git a/app/views/users/user_activities.html.erb b/app/views/users/user_activities.html.erb index 080e772a1..9165e6f2e 100644 --- a/app/views/users/user_activities.html.erb +++ b/app/views/users/user_activities.html.erb @@ -28,7 +28,13 @@ - +
    <%= content_tag('span', h(e.project), :class => 'project') %> <%= l(:label_new_activity) %> <%= link_to format_activity_title(e.event_title), e.event_url %> <%= content_tag('span', h(e.project), :class => 'project') %> <%= l(:label_new_activity) %> + <% if e.event_type.eql?("message") || e.event_type.eql?("reply") %> + <%= link_to format_activity_title(e.event_title), e.board.project ? project_boards_path(e.board.project,:topic_id => e.id):course_boards_path(e.board.course,:topic_id => e.id) %> + <%else %> + <%= link_to format_activity_title(e.event_title), e.event_url %> + <%end%> +

    <%= format_activity_description(e.event_description) %>