post.view.html 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. {% extends "base-with-sidebar.html" %}
  2. {% load staticres %}
  3. {% block title %}
  4. {{bpo.title}} - 丘丘塔台
  5. {% endblock %}
  6. {% block sidebar %}
  7. {% if bkmode %}
  8. {% include "home/sysconf.sidebar.html" %}
  9. {% else %}
  10. {% include "home/front.sidebar.html" %}
  11. {% endif %}
  12. {% endblock %}
  13. {% block content %}
  14. <div class="btn-toolbar">
  15. <div class="btn-group">
  16. <a class="btn btn-primary" href="javascript:history.go(-1);">
  17. <span class="glyphicon glyphicon-chevron-left"></span>
  18. 后退
  19. </a>
  20. </div>
  21. <div class="btn-group">
  22. <a class="btn btn-info" href="#context">
  23. 正文
  24. </a>
  25. <a class="btn btn-info" href="#commentBox">
  26. 评论
  27. </a>
  28. {% if not bkmode %}
  29. <a class="btn btn-info" href="#commentAdd">
  30. 发表评论
  31. </a>
  32. {% endif %}
  33. </div>
  34. </div>
  35. <br />
  36. <div class="panel panel-info">
  37. <div class="panel-heading"><h4 class="panel-title">
  38. {{bpo.title}}
  39. {% if bkmode %}
  40. (-*-预览-*-)
  41. {% endif %}
  42. </h4></div>
  43. <div id="context" class="panel-body">
  44. <div class="well well-sm">
  45. <strong>{{bpo.author.nick}}</strong>&nbsp;发表于{{i.pubtime|date:"Y-m-d H:i:s"}}
  46. <br />
  47. <strong>分类:</strong>
  48. {% for j in bpo.category.all %}
  49. <a href="{% url 'pichublog_postlist' j.engname %}"><span class="label label-info" style="display:inline-block">{{j.title}}</span></a>
  50. {% endfor %}
  51. </div>
  52. <div class="markdown">{{bpo.html|safe}}</div>
  53. </div>
  54. </div>
  55. <div class="panel panel-info">
  56. <div class="panel-heading"><h4 class="panel-title">评论</h4></div>
  57. <div id="commentBox" class="panel-body">
  58. 载入中...
  59. </div>
  60. </div>
  61. {% if not bkmode %}
  62. <div class="panel panel-info">
  63. <div class="panel-heading">
  64. <h4 class="panel-title">发表评论</h4>
  65. </div>
  66. <div id="commentAdd" class="panel-body">
  67. <div class="container main-container-with-sidebar">
  68. {% if allowcmt %}
  69. <form class="form-horizontal" role="form" action="{% url 'pichublog_cmtadd' bpo.id %}" method="POST" >
  70. {% csrf_token %}
  71. {% if not request.auth.islogin %}
  72. <div class="form-group">
  73. <label for="anonymousMail">电子邮箱</label>
  74. <input type="email" name="mail" class="form-control" id="anonymousMail" placeholder="电子邮箱(不会公开,仅管理员和本小说作者可见)">
  75. </div>
  76. <div class="form-group">
  77. <label for="anonymousSite">个人主页</label>
  78. <input type="text" name="website" class="form-control" id="anonymousSite" placeholder="个人主页">
  79. </div>
  80. <div class="form-group">
  81. <label for="anonymousNick">昵称</label>
  82. <input type="text" name="nick" class="form-control" id="anonymousNick" placeholder="昵称">
  83. </div>
  84. {% endif %}
  85. <div class="form-group">
  86. <label for="CmtCnt">内容</label>
  87. <textarea name="content" id="CmtCnt" class="form-control" rows="3" placeholder="评论内容"></textarea>
  88. </div>
  89. {% if not request.auth.islogin %}
  90. <div class="form-group">
  91. <label for="CmtCnt">验证码</label>
  92. <input type="text" name="captcha" id="CaptInput" class="form-control" placeholder="验证码">
  93. </div>
  94. <div><img id="captcha_box" src="" alt="" class="img-thumbnail"></div>
  95. <div class="alert alert-info" role="alert"><strong>友情提示:</strong>注册后发表评论无需再输入验证码。
  96. <br />
  97. {% if bpo.freecomment %}
  98. {% if crws %}未注册用户的评论需经审核才能显示。{%endif%}
  99. {% endif %}
  100. </div>
  101. {% endif %}
  102. <br />
  103. <div class="form-group">
  104. <button type="submit" class="btn btn-primary">发表评论</button>
  105. {% if not request.auth.islogin %}
  106. <button type="button" class="btn btn-info" onclick="newCaptcha();">
  107. <span class="glyphicon glyphicon-refresh"></span>
  108. 刷新验证码
  109. </button>
  110. {% endif %}
  111. </div>
  112. </form>
  113. {% else %}
  114. <div class="alert alert-danger" role="alert">作者只允许指定人员评论,您无权评论。</div>
  115. {% endif %}
  116. </div>
  117. </div>
  118. </div>
  119. {% endif %}
  120. <script type="text/javascript">
  121. function LoadComment(page){
  122. $("#commentBox").html("载入中...");
  123. $("#commentBox").load("{% url 'pichublog_cmtshow' bpo.id %}?page="+page);
  124. }
  125. function pageturn_cmt(page){
  126. LoadComment(page);
  127. }
  128. function newCaptcha(){
  129. var uuid = uuidGenerate();
  130. var urlsource = "{{OutsiteCaptchaURL}}";
  131. var url = urlsource + uuid + ".png";
  132. $("#captcha_box").attr("src",url);
  133. }
  134. LoadComment(1);
  135. newCaptcha();
  136. </script>
  137. {% endblock %}