create.blade.php 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. @extends('layouts.backend')
  2. @section('title', '新建页面')
  3. @section('stylesheet')
  4. <link rel="stylesheet" href="{{ asset('editor.md/css/editormd.min.css') }}">
  5. @endsection
  6. @section('header')
  7. <h1>
  8. 新建页面
  9. </h1>
  10. @endsection
  11. @section('content')
  12. <!-- /.row -->
  13. <div class="row">
  14. <div class="col-md-12">
  15. @include('backend.alert.warning')
  16. <div class="box box-solid">
  17. <form role="form" method="post" action="{{ url('backend/page') }}" id="page-form">
  18. <div class="box-body">
  19. <div class="form-group">
  20. <label for="title">页面标题</label>
  21. <div class="row">
  22. <div class='col-md-6'>
  23. <input type='text' class='form-control' name="title" id='title' placeholder='标题'>
  24. </div>
  25. </div>
  26. </div>
  27. <div class="form-group">
  28. <label for="link_alias">链接别名</label>
  29. <div class="row">
  30. <div class='col-md-6'>
  31. <input type='text' class='form-control' name="link_alias" id='link_alias' placeholder='链接别名,关于页面请用about关联'>
  32. </div>
  33. </div>
  34. </div>
  35. <div class="form-group">
  36. <label for="keyword">关键字(Keywords)</label>
  37. <div class="row">
  38. <div class='col-md-6'>
  39. <input type='text' class='form-control' name="keyword" id='keyword' placeholder='请输入关键字,以英文逗号分割,利于搜索引擎收录'>
  40. </div>
  41. </div>
  42. </div>
  43. <div class="form-group">
  44. <label for="desc">描述(Description)</label>
  45. <div class="row">
  46. <div class='col-md-10'>
  47. <input type='text' class='form-control' name="desc" id='desc' placeholder='请输入页面描述'>
  48. </div>
  49. </div>
  50. </div>
  51. <div class="form-group">
  52. <label for="content">页面内容</label>
  53. <div id="editormd">
  54. <textarea class="editormd-markdown-textarea" style="display:none;" id="content" name="content"></textarea>
  55. <textarea style="display:none;" name="html_content"></textarea>
  56. </div>
  57. </div>
  58. </div>
  59. {{ csrf_field() }}
  60. <div class="box-footer">
  61. <button type="submit" id="submit-page" class="btn btn-primary">创建</button>
  62. <button type="button" id="reset-btn" class="btn btn-warning">重置</button>
  63. </div>
  64. </form>
  65. </div>
  66. <!-- /.box -->
  67. </div>
  68. </div>
  69. @endsection
  70. @section('javascript')
  71. <script src="{{ asset('editor.md/editormd.min.js') }}"></script>
  72. <script>
  73. var editor = editormd("editormd", {
  74. path : "{{ asset('/editor.md/lib/') }}/",
  75. height : 500,
  76. syncScrolling : "single",
  77. toolbarAutoFixed: false,
  78. saveHTMLToTextarea : false
  79. });
  80. /* 页面操作验证 */
  81. $("#page-form").bootstrapValidator({
  82. live: 'disables',
  83. message: "This Values is not valid",
  84. feedbackIcons: {
  85. valid: 'glyphicon ',
  86. invalid: 'glyphicon ',
  87. validating: 'glyphicon glyphicon-refresh'
  88. },
  89. fields : {
  90. title : {
  91. validators : {
  92. notEmpty : {
  93. message : "页面标题不能为空"
  94. }
  95. }
  96. }
  97. }
  98. }).on('success.form.bv', function(e) {
  99. var html = editor.getPreviewedHTML();
  100. $("#page-form textarea[name='html_content']").val(html);
  101. });
  102. </script>
  103. @endsection