2017-04-24 18:25:17 +08:00
|
|
|
|
<!DOCTYPE html>
|
|
|
|
|
<html lang="zh-CN">
|
|
|
|
|
<head>
|
|
|
|
|
<meta charset="utf-8">
|
|
|
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
|
|
|
|
|
|
|
|
<title>编辑项目 - Powered by MinDoc</title>
|
|
|
|
|
|
|
|
|
|
<!-- Bootstrap -->
|
|
|
|
|
<link href="/static/bootstrap/css/bootstrap.min.css" rel="stylesheet">
|
|
|
|
|
<link href="/static/font-awesome/css/font-awesome.min.css" rel="stylesheet">
|
2017-04-25 20:05:59 +08:00
|
|
|
|
<link href="/static/webuploader/webuploader.css" rel="stylesheet">
|
|
|
|
|
<link href="/static/cropper/2.3.4/cropper.min.css" rel="stylesheet">
|
2017-04-24 18:25:17 +08:00
|
|
|
|
<link href="/static/css/main.css" rel="stylesheet">
|
|
|
|
|
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
|
|
|
|
|
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
|
|
|
|
|
<!--[if lt IE 9]>
|
|
|
|
|
<script src="/static/html5shiv/3.7.3/html5shiv.min.js"></script>
|
|
|
|
|
<script src="/static/respond.js/1.4.2/respond.min.js"></script>
|
|
|
|
|
<![endif]-->
|
|
|
|
|
</head>
|
|
|
|
|
<body>
|
|
|
|
|
<div class="manual-reader">
|
|
|
|
|
{{template "widgets/header.tpl" .}}
|
|
|
|
|
<div class="container manual-body">
|
|
|
|
|
<div class="row">
|
|
|
|
|
<div class="page-left">
|
|
|
|
|
<ul class="menu">
|
|
|
|
|
<li><a href="{{urlfor "ManagerController.Index"}}" class="item"><i class="fa fa-dashboard" aria-hidden="true"></i> 仪表盘</a> </li>
|
|
|
|
|
<li><a href="{{urlfor "ManagerController.Users" }}" class="item"><i class="fa fa-users" aria-hidden="true"></i> 用户管理</a> </li>
|
2017-04-26 18:17:38 +08:00
|
|
|
|
<li class="active"><a href="{{urlfor "ManagerController.Books" }}" class="item"><i class="fa fa-book" aria-hidden="true"></i> 项目管理</a> </li>
|
2017-05-02 18:09:46 +08:00
|
|
|
|
{{/*<li><a href="{{urlfor "ManagerController.Comments" }}" class="item"><i class="fa fa-comments-o" aria-hidden="true"></i> 评论管理</a> </li>*/}}
|
2017-04-26 18:17:38 +08:00
|
|
|
|
<li><a href="{{urlfor "ManagerController.Setting" }}" class="item"><i class="fa fa-cogs" aria-hidden="true"></i> 配置管理</a> </li>
|
2017-04-24 18:25:17 +08:00
|
|
|
|
</ul>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="page-right">
|
|
|
|
|
<div class="m-box">
|
|
|
|
|
<div class="box-head">
|
|
|
|
|
<strong class="box-title"> 项目设置</strong>
|
2017-04-25 20:05:59 +08:00
|
|
|
|
<button type="button" class="btn btn-danger btn-sm pull-right" style="margin-right: 5px;" data-toggle="modal" data-target="#deleteBookModal">删除项目</button>
|
2017-04-24 18:25:17 +08:00
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="box-body" style="padding-right: 200px;">
|
|
|
|
|
<div class="form-left">
|
2017-04-25 20:05:59 +08:00
|
|
|
|
<form method="post" id="bookEditForm" action="{{urlfor "ManagerController.EditBook"}}">
|
|
|
|
|
<input type="hidden" name="identify" value="{{.Model.Identify}}">
|
2017-04-24 18:25:17 +08:00
|
|
|
|
<div class="form-group">
|
|
|
|
|
<label>标题</label>
|
2017-04-25 20:05:59 +08:00
|
|
|
|
<input type="text" class="form-control" name="book_name" id="bookName" placeholder="项目名称" value="{{.Model.BookName}}">
|
2017-04-24 18:25:17 +08:00
|
|
|
|
</div>
|
|
|
|
|
<div class="form-group">
|
|
|
|
|
<label>标识</label>
|
|
|
|
|
<input type="text" class="form-control" value=" {{.BaseUrl}}{{urlfor "DocumentController.Index" ":key" .Model.Identify}}" disabled>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="form-group">
|
|
|
|
|
<label>描述</label>
|
|
|
|
|
<textarea rows="3" class="form-control" name="description" style="height: 90px">{{.Model.Description}}</textarea>
|
2017-04-25 20:05:59 +08:00
|
|
|
|
<p class="text">描述信息不超过500个字符</p>
|
2017-04-24 18:25:17 +08:00
|
|
|
|
</div>
|
|
|
|
|
<div class="form-group">
|
|
|
|
|
<label>标签</label>
|
2017-04-25 20:05:59 +08:00
|
|
|
|
<input type="text" class="form-control" name="label" placeholder="项目标签" value="{{.Model.Label}}">
|
2017-04-24 18:25:17 +08:00
|
|
|
|
<p class="text">最多允许添加10个标签,多个标签请用“;”分割</p>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="form-group">
|
|
|
|
|
<label>开启评论</label>
|
|
|
|
|
<div class="radio">
|
|
|
|
|
<label class="radio-inline">
|
|
|
|
|
<input type="radio" {{if eq .Model.CommentStatus "open"}}checked{{end}} name="comment_status" value="open">允许所有人评论<span class="text"></span>
|
|
|
|
|
</label>
|
|
|
|
|
<label class="radio-inline">
|
|
|
|
|
<input type="radio" {{if eq .Model.CommentStatus "closed"}}checked{{end}} name="comment_status" value="closed">关闭评论<span class="text"></span>
|
|
|
|
|
</label>
|
|
|
|
|
<label class="radio-inline">
|
|
|
|
|
<input type="radio" {{if eq .Model.CommentStatus "group_only"}}checked{{end}} name="comment_status" value="group_only">仅允许参与者评论<span class="text"></span>
|
|
|
|
|
</label>
|
|
|
|
|
<label class="radio-inline">
|
|
|
|
|
<input type="radio" {{if eq .Model.CommentStatus "registered_only"}}checked{{end}} name="comment_status" value="registered_only">仅允许注册者评论<span class="text"></span>
|
|
|
|
|
</label>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
{{if eq .Model.PrivatelyOwned 1}}
|
|
|
|
|
<div class="form-group">
|
|
|
|
|
<label>访问令牌</label>
|
|
|
|
|
<div class="row">
|
2017-04-25 20:05:59 +08:00
|
|
|
|
<div class="col-sm-10">
|
|
|
|
|
<input type="text" name="token" id="token" class="form-control" placeholder="访问令牌" readonly value="{{.Model.PrivateToken}}">
|
2017-04-24 18:25:17 +08:00
|
|
|
|
</div>
|
2017-04-25 20:05:59 +08:00
|
|
|
|
<div class="col-sm-2">
|
|
|
|
|
<button type="button" class="btn btn-success btn-sm" id="createToken" data-loading-text="生成" data-action="create">生成</button>
|
|
|
|
|
<button type="button" class="btn btn-danger btn-sm" id="deleteToken" data-loading-text="删除" data-action="delete">删除</button>
|
2017-04-24 18:25:17 +08:00
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
{{end}}
|
|
|
|
|
<div class="form-group">
|
2017-04-25 20:05:59 +08:00
|
|
|
|
<button type="submit" id="btnSaveBookInfo" class="btn btn-success" data-loading-text="保存中...">保存修改</button>
|
2017-04-24 18:25:17 +08:00
|
|
|
|
<span id="form-error-message" class="error-message"></span>
|
|
|
|
|
</div>
|
|
|
|
|
</form>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="form-right">
|
|
|
|
|
<label>
|
2017-04-25 20:05:59 +08:00
|
|
|
|
<img src="{{.Model.Cover}}" onerror="this.src='/static/images/book.png'" alt="封面" style="max-width: 120px;border: 1px solid #999" id="headimgurl">
|
2017-04-24 18:25:17 +08:00
|
|
|
|
</label>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="clearfix"></div>
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
{{template "widgets/footer.tpl" .}}
|
|
|
|
|
</div>
|
2017-04-25 20:05:59 +08:00
|
|
|
|
<!-- Delete Book Modal -->
|
|
|
|
|
<div class="modal fade" id="deleteBookModal" tabindex="-1" role="dialog" aria-labelledby="deleteBookModalLabel">
|
|
|
|
|
<div class="modal-dialog" role="document">
|
|
|
|
|
<form method="post" id="deleteBookForm" action="{{urlfor "BookController.Delete"}}">
|
|
|
|
|
<input type="hidden" name="identify" value="{{.Model.Identify}}">
|
|
|
|
|
<div class="modal-content">
|
|
|
|
|
<div class="modal-header">
|
|
|
|
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
|
|
|
|
<h4 class="modal-title">删除项目</h4>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="modal-body">
|
|
|
|
|
<span style="font-size: 14px;font-weight: 400;">确定删除项目吗?</span>
|
|
|
|
|
<p></p>
|
|
|
|
|
<p class="text error-message">删除项目后将无法找回。</p>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="modal-footer">
|
|
|
|
|
<span id="form-error-message2" class="error-message"></span>
|
|
|
|
|
<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
|
|
|
|
|
<button type="submit" id="btnDeleteBook" class="btn btn-primary">确定删除</button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</form>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2017-04-24 18:25:17 +08:00
|
|
|
|
|
2017-04-25 20:05:59 +08:00
|
|
|
|
<script src="/static/jquery/1.12.4/jquery.min.js" type="text/javascript"></script>
|
|
|
|
|
<script src="/static/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
|
|
|
|
|
<script src="/static/webuploader/webuploader.min.js" type="text/javascript"></script>
|
|
|
|
|
<script src="/static/cropper/2.3.4/cropper.min.js" type="text/javascript"></script>
|
|
|
|
|
<script src="/static/js/jquery.form.js" type="text/javascript"></script>
|
|
|
|
|
<script src="/static/js/main.js" type="text/javascript"></script>
|
|
|
|
|
<script type="text/javascript">
|
|
|
|
|
$(function () {
|
|
|
|
|
$("#upload-logo-panel").on("hidden.bs.modal",function () {
|
|
|
|
|
$("#upload-logo-panel").find(".modal-body").html(window.modalHtml);
|
|
|
|
|
}).on("show.bs.modal",function () {
|
|
|
|
|
window.modalHtml = $("#upload-logo-panel").find(".modal-body").html();
|
|
|
|
|
});
|
|
|
|
|
$("#createToken,#deleteToken").on("click",function () {
|
|
|
|
|
var btn = $(this).button("loading");
|
|
|
|
|
var action = $(this).attr("data-action");
|
|
|
|
|
$.ajax({
|
|
|
|
|
url : "{{urlfor "ManagerController.CreateToken"}}",
|
|
|
|
|
type :"post",
|
|
|
|
|
data : { "identify" : {{.Model.Identify}} , "action" : action },
|
|
|
|
|
dataType : "json",
|
|
|
|
|
success : function (res) {
|
|
|
|
|
if(res.errcode === 0){
|
|
|
|
|
$("#token").val(res.data);
|
|
|
|
|
}else{
|
|
|
|
|
alert(res.message);
|
|
|
|
|
}
|
|
|
|
|
btn.button("reset");
|
|
|
|
|
},
|
|
|
|
|
error : function () {
|
|
|
|
|
btn.button("reset");
|
|
|
|
|
alert("服务器错误");
|
|
|
|
|
}
|
|
|
|
|
}) ;
|
|
|
|
|
});
|
|
|
|
|
$("#token").on("focus",function () {
|
|
|
|
|
$(this).select();
|
|
|
|
|
});
|
|
|
|
|
$("#bookEditForm").ajaxForm({
|
|
|
|
|
beforeSubmit : function () {
|
|
|
|
|
var bookName = $.trim($("#bookName").val());
|
|
|
|
|
if (bookName === "") {
|
|
|
|
|
return showError("项目名称不能为空");
|
|
|
|
|
}
|
|
|
|
|
$("#btnSaveBookInfo").button("loading");
|
|
|
|
|
},
|
|
|
|
|
success : function (res) {
|
|
|
|
|
if(res.errcode === 0){
|
|
|
|
|
showSuccess("保存成功")
|
|
|
|
|
}else{
|
|
|
|
|
showError("保存失败")
|
|
|
|
|
}
|
|
|
|
|
$("#btnSaveBookInfo").button("reset");
|
|
|
|
|
},
|
|
|
|
|
error : function () {
|
|
|
|
|
showError("服务错误");
|
|
|
|
|
$("#btnSaveBookInfo").button("reset");
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
$("#deleteBookForm").ajaxForm({
|
|
|
|
|
success : function (res) {
|
|
|
|
|
if(res.errcode === 0){
|
|
|
|
|
window.location = "{{urlfor "ManagerController.Books"}}";
|
|
|
|
|
}else{
|
|
|
|
|
console.log(res.message)
|
|
|
|
|
showError(res.message,"#form-error-message2");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
</script>
|
2017-04-24 18:25:17 +08:00
|
|
|
|
</body>
|
|
|
|
|
</html>
|