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
8a38022d
Commit
8a38022d
authored
Oct 19, 2014
by
Nicolas Widart
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add module settings update ability
parent
8e0e5b01
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
16 additions
and
15 deletions
+16
-15
SettingController.php
Http/Controllers/Admin/SettingController.php
+0
-5
routes.php
Http/routes.php
+1
-1
EloquentSettingRepository.php
Repositories/Eloquent/EloquentSettingRepository.php
+7
-2
module-settings.blade.php
Resources/views/admin/module-settings.blade.php
+3
-3
module-fields.blade.php
Resources/views/admin/partials/module-fields.blade.php
+5
-4
No files found.
Http/Controllers/Admin/SettingController.php
View file @
8a38022d
...
...
@@ -52,9 +52,4 @@ class SettingController extends AdminBaseController
return
View
::
make
(
'setting::admin.module-settings'
,
compact
(
'module'
,
'moduleSettings'
,
'settings'
));
}
public
function
postModuleSettings
(
$module
)
{
dd
(
'Module settings posted'
);
}
}
Http/routes.php
View file @
8a38022d
...
...
@@ -4,7 +4,7 @@ $router->group(['prefix' => LaravelLocalization::setLocale(), 'before' => 'Larav
$router
->
group
([
'prefix'
=>
Config
::
get
(
'core::core.admin-prefix'
),
'namespace'
=>
'Modules\Setting\Http\Controllers'
],
function
(
$router
)
{
$router
->
get
(
'settings/{module}'
,
[
'as'
=>
'dashboard.module.settings'
,
'uses'
=>
'Admin\SettingController@getModuleSettings'
]);
$router
->
post
(
'settings
/{module}
'
,
[
'as'
=>
'dashboard.module.settings.post'
,
'uses'
=>
'Admin\SettingController@postModuleSettings'
]);
$router
->
post
(
'settings'
,
[
'as'
=>
'dashboard.module.settings.post'
,
'uses'
=>
'Admin\SettingController@postModuleSettings'
]);
$router
->
resource
(
'settings'
,
'Admin\SettingController'
,
[
'except'
=>
[
'show'
,
'edit'
,
'update'
,
'destroy'
,
'create'
],
'names'
=>
[
'index'
=>
'dashboard.setting.index'
,
'store'
=>
'dashboard.setting.store'
...
...
Repositories/Eloquent/EloquentSettingRepository.php
View file @
8a38022d
...
...
@@ -149,7 +149,12 @@ class EloquentSettingRepository extends EloquentBaseRepository implements Settin
*/
public
function
savedModuleSettings
(
$module
)
{
return
$this
->
findByModule
(
$module
);
$moduleSettings
=
[];
foreach
(
$this
->
findByModule
(
$module
)
as
$setting
)
{
$moduleSettings
[
$setting
->
name
]
=
$setting
;
}
return
$moduleSettings
;
}
/**
...
...
@@ -159,6 +164,6 @@ class EloquentSettingRepository extends EloquentBaseRepository implements Settin
*/
private
function
findByModule
(
$module
)
{
return
$this
->
model
->
where
(
'name'
,
"
$module
%"
)
->
get
();
return
$this
->
model
->
where
(
'name'
,
'LIKE'
,
$module
.
'_%'
)
->
get
();
}
}
Resources/views/admin/module-settings.blade.php
View file @
8a38022d
...
...
@@ -13,7 +13,7 @@
@section('content')
@include('flash::message')
{!! Form::open(['route' => ['dashboard.module.settings.post'
,
$module
], 'method' => 'post']) !!}
{!! Form::open(['route' => ['dashboard.module.settings.post'], 'method' => 'post']) !!}
<div class="
row
">
<div class="
col
-
md
-
12
">
<div class="
box
box
-
info
">
...
...
@@ -25,10 +25,10 @@
</
ul
>
<
div
class
="
tab
-
content
">
<div class="
tab
-
pane
{{
App
::
getLocale
()
==
'en'
?
'active'
:
''
}}
" id="
tab_1
-
1
">
@include('setting::admin.partials.module-fields', ['lang' => 'en', 'moduleSettings' =>
$moduleSettings
, 'settings' =>
$settings
])
@include('setting::admin.partials.module-fields', ['lang' => 'en', 'moduleSettings' =>
$moduleSettings
, 'settings' =>
$settings
, 'module' =>
$module
])
</div>
<div class="
tab
-
pane
{{
App
::
getLocale
()
==
'fr'
?
'active'
:
''
}}
" id="
tab_2
-
2
">
@include('setting::admin.partials.module-fields', ['lang' => 'fr', 'moduleSettings' =>
$moduleSettings
, 'settings' =>
$settings
])
@include('setting::admin.partials.module-fields', ['lang' => 'fr', 'moduleSettings' =>
$moduleSettings
, 'settings' =>
$settings
, 'module' =>
$module
])
</div>
</div>
</div>
...
...
Resources/views/admin/partials/module-fields.blade.php
View file @
8a38022d
<?php
foreach
(
$moduleSettings
as
$setting
=>
$description
)
:
?>
<?php
$settingName
=
$module
.
'_'
.
$setting
;
?>
<div
class=
'form-group'
>
{!! Form::label($setting . "[$lang]", $description) !!}
<?php
if
(
count
(
$settings
)
>=
1
)
:
?>
{!! Form::text($setting
. "[$lang]", Input::old($setting . "[$lang]", $settings[$setting
]->translate($lang)->value), ['class' => 'form-control', 'placeholder' => $description]) !!}
{!! Form::label($setting
Name
. "[$lang]", $description) !!}
<?php
if
(
isset
(
$settings
[
$settingName
])
)
:
?>
{!! Form::text($setting
Name . "[$lang]", Input::old($settingName . "[$lang]", $settings[$settingName
]->translate($lang)->value), ['class' => 'form-control', 'placeholder' => $description]) !!}
<?php
else
:
?>
{!! Form::text($setting
. "[$lang]", Input::old($setting
. "[$lang]"), ['class' => 'form-control', 'placeholder' => $description]) !!}
{!! Form::text($setting
Name . "[$lang]", Input::old($settingName
. "[$lang]"), ['class' => 'form-control', 'placeholder' => $description]) !!}
<?php
endif
;
?>
</div>
<?php
endforeach
;
?>
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