Commit bbb1e626 authored by Nicolas Widart's avatar Nicolas Widart

Preparing menu index view

parent 58aed91f
......@@ -10,6 +10,11 @@ return [
'create menu item' => 'Create a menu item',
],
'button' => [
'create menu item' => 'Create a menu item'
'create menu item' => 'Create a menu item',
'create menu' => 'Create a menu'
],
'table' => [
'name' => 'Name',
'title' => 'Title',
]
];
......@@ -8,6 +8,11 @@ return [
'menu' => 'Gestionnaire de menu'
],
'button' => [
'create menu item' => 'Créer un élément de menu'
'create menu item' => 'Créer un élément de menu',
'create menu' => 'Créer un menu'
],
'table' => [
'name' => 'Nom',
'title' => 'Titre',
]
];
......@@ -10,52 +10,113 @@
</ol>
@stop
@section('styles')
<link href="{!! Module::asset('menu', 'css/nestable.css') !!}" rel="stylesheet" type="text/css" />
@stop
@section('content')
<div class="row">
<div class="col-md-6">
<div class="btn-group pull-right">
<a href="{{ URL::route('dashboard.menu.create') }}" class="btn btn-primary btn-flat">
<i class="fa fa-pencil"></i> {{ trans('menu::menu.button.create menu item') }}
</a>
<div class="col-md-12">
<div class="row">
<div class="btn-group pull-right" style="margin: 0 15px 15px 0;">
<a href="{{ URL::route('dashboard.menu.create') }}" class="btn btn-primary btn-flat">
<i class="fa fa-pencil"></i> {{ trans('menu::menu.button.create menu') }}
</a>
</div>
</div>
<div class="dd">
<ol class="dd-list">
<li class="dd-item" data-id="1">
<div class="dd-handle">Item 1</div>
</li>
<li class="dd-item" data-id="2">
<div class="dd-handle">Item 2</div>
</li>
<li class="dd-item" data-id="3">
<div class="dd-handle">Item 3</div>
<ol class="dd-list">
<li class="dd-item" data-id="4">
<div class="dd-handle">Item 4</div>
</li>
<li class="dd-item" data-id="5">
<div class="dd-handle">Item 5</div>
</li>
</ol>
</li>
</ol>
<div class="box">
<div class="box-header">
</div>
<!-- /.box-header -->
<div class="box-body table-responsive">
<table class="data-table table table-bordered table-hover">
<thead>
<tr>
<th>{{ trans('menu::menu.table.name') }}</th>
<th>{{ trans('menu::menu.table.title') }}</th>
<th>{{ trans('core::core.table.actions') }}</th>
</tr>
</thead>
<tbody>
<?php if (isset($menus)): ?>
<?php foreach($menus as $menu): ?>
<tr>
<td>
<a href="{{ URL::route('dashboard.post.edit', [$menu->id]) }}">
{{ $menu->title }}
</a>
</td>
<td>
<a href="{{ URL::route('dashboard.post.edit', [$menu->id]) }}">
{{ $menu->slug }}
</a>
</td>
<td>
<div class="btn-group">
<a href="{{ URL::route('dashboard.post.edit', [$menu->id]) }}" class="btn btn-default btn-flat"><i class="glyphicon glyphicon-pencil"></i></a>
<button class="btn btn-danger btn-flat" data-toggle="modal" data-target="#confirmation-{{ $menu->id }}"><i class="glyphicon glyphicon-trash"></i></button>
</div>
</td>
</tr>
<?php endforeach; ?>
<?php endif; ?>
</tbody>
<tfoot>
<tr>
<th>{{ trans('menu::menu.table.name') }}</th>
<th>{{ trans('menu::menu.table.title') }}</th>
<th>{{ trans('core::core.table.actions') }}</th>
</tr>
</tfoot>
</table>
<!-- /.box-body -->
</div>
<!-- /.box -->
</div>
</div>
</div>
<?php if (isset($menus)): ?>
<?php foreach($menus as $menu): ?>
<!-- Modal -->
<div class="modal fade" id="confirmation-{{ $menu->id }}" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
<h4 class="modal-title" id="myModalLabel">{{ trans('core::core.modal.title') }}</h4>
</div>
<div class="modal-body">
{{ trans('core::core.modal.confirmation-message') }}
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">{{ trans('core::core.button.cancel') }}</button>
{!! Form::open(['route' => ['dashboard.post.destroy', $menu->id], 'method' => 'delete', 'class' => 'pull-left']) !!}
<button type="submit" class="btn btn-danger btn-flat"><i class="glyphicon glyphicon-trash"></i> {{ trans('core::core.button.delete') }}</button>
{!! Form::close() !!}
</div>
</div>
</div>
</div>
<?php endforeach; ?>
<?php endif; ?>
@stop
@section('scripts')
<script src="{!! Module::asset('menu', 'js/jquery.nestable.js') !!}"></script>
<script>
$( document ).ready(function() {
$('.dd').nestable();
$('.dd').on('change', function() {
var data = $('.dd').nestable('serialize');
console.log(data);
<?php $locale = App::getLocale(); ?>
<script type="text/javascript">
$(function () {
$('.data-table').dataTable({
"bPaginate": true,
"bLengthChange": true,
"bFilter": true,
"bSort": true,
"bInfo": true,
"bAutoWidth": true,
"oLanguage": {
"sUrl": '<?php echo Module::asset('core', "js/vendor/datatables/{$locale}.json") ?>'
},
"aoColumns": [
null,
null,
{ "bSortable": false }
]
});
});
});
</script>
@stop
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment