edit.blade.php 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  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="{{ route('backend.page.update', ['id' => $page->id]) }}" 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' value="{{ $page->title }}" 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' value="{{ $page->link_alias }}" 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' value="{{ $page->keyword }}" 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' value="{{ $page->desc }}" 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">{{ $page->content }}</textarea>
  55. <textarea style="display:none;" name="html_content"></textarea>
  56. </div>
  57. </div>
  58. </div>
  59. {{ csrf_field() }}
  60. {{ method_field('PUT') }}
  61. <div class="box-footer">
  62. <button type="submit" id="submit-page" class="btn btn-primary">创建</button>
  63. <button type="button" id="reset-btn" class="btn btn-warning">重置</button>
  64. </div>
  65. </form>
  66. </div>
  67. <!-- /.box -->
  68. </div>
  69. </div>
  70. @endsection
  71. @section('javascript')
  72. <script src="{{ asset('editor.md/editormd.min.js') }}"></script>
  73. <script>
  74. var editor = editormd("editormd", {
  75. path : "{{ asset('/editor.md/lib/') }}/",
  76. height : 500,
  77. syncScrolling : "single",
  78. toolbarAutoFixed: false,
  79. saveHTMLToTextarea : false
  80. });
  81. /* 页面操作验证 */
  82. $("#page-form").bootstrapValidator({
  83. live: 'disables',
  84. message: "This Values is not valid",
  85. feedbackIcons: {
  86. valid: 'glyphicon ',
  87. invalid: 'glyphicon ',
  88. validating: 'glyphicon glyphicon-refresh'
  89. },
  90. fields : {
  91. title : {
  92. validators : {
  93. notEmpty : {
  94. message : "页面标题不能为空"
  95. }
  96. }
  97. }
  98. }
  99. }).on('success.form.bv', function(e) {
  100. var html = editor.getPreviewedHTML();
  101. $("#page-form textarea[name='html_content']").val(html);
  102. });
  103. </script>
  104. @endsection