diff --git a/app/controllers/messages_controller.rb b/app/controllers/messages_controller.rb index bab5dfb4c..fd1266095 100644 --- a/app/controllers/messages_controller.rb +++ b/app/controllers/messages_controller.rb @@ -165,7 +165,15 @@ class MessagesController < ApplicationController render_attachment_warning_if_needed(@message) flash[:notice] = l(:notice_successful_update) @message.reload - redirect_to board_message_url(@message.board, @message.root, :r => (@message.parent_id && @message.id)) + if params[:is_board] + if @project + redirect_to project_boards_path(@project) + elsif @course + redirect_to course_boards_path(@course) + end + else + redirect_to board_message_url(@message.board, @message.root, :r => (@message.parent_id && @message.id)) + end elsif request.get? respond_to do |format| format.html { diff --git a/app/views/boards/_course_show.html.erb b/app/views/boards/_course_show.html.erb index 3b14ee767..adc064e1a 100644 --- a/app/views/boards/_course_show.html.erb +++ b/app/views/boards/_course_show.html.erb @@ -29,17 +29,28 @@
<% end %> - +

讨论区共有<%= @topic_count %>个帖子

<% if @topics.any? %> <% @topics.each do |topic| %> -
+
<%= link_to image_tag(url_to_avatar(topic.author), :width=>"42",:height=>"42"), user_path(topic.author),:class =>'talkmain_pic fl' %>
<% author = topic.author.to_s + ":" %> <%= link_to author, user_path(topic.author), :class =>"talkmain_name fl " %> + <% if topic.course_editable_by?(User.current) %> + <%= l(:button_edit) %> + <% end %> + <%= link_to( + l(:button_delete), + {:controller =>'messages',:action => 'destroy', :id => topic.id, :board_id => topic.board_id, :is_board=>'true'}, + :method => :post, + :data => {:confirm => l(:text_are_you_sure)}, + :class => 'talk_edit fr' + ) if topic.destroyable_by?(User.current) %>

  <%= h(topic.subject) %>

<% if topic.sticky? %> - <%= l(:label_board_sticky)%> + <%= l(:label_board_sticky)%> <% end %> @@ -59,6 +70,11 @@
+
+
    + <%= render :partial => 'edit',locals: {:topic => topic} %> +
+
<% reply = Message.new(:subject => "RE: #{@message.subject}")%> <% if !topic.locked? && authorize_for('messages', 'reply') %> diff --git a/app/views/boards/_edit.html.erb b/app/views/boards/_edit.html.erb new file mode 100644 index 000000000..c41f723de --- /dev/null +++ b/app/views/boards/_edit.html.erb @@ -0,0 +1,42 @@ + + <% if topic.project %> + <%#= board_breadcrumb(@message) %> + +
+
    + <%= form_for topic, { :as => :message, + :url => {:controller => 'messages',:action => 'edit', :is_board => 'true',:id => topic.id, :board_id => topic.board_id}, + :html => {:multipart => true, + :id => 'message-form' + topic.id.to_s, + :method => :post} + } do |f| %> + <%= render :partial => 'form_project', + :locals => {:f => f, :replying => !topic.parent.nil?} %> + <%= 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" %> +
+
+ <% end %> +<% elsif topic.course %> + <%#= course_board_breadcrumb(@message) %> +
+
    + <%= form_for topic, { + :as => :message, + :url => {:controller => 'messages',:action => 'edit', :is_board => 'true',:id => topic.id, :board_id => topic.board_id}, + :html => {:multipart => true, + :id => 'message-form' + topic.id.to_s, + :method => :post} + } do |f| %> + <%= render :partial => 'form_course', + :locals => {:f => f, :replying => !topic.parent.nil?} %> + <%= 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" %> + + <% end %> +
+
+<% end %> + + +
diff --git a/app/views/boards/_project_show.html.erb b/app/views/boards/_project_show.html.erb index 62ab2d08d..124472f5c 100644 --- a/app/views/boards/_project_show.html.erb +++ b/app/views/boards/_project_show.html.erb @@ -29,29 +29,28 @@
- +

讨论区共有<%= @topic_count %>个帖子

<% if @topics.any? %> <% @topics.each do |topic| %> -
+
<%= link_to image_tag(url_to_avatar(topic.author), :width=>"42",:height=>"42"), user_path(topic.author),:class =>'talkmain_pic fl' %>
<% author = topic.author.to_s + ":" %> <%= link_to author, user_path(topic.author), :class =>"talkmain_name fl " %> - <%= link_to( - l(:button_edit), - {:action => 'edit', :id => topic}, - :class => 'talk_edit fr' - ) if @message.editable_by?(User.current) %> - <%= link_to( + <% if topic.editable_by?(User.current) %> + <%= l(:button_edit) %> + <% end %> + <%= link_to( l(:button_delete), - {:action => 'destroy', :id => topic}, + {:controller =>'messages',:action => 'destroy', :id => topic.id, :board_id => topic.board_id, :is_board=>'true'}, :method => :post, :data => {:confirm => l(:text_are_you_sure)}, :class => 'talk_edit fr' - ) if @message.destroyable_by?(User.current) %> + ) if topic.destroyable_by?(User.current) %>

  <%= h(topic.subject) %>

<% if topic.sticky? %> - <%= l(:label_board_sticky)%> + <%= l(:label_board_sticky)%> <% end %>
@@ -74,6 +73,12 @@
+ +
+
    + <%= render :partial => 'edit',locals: {:topic => topic} %> +
+
<% reply = Message.new(:subject => "RE: #{@message.subject}")%> <% if !topic.locked? && authorize_for('messages', 'reply') %> @@ -157,7 +162,7 @@
<%if replies_all.first %> - + <% end %> <% end %>
diff --git a/app/views/boards/show.html.erb b/app/views/boards/show.html.erb index fefe54b78..9faf07b9a 100644 --- a/app/views/boards/show.html.erb +++ b/app/views/boards/show.html.erb @@ -31,7 +31,10 @@ function show_newtalk() $("#about_newtalk").toggle(); } - +function show_newtalk1(id) +{ + $(id).toggle(); +} <% if @project %> <%= render :partial => 'project_show', locals: {project: @project} %>