article.html 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. {% extends "base.html" %}
  2. {% import "macro.html" as macro %}
  3. {% block title %} 文档 {% endblock %}
  4. {% block style %}
  5. {{ super() }}
  6. <link href="{{ url_for('static', filename='styles/docx/article.css') }}" rel="stylesheet">
  7. {% endblock %}
  8. {% block context %}
  9. <section id="base" class="container mt-3">
  10. {% if current_user.check_role("ReadBlog") %}
  11. {# 检查是否具有读取权限 #}
  12. <div class="row">
  13. <article class="col-12">
  14. <h1> {{ article.title }} <small> {{ article.subtitle }} <small> {{ article.update_time}} </small> </small> </h1>
  15. {% for archive in article.archive %}
  16. <span class="badge badge-info"> {{ archive.name }} </span>
  17. {% endfor %}
  18. <a href="{{ url_for('docx.article_down_page', blog_id=article.blog_id) }}"> 下载 </a>
  19. <hr>
  20. {{ article.context | safe }}
  21. </article>
  22. </div>
  23. {% endif %}
  24. {% if current_user.check_role("ReadComment") %}
  25. <div class="row">
  26. <article class="col-12">
  27. <h1 class="mt-3"> 评论 </h1>
  28. <section class="col-12 text-right">
  29. <form action="{{ url_for('docx.comment_page', blog=article.blog_id) }}" method="post">
  30. {{ form.hidden_tag() }}
  31. {{ form.context(class="form-control mb-2", rows="3") }}
  32. <div id="CommentModal" class="modal fade" role="dialog" aria-hidden="true">
  33. <div class="modal-dialog">
  34. <div class="modal-content text-left">
  35. <div class="modal-header">
  36. <h4 class="modal-title" id="CommentModalLabel"> 确认评论? </h4>
  37. </div>
  38. <div class="modal-body">
  39. <p> 是否确认评论?请注意网络用语文明。 </p>
  40. </div>
  41. <div class="modal-footer">
  42. {{ form.submit(class="btn btn-info", value="确认") }}
  43. <button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>
  44. </div>
  45. </div>
  46. </div>
  47. </div>
  48. <button type="button" class="btn btn-info mb-2" data-toggle="modal" data-target="#CommentModal"> 评论 </button>
  49. </form>
  50. </section>
  51. <hr>
  52. {% for comment in article.comment %}
  53. {% if show_delete %}
  54. <div id="DeleteModal{{comment.comment_id}}" class="modal fade" role="dialog" aria-hidden="true">
  55. <div class="modal-dialog">
  56. <div class="modal-content text-left">
  57. <div class="modal-header">
  58. <h4 class="modal-title"> 确认删除评论? </h4>
  59. </div>
  60. <div class="modal-body">
  61. <p> 是否确认删除评论? </p>
  62. </div>
  63. <div class="modal-footer">
  64. <a class="btn btn-danger"
  65. href="{{ url_for("docx.delete_comment_page", comment_id=comment.comment_id) }}"> 删除 </a>
  66. <button type="button" class="btn btn-secondary" data-dismiss="modal"> 取消 </button>
  67. </div>
  68. </div>
  69. </div>
  70. </div>
  71. {% endif %}
  72. <section class="col-12">
  73. <div class="comment">
  74. <p class="comment-title h5">
  75. {% if show_email %} {# 判断是否可读取用户信息 #}
  76. {{ comment.auth.email }}
  77. {% else %}
  78. {{ comment.auth.s_email }}
  79. {% endif %}
  80. {% if show_delete %}
  81. <a class="mb-2"
  82. data-toggle="modal" data-target="#DeleteModal{{comment.comment_id}}"> &times; </a>
  83. {% endif %}
  84. <br>
  85. <small> {{ comment.update_time }} </small>
  86. </p>
  87. <p> {{ comment.context.replace('\n', '<br>') | safe }} </p>
  88. </div>
  89. </section>
  90. {% endfor %}
  91. </article>
  92. </div>
  93. {% endif %}
  94. </section>
  95. {% endblock %}