FEATURE: make widgets not deletable
This commit is contained in:
@@ -79,6 +79,13 @@ class EditWidget extends Controller
|
|||||||
// create new widget
|
// create new widget
|
||||||
$widget = Widget::findOrFail($id);
|
$widget = Widget::findOrFail($id);
|
||||||
|
|
||||||
|
// check if widget area is deletable
|
||||||
|
if (!$widget->deletable) {
|
||||||
|
return redirect()
|
||||||
|
->back()
|
||||||
|
->with('error', trans('admin/widgets.notDeletable'));
|
||||||
|
}
|
||||||
|
|
||||||
$widget->delete();
|
$widget->delete();
|
||||||
|
|
||||||
// redirect with success notification
|
// redirect with success notification
|
||||||
|
|||||||
@@ -1,16 +1,20 @@
|
|||||||
<?php
|
<?php
|
||||||
return [
|
return [
|
||||||
"actions" => "Akce",
|
"actions" => "Akce",
|
||||||
|
"associateWidgets" => "Přiřadit widgety do této plochy",
|
||||||
"code" => "Unikátní kód (používá se v šablonách pro vykreslení)",
|
"code" => "Unikátní kód (používá se v šablonách pro vykreslení)",
|
||||||
"createNew" => "Vytvořit novou plochu",
|
"createNew" => "Vytvořit novou plochu",
|
||||||
|
"delete" => "Smazat",
|
||||||
"description" => "Popis",
|
"description" => "Popis",
|
||||||
"edit" => "Upravuji plochu :name",
|
"edit" => "Upravuji plochu :name",
|
||||||
"editButton" => "Upravit",
|
"editButton" => "Upravit",
|
||||||
"editSuccessfull" => "Změny úspěšně uloženy",
|
"editSuccessfull" => "Změny úspěšně uloženy",
|
||||||
|
"editTooltip" => "Upravit plochu pro widgety",
|
||||||
"invalidArea" => "Zvolená plocha pro widgety není platná. Vyberte prosím nějakou jinou.",
|
"invalidArea" => "Zvolená plocha pro widgety není platná. Vyberte prosím nějakou jinou.",
|
||||||
"name" => "Jméno",
|
"name" => "Jméno",
|
||||||
"new" => "Nová plocha pro widgety",
|
"new" => "Nová plocha pro widgety",
|
||||||
"noEntries" => "Zatím nebyla definována žádná plocha pro widgety.",
|
"noEntries" => "Zatím nebyla definována žádná plocha pro widgety.",
|
||||||
|
"notDeletableArea" => "Nelze smazat požadovanou plochu. Tato plocha je nezbytnou součástí nainstalované šablony a její odstranění by znefunkčnilo celou šablonu.",
|
||||||
"overview" => "Seznam všech ploch pro widgety",
|
"overview" => "Seznam všech ploch pro widgety",
|
||||||
"save" => "Uložit",
|
"save" => "Uložit",
|
||||||
"successfullyCreated" => "Plocha pro widgety úspěšně vytvořena",
|
"successfullyCreated" => "Plocha pro widgety úspěšně vytvořena",
|
||||||
|
|||||||
@@ -6,13 +6,16 @@ return [
|
|||||||
"associationExists" => "Tento widget již je přiřazený k této ploše pro widgety",
|
"associationExists" => "Tento widget již je přiřazený k této ploše pro widgety",
|
||||||
"cannotSave" => "Nelze uložit widget. Došlo k nečekané vyjímce. Zpráva: :exception",
|
"cannotSave" => "Nelze uložit widget. Došlo k nečekané vyjímce. Zpráva: :exception",
|
||||||
"createdAt" => "Vytvořeno",
|
"createdAt" => "Vytvořeno",
|
||||||
|
"delete" => "Smazat",
|
||||||
"deleteAssociation" => "Odstranit",
|
"deleteAssociation" => "Odstranit",
|
||||||
"description" => "Popis",
|
"description" => "Popis",
|
||||||
"descriptionOfWidgets" => "Widgety se zobrazují v plochách pro widgety. Tyto plochy je možné umístit na libovolné místo na webu.",
|
"descriptionOfWidgets" => "Widgety se zobrazují v plochách pro widgety. Tyto plochy je možné umístit na libovolné místo na webu.",
|
||||||
"edit" => "Upravit",
|
"edit" => "Upravit",
|
||||||
|
"editTooltip" => "Upravit tento widget",
|
||||||
"missingValue" => "Nelze uložit bez hodnoty pro pole :field",
|
"missingValue" => "Nelze uložit bez hodnoty pro pole :field",
|
||||||
"name" => "Jméno",
|
"name" => "Jméno",
|
||||||
"noEntries" => "Není dostupný žádný widget.",
|
"noEntries" => "Není dostupný žádný widget.",
|
||||||
|
"notDeletable" => "Nelze smazat widget. Smazání widgetu by melo za následek možné znefunkčnění celé šablony.",
|
||||||
"overview" => "Seznam všech widgetů",
|
"overview" => "Seznam všech widgetů",
|
||||||
"preview" => "Náhled",
|
"preview" => "Náhled",
|
||||||
"successfullyAssociated" => "Widget úspěšně vložen do plochy",
|
"successfullyAssociated" => "Widget úspěšně vložen do plochy",
|
||||||
|
|||||||
@@ -23,5 +23,8 @@ return [
|
|||||||
'successfullyDeassociated' => 'Successfully removed from widget area',
|
'successfullyDeassociated' => 'Successfully removed from widget area',
|
||||||
'widgetExists' => 'Widget :id already exists.',
|
'widgetExists' => 'Widget :id already exists.',
|
||||||
'descriptionOfWidgets' => 'Widgets are displayed in widget areas.',
|
'descriptionOfWidgets' => 'Widgets are displayed in widget areas.',
|
||||||
'successfullyDeleted' => 'Widget successfully deleted'
|
'successfullyDeleted' => 'Widget successfully deleted',
|
||||||
|
'delete' => 'Delete',
|
||||||
|
'editTooltip' => 'Edit this widget',
|
||||||
|
'notDeletable' => 'Cannot delete this widget. It is essential part of currenty installed template and therefore cannot be deleted.'
|
||||||
];
|
];
|
||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
@if (count($widgets))
|
@if (count($widgets))
|
||||||
<table class="table table-striped full-width">
|
<table class="table table-striped item-list">
|
||||||
<tr>
|
<tr>
|
||||||
<th>@lang('admin/widgets.widgetType')</th>
|
<th>@lang('admin/widgets.widgetType')</th>
|
||||||
<th>@lang('admin/widgets.name')</th>
|
<th>@lang('admin/widgets.name')</th>
|
||||||
@@ -18,8 +18,34 @@
|
|||||||
<td><a href="{{route('widgets.edit', ['id' => $widget->id])}}">{{$widget->name}}</a></td>
|
<td><a href="{{route('widgets.edit', ['id' => $widget->id])}}">{{$widget->name}}</a></td>
|
||||||
<td>{{$widget->description}}</td>
|
<td>{{$widget->description}}</td>
|
||||||
<td class="text-center">
|
<td class="text-center">
|
||||||
<a href="{{route('widgets.edit', ['id' => $widget->id])}}"><i class="fa fa-fw fa-pencil"></i></a>
|
|
||||||
<a href="{{route('widgets.delete', ['id' => $widget->id])}}"><i class="fa fa-fw remove fa-trash"></i></a>
|
|
||||||
|
<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 class="edit" data-toggle="tooltip"
|
||||||
|
title="@lang('admin/widgets.editTooltip')"
|
||||||
|
href="{{route('widgets.edit', ['id' => $widget->id])}}"><i
|
||||||
|
class="fa fa-pencil"></i></a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
@if($widget->deletable)
|
||||||
|
<li>
|
||||||
|
<a class="confirm remove" data-toggle="tooltip" title="@lang('admin/widgets.delete')"
|
||||||
|
href="{{route('widgets.delete', ['id' => $widget->id])}}"><i
|
||||||
|
class="fa fa-trash"></i></a>
|
||||||
|
</li>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@endforeach
|
@endforeach
|
||||||
|
|||||||
Reference in New Issue
Block a user