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

48 lines
1.6 KiB

<% this.title = article.id ? '编辑帖子' : '发表帖子'; %>
<% include header %>
<style type="text/css">
.am-panel-title{
font-size: 1.6em;
}
</style>
<div class="padding">
<form class="ui form" method="post" action="<%= syzoj.utils.makeUrl(['article', article.id, 'edit']) %>">
<div class="ui top attached tabular menu">
<a class="item active" data-tab="edit">编辑</a>
<a class="item" data-tab="preview" id="preview_tab">预览</a>
</div>
<div class="ui bottom attached tab segment active" data-tab="edit">
<div class="field">
<label for="title">标题</label>
<input type="text" id="title" name="title" value="<%= article.title %>">
<label for="content">内容</label>
<textarea rows="15" id="content" name="content"><%= article.content %></textarea>
</div>
</div>
<div class="ui bottom attached tab segment" data-tab="preview">
<div class="ui header" id="pv-title"></div>
<div id="pv-content"></div>
</div>
<button type="submit" class="ui labeled submit icon button">
<i class="icon edit"></i> 提交
</button>
</form>
</div>
<script type="text/javascript">
$(function () {
function render(output, input) {
$.post('/api/markdown', { s: input.val() }, function (s) {
// console.log(s);
output.html(s);
});
}
$("#preview_tab").click(function () {
$("#pv-title").text($("#title").val());
$("#pv-content").text('Loading...');
render($("#pv-content"), $("#content"));
});
$('.tabular.menu .item').tab();
})
</script>
<% include footer %>