diff --git a/app/controllers/messages_controller.rb b/app/controllers/messages_controller.rb
index c35edfa1..2a408788 100644
--- a/app/controllers/messages_controller.rb
+++ b/app/controllers/messages_controller.rb
@@ -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
diff --git a/app/controllers/news_controller.rb b/app/controllers/news_controller.rb
index f91bc401..8bce84f9 100644
--- a/app/controllers/news_controller.rb
+++ b/app/controllers/news_controller.rb
@@ -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
diff --git a/app/views/messages/new.html.erb b/app/views/messages/new.html.erb
index f02af1da..20263423 100644
--- a/app/views/messages/new.html.erb
+++ b/app/views/messages/new.html.erb
@@ -1,4 +1,8 @@
-
<%= link_to h(@board.name), :controller => 'boards', :action => 'show', :project_id => @project, :id => @board %> » <%= l(:label_message_new) %>
+<% if @project %>
+ <%= link_to h(@board.name), :controller => 'boards', :action => 'show', :project_id => @project, :id => @board %> » <%= l(:label_message_new) %>
+<% elsif @course %>
+ <%= link_to h(@board.name), :controller => 'boards', :action => 'show', :course_id => @course, :id => @board %> » <%= l(:label_message_new) %>
+<% end %>
<%= form_for @message, :url => {:action => 'new'}, :html => {:multipart => true, :id => 'message-form'} do |f| %>
<%= render :partial => 'form', :locals => {:f => f} %>
diff --git a/app/views/news/_form.html.erb b/app/views/news/_form.html.erb
index bfdfeaa3..0601ee25 100644
--- a/app/views/news/_form.html.erb
+++ b/app/views/news/_form.html.erb
@@ -1,6 +1,6 @@
<%= error_messages_for @news %>
diff --git a/app/views/news/new.html.erb b/app/views/news/new.html.erb
index feaf7540..68fad17f 100644
--- a/app/views/news/new.html.erb
+++ b/app/views/news/new.html.erb
@@ -1,9 +1,17 @@
-
-<%= 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 %>