panel.html 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. {% if g.user.is_authenticated %}
  2. <ul class="list-group">
  3. {% if topic in current_user.following_topics %}
  4. <button type="button" class="btn btn-info btn-block topicfollow active" id="{{ topic.id }}">取消关注</button>
  5. {% else %}
  6. <button type="button" class="btn btn-info btn-block topicfollow" id="{{ topic.id }}">关注问题</button>
  7. {% endif %}
  8. {% if current_user.is_authenticated and current_user == topic.author %}
  9. <a class="btn btn-success btn-block" href="{{ url_for('topic.edit',topicId=topic.uid)}}">
  10. 编辑问题
  11. </a>
  12. {%- endif %}
  13. {% if topic.id | is_collected %}
  14. <span class="btn btn-default btn-block">已收藏</span>
  15. {% else %}
  16. <span class="btn btn-default btn-block" data-toggle="modal" data-target="#sidecollect">收藏问题</span>
  17. <div class="modal fade" id="sidecollect" tabindex="-1" role="dialog" aria-labelledby="sidecollectLabel">
  18. <div class="modal-dialog" role="document">
  19. <div class="modal-content">
  20. <div class="modal-header">
  21. <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
  22. <h4 class="modal-title" id="sidecollectLabel">收藏夹</h4>
  23. </div>
  24. {% if not current_user.collects.all() %}
  25. <div class="modal-body">
  26. <a href="{{ url_for('mine.collect') }}" style="text-decoration:none">
  27. <i class="icon icon-plus"></i> 创建
  28. </a>
  29. </div>
  30. {% else %}
  31. <form action="{{ url_for('mine.collect_detail',topicId=topic.uid)}}" method="POST">
  32. {{ form.hidden_tag() }}
  33. <div class="modal-body">
  34. <p> 添加到收藏夹 </p>
  35. {% for collect in current_user.collects %}
  36. <label data-id="{{ collect.id }}"><input name="add-to-collect" type="checkbox" value="{{ collect.id}}" />{{ collect.name }}</label>
  37. {% if collect.is_privacy %}
  38. <span class="label label-default">私密</span>
  39. {% else %}
  40. <span class="label label-default">公开</span>
  41. {% endif %}
  42. <br/>
  43. {% endfor %}
  44. </div>
  45. <div class="modal-footer" style="padding-top:5px;padding-bottom:5px;">
  46. <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
  47. <button type="submit" class="btn btn-primary">提交</button>
  48. </div>
  49. </form>
  50. {% endif %}
  51. </div>
  52. </div>
  53. </div>
  54. {% endif %}
  55. </ul>
  56. {% endif %}