修正课程讨论区、课程通知等创建时BUG修正

This commit is contained in:
nwb 2014-06-27 15:58:41 +08:00
parent 99c9f81aea
commit 917288c84c
5 changed files with 24 additions and 9 deletions

View File

@ -68,6 +68,9 @@ class MessagesController < ApplicationController
call_hook(:controller_messages_new_after_save, { :params => params, :message => @message})
render_attachment_warning_if_needed(@message)
redirect_to board_message_path(@board, @message)
else
layout_file = @project ? 'base_projects' : 'base_courses'
render :action => 'new', :layout => layout_file
end
end
end

View File

@ -116,7 +116,7 @@ class NewsController < ApplicationController
flash[:notice] = l(:notice_successful_create)
redirect_to project_news_index_path(@project)
else
layout_file = (@project.project_type == 1) ? 'base_courses' : 'base_projects'
layout_file = @project ? 'base_projects' : 'base_courses'
render :action => 'new', :layout => layout_file
end
elsif @course

View File

@ -1,4 +1,8 @@
<h3><%= link_to h(@board.name), :controller => 'boards', :action => 'show', :project_id => @project, :id => @board %> &#187; <%= l(:label_message_new) %></h3>
<% if @project %>
<h3><%= link_to h(@board.name), :controller => 'boards', :action => 'show', :project_id => @project, :id => @board %> &#187; <%= l(:label_message_new) %></h3>
<% elsif @course %>
<h3><%= link_to h(@board.name), :controller => 'boards', :action => 'show', :course_id => @course, :id => @board %> &#187; <%= l(:label_message_new) %></h3>
<% end %>
<%= form_for @message, :url => {:action => 'new'}, :html => {:multipart => true, :id => 'message-form'} do |f| %>
<%= render :partial => 'form', :locals => {:f => f} %>

View File

@ -1,6 +1,6 @@
<%= error_messages_for @news %>
<div class="add_frame_header" >
<% str = (@project.project_type == 1) ? l(:bale_news_notice) : l(:label_news_new) %>
<% str = @project ? l(:bale_news_notice) : l(:label_news_new) %>
<%= str %>
</div>
<div class="box tabular">

View File

@ -1,9 +1,17 @@
<!-- <h3><%=l(:label_news_new)%></h3> -->
<%= labelled_form_for @news, :url => project_news_index_path(@project),
:html => { :id => 'news-form', :multipart => true } do |f| %>
<%= render :partial => 'news/form', :locals => { :f => f } %>
<%= submit_tag l(:button_create), :class => "whiteButton m3p10 h30" %>
<%= preview_link preview_news_path(:project_id => @project), 'news-form' ,target='preview',{:class => 'whiteButton m3p10'}%>
<% if @project %>
<%= labelled_form_for @news, :url => project_news_index_path(@project),
:html => {:id => 'news-form', :multipart => true} do |f| %>
<%= render :partial => 'news/form', :locals => {:f => f} %>
<%= submit_tag l(:button_create), :class => "whiteButton m3p10 h30" %>
<%= preview_link preview_news_path(:project_id => @project), 'news-form', target='preview', {:class => 'whiteButton m3p10'} %>
<% end %>
<% elsif @course %>
<%= labelled_form_for @news, :url => course_news_index_path(@course),
:html => {:id => 'news-form', :multipart => true} do |f| %>
<%= render :partial => 'news/form', :locals => {:f => f} %>
<%= submit_tag l(:button_create), :class => "whiteButton m3p10 h30" %>
<%= preview_link preview_news_path(:course_id => @course), 'news-form', target='preview', {:class => 'whiteButton m3p10'} %>
<% end %>
<% end %>
<div id="preview" class="wiki"></div>