FEATURE: style categories

This commit is contained in:
Michal Kváček
2016-09-04 02:28:06 +02:00
parent 4cfd93161b
commit d0be4d1e49
5 changed files with 55 additions and 89 deletions
@@ -30,7 +30,6 @@ class CategoriesServiceProvider extends ServiceProvider
*/ */
public function register() public function register()
{ {
//
} }
/** /**
@@ -40,9 +39,7 @@ class CategoriesServiceProvider extends ServiceProvider
*/ */
protected function registerConfig() protected function registerConfig()
{ {
$this->publishes([ $this->publishes([__DIR__ . '/../Config/config.php' => config_path('categories.php')]);
__DIR__ . '/../Config/config.php' => config_path('categories.php'),
]);
$this->mergeConfigFrom(__DIR__ . '/../Config/config.php', 'categories'); $this->mergeConfigFrom(__DIR__ . '/../Config/config.php', 'categories');
} }
@@ -1,19 +1,7 @@
@extends('admin.layout') @extends('admin.layoutWithNavigation')
@section('pageHeading', trans('categories::categories.edit'))
@section('content') @section('content')
<h2>@lang('categories::categories.edit')</h2>
@if (session('success'))
<div data-alert class="callout success">
<strong>{{ session('success') }}</strong>
</div>
@endif
@if (session('error'))
<div data-alert class="callout alert">
<strong>{{ session('error') }}</strong>
</div>
@endif
@include('categories::admin.form', ['action' => route('categories.postEdit', ['id' => $category->id])]) @include('categories::admin.form', ['action' => route('categories.postEdit', ['id' => $category->id])])
@endsection @endsection
@@ -1,64 +1,67 @@
<form action="{{$action}}" method="post"> <form action="{{$action}}" method="post">
{!! csrf_field() !!} {!! csrf_field() !!}
<div class="row"> <div class="row">
<div class="column large-5"> <div class="col-lg-5">
<label> <label class="label-control">
@lang('categories::categories.fields.name') @lang('categories::categories.fields.name')
<input type="text" name="name" class="slug-source" value="{{old('name', $category->name)}}">
</label> </label>
<input type="text" name="name" class="form-control slug-source" value="{{old('name', $category->name)}}">
</div> </div>
<div class="column large-5"> <div class="col-lg-5">
<label> <label>
@lang('categories::categories.fields.url') @lang('categories::categories.fields.url')
<input type="text" name="url" class="slug-target" value="{{old('url', $category->url)}}">
</label> </label>
<input type="text" name="url" class="form-control slug-target" value="{{old('url', $category->url)}}">
</div> </div>
<div class="column large-2 text-center"> <div class="col-lg-2 text-center">
<label> <div>
@lang('admin/contents.lockUrl')<br /> <label>
<input class="checkbox" value="1" id="lockUrl"
<input type="checkbox" value="1" id="lockUrl" @if(old('lockUrl') || ($category->id > 0 && \Illuminate\Support\Str::slug($category->name) != $category->url)) checked
@if(old('lockUrl') || ($category->id > 0 && \Illuminate\Support\Str::slug($category->name) != $category->url)) checked @endif name="lockUrl" type="checkbox">
@endif name="lockUrl" /> <span>@lang('admin/contents.lockUrl')</span>
</label> </label>
</div>
</div> </div>
</div> </div>
<label> <label class="label-control">
@lang('categories::categories.fields.description') @lang('categories::categories.fields.description')
<textarea name="description">{{old('description', $category->description)}}</textarea>
</label> </label>
<textarea class="form-control" name="description">{{old('description', $category->description)}}</textarea>
<div class="row"> <div class="row">
<div class="column large-6"> <div class="col-lg-6">
<label> <label class="label-control">
@lang('categories::categories.fields.module') @lang('categories::categories.fields.module')
<select name="moduleId" @if($category->id) disabled @endif> </label>
@foreach($modules as $module)
<option @if($module->id == $category->module_id) selected <select class="form-control" name="moduleId" @if($category->id) disabled @endif>
@endif value="{{$module->id}}">{{trans($module->name)}}</option> @foreach($modules as $module)
<option @if($module->id == $category->module_id) selected
@endif value="{{$module->id}}">{{trans($module->name)}}</option>
@endforeach
</select>
</div>
<div class="col-lg-6">
@if(count($categories))
<label class="label-control">
@lang('categories::categories.fields.parentCategory')
</label>
<select class="form-control" name="parentCategory">
<option value="">@lang('admin/contents.noCategory')</option>
@foreach($categories as $parentCategory)
@include('categories::admin.snippets.optionParentCategories', ['level' => 0, 'selectedCategory' => $category, 'currentCategory' => $parentCategory])
@endforeach @endforeach
</select> </select>
</label>
</div>
<div class="column large-6">
@if(count($categories))
<label>
@lang('categories::categories.fields.parentCategory')
<select name="parentCategory">
<option value=""> ---</option>
@foreach($categories as $parentCategory)
@include('categories::admin.snippets.optionParentCategories', ['level' => 0, 'selectedCategory' => $category, 'currentCategory' => $parentCategory])
@endforeach
</select>
</label>
@endif @endif
</div> </div>
</div> </div>
<button type="submit" class="button primary">@lang('categories::categories.fields.save')</button> <button type="submit" class="btn btn-primary">@lang('categories::categories.fields.save')</button>
</form> </form>
@@ -1,19 +1,7 @@
@extends('admin.layout') @extends('admin.layoutWithNavigation')
@section('pageHeading', trans('categories::categories.new'))
@section('content') @section('content')
<h2>@lang('categories::categories.new')</h2>
@if (session('success'))
<div data-alert class="callout success">
<strong>{{ session('success') }}</strong>
</div>
@endif
@if (session('error'))
<div data-alert class="callout alert">
<strong>{{ session('error') }}</strong>
</div>
@endif
@include('categories::admin.form', ['action' => route('categories.postNew')]) @include('categories::admin.form', ['action' => route('categories.postNew')])
@endsection @endsection
@@ -1,22 +1,10 @@
@extends('admin.layout') @extends('admin.layoutWithNavigation')
@section('pageHeading', trans('categories::categories.overview'))
@section('content') @section('content')
<h2>@lang('categories::categories.overview')</h2>
@if (session('success'))
<div data-alert class="callout success">
<strong>{{ session('success') }}</strong>
</div>
@endif
@if (session('error'))
<div data-alert class="callout alert">
<strong>{{ session('error') }}</strong>
</div>
@endif
@if(count($categories)) @if(count($categories))
<table class="full-width"> <table class="table table-striped">
<thead> <thead>
<tr> <tr>
<th>@lang('categories::categories.name')</th> <th>@lang('categories::categories.name')</th>
@@ -31,6 +19,8 @@
</tbody> </tbody>
</table> </table>
@else @else
<em>@lang('categories::categories.noCategories')</em> <div class="alert alert-info">
@lang('categories::categories.noCategories')
</div>
@endif @endif
@stop @stop