算法评测平台前端。
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.

76 lines
3.3 KiB

8 years ago
<% 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>
8 years ago
<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>
8 years ago
<div class="field">
<label>比赛公告</label>
8 years ago
<textarea class="" rows="5" id="doc-ta-1" name="information" class="font-content"><%= contest.information %></textarea>
8 years ago
</div>
<div class="field">
<label>开始时间</label>
<input type="text" name="start_time" value="<%= syzoj.utils.formatDate(contest.start_time || syzoj.utils.getCurrentDate()) %>">
8 years ago
</div>
<div class="field">
<label>结束时间</label>
<input type="text" name="end_time" value="<%= syzoj.utils.formatDate(contest.end_time || syzoj.utils.getCurrentDate()) %>">
8 years ago
</div>
<button type="submit" class="ui button">提交</button>
</form>
<script>
$(function () {
$('#search_problems')
.dropdown({
debug: true,
apiSettings: {
url: '/api/v2/search/problems/{query}',
8 years ago
onResponse: function (response) {
var a = $('#search_problems').val().map(function (x) { return parseInt(x) });
8 years ago
if (response.results) {
response.results = response.results.filter(x => !a.includes(parseInt(x.value)));
}
return response;
},
cache: false
}
});
});
</script>
<% include footer %>