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
3bb7d888
Commit
3bb7d888
authored
Nov 19, 2014
by
Nicolas Widart
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor for cleaner repository and views
parent
345db88b
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
50 additions
and
66 deletions
+50
-66
EloquentMenuItemRepository.php
Repositories/Eloquent/EloquentMenuItemRepository.php
+2
-17
EloquentMenuRepository.php
Repositories/Eloquent/EloquentMenuRepository.php
+2
-13
create-trans-fields.blade.php
...ws/admin/menuitems/partials/create-trans-fields.blade.php
+11
-11
edit-trans-fields.blade.php
...iews/admin/menuitems/partials/edit-trans-fields.blade.php
+11
-11
create-fields.blade.php
Resources/views/admin/menus/partials/create-fields.blade.php
+10
-0
create-trans-fields.blade.php
.../views/admin/menus/partials/create-trans-fields.blade.php
+7
-7
edit-trans-fields.blade.php
...es/views/admin/menus/partials/edit-trans-fields.blade.php
+7
-7
No files found.
Repositories/Eloquent/EloquentMenuItemRepository.php
View file @
3bb7d888
...
...
@@ -10,27 +10,12 @@ class EloquentMenuItemRepository extends EloquentBaseRepository implements MenuI
{
public
function
create
(
$data
)
{
$menuItem
=
new
Menuitem
;
$menuItem
->
menu_id
=
$data
[
'menu_id'
];
$menuItem
->
page_id
=
$data
[
'page_id'
];
$menuItem
->
target
=
$data
[
'target'
];
$menuItem
->
module_name
=
$data
[
'module'
];
$translatableData
=
Helper
::
separateLanguages
(
$data
);
Helper
::
updateTranslated
(
$menuItem
,
$translatableData
);
return
$menuItem
;
return
$this
->
model
->
create
(
$data
);
}
public
function
update
(
$menuItem
,
$data
)
{
$menuItem
->
menu_id
=
$data
[
'menu_id'
];
$menuItem
->
page_id
=
$data
[
'page_id'
];
$menuItem
->
target
=
$data
[
'target'
];
$menuItem
->
module_name
=
$data
[
'module'
];
$translatableData
=
Helper
::
separateLanguages
(
$data
);
Helper
::
updateTranslated
(
$menuItem
,
$translatableData
);
$menuItem
->
update
(
$data
);
return
$menuItem
;
}
...
...
Repositories/Eloquent/EloquentMenuRepository.php
View file @
3bb7d888
...
...
@@ -9,23 +9,12 @@ class EloquentMenuRepository extends EloquentBaseRepository implements MenuRepos
{
public
function
create
(
$data
)
{
$menu
=
new
Menu
;
$menu
->
name
=
$data
[
'name'
];
$menu
->
primary
=
$data
[
'primary'
];
$translatableData
=
Helper
::
separateLanguages
(
$data
);
Helper
::
updateTranslated
(
$menu
,
$translatableData
);
return
$menu
;
return
$this
->
model
->
create
(
$data
);
}
public
function
update
(
$menu
,
$data
)
{
$menu
->
name
=
$data
[
'name'
];
$menu
->
primary
=
$data
[
'primary'
];
$translatableData
=
Helper
::
separateLanguages
(
$data
);
Helper
::
updateTranslated
(
$menu
,
$translatableData
);
$menu
->
update
(
$data
);
return
$menu
;
}
...
...
Resources/views/admin/menuitems/partials/create-trans-fields.blade.php
View file @
3bb7d888
<div
class=
'form-group{{ $errors->has("
title[{$lang}
]") ? '
has-error
'
:
''
}}'
>
{!! Form::label("
title[{$lang}
]", trans('menu::menu.form.title')) !!}
{!! Form::text("
title[{$lang}]", Input::old("title[{$lang}
]"), ['class' => 'form-control', 'placeholder' => trans('menu::menu.form.title')]) !!}
{!! $errors->first("
title[{$lang}
]", '
<span
class=
"help-block"
>
:message
</span>
') !!}
<div
class=
'form-group{{ $errors->has("
{$lang}[title
]") ? '
has-error
'
:
''
}}'
>
{!! Form::label("
{$lang}[title
]", trans('menu::menu.form.title')) !!}
{!! Form::text("
{$lang}[title]", Input::old("{$lang}[title
]"), ['class' => 'form-control', 'placeholder' => trans('menu::menu.form.title')]) !!}
{!! $errors->first("
{$lang}[title
]", '
<span
class=
"help-block"
>
:message
</span>
') !!}
</div>
<div
class=
"form-group"
>
{!! Form::label("
uri[{$lang}
]", trans('menu::menu.form.uri')) !!}
<div
class=
'input-group{{ $errors->has("
uri[{$lang}
]") ? '
has-error
'
:
''
}}'
>
{!! Form::label("
{$lang}[uri
]", trans('menu::menu.form.uri')) !!}
<div
class=
'input-group{{ $errors->has("
{$lang}[uri
]") ? '
has-error
'
:
''
}}'
>
<span
class=
"input-group-addon"
>
/{{ $lang }}/
</span>
{!! Form::text("
uri[{$lang}]", Input::old("uri[{$lang}
]"), ['class' => 'form-control', 'placeholder' => trans('menu::menu.form.uri')]) !!}
{!! $errors->first("
uri[{$lang}
]", '
<span
class=
"help-block"
>
:message
</span>
') !!}
{!! Form::text("
{$lang}[uri]", Input::old("{$lang}[uri
]"), ['class' => 'form-control', 'placeholder' => trans('menu::menu.form.uri')]) !!}
{!! $errors->first("
{$lang}[uri
]", '
<span
class=
"help-block"
>
:message
</span>
') !!}
</div>
</div>
<div
class=
"checkbox"
>
<label
for=
"
status[{{$lang}}
]"
>
<input
id=
"
status[{{$lang}}
]"
name=
"
status[{{$lang}}
]"
<label
for=
"
{{$lang}}[status
]"
>
<input
id=
"
{{$lang}}[status
]"
name=
"
{{$lang}}[status
]"
type=
"checkbox"
class=
"flat-blue"
value=
"1"
/>
...
...
Resources/views/admin/menuitems/partials/edit-trans-fields.blade.php
View file @
3bb7d888
<div
class=
'form-group{{ $errors->has("
title[{$lang}
]") ? '
has-error
'
:
''
}}'
>
{!! Form::label("
title[{$lang}
]", trans('menu::menu.form.title')) !!}
{!! Form::text("
title[{$lang}]", Input::old("title[{$lang}
]", $menuItem->translate($lang)->title), ['class' => 'form-control', 'placeholder' => trans('menu::menu.form.title')]) !!}
{!! $errors->first("
title[{$lang}
]", '
<span
class=
"help-block"
>
:message
</span>
') !!}
<div
class=
'form-group{{ $errors->has("
{$lang}[title
]") ? '
has-error
'
:
''
}}'
>
{!! Form::label("
{$lang}[title
]", trans('menu::menu.form.title')) !!}
{!! Form::text("
{$lang}[title]", Input::old("{$lang}[title
]", $menuItem->translate($lang)->title), ['class' => 'form-control', 'placeholder' => trans('menu::menu.form.title')]) !!}
{!! $errors->first("
{$lang}[title
]", '
<span
class=
"help-block"
>
:message
</span>
') !!}
</div>
<div
class=
"form-group"
>
{!! Form::label("
uri[{$lang}
]", trans('menu::menu.form.uri')) !!}
<div
class=
'input-group{{ $errors->has("
uri[{$lang}
]") ? '
has-error
'
:
''
}}'
>
{!! Form::label("
{$lang}[uri
]", trans('menu::menu.form.uri')) !!}
<div
class=
'input-group{{ $errors->has("
{$lang}[uri
]") ? '
has-error
'
:
''
}}'
>
<span
class=
"input-group-addon"
>
/{{ $lang }}/
</span>
{!! Form::text("
uri[{$lang}]", Input::old("uri[{$lang}
]", $menuItem->translate($lang)->uri), ['class' => 'form-control', 'placeholder' => trans('menu::menu.form.uri')]) !!}
{!! $errors->first("
uri[{$lang}
]", '
<span
class=
"help-block"
>
:message
</span>
') !!}
{!! Form::text("
{$lang}[uri]", Input::old("{$lang}[uri
]", $menuItem->translate($lang)->uri), ['class' => 'form-control', 'placeholder' => trans('menu::menu.form.uri')]) !!}
{!! $errors->first("
{$lang}[uri
]", '
<span
class=
"help-block"
>
:message
</span>
') !!}
</div>
</div>
<div
class=
"checkbox"
>
<label
for=
"
status[{{$lang}}
]"
>
<input
id=
"
status[{{$lang}}
]"
name=
"
status[{{$lang}}
]"
<label
for=
"
{{$lang}}[status
]"
>
<input
id=
"
{{$lang}}[status
]"
name=
"
{{$lang}}[status
]"
type=
"checkbox"
class=
"flat-blue"
{{
(
bool
)$
menuItem-
>
translate($lang)->status ? 'checked' : '' }}
...
...
Resources/views/admin/menus/partials/create-fields.blade.php
View file @
3bb7d888
...
...
@@ -3,3 +3,13 @@
{!! Form::text('name', Input::old('name'), ['class' => 'form-control', 'placeholder' => trans('menu::menu.form.name')]) !!}
{!! $errors->first('Name', '
<span
class=
"help-block"
>
:message
</span>
') !!}
</div>
<div
class=
"checkbox"
>
<label
for=
"primary"
>
<input
id=
"primary"
name=
"primary"
type=
"checkbox"
class=
"flat-blue"
value=
"1"
/>
{{ trans('menu::menu.form.primary') }}
</label>
</div>
Resources/views/admin/menus/partials/create-trans-fields.blade.php
View file @
3bb7d888
<div
class=
'form-group{{ $errors->has("
title[{$lang}
]") ? '
has-error
'
:
''
}}'
>
{!! Form::label("
title[{$lang}
]", trans('menu::menu.form.title')) !!}
{!! Form::text("
title[{$lang}]", Input::old("title[{$lang}
]"), ['class' => 'form-control', 'placeholder' => trans('menu::menu.form.title')]) !!}
{!! $errors->first("
title[{$lang}
]", '
<span
class=
"help-block"
>
:message
</span>
') !!}
<div
class=
'form-group{{ $errors->has("
{$lang}[title
]") ? '
has-error
'
:
''
}}'
>
{!! Form::label("
{$lang}[title
]", trans('menu::menu.form.title')) !!}
{!! Form::text("
{$lang}[title]", Input::old("{$lang}[title
]"), ['class' => 'form-control', 'placeholder' => trans('menu::menu.form.title')]) !!}
{!! $errors->first("
{$lang}[title
]", '
<span
class=
"help-block"
>
:message
</span>
') !!}
</div>
<div
class=
"checkbox"
>
<label
for=
"
status[{{$lang}}
]"
>
<input
id=
"
status[{{$lang}}
]"
name=
"
status[{{$lang}}
]"
<label
for=
"
{{$lang}}[status
]"
>
<input
id=
"
{{$lang}}[status
]"
name=
"
{{$lang}}[status
]"
type=
"checkbox"
class=
"flat-blue"
...
...
Resources/views/admin/menus/partials/edit-trans-fields.blade.php
View file @
3bb7d888
<div
class=
'form-group{{ $errors->has("
title[{$lang}
]") ? '
has-error
'
:
''
}}'
>
{!! Form::label("
title[{$lang}
]", trans('menu::menu.form.title')) !!}
{!! Form::text("
title[{$lang}]", Input::old("title[{$lang}
]", $menu->translate($lang)->title), ['class' => 'form-control', 'placeholder' => trans('menu::menu.form.title')]) !!}
{!! $errors->first("
title[{$lang}
]", '
<span
class=
"help-block"
>
:message
</span>
') !!}
<div
class=
'form-group{{ $errors->has("
{$lang}[title
]") ? '
has-error
'
:
''
}}'
>
{!! Form::label("
{$lang}[title
]", trans('menu::menu.form.title')) !!}
{!! Form::text("
{$lang}[title]", Input::old("{$lang}[title
]", $menu->translate($lang)->title), ['class' => 'form-control', 'placeholder' => trans('menu::menu.form.title')]) !!}
{!! $errors->first("
{$lang}[title
]", '
<span
class=
"help-block"
>
:message
</span>
') !!}
</div>
<div
class=
"checkbox"
>
<label
for=
"
status[{{$lang}}
]"
>
<input
id=
"
status[{{$lang}}
]"
name=
"
status[{{$lang}}
]"
<label
for=
"
{{$lang}}[status
]"
>
<input
id=
"
{{$lang}}[status
]"
name=
"
{{$lang}}[status
]"
type=
"checkbox"
class=
"flat-blue"
{{
((
bool
)$
menu-
>
translate($lang)->status) ? 'checked' : '' }}
...
...
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