2018-01-01 04:00:45 +00:00
|
|
|
@extends('layouts.app')
|
2018-01-01 08:32:20 +00:00
|
|
|
@section('styles')
|
|
|
|
<link rel="stylesheet" type="text/css" href="{{ asset('css/simditor.css') }}">
|
|
|
|
@stop
|
|
|
|
@section('scripts')
|
|
|
|
<script type="text/javascript" src="{{ asset('js/module.js') }}"></script>
|
|
|
|
<script type="text/javascript" src="{{ asset('js/hotkeys.js') }}"></script>
|
|
|
|
<script type="text/javascript" src="{{ asset('js/uploader.js') }}"></script>
|
|
|
|
<script type="text/javascript" src="{{ asset('js/simditor.js') }}"></script>
|
2018-01-01 04:00:45 +00:00
|
|
|
|
2018-01-01 08:32:20 +00:00
|
|
|
<script>
|
|
|
|
$(document).ready(function () {
|
|
|
|
var editor = new Simditor({
|
2018-01-01 10:48:03 +00:00
|
|
|
textarea: $('#editor'),
|
|
|
|
upload: {
|
|
|
|
url: '{{ route('topics.upload_image') }}',
|
|
|
|
params: {_token: '{{ csrf_token() }}'},
|
|
|
|
fileKey: 'upload_file',
|
|
|
|
connectionCount: 3,
|
|
|
|
leaveConfirm: '文件上传中,关闭此页面将取消上传。'
|
|
|
|
},
|
|
|
|
pasteImage: true
|
2018-01-01 08:32:20 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
@stop
|
2018-01-01 04:00:45 +00:00
|
|
|
@section('content')
|
|
|
|
|
|
|
|
<div class="container">
|
|
|
|
<div class="col-md-10 col-md-offset-1">
|
|
|
|
<div class="panel panel-default">
|
|
|
|
|
2018-01-01 08:32:20 +00:00
|
|
|
<div class="panel-body">
|
|
|
|
<h2 class="text-center">
|
|
|
|
<i class="glyphicon glyphicon-edit"></i>
|
2018-01-01 04:00:45 +00:00
|
|
|
@if($topic->id)
|
2018-01-01 08:32:20 +00:00
|
|
|
编辑话题
|
2018-01-01 04:00:45 +00:00
|
|
|
@else
|
2018-01-01 08:32:20 +00:00
|
|
|
新建话题
|
2018-01-01 04:00:45 +00:00
|
|
|
@endif
|
2018-01-01 08:32:20 +00:00
|
|
|
</h2>
|
2018-01-01 04:00:45 +00:00
|
|
|
|
2018-01-01 08:32:20 +00:00
|
|
|
<hr>
|
|
|
|
|
|
|
|
@include('common.error')
|
2018-01-01 04:00:45 +00:00
|
|
|
|
|
|
|
@if($topic->id)
|
|
|
|
<form action="{{ route('topics.update', $topic->id) }}" method="POST" accept-charset="UTF-8">
|
|
|
|
<input type="hidden" name="_method" value="PUT">
|
|
|
|
@else
|
|
|
|
<form action="{{ route('topics.store') }}" method="POST" accept-charset="UTF-8">
|
|
|
|
@endif
|
|
|
|
|
2018-01-01 08:32:20 +00:00
|
|
|
{{csrf_field()}}
|
2018-01-01 04:00:45 +00:00
|
|
|
<div class="form-group">
|
2018-01-01 08:32:20 +00:00
|
|
|
<input class="form-control" type="text" name="title"
|
|
|
|
value="{{ old('title', $topic->title ) }}" placeholder="请填写标题" required/>
|
2018-01-01 04:00:45 +00:00
|
|
|
</div>
|
2018-01-01 08:32:20 +00:00
|
|
|
|
2018-01-01 04:00:45 +00:00
|
|
|
<div class="form-group">
|
2018-01-01 08:32:20 +00:00
|
|
|
<select class="form-control" name="category_id" required>
|
|
|
|
<option value="" hidden disabled selected>请选择分类</option>
|
|
|
|
@foreach ($categories as $value)
|
2018-01-01 13:22:16 +00:00
|
|
|
<option value="{{ $value->id }}" {{ $topic->category_id == $value->id ? 'selected' : '' }}>{{ $value->name }}</option>
|
2018-01-01 08:32:20 +00:00
|
|
|
@endforeach
|
|
|
|
</select>
|
2018-01-01 04:00:45 +00:00
|
|
|
</div>
|
2018-01-01 08:32:20 +00:00
|
|
|
|
2018-01-01 12:18:33 +00:00
|
|
|
|
2018-01-01 04:00:45 +00:00
|
|
|
<div class="form-group">
|
2018-01-01 12:18:33 +00:00
|
|
|
<textarea name="body" class="form-control" id="editor" rows="3"
|
|
|
|
placeholder="请填入至少三个字符的内容。"
|
|
|
|
required>{{ old('body', $topic->body ) }}
|
|
|
|
</textarea>
|
2018-01-01 04:00:45 +00:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="well well-sm">
|
2018-01-01 08:32:20 +00:00
|
|
|
<button type="submit" class="btn btn-primary"><span
|
|
|
|
class="glyphicon glyphicon-ok" aria-hidden="true"></span> 保存
|
|
|
|
</button>
|
2018-01-01 04:00:45 +00:00
|
|
|
</div>
|
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2018-01-01 08:32:20 +00:00
|
|
|
@endsection
|