🍎 发布文章可选文章是否可评论

pull/21/head
ruibaby 2018-07-10 00:28:42 +08:00
parent bfdc736a94
commit f82c699641
5 changed files with 77 additions and 37 deletions

View File

@ -125,4 +125,9 @@ public class Post implements Serializable {
* 访
*/
private Long postViews = 0L;
/**
*
*/
private Integer allowComment = 0;
}

View File

@ -0,0 +1,27 @@
package cc.ryanc.halo.model.enums;
/**
* @author : RYAN0UP
* @date : 2018/7/9
*/
public enum AllowComment {
/**
*
*/
ALLOW(1),
/**
*
*/
DISALLOW(0);
private Integer code;
AllowComment(Integer code) {
this.code = code;
}
public Integer getCode() {
return code;
}
}

View File

@ -76,8 +76,11 @@
</div>
</div>
<div class="box-body">
<div>
</div>
<label for="allowComment" class="control-label">开启评论:</label>
<select class="form-control" id="allowComment" name="allowComment">
<option value="1" <#if post?? && post.allowComment?default(1)==1>selected</#if>>是</option>
<option value="0" <#if post?? && post.allowComment?default(1)==0>selected</#if>>否</option>
</select>
</div>
<div class="box-footer">
<button onclick="push(1)" class="btn btn-default btn-sm ">保存草稿</button>
@ -324,7 +327,8 @@
'postContent': editor.getHTML(),
'postThumbnail': $('#selectImg')[0].src,
'cateList' : cateList.toString(),
'tagList' : $('#tagList').tagEditor('getTags')[0].tags.toString()
'tagList' : $('#tagList').tagEditor('getTags')[0].tags.toString(),
'allowComment' : $('#allowComment').val()
},
success: function (data) {
if(data.code==1){

View File

@ -1,17 +1,19 @@
<#switch options.comment_system>
<#case "native">
<#include "../../../common/comment/_native_comment.ftl">
<#break >
<#case "valine">
<#include "../../../common/comment/_valine_comment.ftl">
<#break >
<#case "disqus">
<#include "../../../common/comment/_disqus_comment.ftl">
<#break >
<#case "livere">
<#include "../../../common/comment/_livere_comment.ftl">
<#break >
<#case "changyan">
<#include "../../../common/comment/_changyan_comment.ftl">
<#break >
</#switch>
<#if post.allowComment?default(1)==1>
<#switch options.comment_system>
<#case "native">
<#include "../../../common/comment/_native_comment.ftl">
<#break >
<#case "valine">
<#include "../../../common/comment/_valine_comment.ftl">
<#break >
<#case "disqus">
<#include "../../../common/comment/_disqus_comment.ftl">
<#break >
<#case "livere">
<#include "../../../common/comment/_livere_comment.ftl">
<#break >
<#case "changyan">
<#include "../../../common/comment/_changyan_comment.ftl">
<#break >
</#switch>
</#if>

View File

@ -1,17 +1,19 @@
<#switch options.comment_system>
<#case "native">
<#include "../../../common/comment/_native_comment.ftl">
<#break >
<#case "valine">
<#include "../../../common/comment/_valine_comment.ftl">
<#break >
<#case "disqus">
<#include "../../../common/comment/_disqus_comment.ftl">
<#break >
<#case "livere">
<#include "../../../common/comment/_livere_comment.ftl">
<#break >
<#case "changyan">
<#include "../../../common/comment/_changyan_comment.ftl">
<#break >
</#switch>
<#if post.allowComment?default(1)==1>
<#switch options.comment_system>
<#case "native">
<#include "../../../common/comment/_native_comment.ftl">
<#break >
<#case "valine">
<#include "../../../common/comment/_valine_comment.ftl">
<#break >
<#case "disqus">
<#include "../../../common/comment/_disqus_comment.ftl">
<#break >
<#case "livere">
<#include "../../../common/comment/_livere_comment.ftl">
<#break >
<#case "changyan">
<#include "../../../common/comment/_changyan_comment.ftl">
<#break >
</#switch>
</#if>