You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
educoder/app/views/admins/competition_settings/index.html.erb

314 lines
15 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<%
define_admin_breadcrumbs do
add_admin_breadcrumb('竞赛列表', admins_competitions_path)
add_admin_breadcrumb(@competition.name)
end
%>
<div class="card mb-5">
<div class="card-header d-flex justify-content-between align-items-center">
<span class="flex-1">基础设置</span>
</div>
<div class="card-body row">
<%= form_tag(basic_setting_admins_competition_competition_settings_path(@competition), method: :post, class: 'basic-setting-form flex-1', remote: true) do %>
<div class="container competition-mode-container">
<div class="row align-items-center mb-1">
<div class="col-1 text-right">
主标题
</div>
<div class="col-5 text-left">
<%= text_field_tag(:name, @competition.name, autocomplete: 'off', class: 'form-control', placeholder: '竞赛标题') %>
</div>
</div>
<div class="row align-items-center mb-1">
<div class="col-1 text-right">
副标题
</div>
<div class="col-5 text-left">
<%= text_field_tag(:sub_title, @competition.sub_title, autocomplete: 'off', class: 'form-control', placeholder: '竞赛副标题') %>
</div>
</div>
<div class="row align-items-center mb-1">
<div class="col-1 text-right">
起止时间
</div>
<div class="col-5 competition-start-end-date d-flex">
<%= text_field_tag :start_time, @competition.start_time&.strftime('%Y-%m-%d %H:%M:%S'), autocomplete: 'off', class: 'form-control start-date mx-0 mr-2', placeholder: '竞赛开始时间' %>
<%= text_field_tag :end_time, @competition.end_time&.strftime('%Y-%m-%d %H:%M:%S'), autocomplete: 'off', class: 'form-control end-date mx-0', placeholder: '竞赛截止时间' %>
</div>
</div>
<div class="row align-items-center mb-1">
<div class="col-1 text-right">
竞赛模式
</div>
<div class="col-5 text-left">
<%= radio_button_tag(:mode, 1, @competition.mode == 1, class: 'form-radio-input') %>
<label class="form-radio-label mb-0" for="mode_1">实训模式(参赛者报名参赛,挑战实训,系统评审)</label>
</div>
</div>
<div class="row align-items-center mb-1">
<div class="col-1 text-right">
</div>
<div class="col-5 text-left">
<%= radio_button_tag(:mode, 2, @competition.mode == 2, class: 'form-radio-input') %>
<label class="form-radio-label mb-0" for="mode_2">课堂模式(参赛者加入课堂,提交作品,评委评审)</label>
</div>
<div class="col-6">
<%= text_field_tag(:course_id, @competition.competition_mode_setting&.course_id, autocomplete: 'off', class: 'form-control', placeholder: '课堂id') %>
</div>
</div>
<div class="row align-items-center mb-1">
<div class="col-1 text-right">
</div>
<div class="col-5 text-left">
<%= radio_button_tag(:mode, 3, @competition.mode == 3, class: 'form-radio-input') %>
<label class="form-radio-label mb-0" for="mode_3">教学模式(参赛者报名参赛,统计战队课堂和实训数据)</label>
</div>
<div class="col-6 teaching-mode-date d-flex">
<%= text_field_tag :teach_start_time, @competition.competition_mode_setting&.start_time, autocomplete: 'off', class: 'form-control start-date mx-0 mr-2', placeholder: '统计数据的开始时间' %>
<%= text_field_tag :teach_end_time, @competition.competition_mode_setting&.end_time, autocomplete: 'off', class: 'form-control end-date mx-0', placeholder: '统计数据的结束时间' %>
</div>
</div>
<div class="row align-items-center mb-2">
<div class="col-1 text-right">
</div>
<div class="col-5 text-left">
<%= radio_button_tag(:mode, 4, @competition.mode == 4, class: 'form-radio-input') %>
<label class="form-radio-label mb-0" for="mode_4">托管模式(参赛者报名参赛,在其他平台完成任务)</label>
</div>
</div>
<div class="row align-items-center mb-2">
<div class="col-1 text-right">
URL
</div>
<div class="col-5 text-left mode-input">
<%= text_field_tag(:identifier, @competition.identifier, autocomplete: 'off', class: 'form-control', placeholder: '请输入url赛事网址') %>
</div>
</div>
<div class="row align-items-center mb-2">
<div class="col-1 text-right">
主办方
</div>
<div class="col-5 text-left">
</div>
</div>
<div class="row align-items-center mb-2">
<div class="col-1 text-right">
奖金
</div>
<div class="col-5 text-left input-group">
<div class="input-group-prepend">
<div class="input-group-text">¥</div>
</div>
<%= number_field_tag(:bonus, @competition.bonus, autocomplete: 'off', step: 1, min: 0, class: 'form-control', placeholder: '请输入总奖金额') %>
</div>
</div>
<div class="row align-items-center mb-2">
<div class="col-1 text-right">
奖项数
</div>
<div class="col-5 text-left">
<%= number_field_tag(:awards_count, @competition.awards_count, autocomplete: 'off', step: 1, min: 0, class: 'form-control', placeholder: '请输入奖项数') %>
</div>
</div>
<div class="row des-row align-items-center mb-2">
<div class="col-1 text-right">
描述
</div>
<div class="col-11 text-left">
<%= text_area_tag(:description, @competition.description, class: 'form-control', placeholder: '请输入赛事简介') %>
</div>
</div>
<div class="error my-2 danger text-danger"></div>
<div class="row des-row align-items-center mb-2">
<div class="col-1 text-right">
</div>
<div class="col-5 text-left">
<%= javascript_void_link '保存', class: 'btn btn-primary submit-btn' %>
</div>
</div>
</div>
<% end %>
</div>
</div>
<div class="card mb-5">
<div class="card-header d-flex justify-content-between align-items-center">
<span class="flex-1">导航设置</span>
</div>
<div class="card-body row">
<%= form_tag(nav_setting_admins_competition_competition_settings_path(@competition), method: :post, class: 'nav-setting-form flex-1', remote: true) do %>
<div class="container competition-mode-container">
<% @competition.competition_modules.each do |com_module| %>
<% case com_module.module_type %>
<% when 'home' %>
<div id="MD_typeFrom">
<div class="row MD_type">
<div class="col-1 text-right">
<label class="checkbox checkbox-primary mt-1">
<input type="checkbox" name="navbar[][hidden]" value="0" hidden class="font-16" checked="checked">
<input type="checkbox" disabled="disabled" class="font-16" checked="checked">
</label>
</div>
<div class="col-md-4">
<%= text_field_tag('navbar[][name]', com_module.name, id: nil, class: 'form-control', placeholder: '首页') %>
<input type="hidden" value="<%= com_module.module_type %>" name="navbar[][module_type]">
</div>
<div class="col-md-1">
<%= text_field_tag('navbar[][position]', com_module.position, id: nil, class: 'form-control', placeholder: '位置') %>
</div>
</div>
</div>
<% when 'enroll' %>
<div class="row mt-2">
<div class="col-1 text-right">
<label class="checkbox checkbox-primary mt-1">
<%= check_box_tag('navbar[][hidden]', 0, !com_module.hidden, id: nil, class: 'font-16') %>
</label>
</div>
<div class="col-md-8 color-blue mt-1">
<input type="hidden" value="<%= com_module.module_type %>" name="navbar[][module_type]">
<input type="hidden" value="报名" name="navbar[][name]">
报名
</div>
</div>
<div class="row mt-2 align-items-center">
<div class="col-1 text-right">&nbsp;&nbsp;</div>
<div class="col-1 text-left" style="max-width: 120px;flex: 0 0 120px;">
报名截止时间
</div>
<div class="col-md-3">
<%= text_field_tag :enroll_end_time, @competition.enroll_end_time&.strftime('%Y-%m-%d'), autocomplete: 'off', class: 'form-control enroll_end_time', placeholder: '报名截止时间' %>
</div>
</div>
<div class="row mt-2">
<div class="col-1 text-right">&nbsp;&nbsp;</div>
<div class="col-1 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>
</div>
<div id="requireForm" class="competition-staff-settings">
<% @competition.competition_staffs.each do |staff| %>
<div class="row mt-2 mb-4 requireForm_item">
<div class="col-1 text-right">&nbsp;&nbsp;</div>
<div class="col-1 text-left mt-1">
<input type="text" class="form-control" name="competition_staffs[][minimum]" value="<%= staff.minimum %>" />
</div>
<span class="mt-2">~</span>
<div class="col-1 mt-1">
<input type="text" class="form-control" name="competition_staffs[][maximum]" value="<%= staff.maximum %>" />
</div>
<span class="mt-2">人</span>
<div class="col-2 mt-1">
<select class="form-control" name="competition_staffs[][category]">
<option value="all" <%= staff.category == "all" ? "selected='selected'" : "" %>>不限</option>
<option value="teacher" <%= staff.category == "teacher" ? "selected='selected'" : "" %>>教师</option>
<option value="student" <%= staff.category == "student" ? "selected='selected'" : "" %>>学生</option>
<option value="profession" <%= staff.category == "profession" ? "selected='selected'" : "" %>>专业人士</option>
</select>
</div>
<div class="col-2 mt-1">
<label class="radio checkbox-primary mt-1" value="require_1_1">
<input id="require_1_<%= staff.id %>" <%= staff.mutiple_limited? ? '' : 'checked="checked"' %> class="mutiple-limited-radio" value="false" name="competition_staffs[][mutiple_limited]" type="checkbox">
<label for="require_1_<%= staff.id %>">可多次报名</label>
</label>
</div>
<div class="col-2 mt-1">
<label class="radio checkbox-primary mt-1" value="require_1_2">
<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>
<a href="javascript:void(0)" class="ml20 delRequrieBtn">
<i class="fa fa-times-circle font-20 color-grey-c"></i>
</a>
</div>
</div>
<% end %>
</div>
<% when 'inform', 'chart', 'resource' %>
<div class="row mt-2 new_module_div linkFormItem">
<div class="col-1 text-right">
<label class="checkbox checkbox-primary mt-1">
<%= check_box_tag('navbar[][hidden]', 0, !com_module.hidden, id: nil, class: 'font-16') %>
</label>
</div>
<div class="col-md-label mt-2">
<input type="hidden" value="<%= com_module.module_type %>" name="navbar[][module_type]">
<input type="hidden" value="<%= com_module.name %>" name="navbar[][name]">
<%= com_module.name %>
</div>
<div class="col-md-1 mt-1">
<%= text_field_tag('navbar[][position]', com_module.position, id: nil, class: 'form-control', placeholder: '位置') %>
</div>
<% if com_module.module_type == "resource" %>
<div class="col-md-3 mt-1">
<%= text_field_tag('navbar[][url]', com_module.url, id: nil, class: 'form-control', placeholder: '请输入资料下载地址') %>
</div>
<%= javascript_void_link '+', class: 'mt-1 btn btn-primary waves-effect waves-light btn-xs setBtn_s add_linkBtn' %>
<% end %>
</div>
<% else %>
<div class="row mt-2 align-items-center linkFormItem">
<div class="col-1 text-right">
<label class="checkbox checkbox-primary mt-1">
<%= check_box_tag('navbar[][hidden]', 0, !com_module.hidden, id: nil, class: 'font-16') %>
</label>
</div>
<div class="col-md-label mt-1">
<input type="hidden" value="<%= com_module.module_type %>" name="navbar[][module_type]">
<%= text_field_tag('navbar[][name]', com_module.name, id: nil, class: 'form-control', placeholder: '请输入模块名称') %>
</div>
<div class="col-md-1 mt-1">
<%= text_field_tag('navbar[][position]', com_module.position, id: nil, class: 'form-control', placeholder: '位置') %>
</div>
<div class="col-md-3 mt-1">
<%= text_field_tag('navbar[][url]', com_module.url, id: nil, class: 'form-control', placeholder: '请输入资料下载地址') %>
</div>
<%= javascript_void_link '+', class: 'mt-1 btn btn-primary waves-effect waves-light btn-xs setBtn_s add_linkBtn' %>
<%= javascript_void_link '×', class: 'mt-1 btn btn-icon waves-effect btn-default waves-light setBtn_s ml10 del_linkBtn' %>
</div>
<% end %>
<% end %>
<!-- <div class="row mt-2">-->
<!-- <div class="col-1 text-right">-->
<!-- <label class="checkbox checkbox-primary mt-1">-->
<!-- <input id="checkbox2" type="checkbox">-->
<!-- <label for="checkbox2">&nbsp;</label>-->
<!-- </label>-->
<!-- </div>-->
<!-- <div class="col-md-label mt-2">获奖证书</div>-->
<!-- </div>-->
<div class="error my-2 danger text-danger"></div>
<div class="row mt-2 mb-4">
<div class="col-1 text-right">
</div>
<div class="col-md-label mt-2"><%= javascript_void_link '保存', class: 'btn btn-primary submit-btn' %></div>
</div>
</div>
<% end %>
</div>
</div>