From 68d8f10482610c68fcdf6973594e06748e135425 Mon Sep 17 00:00:00 2001 From: p31729568 Date: Sat, 20 Jul 2019 16:01:07 +0800 Subject: [PATCH] competition modify --- app/controllers/managements_controller.rb | 6 ++ app/models/competition_text_config.rb | 2 +- .../_qg_second_opensource.html.erb | 99 ++++++++++--------- .../_competition_list_page.html.erb | 25 ++++- config/routes.rb | 2 + ...0074324_change_competition_text_configs.rb | 8 ++ 6 files changed, 90 insertions(+), 52 deletions(-) create mode 100644 db/migrate/20190720074324_change_competition_text_configs.rb diff --git a/app/controllers/managements_controller.rb b/app/controllers/managements_controller.rb index 156ae951..6a377933 100644 --- a/app/controllers/managements_controller.rb +++ b/app/controllers/managements_controller.rb @@ -1133,6 +1133,12 @@ end render :json => {:status => 1} end + def update_competition_text + text = CompetitionTextConfig.find(params[:id]) + text.update_attributes(name: params[:name], description: params[:description]) + render :json => {:status => 1} + end + def delete_competition_text ctc = CompetitionTextConfig.find params[:id] ctc.destroy diff --git a/app/models/competition_text_config.rb b/app/models/competition_text_config.rb index 25ddb28e..436818bf 100644 --- a/app/models/competition_text_config.rb +++ b/app/models/competition_text_config.rb @@ -1,4 +1,4 @@ class CompetitionTextConfig < ActiveRecord::Base - # attr_accessible :title, :body + attr_accessible :name, :description, :competition_id belongs_to :competition end diff --git a/app/views/competitions/_qg_second_opensource.html.erb b/app/views/competitions/_qg_second_opensource.html.erb index 3b88b612..ddaad572 100644 --- a/app/views/competitions/_qg_second_opensource.html.erb +++ b/app/views/competitions/_qg_second_opensource.html.erb @@ -4,71 +4,59 @@
<% index += 1 %> - -
-
-

- 为推动我国基于开源的开放创新生态环境建设,加快面向自主创新的高校信息技术新工科人才培养模式变革,大力培养实践能力强、创新能力强、具备国际竞争力的信息技术领域高素质人才,教育部高等学校计算机类专业教学指导委员会、教育部高等学校软件工程专业教学指导委员会、全国高等学校计算机教育研究会。 - - 创新能力强、具备国际竞争力的信息技术领域高素质人才,教育部高等学校计算机类专业教学指导委员会、教育部高等学校软件工程专业教学指导委员会、全国高等学校计算机教育研究会、信息技术新工科产学研联盟、中国计算机学会软件工程专委会、中国计算机学会系统软件专委会、绿色计算产业联盟等共同研究,决定举办第二届全国高校绿色计算创新大赛。 -

-
-
- -
-
- +
+
+

+ <%= @competition.competition_text_configs.first.try(:description) %> +

+<% index += 1 %> -<% @competition.competition_stages.each_with_index do |stage, i| %> -
- <% - first_section = stage.competition_stage_sections[0] - second_section = stage.competition_stage_sections[1] - %> -
-
    -

    - - <%= first_section.try(:name) %> - <%= first_section.start_time.try(:strftime, '%Y年%m月%d日') %>~<%= first_section.end_time.try(:strftime, '%Y年%m月%d日') %> - - - <%= second_section.try(:name) %> - <%= second_section.try(:start_time).try(:strftime, '%Y年%m月%d日') %>~<%= second_section.try(:end_time).try(:strftime, '%Y年%m月%d日') %> - -

    -
  • - <% is_start = Time.now > first_section.start_time %> - <% first_section.competition_entries.each_with_index do |entry, j| %> - <% - competition_url = User.current.logged? ? "#{entry.url}?eid=#{User.current.id}" : "#{entry.url}" - btn_url = is_start ? "#{competition_url}" : "javascript:void(0);" - %> - <%= entry.name %> - <% end %> -
  • -
+<% + first_stage = @competition.competition_stages.first + first_section = first_stage.competition_stage_sections.first + first_entry = first_section.competition_entries.first + is_start = Time.now > first_section.start_time + competition_url = User.current.logged? ? "#{first_entry.url}?eid=#{User.current.id}" : "#{first_entry.url}" + btn_url = is_start ? "#{competition_url}" : "javascript:void(0);" +%> +
+
+
<% index += 1 %> -<% end %>
<% index += 1 %>
<% index += 1 %>
+<% index += 1 %> +