diff --git a/app/controllers/news_controller.rb b/app/controllers/news_controller.rb index 0ce30753d..67d4de0ff 100644 --- a/app/controllers/news_controller.rb +++ b/app/controllers/news_controller.rb @@ -414,10 +414,15 @@ class NewsController < ApplicationController if @news.org_subfield_id @org_subfield = OrgSubfield.find(@news.org_subfield_id) @organization = @org_subfield.organization + elsif @news.contest_id + @contest = Contest.find(@news.contest_id) end if @course @left_nav_type = 4 render :layout => "base_courses" + elsif @contest + @left_nav_type = 4 + render :layout => "base_contests" elsif @org_subfield render :layout => 'base_org' end diff --git a/app/views/news/_contest_news.html.erb b/app/views/news/_contest_news.html.erb index 56bcff846..cd0be8305 100644 --- a/app/views/news/_contest_news.html.erb +++ b/app/views/news/_contest_news.html.erb @@ -26,7 +26,7 @@ <% if contest && User.current.allowed_to?(:manage_news, @contest) %> <%= labelled_form_for @news, :url => new_contest_news_path(:contest_id => @contest), - :html => {:id => 'contest_news_form', :nhname => 'form', :multipart => true, :method => "get"} do |f| %> + :html => {:id => 'news-form', :nhname => 'form', :multipart => true, :method => "get"} do |f| %> <%= render :partial => 'contest_news_new', :locals => {:f => f, :news => @news, :edit_mode => false, :contest => @contest} %> <% end %> <% end %> diff --git a/app/views/news/_contest_news_new.html.erb b/app/views/news/_contest_news_new.html.erb index ca899a034..6ebdf4365 100644 --- a/app/views/news/_contest_news_new.html.erb +++ b/app/views/news/_contest_news_new.html.erb @@ -108,7 +108,7 @@ if(regexcontestTitle() && regexcontestDescription()) { news_description_editor.sync(); - $("#contest_news_form").submit(); + $("#news-form").submit(); } } \ No newline at end of file diff --git a/app/views/news/edit.html.erb b/app/views/news/edit.html.erb index c47e7bd6d..5a176e8aa 100644 --- a/app/views/news/edit.html.erb +++ b/app/views/news/edit.html.erb @@ -20,8 +20,10 @@ <%= render :partial => 'edit_for_org_subfield', :locals => {:f => f, :news => @news} %> <% elsif @course %> <%= render :partial => 'course_news_new', :locals => {:f => f, :news => @news, :edit_mode => true, :course => @course} %> + <% elsif @contest %> + <%= render :partial => 'contest_news_new', :locals => {:f => f, :news => @news, :edit_mode => true, :contest => @contest} %> <% elsif @project %> - <%= render :partial => 'project_news_new', :locals => {:f => f, :news => @news, :edit_mode => true} %> + <%= render :partial => 'project_news_new', :locals => {:f => f, :news => @news, :edit_mode => true} %> <% end %> <% end %>