mirror of
https://github.com/cnodejs/nodeclub.git
synced 2025-12-08 19:55:55 +00:00
91 lines
3.0 KiB
HTML
91 lines
3.0 KiB
HTML
<%- partial('editor_sidebar') %>
|
|
|
|
<div id='content'>
|
|
<div class='panel'>
|
|
<div class='header'>
|
|
<ol class='breadcrumb'>
|
|
<li><a href='/'>主页</a><span class='divider'>/</span></li>
|
|
<% if(locals.action && action == 'edit'){ %>
|
|
<li class='active'>编辑话题</li>
|
|
<% }else{ %>
|
|
<li class='active'>发布话题</li>
|
|
<% } %>
|
|
</ol>
|
|
</div>
|
|
<div class='inner post'>
|
|
<% if(locals.edit_error){ %>
|
|
<div class="alert alert-error">
|
|
<a class="close" data-dismiss="alert" href="#">×</a>
|
|
<strong><%= edit_error %></strong>
|
|
</div>
|
|
<% } %>
|
|
<% if(locals.error){ %>
|
|
<div class="alert alert-error" >
|
|
<strong><%= error %></strong>
|
|
</div>
|
|
<% }else{ %>
|
|
<% if (locals.action && action === 'edit') { %>
|
|
<form id='create_topic_form' action='/topic/<%= topic_id %>/edit' method='post'>
|
|
<% } else { %>
|
|
<form id='create_topic_form' action='/topic/create' method='post'>
|
|
<% } %>
|
|
<fieldset>
|
|
<textarea autofocus class='span9' id='title' name='title' rows='1'
|
|
placeholder="标题字数 10 字以上"
|
|
><%= locals.title || '' %></textarea>
|
|
|
|
<div class='markdown_editor in_editor'>
|
|
<div class='markdown_in_editor'>
|
|
<textarea class='editor' name='t_content' rows='20'
|
|
placeholder='文章支持 Markdown 语法, 请注意标记代码'
|
|
><%= locals.content || '' %></textarea>
|
|
<div class='editor_buttons'>
|
|
<button class='btn action_preview'>预览</button>
|
|
<button id='submit_btn' type="submit" class='btn btn-primary'>提交</button>
|
|
</div>
|
|
</div>
|
|
<div class='markdown_in_preview'>
|
|
<div class='preview'></div>
|
|
<div class='editor_buttons'>
|
|
<button class='btn action_modify'>修改</button>
|
|
<button id='submit_btn' type="submit" class='btn btn-primary'>提交</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<input type='hidden' id='topic_tags' name='topic_tags' value=''></input>
|
|
<input type='hidden' name='_csrf' value='<%= csrf %>' />
|
|
</fieldset>
|
|
</form>
|
|
</div>
|
|
<% } %>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- ajaxupload -->
|
|
<!-- markdown editor -->
|
|
<%- Loader('/public/topic_edit.min.js')
|
|
.js('/public/libs/ajax-upload/ajaxupload.js')
|
|
.js('/public/libs/marked.js')
|
|
.js('/public/javascripts/markdown_editor.js')
|
|
.done(assets, config.site_static_host, config.mini_assets)
|
|
%>
|
|
<script>
|
|
$(function () {
|
|
$('.tag_selectable').click(function(){
|
|
$(this).toggleClass('tag_select');
|
|
});
|
|
|
|
$('#submit_btn').click(function(){
|
|
var values=[];
|
|
$('.tag_selectable').each(function(){
|
|
if($(this).hasClass('tag_select')){
|
|
values.push($(this).attr('tag_id'));
|
|
}
|
|
});
|
|
$('#topic_tags').val(values);
|
|
$('#create_topic_form').submit();
|
|
});
|
|
});
|
|
</script>
|