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
+20
View File
@@ -0,0 +1,20 @@
<?php
return [
"actions" => "Akce",
"deleteSuccessfull" => "Kategorie úspěšně smazána",
"description" => "Modul pro správu a kategorizaci obsahu.",
"edit" => "Úprava kategorie",
"fields" => ["description" => "Popis",
"module" => "Modul",
"name" => "Jméno",
"parentCategory" => "Rodičovská kategorie",
"save" => "Uložit",
"url" => "URL",
],
"module" => "Modul",
"name" => "Kategorie",
"new" => "Nová kategorie",
"noCategories" => "Žádná vytvořená kategorie.",
"overview" => "Všechny kategorie",
"saveSuccessfull" => "Kategorie úspěšně uložena",
];
+21
View File
@@ -0,0 +1,21 @@
<?php
return [
'name' => 'Categories',
'description' => 'Module for category management and content categorization.',
'new' => 'New category',
'overview' => 'All categories',
'fields' => [
'name' => 'Name',
'description' => 'Description',
'url' => 'URL',
'module' => 'Module',
'parentCategory' => 'Parent category',
'save' => 'Save category'
],
'edit' => 'Edit category',
'saveSuccessfull' => 'Category successfully saved',
'deleteSuccessfull' => 'Category successfully deleted',
'module' => 'Module',
'actions' => 'Actions',
'noCategories' => 'No categories available'
];
+20
View File
@@ -0,0 +1,20 @@
<?php
return [
"actions" => "Akcie",
"deleteSuccessfull" => "Kategória úspešne zmazaná.",
"description" => "Modul pre správu kategórií a kategorizovanie obsahu",
"edit" => "Upraviť kategóriu",
"fields" => ["description" => "Popis",
"module" => "Modul",
"name" => "Názov",
"parentCategory" => "Rodičovská kategória",
"save" => "Uložiť kategóriu",
"url" => "URL",
],
"module" => "Modul",
"name" => "Kategórie",
"new" => "Nová kategória",
"noCategories" => "Žiadne kategórie nie sú dostupné.",
"overview" => "Všetky kategórie",
"saveSuccessfull" => "Kategória úspešne uložená.",
];
+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