FEATURE: add comments into articles

This commit is contained in:
Michal Kváček
2016-09-04 23:20:07 +02:00
parent f304ef0141
commit 59dede6049
13 changed files with 83 additions and 258 deletions
@@ -93,6 +93,10 @@ class Article extends Handler
$sub->route('content.new', trans('article::article.new'), ['id' => self::getModuleId()], 10, ['icon' => 'fa fa-fw fa-pencil']);
$sub->route('content.overview', trans('article::article.overview'), ['id' => self::getModuleId()], 30, ['icon' => 'fa fa-fw fa-book']);
}, 10, ['icon' => 'fa fa-fw fa-book']);
$menu->dropdown(trans('article::module.comments'), function ($sub) {
$sub->route('comments.overview', trans('article::module.commentsOverview'), [], 10, ['icon' => 'fa fa-fw fa-commenting-o']);
}, 10, ['icon' => 'fa fa-fw fa-comments-o']);
}
public static function getModuleId()
+12 -1
View File
@@ -1,5 +1,4 @@
<?php
Route::group([
'middleware' => 'web',
'prefix' => 'article',
@@ -22,4 +21,16 @@ Route::group([
Route::get('/delete/{id}', 'EditCategory@delete')
->name('article.delete');
});
// routes for comments
Route::group([
'middleware' => 'web',
'prefix' => 'comments',
'namespace' => 'Modules\Blog\Article\Http\Controllers'
], function () {
Route::get('/', 'CommentsOverview@getOverview')
->name('comments.overview');
});
@@ -1,5 +1,7 @@
<?php
return [
'name' => 'Article',
'description' => 'Base submodule for blog'
'name' => 'Article',
'description' => 'Base submodule for blog',
'comments' => 'Comments',
'commentsOverview' => 'All comments'
];
@@ -1,89 +1,89 @@
<div class="row">
<div class="columns large-6">
<label>
@lang('admin/contents.field_title')
<div class="col-lg-6">
<input type="text" name="title" required class="form-control slug-source"
placeholder="@lang('admin/contents.field_title')"
value="{{old('title', $page->title)}}" />
<input type="text" name="title" class="slug-source" placeholder="@lang('admin/contents.field_title')"
value="{{old('title', $page->title)}}" />
</label>
@include('admin.snippets.hasError', ['field' => 'title'])
</div>
<div class="columns large-4">
<label>
@lang('admin/contents.field_url')
<div class="col-lg-4">
<input type="text" name="url" class="slug-target" placeholder="@lang('admin/contents.field_url')"
value="{{old('url', $page->url)}}" />
<input type="text" name="url" required class="form-control slug-target"
placeholder="@lang('admin/contents.field_url')"
value="{{old('url', $page->url)}}" />
@if (isset($errors) && $errors->has('url'))
<div class="callout alert">
{{ $errors->first('url') }}
</div>
@endif
</label>
@include('admin.snippets.hasError', ['field' => 'url'])
</div>
<div class="column large-2 text-center">
<div class="col-lg-2 text-center">
<label>
@lang('admin/contents.lockUrl')<br />
<input type="checkbox" value="1" id="lockUrl"
<input class="checkbox" value="1" id="lockUrl"
@if(old('lockUrl') || ($page->id > 0 && \Illuminate\Support\Str::slug($page->title) != $page->url)) checked
@endif name="lockUrl" />
@endif name="lockUrl" type="checkbox">
<span>@lang('admin/contents.lockUrl')</span>
</label>
</div>
</div>
<div class="row">
<div class="columns large-6">
<label>
<select name="status">
@foreach($contentStatuses as $status => $translation)
<option value="{{$status}}" @if(old('status', $page->status) == $status) selected @endif>
{{$translation}}
</option>
@endforeach
</select>
</label>
<div class="col-lg-6">
<select class="form-control" name="status">
@foreach($contentStatuses as $status => $translation)
<option value="{{$status}}" @if(old('status', $page->status) == $status) selected @endif>
{{$translation}}
</option>
@endforeach
</select>
@if (isset($errors) && $errors->has('status'))
<div class="callout alert">
{{ $errors->first('status') }}
</div>
@endif
@include('admin.snippets.hasError', ['field' => 'status'])
</div>
<div class="column large-6">
<div class="col-lg-4">
<select class="form-control" name="parentPage">
<option value="">@lang('admin/contents.noParentPage')</option>
@foreach($rootPages as $rootPage)
<option value="{{$rootPage->id}}"
@if(old('parent_page', $page->parent_id) == $rootPage->id) selected @endif>
{{$rootPage->title}}
</option>
@endforeach
</select>
@include('admin.snippets.hasError', ['field' => 'parentPage'])
</div>
<div class="col-lg-2 text-center">
<label>
@lang('article::article.allowComments')
<input type="checkbox" value="1" @if(old('allowComments', isset($page->module_settings->allowComments) ? $page->module_settings->allowComments : true)) checked @endif name="allowComments" />
<input class="checkbox" value="1"
@if(old('allowComments', isset($page->module_settings->allowComments) ? $page->module_settings->allowComments : true)) checked
@endif name="allowComments" type="checkbox">
<span>@lang('article::article.allowComments')</span>
</label>
</div>
@if($module->support_categories && count($categories))
<div class="column large-12">
<label>
@lang('admin/contents.category')
<select name="category">
<option value=""> ---</option>
@foreach($categories as $category)
<option value="{{$category->id}}"
@if($category->id == old('category', $page->category_id)) selected @endif>
{{str_repeat(' - ', $category->real_depth)}} {{$category->name}}
</option>
@endforeach
</select>
</label>
<div class="col-lg-12">
<select class="form-control" name="category">
<option value="">@lang('admin/contents.noCategory')</option>
@foreach($categories as $category)
<option value="{{$category->id}}"
@if($category->id == old('category', $page->category_id)) selected @endif>
{{str_repeat(' - ', $category->real_depth)}} {{$category->name}}
</option>
@endforeach
</select>
</div>
@endif
</div>
<div class="row">
<div class="columns large-12">
<label>
<textarea name="pageContent" id="pageContent" class="wysiwyg-editor">
{{old('pageContent', $page->content)}}
</textarea>
</label>
<div class="col-lg-12">
<textarea name="pageContent" id="pageContent" class="wysiwyg-editor">
{{old('pageContent', $page->content)}}
</textarea>
</div>
</div>
</div>
-15
View File
@@ -1,15 +0,0 @@
{
"name": "pingpong-modules/article",
"description": "",
"authors": [
{
"name": "Pingpong Labs",
"email": "pingpong.labs@gmail.com"
}
],
"autoload": {
"psr-4": {
"Modules\\Article\\": ""
}
}
}