竞赛编辑功能

This commit is contained in:
huang 2016-12-23 19:56:00 +08:00
parent bc5846c2d6
commit 2c97f12538
4 changed files with 10 additions and 3 deletions

View File

@ -414,10 +414,15 @@ class NewsController < ApplicationController
if @news.org_subfield_id if @news.org_subfield_id
@org_subfield = OrgSubfield.find(@news.org_subfield_id) @org_subfield = OrgSubfield.find(@news.org_subfield_id)
@organization = @org_subfield.organization @organization = @org_subfield.organization
elsif @news.contest_id
@contest = Contest.find(@news.contest_id)
end end
if @course if @course
@left_nav_type = 4 @left_nav_type = 4
render :layout => "base_courses" render :layout => "base_courses"
elsif @contest
@left_nav_type = 4
render :layout => "base_contests"
elsif @org_subfield elsif @org_subfield
render :layout => 'base_org' render :layout => 'base_org'
end end

View File

@ -26,7 +26,7 @@
</div> </div>
<% if contest && User.current.allowed_to?(:manage_news, @contest) %> <% if contest && User.current.allowed_to?(:manage_news, @contest) %>
<%= labelled_form_for @news, :url => new_contest_news_path(:contest_id => @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} %> <%= render :partial => 'contest_news_new', :locals => {:f => f, :news => @news, :edit_mode => false, :contest => @contest} %>
<% end %> <% end %>
<% end %> <% end %>

View File

@ -108,7 +108,7 @@
if(regexcontestTitle() && regexcontestDescription()) if(regexcontestTitle() && regexcontestDescription())
{ {
news_description_editor.sync(); news_description_editor.sync();
$("#contest_news_form").submit(); $("#news-form").submit();
} }
} }
</script> </script>

View File

@ -20,8 +20,10 @@
<%= render :partial => 'edit_for_org_subfield', :locals => {:f => f, :news => @news} %> <%= render :partial => 'edit_for_org_subfield', :locals => {:f => f, :news => @news} %>
<% elsif @course %> <% elsif @course %>
<%= render :partial => 'course_news_new', :locals => {:f => f, :news => @news, :edit_mode => true, :course => @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 %> <% 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 %>
<% end %> <% end %>
</div> </div>