|
|
<% this.title = contest.id ? '编辑比赛' : '新建比赛' %> |
|
|
<% include header %> |
|
|
<div class="padding"> |
|
|
<form class="ui form" action="<%= syzoj.utils.makeUrl(['contest', contest.id, 'edit']) %>" method="post"> |
|
|
<div class="field"> |
|
|
<label>比赛名称</label> |
|
|
<input type="text" name="title" value="<%= contest.title %>"> |
|
|
</div> |
|
|
<div class="field"> |
|
|
<label>比赛描述</label> |
|
|
<input type="text" name="subtitle" value="<%= contest.subtitle %>"> |
|
|
</div> |
|
|
<div class="field"> |
|
|
<label>试题列表</label> |
|
|
<select class="ui fluid search dropdown" multiple="" id="search_problems" name="problems"> |
|
|
<% for (let problem of problems) { %> |
|
|
<option value="<%= problem.id %>" selected>#<%= problem.id %>. <%= problem.title %></option> |
|
|
<% } %> |
|
|
</select> |
|
|
</div> |
|
|
<div class="inline fields"> |
|
|
<label>赛制</label> |
|
|
<div class="field"> |
|
|
<div class="ui radio checkbox"> |
|
|
<input type="radio" name="type" id="type-noi" value="noi"<% if (contest.type === 'noi') { %> checked="checked"<% } %>> |
|
|
<label for="type-noi">NOI</label> |
|
|
</div> |
|
|
</div> |
|
|
<div class="field"> |
|
|
<div class="ui radio checkbox"> |
|
|
<input type="radio" name="type" id="type-ioi" value="ioi"<% if (contest.type === 'ioi') { %> checked="checked"<% } %>> |
|
|
<label for="type-ioi">IOI</label> |
|
|
</div> |
|
|
</div> |
|
|
<div class="field"> |
|
|
<div class="ui radio checkbox"> |
|
|
<input type="radio" name="type" id="type-acm" value="acm"<% if (contest.type === 'acm') { %> checked="checked"<% } %>> |
|
|
<label for="type-acm">ACM</label> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
<div class="field"> |
|
|
<label>比赛公告</label> |
|
|
<textarea class="" rows="5" id="doc-ta-1" name="information" class="font-content"><%= contest.information %></textarea> |
|
|
</div> |
|
|
<div class="field"> |
|
|
<label>开始时间</label> |
|
|
<input type="text" name="start_time" value="<%= syzoj.utils.formatDate(contest.start_time || syzoj.utils.getCurrentDate()) %>"> |
|
|
</div> |
|
|
<div class="field"> |
|
|
<label>结束时间</label> |
|
|
<input type="text" name="end_time" value="<%= syzoj.utils.formatDate(contest.end_time || syzoj.utils.getCurrentDate()) %>"> |
|
|
</div> |
|
|
<div class="inline field"> |
|
|
<label class="ui header">公开</label> |
|
|
<div class="ui toggle checkbox"> |
|
|
<input type="checkbox"<% if (contest.is_public) { %> checked<% } %> name="is_public"> |
|
|
<label><span style="visibility: hidden; "> </span></label> |
|
|
</div> |
|
|
</div> |
|
|
<button type="submit" class="ui button">提交</button> |
|
|
</form> |
|
|
<script> |
|
|
$(function () { |
|
|
$('#search_problems') |
|
|
.dropdown({ |
|
|
debug: true, |
|
|
apiSettings: { |
|
|
url: '/api/v2/search/problems/{query}', |
|
|
onResponse: function (response) { |
|
|
var a = $('#search_problems').val().map(function (x) { return parseInt(x) }); |
|
|
if (response.results) { |
|
|
response.results = response.results.filter(x => !a.includes(parseInt(x.value))); |
|
|
} |
|
|
return response; |
|
|
}, |
|
|
cache: false |
|
|
} |
|
|
}); |
|
|
}); |
|
|
</script> |
|
|
<% include footer %>
|
|
|
|