FEATURE: rewrite widgets management into new layout
This commit is contained in:
@@ -18,6 +18,12 @@ class EditWidgetArea extends Controller
|
|||||||
return view('admin.widgets.area.edit', ['area' => $area]);
|
return view('admin.widgets.area.edit', ['area' => $area]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param EditWidgetAreaRequest $request
|
||||||
|
* @param $id
|
||||||
|
*
|
||||||
|
* @return \Illuminate\Http\RedirectResponse
|
||||||
|
*/
|
||||||
public function postEdit(EditWidgetAreaRequest $request, $id)
|
public function postEdit(EditWidgetAreaRequest $request, $id)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
@@ -35,7 +41,7 @@ class EditWidgetArea extends Controller
|
|||||||
Event::fire(new \App\Events\EditWidgetArea($area));
|
Event::fire(new \App\Events\EditWidgetArea($area));
|
||||||
|
|
||||||
return redirect()
|
return redirect()
|
||||||
->route('widgetareas.edit', ['id' => $id])
|
->route('widgetareas.overview')
|
||||||
->with('success', trans('admin/widgetAreas.editSuccessfull'));
|
->with('success', trans('admin/widgetAreas.editSuccessfull'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ return [
|
|||||||
'new' => 'New widget area',
|
'new' => 'New widget area',
|
||||||
'name' => 'Widget area name',
|
'name' => 'Widget area name',
|
||||||
'code' => 'Unique code',
|
'code' => 'Unique code',
|
||||||
|
'uniqueCode' => 'Unique code',
|
||||||
'description' => 'Description',
|
'description' => 'Description',
|
||||||
'createNew' => 'Create new widget area',
|
'createNew' => 'Create new widget area',
|
||||||
'successfullyCreated' => 'Widget area successfully created',
|
'successfullyCreated' => 'Widget area successfully created',
|
||||||
@@ -12,6 +13,7 @@ return [
|
|||||||
'actions' => 'Actions',
|
'actions' => 'Actions',
|
||||||
'noEntries' => 'No widget areas defined yet. Try to create some first.',
|
'noEntries' => 'No widget areas defined yet. Try to create some first.',
|
||||||
'editButton' => 'Edit',
|
'editButton' => 'Edit',
|
||||||
|
'save' => 'Save',
|
||||||
'edit' => 'Editing widget area :name',
|
'edit' => 'Editing widget area :name',
|
||||||
'editSuccessfull' => 'Successfully edited'
|
'editSuccessfull' => 'Successfully edited'
|
||||||
];
|
];
|
||||||
@@ -3,6 +3,6 @@
|
|||||||
@section('pageHeading', @trans('admin/widgetAreas.edit', ['name' => $area->name]))
|
@section('pageHeading', @trans('admin/widgetAreas.edit', ['name' => $area->name]))
|
||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
@include('admin.widgets.area.form', ['action' => {{route('widgetareas.postEdit', ['id' => $area->id])}}])
|
@include('admin.widgets.area.form', ['action' => route('widgetareas.postEdit', ['id' => $area->id])])
|
||||||
@stop
|
@stop
|
||||||
|
|
||||||
|
|||||||
@@ -1,36 +1,26 @@
|
|||||||
<form action="{{$action}}" method="POST">
|
<form action="{{$action}}" method="POST">
|
||||||
{!! csrf_field() !!}
|
{!! csrf_field() !!}
|
||||||
<label>
|
|
||||||
|
<label class="control-label">
|
||||||
@lang('admin/widgetAreas.name')
|
@lang('admin/widgetAreas.name')
|
||||||
|
|
||||||
<input type="text" name="name" value="{{$area->name}}" placeholder="@lang('admin/widgetAreas.name')" />
|
|
||||||
|
|
||||||
@if (isset($errors) && $errors->has('name'))
|
|
||||||
<div class="callout alert">
|
|
||||||
{{ $errors->first('name') }}
|
|
||||||
</div>
|
|
||||||
@endif
|
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<label>
|
<input type="text" class="form-control" name="name" value="{{$area->name}}"
|
||||||
|
placeholder="@lang('admin/widgetAreas.name')" />
|
||||||
|
|
||||||
|
<label class="control-label">
|
||||||
@lang('admin/widgetAreas.code')
|
@lang('admin/widgetAreas.code')
|
||||||
|
|
||||||
<input type="text" name="code" disabled="true" value="{{$area->code}}"
|
|
||||||
placeholder="@lang('admin/widgetAreas.code')" />
|
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<label>
|
<input type="text" class="form-control" name="code" @if($area->code) disabled @endif value="{{$area->code}}"
|
||||||
|
placeholder="@lang('admin/widgetAreas.code')" />
|
||||||
|
|
||||||
|
<label class="control-label">
|
||||||
@lang('admin/widgetAreas.description')
|
@lang('admin/widgetAreas.description')
|
||||||
|
|
||||||
<textarea rows="3" name="description"
|
|
||||||
placeholder="@lang('admin/widgetAreas.description')">{{$area->description}}</textarea>
|
|
||||||
|
|
||||||
@if (isset($errors) && $errors->has('description'))
|
|
||||||
<div class="callout alert">
|
|
||||||
{{ $errors->first('description') }}
|
|
||||||
</div>
|
|
||||||
@endif
|
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<button type="submit" class="button success">@lang('admin/widgetAreas.editButton')</button>
|
<textarea rows="3" class="form-control" name="description"
|
||||||
|
placeholder="@lang('admin/widgetAreas.description')">{{$area->description}}</textarea>
|
||||||
|
|
||||||
|
<button type="submit" class="btn btn-primary">@lang('admin/widgetAreas.save')</button>
|
||||||
</form>
|
</form>
|
||||||
@@ -3,40 +3,64 @@
|
|||||||
@section('pageHeading', @trans('admin/widgetAreas.overview'))
|
@section('pageHeading', @trans('admin/widgetAreas.overview'))
|
||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
<div class="column large-8">
|
<div class="row">
|
||||||
|
<div class="col-lg-8">
|
||||||
@if (count($areas) > 0)
|
@if (count($areas) > 0)
|
||||||
<table class="full-width">
|
<table class="table item-list table-striped">
|
||||||
<tr>
|
<tr>
|
||||||
<th>@lang('admin/widgetAreas.name')</th>
|
<th>@lang('admin/widgetAreas.name')</th>
|
||||||
<th>@lang('admin/widgetAreas.code')</th>
|
<th>@lang('admin/widgetAreas.uniqueCode')</th>
|
||||||
<th>@lang('admin/widgetAreas.description')</th>
|
<th>@lang('admin/widgetAreas.description')</th>
|
||||||
<th>@lang('admin/widgetAreas.actions')</th>
|
<th>@lang('admin/widgetAreas.actions')</th>
|
||||||
</tr>
|
</tr>
|
||||||
@foreach($areas as $area)
|
@foreach($areas as $area)
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{$area->name}}</td>
|
<td><a href="{{route('widgetareas.edit', ['id' => $area->id])}}">{{$area->name}}</a></td>
|
||||||
<td>{{$area->code}}</td>
|
<td><a href="{{route('widgetareas.edit', ['id' => $area->id])}}">{{$area->code}}</a></td>
|
||||||
<td>{{str_limit($area->description, 100)}}</td>
|
<td>{{str_limit($area->description, 100)}}</td>
|
||||||
<td class="text-center">
|
<td class="text-center">
|
||||||
<a href="{{route('widgets.associate', ['widgetArea' => $area->id])}}"><i class="fa fa-plus"></i></a>
|
<div class="item-actions-dropdown">
|
||||||
<a href="{{route('widgetareas.edit', ['id' => $area->id])}}"><i class="fa fa-edit"></i></a>
|
<a class="item-actions-toggle-btn">
|
||||||
<a href="{{route('widgetareas.delete', ['id' => $area->id])}}"><i
|
<span class="inactive"><i class="fa fa-cog"></i></span>
|
||||||
class="fa fa-remove confirm"></i></a>
|
<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" href="{{route('widgetareas.edit', ['id' => $area->id])}}"><i
|
||||||
|
class="fa fa-pencil"></i></a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="{{route('widgets.associate', ['widgetArea' => $area->id])}}"><i
|
||||||
|
class="fa fa-plus"></i></a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a class="confirm remove"
|
||||||
|
href="{{route('widgetareas.delete', ['id' => $area->id])}}"><i
|
||||||
|
class="fa fa-trash"></i></a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@endforeach
|
@endforeach
|
||||||
</table>
|
</table>
|
||||||
@else
|
@else
|
||||||
<em>@lang('admin/widgetAreas.noEntries')</em>
|
<div class="alert alert-info">
|
||||||
|
<em>@lang('admin/widgetAreas.noEntries')</em>
|
||||||
|
</div>
|
||||||
@endif
|
@endif
|
||||||
</div>
|
</div>
|
||||||
<div class="column large-4">
|
<div class="col-lg-4">
|
||||||
<h3>@lang('admin/widgetAreas.new')</h3>
|
<h3>@lang('admin/widgetAreas.new')</h3>
|
||||||
|
|
||||||
@include('admin.widgets.area.newForm', ['hideMessages' => true])
|
@include('admin.widgets.area.form', ['action' => route('widgetareas.postNew'), 'area' => new \App\Models\WidgetArea()])
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="row pagination">
|
<div class="row pagination">
|
||||||
{!! $areas->render() !!}
|
{!! $areas->render() !!}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -0,0 +1,39 @@
|
|||||||
|
@forelse($widgets as $widget)
|
||||||
|
<div class="{{$tileClass}}">
|
||||||
|
<div class=" card @if (in_array($widget->id, $associatedWidgetIds)) card-info @else card-success @endif">
|
||||||
|
|
||||||
|
<div class="card-header">
|
||||||
|
<div class="header-block">
|
||||||
|
<p class="title" title="{{$widget->name}}"
|
||||||
|
data-toggle="tooltip"> {{str_limit($widget->name, 15)}}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="card-block text-center">
|
||||||
|
{{trans(call_user_func([$widget->widget_type_handler, 'getName']))}}
|
||||||
|
</div>
|
||||||
|
<div class="card-footer text-right">
|
||||||
|
<a href="{{route('widgets.edit', ['id' => $widget->id])}}" class="btn btn-sm btn-secondary"><i
|
||||||
|
class="fa fa-pencil"></i></a>
|
||||||
|
|
||||||
|
@if (in_array($widget->id, $associatedWidgetIds))
|
||||||
|
<a href="{{route('widgets.deleteAssociation', ['widgetId' => $widget->id, 'widgetArea' => $widgetArea->id])}}"
|
||||||
|
class="btn confirm btn-sm btn-danger">
|
||||||
|
<i class="fa fa-trash"></i>
|
||||||
|
</a>
|
||||||
|
@else
|
||||||
|
<a href="{{route('widgets.makeAssociation', ['widgetId' => $widget->id, 'widgetArea' => $widgetArea->id])}}"
|
||||||
|
class="btn btn-sm btn-primary"><i class="fa fa-plus"></i></a>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@empty
|
||||||
|
<div class="alert alert-info">
|
||||||
|
<em>@lang('admin/widgets.noEntries')</em>
|
||||||
|
</div>
|
||||||
|
@endforelse
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
{!! $widgets->render() !!}
|
||||||
|
</div>
|
||||||
Reference in New Issue
Block a user