diff --git a/app/assets/javascripts/admins/competition_settings/index.js b/app/assets/javascripts/admins/competition_settings/index.js new file mode 100644 index 000000000..f02f845c4 --- /dev/null +++ b/app/assets/javascripts/admins/competition_settings/index.js @@ -0,0 +1,23 @@ +$(document).on('turbolinks:load', function(){ + if ($('body.admins-competition-settings-index-page').length > 0) { + + var baseOptions = { + autoclose: true, + language: 'zh-CN', + format: 'yyyy-mm-dd', + startDate: '2017-04-01', + endDate: '-1d' + }; + + var defineDateRangeSelect = function(element){ + var options = $.extend({inputs: $(element).find('.start-date, .end-date')}, baseOptions); + $(element).datepicker(options); + + $(element).find('.start-date').datepicker().on('changeDate', function(e){ + $(element).find('.end-date').datepicker('setStartDate', e.date); + }); + }; + + defineDateRangeSelect('.teaching-mode-date'); + } +}); \ No newline at end of file diff --git a/app/assets/stylesheets/admins/competition_settings.scss b/app/assets/stylesheets/admins/competition_settings.scss new file mode 100644 index 000000000..20468aaed --- /dev/null +++ b/app/assets/stylesheets/admins/competition_settings.scss @@ -0,0 +1,21 @@ +.admins-competition-settings-index-page { + .competition-mode-container { + .row { + height: 35px; + } + + .des-row { + height: auto; + } + + .form-control { + font-size: 14px; + } + + //.mode-input { + // input { + // width: 40%; + // } + //} + } +} \ No newline at end of file diff --git a/app/models/competition.rb b/app/models/competition.rb index 8b9d59ed2..708af2556 100644 --- a/app/models/competition.rb +++ b/app/models/competition.rb @@ -28,9 +28,9 @@ class Competition < ApplicationRecord def mode_type case mode when 1 - "课堂" - when 2 "实训" + when 2 + "课堂" when 3 "教学" when 4 @@ -94,9 +94,9 @@ class Competition < ApplicationRecord GROUP BY competition_stage_id order by competition_stage_id") end - def awards_count - competition_awards.pluck(:num)&.sum > 0 ? competition_awards.pluck(:num)&.sum : 20 - end + # def awards_count + # competition_awards.pluck(:num)&.sum > 0 ? competition_awards.pluck(:num)&.sum : 20 + # end private diff --git a/app/views/admins/competition_settings/index.html.erb b/app/views/admins/competition_settings/index.html.erb index 4f53cb5d3..4c73609e4 100644 --- a/app/views/admins/competition_settings/index.html.erb +++ b/app/views/admins/competition_settings/index.html.erb @@ -10,9 +10,110 @@ 基础设置