edit.blade.php 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. @extends('admin.layout')
  2. <style type="text/css">
  3. </style>
  4. @section('header')
  5. @endsection
  6. @section('content')
  7. <div id="sg-main-container-sg">
  8. <div class="wrapper wrapper-content animated fadeInRight">
  9. <div class="row">
  10. <div class="col-sm-12">
  11. <div class="ibox float-e-margins">
  12. <div class="ibox-title">
  13. <h5>{{ '编辑' . $model_name }}</h5>
  14. <div class="ibox-tools">
  15. <a class="collapse-link"> <i class="fa fa-chevron-up"></i>
  16. </a>
  17. </div>
  18. </div>
  19. <div class="ibox-content">
  20. <div class="row">
  21. <div class="col-sm-12 pull-right">
  22. <a href="{{ $pre_uri . 'index?type' . $type }}" class="btn btn-sm btn-primary pull-right">返回列表</a>
  23. </div>
  24. </div>
  25. <form class="form-horizontal" method="POST" action="{{ $pre_uri . 'update' }}" enctype="multipart/form-data">
  26. {{ csrf_field() }}
  27. <input type="hidden" name="data[type]" value="{{ $type }}">
  28. <input type="hidden" name="id" value="{{ $item->id }}">
  29. <div class="form-group row">
  30. <label class="col-sm-2 col-sm-offset-1 control-label">标题</label>
  31. <div class="col-sm-8">
  32. <input type="text" name="data[title]" class="form-control" placeholder="请输入标题" value="{{ $item->title }}" required>
  33. </div>
  34. @if($errors->has('title'))
  35. <span class="help-block">{{ $errors->first('title') }}</span>
  36. @endif
  37. </div>
  38. @if($type != 3)
  39. <div class="form-group row">
  40. <label class="col-sm-2 col-sm-offset-1 control-label">内容</label>
  41. <div class="col-sm-8">
  42. <script id="content-editor" name="data[content]" type="text/plain">{!! $item->content !!}</script>
  43. </div>
  44. @if($errors->has('title'))
  45. <span class="help-block">{{ $errors->first('title') }}</span>
  46. @endif
  47. </div>
  48. @else
  49. <div class="form-group row">
  50. <label class="col-sm-2 col-sm-offset-1 control-label">视频</label>
  51. <div class="col-sm-8">
  52. <div class="input-group">
  53. <input type="text" class="form-control" placeholder="上传视频文件" value="{{ $item->content }}" readonly id="upload-video-path">
  54. <input type="file" name="video" accept="video/*" style="display: none" id="upload-video-input" required>
  55. <span class="input-group-btn" id="upload-video-btn">
  56. <button class="btn btn-success" type="button">上传新文件</button>
  57. </span>
  58. </div>
  59. </div>
  60. @if($errors->has('content'))
  61. <span class="help-block">{{ $errors->first('content') }}</span>
  62. @endif
  63. </div>
  64. @endif
  65. <div class="form-group row">
  66. <label class="col-sm-2 col-sm-offset-1 control-label">排序</label>
  67. <div class="col-sm-8">
  68. <input type="text" name="data[sort]" class="form-control" placeholder="请输入排序" value="{{ $item->sort }}">
  69. </div>
  70. @if($errors->has('sort'))
  71. <span class="help-block">{{ $errors->first('sort') }}</span>
  72. @endif
  73. </div>
  74. <div class="form-group row">
  75. <div class="col-sm-8 col-sm-offset-3">
  76. <button type="submit" class="btn btn-sm btn-primary">提交</button>
  77. </div>
  78. </div>
  79. </form>
  80. </div>
  81. </div>
  82. </div>
  83. </div>
  84. </div>
  85. </div>
  86. @endsection
  87. @section('footer')
  88. <script type="text/javascript">
  89. $(function () {
  90. $('#upload-video-btn').on('click', function () {
  91. $('#upload-video-input').click();
  92. });
  93. $('#upload-video-input').change(function () {
  94. if(this['files'].length > 0) {
  95. $('#upload-video-path').val(this['files'][0]['name']);
  96. }
  97. });
  98. UE.getEditor('content-editor');
  99. })
  100. </script>
  101. @endsection