manage_setting.tpl 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. <!DOCTYPE html>
  2. <html lang="zh-CN">
  3. <head>
  4. <meta charset="utf-8">
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  6. <meta name="viewport" content="width=device-width, initial-scale=1">
  7. <title>文章设置 - Powered by MinDoc</title>
  8. <!-- Bootstrap -->
  9. <link href="{{cdncss "/static/bootstrap/css/bootstrap.min.css"}}" rel="stylesheet">
  10. <link href="{{cdncss "/static/font-awesome/css/font-awesome.min.css"}}" rel="stylesheet">
  11. <link href="{{cdncss "/static/css/main.css" "version"}}" rel="stylesheet">
  12. <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
  13. <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
  14. <!--[if lt IE 9]>
  15. <script src="/static/html5shiv/3.7.3/html5shiv.min.js"></script>
  16. <script src="/static/respond.js/1.4.2/respond.min.js"></script>
  17. <![endif]-->
  18. </head>
  19. <body>
  20. <div class="manual-reader">
  21. {{template "widgets/header.tpl" .}}
  22. <div class="container manual-body">
  23. <div class="row">
  24. <div class="page-left">
  25. <ul class="menu">
  26. <li {{if eq .ControllerName "BookController"}}class="active"{{end}}><a href="{{urlfor "BookController.Index"}}" class="item"><i class="fa fa-sitemap" aria-hidden="true"></i> 我的项目</a> </li>
  27. <li {{if eq .ControllerName "BlogController"}}class="active"{{end}}><a href="{{urlfor "BlogController.ManageList"}}" class="item"><i class="fa fa-file" aria-hidden="true"></i> 我的文章</a> </li>
  28. </ul>
  29. </div>
  30. <div class="page-right">
  31. <div class="m-box">
  32. <div class="box-head">
  33. <strong class="box-title"> 文章设置</strong>
  34. </div>
  35. </div>
  36. <div class="box-body">
  37. <form method="post" id="gloablEditForm" action="{{urlfor "BlogController.ManageSetting"}}">
  38. <input type="hidden" name="id" id="blogId" value="{{.Model.BlogId}}">
  39. <input type="hidden" name="identify" value="{{.Model.BlogIdentify}}">
  40. <input type="hidden" name="document_id" value="{{.Model.DocumentId}}">
  41. <input type="hidden" name="order_index" value="{{.Model.OrderIndex}}">
  42. <div class="form-group">
  43. <label>文章标题</label>
  44. <input type="text" class="form-control" name="title" id="title" placeholder="文章标题" value="{{.Model.BlogTitle}}">
  45. </div>
  46. <div class="form-group">
  47. <label>文章类型</label>
  48. <div class="radio">
  49. <label class="radio-inline">
  50. <input type="radio" {{if eq .Model.BlogType 0}}checked{{end}} name="blog_type" value="0">普通文章<span class="text"></span>
  51. </label>
  52. <label class="radio-inline">
  53. <input type="radio" {{if eq .Model.BlogType 1}}checked{{end}} name="blog_type" value="1">链接文章<span class="text"></span>
  54. </label>
  55. </div>
  56. </div>
  57. <div class="form-group" id="blogLinkDocument"{{if ne .Model.BlogType 1}} style="display: none;" {{end}}>
  58. <label>关联文档</label>
  59. <div class="row">
  60. <div class="col-sm-6">
  61. <input type="text" class="form-control" placeholder="请输入项目标识" name="bookIdentify" value="{{.Model.BookIdentify}}">
  62. </div>
  63. <div class="col-sm-6">
  64. <input type="text" class="form-control" placeholder="请输入文档标识" name="documentIdentify" value="{{.Model.DocumentIdentify}}">
  65. </div>
  66. </div>
  67. </div>
  68. <div class="form-group">
  69. <label>文章状态</label>
  70. <div class="radio">
  71. <label class="radio-inline">
  72. <input type="radio" {{if eq .Model.BlogStatus "public"}}checked{{end}} name="status" value="public">公开<span class="text"></span>
  73. </label>
  74. <label class="radio-inline">
  75. <input type="radio" {{if eq .Model.BlogStatus "password"}}checked{{end}} name="status" value="password">加密<span class="text"></span>
  76. </label>
  77. </div>
  78. </div>
  79. <div class="form-group"{{if eq .Model.BlogStatus "public"}} style="display: none;"{{end}} id="blogPassword">
  80. <label>文章密码</label>
  81. <input type="password" class="form-control" name="password" id="password" placeholder="文章密码" value="{{.Model.Password}}" maxlength="20">
  82. </div>
  83. <div class="form-group">
  84. <label>文章摘要</label>
  85. <textarea rows="3" class="form-control" name="excerpt" style="height: 90px" placeholder="项目描述">{{.Model.BlogExcerpt}}</textarea>
  86. <p class="text">文章摘要不超过500个字符</p>
  87. </div>
  88. <div class="form-group">
  89. <button type="submit" id="btnSaveBlogInfo" class="btn btn-success" data-loading-text="保存中...">保存</button>
  90. <a href="{{.Referer}}" title="返回" class="btn btn-info">返回</a>
  91. <span id="form-error-message" class="error-message"></span>
  92. </div>
  93. </form>
  94. <div class="clearfix"></div>
  95. </div>
  96. </div>
  97. </div>
  98. </div>
  99. {{template "widgets/footer.tpl" .}}
  100. </div>
  101. <script src="{{cdnjs "/static/jquery/1.12.4/jquery.min.js"}}" type="text/javascript"></script>
  102. <script src="{{cdnjs "/static/bootstrap/js/bootstrap.min.js"}}" type="text/javascript"></script>
  103. <script src="{{cdnjs "/static/js/jquery.form.js"}}" type="text/javascript"></script>
  104. <script src="{{cdnjs "/static/js/main.js"}}" type="text/javascript"></script>
  105. <script type="text/javascript">
  106. $(function () {
  107. $("#gloablEditForm").ajaxForm({
  108. beforeSubmit : function () {
  109. var title = $.trim($("#title").val());
  110. if (title === ""){
  111. return showError("文章标题不能为空");
  112. }
  113. $("#btnSaveBlogInfo").button("loading");
  114. },success : function ($res) {
  115. if($res.errcode === 0) {
  116. showSuccess("保存成功");
  117. $("#blogId").val($res.data.blog_id);
  118. }else{
  119. showError($res.message);
  120. }
  121. $("#btnSaveBlogInfo").button("reset");
  122. }, error : function () {
  123. showError("服务器异常.");
  124. $("#btnSaveBlogInfo").button("reset");
  125. }
  126. }).find("input[name='status']").change(function () {
  127. var $status = $(this).val();
  128. if($status === "password"){
  129. $("#blogPassword").show();
  130. }else{
  131. $("#blogPassword").hide();
  132. }
  133. });
  134. $("#gloablEditForm").find("input[name='blog_type']").change(function () {
  135. var $link = $(this).val();
  136. if($link == 1){
  137. $("#blogLinkDocument").show();
  138. }else{
  139. $("#blogLinkDocument").hide();
  140. }
  141. });
  142. });
  143. </script>
  144. </body>
  145. </html>