issues25489
cxt 5 years ago
parent 0b1337f0e5
commit d254907b7d

@ -221,11 +221,12 @@
</div>
<div class="row mt-2">
<div class="col-1 text-right">&nbsp;&nbsp;</div>
<div class="col-1 text-left mt-1">
报名要求
<div class="col-2 text-left mt-1">
报名模式和要求
</div>
<div class="col-md-3">
<%= javascript_void_link '+', class: 'btn btn-primary waves-effect waves-light btn-xs setBtn_s addRequireBtn' %>
<div class="col-2 text-left">
<%= radio_button_tag(:team_mode, 0, !@competition.team_mode, class: 'form-radio-input') %>
<label class="form-radio-label mb-0" for="team_mode_0">个人赛</label>
</div>
</div>
@ -242,10 +243,8 @@
</div>
<span class="mt-2">人</span>
<div class="col-2 mt-1">
<select class="form-control" name="competition_staffs[][category]">
<option value="student" <%= staff.category == "student" ? "selected='selected'" : "" %>>学生</option>
<option value="teacher" <%= staff.category == "teacher" ? "selected='selected'" : "" %>>教师</option>
</select>
<% identity_options = [['全部', 'all'], ['教师', 'teacher'], ['学生', 'student'], ['专业人士', 'professional']] %>
<%= select_tag("competition_staffs[][category]", options_for_select(identity_options, staff.category), multiple: true, class: 'form-control') %>
</div>
<div class="col-2 mt-1">
<label class="radio checkbox-primary mt-1" value="require_1_1">
@ -258,6 +257,7 @@
<input id="require_2_<%= staff.id %>" <%= staff.mutiple_limited? ? 'checked="checked"' : '' %> class="mutiple-limited-radio" value="true" name="competition_staffs[][mutiple_limited]" type="checkbox">
<label for="require_2_<%= staff.id %>">不可多次报名</label>
</label>
<%= javascript_void_link '+', class: 'btn btn-primary waves-effect waves-light btn-xs setBtn_s addRequireBtn' %>
<a href="javascript:void(0)" class="ml20 delRequrieBtn">
<i class="fa fa-times-circle font-20 color-grey-c"></i>
</a>

@ -0,0 +1,6 @@
class AddTeamModeToCompetitions < ActiveRecord::Migration[5.2]
def change
add_column :competitions, :team_mode, :boolean, default: 0
add_column :competition_staffs, :category_name, :string
end
end

@ -0,0 +1,7 @@
class MigrateCompetitionTeamMode < ActiveRecord::Migration[5.2]
def change
Competition.all.each do |competition|
competition.update_attributes!(team_mode: 1) unless (competition.competition_staffs.sum(:maximum).to_i == 1 || (competition.competition_staffs.nil? && competition.max_num == 1))
end
end
end
Loading…
Cancel
Save