From d8ef2f0965eb949eded528c19040a66db092a991 Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Tue, 26 Jan 2016 18:24:15 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=AA=E4=BA=BA=E7=95=99=E8=A8=80=E4=B8=AD?= =?UTF-8?q?=E7=9A=84at=E5=90=AF=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/at_controller.rb | 15 +- app/models/at_message.rb | 13 +- app/views/users/_jour_form.html.erb | 3 +- app/views/users/_user_jours_list.html.erb | 2 +- db/schema.rb | 4082 +++++++++++---------- 5 files changed, 2080 insertions(+), 2035 deletions(-) diff --git a/app/controllers/at_controller.rb b/app/controllers/at_controller.rb index 25e731754..456306c64 100644 --- a/app/controllers/at_controller.rb +++ b/app/controllers/at_controller.rb @@ -34,6 +34,12 @@ class AtController < ApplicationController find_homework(id) when 'Topic' find_topic(id) + when 'JournalsForMessage' + find_journals_for_message(id) + when 'Principal' + find_principal(id) + when 'All' + nil else nil end @@ -120,7 +126,11 @@ class AtController < ApplicationController #JournalsForMessage def find_journals_for_message(id) jounrnal = JournalsForMessage.find(id) - find_at_users(jounrnal.jour_type, jounrnal.jour_id) + if jounrnal.jour_type == 'Principal' + [jounrnal.user] + (JournalsForMessage.where(m_reply_id: id).map(&:user) || []) + else + find_at_users(jounrnal.jour_type, jounrnal.jour_id) + end end #Poll @@ -129,8 +139,6 @@ class AtController < ApplicationController #Journal def find_journal(id) - journal = Journal.find(id) - find_at_users(journal.journalized_type, journal.journalized_id) end #Document @@ -145,7 +153,6 @@ class AtController < ApplicationController #Principal def find_principal(id) - end #BlogComment diff --git a/app/models/at_message.rb b/app/models/at_message.rb index 3d20ffafb..bca2c7ba4 100644 --- a/app/models/at_message.rb +++ b/app/models/at_message.rb @@ -47,7 +47,11 @@ class AtMessage < ActiveRecord::Base "回复帖子: " end + at_message.subject when 'JournalsForMessage' - "作业: #{at_message.jour.name} 中留言" + if at_message.jour_type == 'Principal' + "留言: 在#{at_message.at_user.show_name}主页中留言" + else + "作业: #{at_message.jour.name} 中留言" + end else logger.error "error type: #{at_message_type}" end @@ -92,7 +96,12 @@ class AtMessage < ActiveRecord::Base when 'Message' {controller: :boards, action: :show, project_id: at_message.board.project, id: at_message.board} when 'JournalsForMessage' - {controller: :homework_common, action: :index, course: at_message.jour.course_id} + if at_message.jour_type == 'Principal' + {controller: :users, action: :user_messages, id: at_message.at_user} + else + {controller: :homework_common, action: :index, course: at_message.jour.course_id} + end + else logger.error "error type: #{at_message_type}" end diff --git a/app/views/users/_jour_form.html.erb b/app/views/users/_jour_form.html.erb index 13bf6d79a..0fa808d17 100644 --- a/app/views/users/_jour_form.html.erb +++ b/app/views/users/_jour_form.html.erb @@ -12,7 +12,8 @@ :minHeight=>40, :input_html => { :id => 'jour_content', :class => 'talk_text fl', - :maxlength => 5000 }%> + :maxlength => 5000 } + %>
diff --git a/app/views/users/_user_jours_list.html.erb b/app/views/users/_user_jours_list.html.erb index 6993a7e91..1b3293e18 100644 --- a/app/views/users/_user_jours_list.html.erb +++ b/app/views/users/_user_jours_list.html.erb @@ -1,5 +1,5 @@ <%= content_for(:header_tags) do %> - <%= import_ke(enable_at: false, prettify: false, init_activity: true) %> + <%= import_ke(enable_at: true, prettify: false, init_activity: true) %> <%#= javascript_include_tag "init_KindEditor","user" %> <% end %>