add new question
parent
ee04c354f6
commit
13a51a87a1
@ -0,0 +1,46 @@
|
||||
<ul class="posts list-unstyled">
|
||||
{% for post in questions %}
|
||||
{% if post.is_anonymous==False %}
|
||||
<li class="post">
|
||||
<div class="post-box">
|
||||
|
||||
<div class="post-content">
|
||||
<h3 class="post-title">
|
||||
<a href="{{ url_for('.post', id=post.id) }}">{{ post.title }}</a>
|
||||
</h3>
|
||||
<div class="post-body">
|
||||
<p>
|
||||
{% if post.body_html %}
|
||||
{{ post.body_html |safe|striptags|truncate(260,killwords=Flase,leeway=0) }}
|
||||
{% else %}
|
||||
{{ post.body |truncate(200,killwords=Flase,leeway=0)}}
|
||||
{% endif %}
|
||||
<small><a href="{{ url_for('.post', id=post.id) }}"><B>Read More</B></a></small>
|
||||
</p>
|
||||
</div>
|
||||
<div class="post-footer">
|
||||
<span class="post-date">
|
||||
<span class="glyphicon glyphicon-time"></span>
|
||||
{{ moment(post.timestamp).fromNow() }}
|
||||
</span>
|
||||
{% if current_user == post.author %}
|
||||
|
||||
{# 删除#}
|
||||
<a class="icon-btn" href="{{ url_for('main.delete_post_inProfile', post_id=post.id)}}">
|
||||
<span class="glyphicon glyphicon-trash"></span>
|
||||
<span>delete</span>
|
||||
</a>
|
||||
{# 修改 #}
|
||||
<a class="icon-btn" href="#">
|
||||
<span class="glyphicon glyphicon-pencil"></span>
|
||||
<span>modification</span>
|
||||
</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</ul>
|
@ -0,0 +1,105 @@
|
||||
{% extends "base.html" %}
|
||||
{% import "bootstrap/wtf.html" as wtf %}
|
||||
|
||||
{% block title %}New Post (Markdown) {% endblock %}
|
||||
|
||||
|
||||
{%block styles%}
|
||||
{{super()}}
|
||||
<link rel="stylesheet" href="{{url_for('static',filename='editormd/css/editormd.min.css')}}">
|
||||
{%endblock%}
|
||||
|
||||
{%block scripts%}
|
||||
{{super()}}
|
||||
<script src="{{ url_for('static',filename='editormd/examples/js/jquery.min.js') }}"></script>
|
||||
<script src="{{ url_for('static',filename='editormd/editormd.min.js') }}"></script>
|
||||
|
||||
<script>
|
||||
window.onload = function(){
|
||||
document.getElementById('title').addEventListener('keydown',function(e){
|
||||
if(e.keyCode!=13) return;
|
||||
e.preventDefault();
|
||||
this.value += '';
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
||||
<script>
|
||||
var testEditor;
|
||||
$(function(){
|
||||
testEditor=editormd("test-editormd",{
|
||||
placeholder:'This editor supports Markdown editing, write on the left, preview on the right',
|
||||
{#width:'1130px',#}
|
||||
height:'600px',
|
||||
syncScrolling : "single",
|
||||
path:"{{url_for('static',filename='editormd/lib/')}}",
|
||||
saveHTMLToTextarea: true,
|
||||
emoji: true,
|
||||
taskList: true,
|
||||
toolbarIcons : function() { //自定义工具栏
|
||||
return ["undo","redo","search","|","bold","del","italic","quote",
|
||||
"uppercase","lowercase","|","h1","h2","h3","h4","h5","h6","|",
|
||||
"list-ul","list-ol","hr","|","link","reference-link","image",
|
||||
"table","code","preformatted-text","code-block","datetime",
|
||||
"emoji","pagebreak","|","clear","watch","preview"]
|
||||
},
|
||||
});
|
||||
})
|
||||
</script>
|
||||
{%endblock%}
|
||||
|
||||
|
||||
|
||||
|
||||
{% block page_content %}
|
||||
|
||||
|
||||
<div>
|
||||
{% if current_user.can(Permission.WRITE) %}
|
||||
<form method="post">
|
||||
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
|
||||
<div class="form-control col-md-12" style="margin-bottom: 20px;margin-top: 20px;width: 100%;height: auto">
|
||||
{# <label class="WriteIndex-titleInput Input-wrapper Input-wrapper--multiline">#}
|
||||
<textarea id="title" name="title" rows="1" class="Input" maxlength="30"
|
||||
placeholder="Enter Title (Max: 30 letters)"
|
||||
style="
|
||||
-webkit-tap-highlight-color: rgba(26,26,26,0);
|
||||
-webkit-box-flex: 1;
|
||||
{# flex: 1 1;#}
|
||||
{# padding: 0;#}
|
||||
font-family: inherit;
|
||||
resize: none;
|
||||
{# color: #1a1a1a;#}
|
||||
overflow: hidden;
|
||||
{# min-height: 44px;#}
|
||||
display: block;
|
||||
width: 100%;
|
||||
border: 0;
|
||||
font-size: 24px;
|
||||
{# line-height: 1.4;#}
|
||||
{# font-weight: 600;#}
|
||||
outline: none;
|
||||
box-shadow: none;
|
||||
height: 100%;"></textarea>
|
||||
{# </label>#}
|
||||
</div>
|
||||
|
||||
{{form.hidden_tag()}}
|
||||
|
||||
<div id="test-editormd" class="form-control col-md-12" style="width: 100%">
|
||||
{{form.body(class="form-control",style="display:none;",id="ts")}}
|
||||
</div>
|
||||
|
||||
<div style="text-align: right;margin-bottom: 20px" >
|
||||
<div class="checkbox" style="display: inline-block;">
|
||||
<label>
|
||||
<input name="anonymous" type="checkbox"> anonymous
|
||||
</label>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary" style="width: 120px;margin-left: 20px">submit</button>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endblock %}
|
Loading…
Reference in New Issue