Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Platform
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Platform
Commits
277b65fc
Commit
277b65fc
authored
Nov 14, 2014
by
Nicolas Widart
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Preparing an menu item list
parent
9a2295da
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
3 deletions
+35
-3
MenuController.php
Http/Controllers/Admin/MenuController.php
+9
-2
edit.blade.php
Resources/views/admin/menus/edit.blade.php
+26
-1
No files found.
Http/Controllers/Admin/MenuController.php
View file @
277b65fc
...
@@ -7,6 +7,7 @@ use Modules\Core\Http\Controllers\Admin\AdminBaseController;
...
@@ -7,6 +7,7 @@ use Modules\Core\Http\Controllers\Admin\AdminBaseController;
use
Modules\Menu\Entities\Menu
;
use
Modules\Menu\Entities\Menu
;
use
Modules\Menu\Http\Requests\CreateMenuRequest
;
use
Modules\Menu\Http\Requests\CreateMenuRequest
;
use
Modules\Menu\Http\Requests\UpdateMenuRequest
;
use
Modules\Menu\Http\Requests\UpdateMenuRequest
;
use
Modules\Menu\Repositories\MenuItemRepository
;
use
Modules\Menu\Repositories\MenuRepository
;
use
Modules\Menu\Repositories\MenuRepository
;
class
MenuController
extends
AdminBaseController
class
MenuController
extends
AdminBaseController
...
@@ -19,12 +20,17 @@ class MenuController extends AdminBaseController
...
@@ -19,12 +20,17 @@ class MenuController extends AdminBaseController
* @var Redirector
* @var Redirector
*/
*/
private
$redirector
;
private
$redirector
;
/**
* @var MenuItemRepository
*/
private
$menuItem
;
public
function
__construct
(
MenuRepository
$menu
,
Redirector
$redirector
)
public
function
__construct
(
MenuRepository
$menu
,
MenuItemRepository
$menuItem
,
Redirector
$redirector
)
{
{
parent
::
__construct
();
parent
::
__construct
();
$this
->
menu
=
$menu
;
$this
->
menu
=
$menu
;
$this
->
redirector
=
$redirector
;
$this
->
redirector
=
$redirector
;
$this
->
menuItem
=
$menuItem
;
}
}
public
function
index
()
public
function
index
()
...
@@ -49,7 +55,8 @@ class MenuController extends AdminBaseController
...
@@ -49,7 +55,8 @@ class MenuController extends AdminBaseController
public
function
edit
(
Menu
$menu
)
public
function
edit
(
Menu
$menu
)
{
{
return
View
::
make
(
'menu::admin.menus.edit'
,
compact
(
'menu'
));
$menuItems
=
$this
->
menuItem
->
all
();
return
View
::
make
(
'menu::admin.menus.edit'
,
compact
(
'menu'
,
'menuItems'
));
}
}
public
function
update
(
Menu
$menu
,
UpdateMenuRequest
$request
)
public
function
update
(
Menu
$menu
,
UpdateMenuRequest
$request
)
...
...
Resources/views/admin/menus/edit.blade.php
View file @
277b65fc
...
@@ -13,6 +13,7 @@
...
@@ -13,6 +13,7 @@
@section('styles')
@section('styles')
<link href="
{
!!
Module
::
asset
(
'core'
,
'css/vendor/iCheck/flat/blue.css'
)
!!
}
" rel="
stylesheet
" type="
text
/
css
" />
<link href="
{
!!
Module
::
asset
(
'core'
,
'css/vendor/iCheck/flat/blue.css'
)
!!
}
" rel="
stylesheet
" type="
text
/
css
" />
<link href="
{
!!
Module
::
asset
(
'menu'
,
'css/nestable.css'
)
!!
}
" rel="
stylesheet
" type="
text
/
css
" />
@stop
@stop
@section('content')
@section('content')
...
@@ -20,12 +21,26 @@
...
@@ -20,12 +21,26 @@
<div class="
row
">
<div class="
row
">
<div class="
col
-
md
-
6
">
<div class="
col
-
md
-
6
">
<div class="
row
">
<div class="
row
">
<div class="
btn
-
group
pull
-
right
">
<div class="
btn
-
group
pull
-
right
"
style="
margin
:
0
15
px
15
px
0
;
"
>
<a href="
{{
URL
::
route
(
'dashboard.menuitem.create'
,
[
$menu
->
id
])
}}
" class="
btn
btn
-
primary
btn
-
flat
">
<a href="
{{
URL
::
route
(
'dashboard.menuitem.create'
,
[
$menu
->
id
])
}}
" class="
btn
btn
-
primary
btn
-
flat
">
<i class="
fa
fa
-
pencil
"></i> {{ trans('menu::menu.button.create menu item') }}
<i class="
fa
fa
-
pencil
"></i> {{ trans('menu::menu.button.create menu item') }}
</a>
</a>
</div>
</div>
</div>
</div>
<div class="
box
box
-
info
" style="
overflow
:
hidden
;
">
<div class="
box
-
body
">
<div class="
dd
">
<ol class="
dd
-
list
">
<?php foreach(
$menuItems
as
$menuItem
): ?>
<li class="
dd
-
item
" data-id="
{{
$menuItem
->
id
}}
">
<a href="" class="
btn
btn
-
sm
btn
-
info
" style="
float
:
left
;
margin
-
right
:
15
px
">Edit</a>
<div class="
dd
-
handle
" style="
margin
-
left
:
50
px
;
">{{
$menuItem->title
}}</div>
</li>
<?php endforeach; ?>
</ol>
</div>
</div>
</div>
</div>
</div>
<div class="
col
-
md
-
6
">
<div class="
col
-
md
-
6
">
<div class="
box
box
-
info
">
<div class="
box
box
-
info
">
...
@@ -91,4 +106,14 @@ $( document ).ready(function() {
...
@@ -91,4 +106,14 @@ $( document ).ready(function() {
});
});
});
});
</script>
</script>
<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
);
});
});
</script>
@stop
@stop
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment