FEATURE: move categories into own repository

This commit is contained in:
Michal Kváček
2017-08-22 14:10:50 +02:00
commit 16471b010f
27 changed files with 679 additions and 0 deletions
+7
View File
@@ -0,0 +1,7 @@
@extends('admin.layoutWithNavigation')
@section('pageHeading', trans('categories::categories.edit'))
@section('content')
@include('categories::admin.form', ['action' => route('categories.postEdit', ['id' => $category->id])])
@endsection
+67
View File
@@ -0,0 +1,67 @@
<form action="{{$action}}" method="post">
{!! csrf_field() !!}
<div class="row">
<div class="col-lg-5">
<label class="label-control">
@lang('categories::categories.fields.name')
</label>
<input type="text" name="name" class="form-control slug-source" value="{{old('name', $category->name)}}">
</div>
<div class="col-lg-5">
<label>
@lang('categories::categories.fields.url')
</label>
<input type="text" name="url" class="form-control slug-target" value="{{old('url', $category->url)}}">
</div>
<div class="col-lg-2 text-center">
<div>
<label>
<input class="checkbox" value="1" id="lockUrl"
@if(old('lockUrl') || ($category->id > 0 && \Illuminate\Support\Str::slug($category->name) != $category->url)) checked
@endif name="lockUrl" type="checkbox">
<span>@lang('admin/contents.lockUrl')</span>
</label>
</div>
</div>
</div>
<label class="label-control">
@lang('categories::categories.fields.description')
</label>
<textarea class="form-control" name="description">{{old('description', $category->description)}}</textarea>
<div class="row">
<div class="col-lg-6">
<label class="label-control">
@lang('categories::categories.fields.module')
</label>
<select class="form-control" name="moduleId" @if($category->id) disabled @endif>
@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
</select>
@endif
</div>
</div>
<button type="submit" class="btn btn-primary">@lang('categories::categories.fields.save')</button>
</form>
+7
View File
@@ -0,0 +1,7 @@
@extends('admin.layoutWithNavigation')
@section('pageHeading', trans('categories::categories.new'))
@section('content')
@include('categories::admin.form', ['action' => route('categories.postNew')])
@endsection
+35
View File
@@ -0,0 +1,35 @@
@extends('admin.layoutWithNavigation')
@section('pageHeading', trans('categories::categories.overview'))
@section('content')
<div class="card items">
<div class="card-block">
@if(count($categories))
<div class="item-list striped rows-striped">
<table class="table table-striped">
<thead>
<tr>
<th>@lang('categories::categories.name')</th>
<th>@lang('categories::categories.module')</th>
<th>@lang('categories::categories.actions')</th>
</tr>
</thead>
<tbody>
@foreach($categories as $category)
@include('categories::admin.snippets.overviewRow', ['level' => 0, 'currentCategory' => $category])
@endforeach
</tbody>
</table>
</div>
@else
<div class="alert alert-info">
@lang('categories::categories.noCategories')
</div>
@endif
</div>
</div>
@stop
@@ -0,0 +1,9 @@
<option @if($currentCategory['id'] == $selectedCategory->parent_id) selected @endif value="{{$currentCategory['id']}}">
{{str_repeat('-', $level)}} {{$currentCategory['name']}}
</option>
@if(isset($currentCategory['children']))
@foreach($currentCategory['children'] as $category)
@include('categories::admin.snippets.optionParentCategories', ['selectedCategory' => $selectedCategory, 'currentCategory' => $category, 'level' => $level+1])
@endforeach
@endif
@@ -0,0 +1,39 @@
<tr>
<td>
{{str_repeat('-', $level)}} <a href="{{route('categories.edit', ['id' => $currentCategory['id']])}}">{{$currentCategory['name']}}</a>
</td>
<td>@lang($modules[$currentCategory['module_id']])</td>
<td>
<div class="item-actions-dropdown">
<a class="item-actions-toggle-btn">
<span class="inactive">
<i class="fa fa-cog"></i>
</span>
<span class="active">
<i class="fa fa-chevron-circle-right"></i>
</span>
</a>
<div class="item-actions-block">
<ul class="item-actions-list">
<li>
<a href="{{route('categories.edit', ['id' => $currentCategory['id']])}}"><i
class="fa fa-fw fa-pencil"></i></a>
</li>
<li>
<a class="confirm remove"
href="{{route('categories.delete', ['id' => $currentCategory['id']])}}"><i
class="fa fa-fw fa-trash"></i></a>
</li>
</ul>
</div>
</div>
</td>
</tr>
@if(isset($currentCategory['children']))
@foreach($currentCategory['children'] as $category)
@include('categories::admin.snippets.overviewRow', ['currentCategory' => $category, 'level' => $level+1])
@endforeach
@endif