mirror of https://github.com/halo-dev/halo
🍎 发布文章可选文章是否可评论
parent
bfdc736a94
commit
f82c699641
|
@ -125,4 +125,9 @@ public class Post implements Serializable {
|
||||||
* 文章访问量
|
* 文章访问量
|
||||||
*/
|
*/
|
||||||
private Long postViews = 0L;
|
private Long postViews = 0L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否允许评论
|
||||||
|
*/
|
||||||
|
private Integer allowComment = 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
|
@ -76,8 +76,11 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="box-body">
|
<div class="box-body">
|
||||||
<div>
|
<label for="allowComment" class="control-label">开启评论:</label>
|
||||||
</div>
|
<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>
|
||||||
<div class="box-footer">
|
<div class="box-footer">
|
||||||
<button onclick="push(1)" class="btn btn-default btn-sm ">保存草稿</button>
|
<button onclick="push(1)" class="btn btn-default btn-sm ">保存草稿</button>
|
||||||
|
@ -324,7 +327,8 @@
|
||||||
'postContent': editor.getHTML(),
|
'postContent': editor.getHTML(),
|
||||||
'postThumbnail': $('#selectImg')[0].src,
|
'postThumbnail': $('#selectImg')[0].src,
|
||||||
'cateList' : cateList.toString(),
|
'cateList' : cateList.toString(),
|
||||||
'tagList' : $('#tagList').tagEditor('getTags')[0].tags.toString()
|
'tagList' : $('#tagList').tagEditor('getTags')[0].tags.toString(),
|
||||||
|
'allowComment' : $('#allowComment').val()
|
||||||
},
|
},
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
if(data.code==1){
|
if(data.code==1){
|
||||||
|
|
|
@ -1,17 +1,19 @@
|
||||||
<#switch options.comment_system>
|
<#if post.allowComment?default(1)==1>
|
||||||
<#case "native">
|
<#switch options.comment_system>
|
||||||
<#include "../../../common/comment/_native_comment.ftl">
|
<#case "native">
|
||||||
<#break >
|
<#include "../../../common/comment/_native_comment.ftl">
|
||||||
<#case "valine">
|
<#break >
|
||||||
<#include "../../../common/comment/_valine_comment.ftl">
|
<#case "valine">
|
||||||
<#break >
|
<#include "../../../common/comment/_valine_comment.ftl">
|
||||||
<#case "disqus">
|
<#break >
|
||||||
<#include "../../../common/comment/_disqus_comment.ftl">
|
<#case "disqus">
|
||||||
<#break >
|
<#include "../../../common/comment/_disqus_comment.ftl">
|
||||||
<#case "livere">
|
<#break >
|
||||||
<#include "../../../common/comment/_livere_comment.ftl">
|
<#case "livere">
|
||||||
<#break >
|
<#include "../../../common/comment/_livere_comment.ftl">
|
||||||
<#case "changyan">
|
<#break >
|
||||||
<#include "../../../common/comment/_changyan_comment.ftl">
|
<#case "changyan">
|
||||||
<#break >
|
<#include "../../../common/comment/_changyan_comment.ftl">
|
||||||
</#switch>
|
<#break >
|
||||||
|
</#switch>
|
||||||
|
</#if>
|
||||||
|
|
|
@ -1,17 +1,19 @@
|
||||||
<#switch options.comment_system>
|
<#if post.allowComment?default(1)==1>
|
||||||
<#case "native">
|
<#switch options.comment_system>
|
||||||
<#include "../../../common/comment/_native_comment.ftl">
|
<#case "native">
|
||||||
<#break >
|
<#include "../../../common/comment/_native_comment.ftl">
|
||||||
<#case "valine">
|
<#break >
|
||||||
<#include "../../../common/comment/_valine_comment.ftl">
|
<#case "valine">
|
||||||
<#break >
|
<#include "../../../common/comment/_valine_comment.ftl">
|
||||||
<#case "disqus">
|
<#break >
|
||||||
<#include "../../../common/comment/_disqus_comment.ftl">
|
<#case "disqus">
|
||||||
<#break >
|
<#include "../../../common/comment/_disqus_comment.ftl">
|
||||||
<#case "livere">
|
<#break >
|
||||||
<#include "../../../common/comment/_livere_comment.ftl">
|
<#case "livere">
|
||||||
<#break >
|
<#include "../../../common/comment/_livere_comment.ftl">
|
||||||
<#case "changyan">
|
<#break >
|
||||||
<#include "../../../common/comment/_changyan_comment.ftl">
|
<#case "changyan">
|
||||||
<#break >
|
<#include "../../../common/comment/_changyan_comment.ftl">
|
||||||
</#switch>
|
<#break >
|
||||||
|
</#switch>
|
||||||
|
</#if>
|
||||||
|
|
Loading…
Reference in New Issue