From 90a35fa24a5d62beaef5cdde3f7161ed76e2133a Mon Sep 17 00:00:00 2001 From: z9hang Date: Mon, 28 Jul 2014 15:06:54 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AB=9E=E8=B5=9B=E3=80=81=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E9=A6=96=E9=A1=B5=EF=BC=8C=E8=B4=B4=E5=90=A7=E5=8A=A8=E6=80=81?= =?UTF-8?q?=E5=90=8D=E5=AD=97=E8=BF=87=E9=95=BF=E6=98=BE=E7=A4=BA=E9=97=AE?= =?UTF-8?q?=E9=A2=98=20=E8=AF=BE=E7=A8=8B=E3=80=81=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E8=B4=B4=E5=AD=90=E5=AF=BC=E8=88=AA=E4=B8=A2?= =?UTF-8?q?=E5=A4=B1=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/messages_controller.rb | 10 +++++++++- app/views/layouts/base_tags.html.erb | 5 +++++ app/views/welcome/contest.html.erb | 4 ++-- app/views/welcome/course.html.erb | 4 ++-- 4 files changed, 18 insertions(+), 5 deletions(-) diff --git a/app/controllers/messages_controller.rb b/app/controllers/messages_controller.rb index e974936eb..438dd0aaf 100644 --- a/app/controllers/messages_controller.rb +++ b/app/controllers/messages_controller.rb @@ -18,7 +18,7 @@ class MessagesController < ApplicationController menu_item :boards default_search_scope :messages - before_filter :find_board, :only => [:new, :preview] + before_filter :find_board, :only => [:new, :preview,:edit] before_filter :find_attachments, :only => [:preview] before_filter :find_message, :except => [:new, :preview] before_filter :authorize, :except => [:preview, :edit, :destroy, :new] @@ -107,7 +107,15 @@ class MessagesController < ApplicationController flash[:notice] = l(:notice_successful_update) @message.reload redirect_to board_message_path(@message.board, @message.root, :r => (@message.parent_id && @message.id)) + elsif request.get? + respond_to do |format| + format.html { + layout_file = @project ? 'base_projects' : 'base_courses' + render :layout => layout_file + } + end end + end # Delete a messages diff --git a/app/views/layouts/base_tags.html.erb b/app/views/layouts/base_tags.html.erb index d7f53a641..6a5b490d1 100644 --- a/app/views/layouts/base_tags.html.erb +++ b/app/views/layouts/base_tags.html.erb @@ -1,3 +1,8 @@ +<% @nav_dispaly_home_path_label = 1 + @nav_dispaly_main_course_label = 1 + @nav_dispaly_main_project_label = 1 + @nav_dispaly_main_contest_label = 1 %> +<% @nav_dispaly_forum_label = 1%> diff --git a/app/views/welcome/contest.html.erb b/app/views/welcome/contest.html.erb index 10da9f331..27afed749 100644 --- a/app/views/welcome/contest.html.erb +++ b/app/views/welcome/contest.html.erb @@ -275,10 +275,10 @@ <%= "#{l(:label_updated_time, value: time_tag_welcome(topic_last_time topic))}".html_safe %> - <%=l(:label_question_sponsor)%>: <%= link_to_user(topic.author) %> + <%=l(:label_question_sponsor)%>: <%= link_to topic.author.login.truncate(10, omission: '...'),user_path(topic.author),title: topic.author.login %> - <%=l(:label_final_reply)%>: <%=link_to_user topic.last_reply.try(:author) %> + <%=l(:label_final_reply)%>: <% unless (topic.last_reply.nil? || topic.last_reply.author.nil?) %><%=link_to topic.last_reply.author.login.truncate(10, omission: '...'),user_path(topic.last_reply.author),title: topic.last_reply.author.login%><% end %> <%=l(:label_reply)%>(<%= link_to topic.try(:replies_count), topic.event_url %>) diff --git a/app/views/welcome/course.html.erb b/app/views/welcome/course.html.erb index dae00f50e..5c2b82e2a 100644 --- a/app/views/welcome/course.html.erb +++ b/app/views/welcome/course.html.erb @@ -243,10 +243,10 @@ <%= "#{l(:label_updated_time, value: time_tag_welcome(topic_last_time topic))}".html_safe %> - 楼主: <%= link_to_user(topic.author) %> + 楼主: <%= link_to topic.author.login.truncate(10, omission: '...'),user_path(topic.author),title: topic.author.login %> - 最后回复:<%= link_to_user topic.last_reply.try(:author) %> + 最后回复:<% unless (topic.last_reply.nil? || topic.last_reply.author.nil?) %><%=link_to topic.last_reply.author.login.truncate(10, omission: '...'),user_path(topic.last_reply.author),title: topic.last_reply.author.login%><% end %> 回复(<%= link_to topic.try(:replies_count), topic.event_url %>)