Browse Source

强化提示 & 落选内容成为草稿

pull/4/head
欧醚 3 years ago
parent
commit
f3714fe826
2 changed files with 17 additions and 2 deletions
  1. +10
    -0
      app.py
  2. +7
    -2
      templates/story.html

+ 10
- 0
app.py View File

@ -213,6 +213,8 @@ def story(story_id):
story = Story.query.get_or_404(story_id)
is_tree = story.is_tree
draft = ''
if is_tree:
tail = request.args.get('tail', story.tail, type=int)
p_tail = Paragraph.query.get_or_404(tail)
@ -230,6 +232,14 @@ def story(story_id):
story_id=story_id, is_chosen=True, is_hidden=False
).all()
if 'username' in session:
last_post = Paragraph.query.filter_by(
story_id=story_id, author=session['username'], is_chosen=False
).order_by(Paragraph.id.desc()).first()
if last_post and last_post.parent_id != tail:
draft = last_post.text
sort_by = request.args.get('sort_by', 'time')
q = Paragraph.query.filter_by(story_id=story_id, parent_id=tail, is_hidden=False)

+ 7
- 2
templates/story.html View File

@ -53,6 +53,10 @@
<div style="font-size:90%;">
<ul>
<li>点击“续!”进行创作。</li>
{% if not is_tree %}
<li>请注意是对现有候选人故事的续写,不是对其他续写的续写。</li>
{% endif %}
</li>
{% if is_tree %}
<li>从第二天开始,在每天的10:00/16:00/22:00,对应故事线赞数总和最高且自身赞数不小于{{min_like_num}}的续写将入选,成为这个角色默认展示故事的一部分。</li>
{% else %}
@ -118,7 +122,8 @@
<input type="hidden" name="story-id" value={{story_id}}>
<input type="hidden" name="tail" value={{tail}}>
<div class="form-group">
<textarea class="form-control" name="text" rows="11" placeholder="来续写{{story.title}}的故事吧!(不超过 140 字)" required maxLength="140"></textarea>
<textarea class="form-control" name="text" rows="11"
placeholder="来续写{{story.title}}的故事吧!(不超过 140 字)" required maxLength="140">{{draft}}</textarea>
</div>
<div class="form-group">
<button type="submit" class="btn btn-link btn-lg">续!</button>
@ -130,7 +135,7 @@
<div class="footer">
<p>
<a href="//closed.social" target="_blank">闭社</a>提供技术支持,本报名系统开源于<a href="//git.closed.social/closed-social/">碧茶</a>
<a href="//closed.social" target="_blank">闭社</a>提供技术支持,本创作系统开源于<a href="//git.closed.social/">碧茶</a>
</p>
<p> 🄯 2021 Copyleft: closed.social</p>
</div>

Loading…
Cancel
Save