edit.htm 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. ##tlayout("admin/layout.htm"){
  2. <!-- 富文本编辑器所需css和js -->
  3. <link rel="stylesheet" href="/admin/script/kindeditor/themes/default/default.css" />
  4. <script charset="utf-8" src="/admin/script/kindeditor/kindeditor-all-min.js"></script>
  5. <script charset="utf-8" src="/admin/script/kindeditor/lang/zh_CN.js"></script>
  6. <div class="breadcrumbs" style="height: 50px;">
  7. <div class="breadcrumbs_title">编辑文章</div>
  8. </div>
  9. <div class="page-content">
  10. <div class="row" style="margin-top: 30px;">
  11. <div class="col-xs-12">
  12. <form action="/admin/article/update" method="post" class="form-horizontal" id="submit_form">
  13. <div class="form-group">
  14. <label class="col-sm-1 control-label"><span style="color: #f00">*</span>标题</label>
  15. <div class="col-sm-11">
  16. ##if(article.type==1){
  17. <input class="col-xs-10 col-sm-5" type="text" name="title" value="${article.title!}" />
  18. ##}else{
  19. <input class="col-xs-10 col-sm-5" type="text" name="title" value="${article.title!}" readonly="readonly" />
  20. ##}
  21. </div>
  22. </div>
  23. <div class="space-4"></div>
  24. <div class="form-group">
  25. <label class="col-sm-1 control-label"><span style="color: #f00">*</span>详细内容</label>
  26. <div class="col-sm-11">
  27. <textarea class="form-control textarea_editor" name="content">${article.content!}</textarea>
  28. </div>
  29. </div>
  30. <div class="space-4"></div>
  31. <div class="form-group">
  32. <label class="col-sm-1 control-label"></label>
  33. <div class="col-sm-11">
  34. <button class="btn btn-info" type="button" onclick="submitForm()"><i class="icon-ok bigger-110"></i>确定</button>
  35. &nbsp; &nbsp; &nbsp;
  36. <button class="btn" type="button" onclick="javascript:history.back(-1)"><i class="icon-undo bigger-110"></i>取消</button>
  37. </div>
  38. </div>
  39. <input type="hidden" name="id" value="${article.id!}" />
  40. </form>
  41. </div>
  42. </div>
  43. </div>
  44. <script>
  45. var editor;
  46. KindEditor.ready(function(K) {
  47. editor = K.create('textarea[name="content"]', {
  48. allowFileManager : true,
  49. items : [
  50. 'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline',
  51. 'removeformat', '|', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist',
  52. 'insertunorderedlist', '|', 'emoticons','image', 'link', 'unlink', 'table', 'lineheight'],
  53. thremType:'simple',
  54. width:'80%',
  55. height:'500px',
  56. basePath:'/admin/script/kindeditor/',
  57. uploadJson : '/admin/editorUploadImg',
  58. });
  59. });
  60. function submitForm(){
  61. editor.sync();
  62. $('#submit_form').ajaxSubmit({
  63. success: function(data){
  64. alert(data.msg);
  65. if(data.success){
  66. window.location.href="/admin/article/list";
  67. }
  68. }
  69. });
  70. }
  71. </script>
  72. ##}