competition setting support 0 teacher

dev_bj
p31729568 5 years ago
parent 1b2f4d8c7c
commit 4e90213802

@ -6,7 +6,7 @@ class CompetitionStaff < ActiveRecord::Base
belongs_to :competition
validates :position, numericality: { only_integer: true }
validates :minimum, numericality: { only_integer: true, greater_than: 0 }
validates :minimum, numericality: { only_integer: true, greater_than_or_equal_to: 0 }
validates :maximum, numericality: { only_integer: true, greater_than_or_equal_to: lambda { |obj| obj.minimum } }
validates :category, presence: true, inclusion: { in: %w(all teacher student profession) }

@ -16,7 +16,7 @@
<div class="df pl20 pr20 mt10">
<label class="mt3"><span class="mr3 color-orange">*</span>队名:</label>
<input type="text" name="name" autocomplete="off" <%= none_edit ? "disabled" : "" %> maxlength="20" value="<%= @team.try(:name) %>" class="input-flex-35" style="margin-right: 102px;" placeholder="请输入您的组队名称"/>
<input type="text" name="name" autocomplete="off" <%= none_edit ? "disabled" : "" %> maxlength="20" value="<%= @team.try(:name) %>" class="input-flex-35" placeholder="请输入您的组队名称"/>
</div>
<p style="line-height: 27px;height: 27px"><span id="team_name_notice" class="color-orange-tip ml73 none"></span></p>
@ -24,7 +24,7 @@
<div class="df pl20 pr20">
<label class="ml10 mt3">导师:</label>
<div class="flex1 pr search-new">
<input type="text" class="input-100-35 fl" <%= @team_user.user_extensions.identity == 0 ? "disabled" : "" %> autocomplete="off" placeholder="请您输入老师姓名进行搜索" id="teacher_search_input"
<input type="text" class="input-100-35 fl" <%= @team_user.user_extensions.identity == 0 ? "disabled" : "" %> autocomplete="off" placeholder="请您输入老师姓名进行搜索;可以后续再添加导师" id="teacher_search_input"
value="<%= @team.try(:id).present? ? @team.teacher.try(:show_name) : (@team_user.user_extensions.identity == 0 ? @team_user.show_name : "") %>">
<input type="hidden" id="teacher_id" data-select="0" value="<%= @team.try(:id).present? ? @team.try(:teacher_id) : (@team_user.user_extensions.identity == 0 ? @team_user.id : "") %>">
<input type="hidden" id="teacher_name" value="<%= @team.try(:id).present? ? @team.teacher.try(:show_name) : (@team_user.user_extensions.identity == 0 ? @team_user.show_name : "") %>">
@ -34,7 +34,7 @@
<ul class="pointerTeacher none" id="pointerTeacher">
</ul>
</div>
<a class="fl ml20 white-btn edu-blueback-btn mt4" onclick="add_teacher()">添加导师</a>
<a class="fl ml20 white-btn edu-blueback-btn mt4 add-teacher-btn" style="display: none;" onclick="add_teacher()">添加导师</a>
</div>
<p style="line-height: 27px;height: 27px"><span id="teacher_notice" class="color-orange-tip ml73 none"></span></p>
<% end %>
@ -52,7 +52,7 @@
<ul class="pointerTeacher none" id="pointerStudent">
</ul>
</div>
<a class="fl ml20 white-btn edu-blueback-btn mt4" onclick="<%= none_edit ? '' : 'add_member()' %>">添加成员</a>
<a class="fl ml20 white-btn edu-blueback-btn mt4 add-member-btn" style="display: none;" onclick="<%= none_edit ? '' : 'add_member()' %>">添加成员</a>
</div>
<p style="line-height: 27px;height: 27px"><span id="member_notice" class="color-orange-tip ml73 none"></span></p>
<% end %>

@ -28,6 +28,8 @@
$("#member_notice").hide();
$("#pointerStudent").hide();
e.stopPropagation();
$('.add-member-btn').trigger('click');
});
$("body").click(function(){
$(".pointerTeacher").hide();

@ -25,6 +25,7 @@
$("#pointerTeacher").hide();
$("#teacher_notice").hide();
e.stopPropagation();
$('.add-teacher-btn').trigger('click');
});
$("body").click(function(){
$(".pointerTeacher").hide();

@ -79,9 +79,9 @@
<% @competition.competition_staffs.each do |staff| %>
<div class="competition-staff-row mb10">
<%= select_tag('competition_staffs[][category]', options_for_select(CompetitionStaff.category_options, staff.category), class: 'winput-120-30') %>
<input type="text" autocomplete="off" class="Other_boxinput" name="competition_staffs[][minimum]" required="required" value="<%= staff.minimum %>"/>
<input type="text" autocomplete="off" class="Other_boxinput" name="competition_staffs[][minimum]" value="<%= staff.minimum %>"/>
&nbsp;&nbsp;~&nbsp;&nbsp;
<input type="text" autocomplete="off" class="Other_boxinput" name="competition_staffs[][maximum]" required="required" value="<%= staff.maximum %>"/>
<input type="text" autocomplete="off" class="Other_boxinput" name="competition_staffs[][maximum]" value="<%= staff.maximum %>"/>
<span class="competition-staff-operate ml10">
<i class="fa fa-trash-o ml5 font-16 delete-icon"></i>
@ -168,9 +168,9 @@
<div class="competition-staff-row-example" style="display: none">
<div class="competition-staff-row mb10">
<%= select_tag('competition_staffs[][category]', options_for_select(CompetitionStaff.category_options, ''), class: 'winput-120-30') %>
<input type="text" autocomplete="off" class="Other_boxinput" name="competition_staffs[][minimum]" require="required" value="1"/>
<input type="text" autocomplete="off" class="Other_boxinput" name="competition_staffs[][minimum]" value="1"/>
&nbsp;&nbsp;~&nbsp;&nbsp;
<input type="text" autocomplete="off" class="Other_boxinput" name="competition_staffs[][maximum]" required="required" value="1"/>
<input type="text" autocomplete="off" class="Other_boxinput" name="competition_staffs[][maximum]" value="1"/>
<span class="competition-staff-operate ml10">
<i class="fa fa-trash-o ml5 font-16 delete-icon"></i>

Loading…
Cancel
Save