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
f79554db
Unverified
Commit
f79554db
authored
Oct 12, 2017
by
Nicolas Widart
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Empty out blade templates and remove extra queries
parent
646088bb
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
391 deletions
+15
-391
UserController.php
Modules/User/Http/Controllers/Admin/UserController.php
+4
-19
create.blade.php
Modules/User/Resources/views/admin/users/create.blade.php
+1
-115
edit.blade.php
Modules/User/Resources/views/admin/users/edit.blade.php
+1
-138
index.blade.php
Modules/User/Resources/views/admin/users/index.blade.php
+9
-119
No files found.
Modules/User/Http/Controllers/Admin/UserController.php
View file @
f79554db
...
@@ -53,11 +53,7 @@ class UserController extends BaseUserModuleController
...
@@ -53,11 +53,7 @@ class UserController extends BaseUserModuleController
*/
*/
public
function
index
()
public
function
index
()
{
{
$users
=
$this
->
user
->
all
();
return
view
(
'user::admin.users.index'
);
$currentUser
=
$this
->
auth
->
user
();
return
view
(
'user::admin.users.index'
,
compact
(
'users'
,
'currentUser'
));
}
}
/**
/**
...
@@ -67,9 +63,7 @@ class UserController extends BaseUserModuleController
...
@@ -67,9 +63,7 @@ class UserController extends BaseUserModuleController
*/
*/
public
function
create
()
public
function
create
()
{
{
$roles
=
$this
->
role
->
all
();
return
view
(
'user::admin.users.create'
);
return
view
(
'user::admin.users.create'
,
compact
(
'roles'
));
}
}
/**
/**
...
@@ -91,20 +85,11 @@ class UserController extends BaseUserModuleController
...
@@ -91,20 +85,11 @@ class UserController extends BaseUserModuleController
/**
/**
* Show the form for editing the specified resource.
* Show the form for editing the specified resource.
*
*
* @param int $id
* @return Response
* @return Response
*/
*/
public
function
edit
(
$id
)
public
function
edit
()
{
{
if
(
!
$user
=
$this
->
user
->
find
(
$id
))
{
return
view
(
'user::admin.users.edit'
);
return
redirect
()
->
route
(
'admin.user.user.index'
)
->
withError
(
trans
(
'user::messages.user not found'
));
}
$roles
=
$this
->
role
->
all
();
$currentUser
=
$this
->
auth
->
user
();
return
view
(
'user::admin.users.edit'
,
compact
(
'user'
,
'roles'
,
'currentUser'
));
}
}
/**
/**
...
...
Modules/User/Resources/views/admin/users/create.blade.php
View file @
f79554db
@
extends
(
'layouts.master'
)
@
extends
(
'layouts.master'
)
@
section
(
'content-header'
)
@
section
(
'content-header'
)
<
h1
>
{{
trans
(
'user::users.title.new-user'
)
}}
</
h1
>
<
ol
class
="
breadcrumb
">
<li><a href="
{{
route
(
'dashboard.index'
)
}}
"><i class="
fa
fa
-
dashboard
"></i> {{ trans('core::core.breadcrumb.home') }}</a></li>
<li class=""><a href="
{{
route
(
'admin.user.user.index'
)
}}
">{{ trans('user::users.breadcrumb.users') }}</a></li>
<li class="
active
">{{ trans('user::users.breadcrumb.new') }}</li>
</ol>
@
stop
@
stop
@section('footer')
<a data-toggle="
modal
" data-target="
#keyboardShortcutsModal"><i class="fa fa-keyboard-o"></i></a>
@
stop
@
section
(
'shortcuts'
)
<
dl
class
="
dl
-
horizontal
">
<dt><code>b</code></dt>
<dd>{{ trans('user::users.navigation.back to index') }}</dd>
</dl>
@stop
@
section
(
'content'
)
@
section
(
'content'
)
{!! Form::open(['route' => 'admin.user.user.store', 'method' => 'post']) !!}
<div class="
row
">
<div class="
col
-
md
-
12
">
<div class="
nav
-
tabs
-
custom
">
<ul class="
nav
nav
-
tabs
">
<li class="
active
"><a href="
#tab_1-1" data-toggle="tab">{{ trans('user::users.tabs.data') }}</a></li>
<
li
class
=""><
a
href
=
"#tab_2-2"
data
-
toggle
=
"tab"
>
{{
trans
(
'user::users.tabs.roles'
)
}}
</
a
></
li
>
<
li
class
=""><
a
href
=
"#tab_3-3"
data
-
toggle
=
"tab"
>
{{
trans
(
'user::users.tabs.permissions'
)
}}
</
a
></
li
>
</
ul
>
<
div
class
="
tab
-
content
">
<div class="
tab
-
pane
active
" id="
tab_1
-
1
">
<div class="
box
-
body
">
<div class="
row
">
<div class="
col
-
sm
-
4
">
<div class="
form
-
group
{{
$errors
->
has
(
'first_name'
)
?
' has-error'
:
''
}}
">
{!! Form::label('first_name', trans('user::users.form.first-name')) !!}
{!! Form::text('first_name', old('first_name'), ['class' => 'form-control', 'placeholder' => trans('user::users.form.first-name')]) !!}
{!!
$errors->first
('first_name', '<span class="
help
-
block
">:message</span>') !!}
</div>
</div>
<div class="
col
-
sm
-
4
">
<div class="
form
-
group
{{
$errors
->
has
(
'last_name'
)
?
' has-error'
:
''
}}
">
{!! Form::label('last_name', trans('user::users.form.last-name')) !!}
{!! Form::text('last_name', old('last_name'), ['class' => 'form-control', 'placeholder' => trans('user::users.form.last-name')]) !!}
{!!
$errors->first
('last_name', '<span class="
help
-
block
">:message</span>') !!}
</div>
</div>
<div class="
col
-
sm
-
4
">
<div class="
form
-
group
{{
$errors
->
has
(
'email'
)
?
' has-error'
:
''
}}
">
{!! Form::label('email', trans('user::users.form.email')) !!}
{!! Form::email('email', old('email'), ['class' => 'form-control', 'placeholder' => trans('user::users.form.email')]) !!}
{!!
$errors->first
('email', '<span class="
help
-
block
">:message</span>') !!}
</div>
</div>
</div>
<div class="
row
">
<div class="
col
-
sm
-
6
">
<div class="
form
-
group
{{
$errors
->
has
(
'password'
)
?
' has-error'
:
''
}}
">
{!! Form::label('password', trans('user::users.form.password')) !!}
{!! Form::password('password', ['class' => 'form-control']) !!}
{!!
$errors->first
('password', '<span class="
help
-
block
">:message</span>') !!}
</div>
</div>
<div class="
col
-
sm
-
6
">
<div class="
form
-
group
{{
$errors
->
has
(
'password_confirmation'
)
?
' has-error'
:
''
}}
">
{!! Form::label('password_confirmation', trans('user::users.form.password-confirmation')) !!}
{!! Form::password('password_confirmation', ['class' => 'form-control']) !!}
{!!
$errors->first
('password_confirmation', '<span class="
help
-
block
">:message</span>') !!}
</div>
</div>
</div>
</div>
</div>
<div class="
tab
-
pane
" id="
tab_2
-
2
">
<div class="
box
-
body
">
<div class="
row
">
<div class="
col
-
md
-
6
">
<div class="
form
-
group
">
<label>{{ trans('user::users.tabs.roles') }}</label>
<select multiple="" class="
form
-
control
" name="
roles
[]
">
<?php foreach (
$roles
as
$role
): ?>
<option value="
{{
$role
->
id
}}
">{{
$role->name
}}</option>
<?php endforeach; ?>
</select>
</div>
</div>
</div>
</div>
</div>
<div class="
tab
-
pane
" id="
tab_3
-
3
">
@include('user::admin.partials.permissions-create')
</div>
<div class="
box
-
footer
">
<button type="
submit
" class="
btn
btn
-
primary
btn
-
flat
">{{ trans('user::button.create') }}</button>
<a class="
btn
btn
-
danger
pull
-
right
btn
-
flat
" href="
{{
route
(
'admin.user.user.index'
)}}
"><i class="
fa
fa
-
times
"></i> {{ trans('user::button.cancel') }}</a>
</div>
</div>
</div>
</div>
</div>
{!! Form::close() !!}
@
stop
@
stop
@
section
(
'footer'
)
@
section
(
'footer'
)
<
a
data
-
toggle
=
"modal"
data
-
target
=
"#keyboardShortcutsModal"
><
i
class
="
fa
fa
-
keyboard
-
o
"></i></a>
<
a
data
-
toggle
=
"modal"
data
-
target
=
"#keyboardShortcutsModal"
><
i
class
="
fa
fa
-
keyboard
-
o
"></i></a>
@stop
@stop
...
@@ -113,19 +15,3 @@
...
@@ -113,19 +15,3 @@
<dd>{{ trans('user::users.navigation.back to index') }}</dd>
<dd>{{ trans('user::users.navigation.back to index') }}</dd>
</dl>
</dl>
@stop
@stop
@push('js-stack')
<script>
$( document ).ready(function() {
$(document).keypressAction({
actions: [
{ key: 'b', route: "
<?=
route
(
'admin.user.user.index'
)
?>
" }
]
});
$('input[type="checkbox"].flat-blue, input[type="radio"].flat-blue').iCheck({
checkboxClass: 'icheckbox_flat-blue',
radioClass: 'iradio_flat-blue'
});
});
</script>
@endpush
Modules/User/Resources/views/admin/users/edit.blade.php
View file @
f79554db
@
extends
(
'layouts.master'
)
@
extends
(
'layouts.master'
)
@
section
(
'content-header'
)
@
section
(
'content-header'
)
<
h1
>
{{
trans
(
'user::users.title.edit-user'
)
}}
<
small
>
{{
$user
->
present
()
->
fullname
()
}}
</
small
>
</
h1
>
<
ol
class
="
breadcrumb
">
<li><a href="
{{
route
(
'dashboard.index'
)
}}
"><i class="
fa
fa
-
dashboard
"></i> {{ trans('core::core.breadcrumb.home') }}</a></li>
<li class=""><a href="
{{
route
(
'admin.user.user.index'
)
}}
">{{ trans('user::users.breadcrumb.users') }}</a></li>
<li class="
active
">{{ trans('user::users.breadcrumb.edit-user') }}</li>
</ol>
@
stop
@
stop
@
section
(
'content'
)
@
section
(
'content'
)
{!! Form::open(['route' => ['admin.user.user.update',
$user->id
], 'method' => 'put']) !!}
<div class="
row
">
<div class="
col
-
md
-
12
">
<div class="
nav
-
tabs
-
custom
">
<ul class="
nav
nav
-
tabs
">
<li class="
active
"><a href="
#tab_1-1" data-toggle="tab">{{ trans('user::users.tabs.data') }}</a></li>
<
li
class
=""><
a
href
=
"#tab_2-2"
data
-
toggle
=
"tab"
>
{{
trans
(
'user::users.tabs.roles'
)
}}
</
a
></
li
>
<
li
class
=""><
a
href
=
"#tab_3-3"
data
-
toggle
=
"tab"
>
{{
trans
(
'user::users.tabs.permissions'
)
}}
</
a
></
li
>
<
li
class
=""><
a
href
=
"#password_tab"
data
-
toggle
=
"tab"
>
{{
trans
(
'user::users.tabs.new password'
)
}}
</
a
></
li
>
</
ul
>
<
div
class
="
tab
-
content
">
<div class="
tab
-
pane
active
" id="
tab_1
-
1
">
<div class="
box
-
body
">
<div class="
row
">
<div class="
col
-
sm
-
4
">
<div class="
form
-
group
{{
$errors
->
has
(
'first_name'
)
?
' has-error'
:
''
}}
">
{!! Form::label('first_name', trans('user::users.form.first-name')) !!}
{!! Form::text('first_name', old('first_name',
$user->first_name
), ['class' => 'form-control', 'placeholder' => trans('user::users.form.first-name')]) !!}
{!!
$errors->first
('first_name', '<span class="
help
-
block
">:message</span>') !!}
</div>
</div>
<div class="
col
-
sm
-
4
">
<div class="
form
-
group
{{
$errors
->
has
(
'last_name'
)
?
' has-error'
:
''
}}
">
{!! Form::label('last_name', trans('user::users.form.last-name')) !!}
{!! Form::text('last_name', old('last_name',
$user->last_name
), ['class' => 'form-control', 'placeholder' => trans('user::users.form.last-name')]) !!}
{!!
$errors->first
('last_name', '<span class="
help
-
block
">:message</span>') !!}
</div>
</div>
<div class="
col
-
sm
-
4
">
<div class="
form
-
group
{{
$errors
->
has
(
'email'
)
?
' has-error'
:
''
}}
">
{!! Form::label('email', trans('user::users.form.email')) !!}
{!! Form::email('email', old('email',
$user->email
), ['class' => 'form-control', 'placeholder' => trans('user::users.form.email')]) !!}
{!!
$errors->first
('email', '<span class="
help
-
block
">:message</span>') !!}
</div>
</div>
</div>
<div class="
row
">
<div class="
col
-
md
-
3
">
<div class="
checkbox
{{
$errors
->
has
(
'activated'
)
?
' has-error'
:
''
}}
">
<input type="
hidden
" value="
{{
$user
->
id
===
$currentUser
->
id
?
'1'
:
'0'
}}
" name="
activated
"/>
<?php
$oldValue
= (bool)
$user->isActivated
() ? 'checked' : ''; ?>
<label for="
activated
">
<input id="
activated
"
name="
activated
"
type="
checkbox
"
class="
flat
-
blue
"
{{
$user->id
===
$currentUser->id
? 'disabled' : '' }}
{{ old('activated',
$oldValue
) }}
value="
1
" />
{{ trans('user::users.form.is activated') }}
{!!
$errors->first
('activated', '<span class="
help
-
block
">:message</span>') !!}
</label>
</div>
</div>
</div>
</div>
</div>
<div class="
tab
-
pane
" id="
tab_2
-
2
">
<div class="
row
">
<div class="
col
-
md
-
6
">
<div class="
form
-
group
">
<label>{{ trans('user::users.tabs.roles') }}</label>
<select multiple="" class="
form
-
control
" name="
roles
[]
">
<?php foreach (
$roles
as
$role
): ?>
<option value="
{{
$role
->
id
}}
" <?php echo
$user->hasRoleId
(
$role->id
) ? 'selected' : '' ?>>{{
$role->name
}}</option>
<?php endforeach; ?>
</select>
</div>
</div>
</div>
</div>
<div class="
tab
-
pane
" id="
tab_3
-
3
">
@include('user::admin.partials.permissions', ['model' =>
$user
])
</div>
<div class="
tab
-
pane
" id="
password_tab
">
<div class="
box
-
body
">
<div class="
row
">
<div class="
col
-
md
-
6
">
<h4>{{ trans('user::users.new password setup') }}</h4>
<div class="
form
-
group
{{
$errors
->
has
(
'password'
)
?
' has-error'
:
''
}}
">
{!! Form::label('password', trans('user::users.form.new password')) !!}
{!! Form::input('password', 'password', '', ['class' => 'form-control']) !!}
{!!
$errors->first
('password', '<span class="
help
-
block
">:message</span>') !!}
</div>
<div class="
form
-
group
{{
$errors
->
has
(
'password_confirmation'
)
?
' has-error'
:
''
}}
">
{!! Form::label('password_confirmation', trans('user::users.form.new password confirmation')) !!}
{!! Form::input('password', 'password_confirmation', '', ['class' => 'form-control']) !!}
{!!
$errors->first
('password_confirmation', '<span class="
help
-
block
">:message</span>') !!}
</div>
</div>
<div class="
col
-
md
-
6
">
<h4>{{ trans('user::users.tabs.or send reset password mail') }}</h4>
<a href="
{{
route
(
"admin.user.user.sendResetPassword"
,
$user
->
id
)
}}
" class="
btn
btn
-
flat
bg
-
maroon
">
{{ trans('user::users.send reset password email') }}
</a>
</div>
</div>
</div>
</div>
<div class="
box
-
footer
">
<button type="
submit
" class="
btn
btn
-
primary
btn
-
flat
" name="
button
" value="
index
">
<i class="
fa
fa
-
angle
-
left
"></i>
{{ trans('core::core.button.update and back') }}
</button>
<button type="
submit
" class="
btn
btn
-
primary
btn
-
flat
">{{ trans('core::core.button.update') }}</button>
<button type="
reset
" class="
btn
btn
-
default
btn
-
flat
" name="
button
">{{ trans('core::core.button.reset') }}</button>
<a class="
btn
btn
-
danger
pull
-
right
btn
-
flat
" href="
{{
route
(
'admin.user.user.index'
)}}
"><i class="
fa
fa
-
times
"></i> {{ trans('core::core.button.cancel') }}</a>
</div>
</div>
</div>
</div>
</div>
{!! Form::close() !!}
@
stop
@
stop
@
section
(
'footer'
)
@
section
(
'footer'
)
<
a
data
-
toggle
=
"modal"
data
-
target
=
"#keyboardShortcutsModal"
><
i
class
="
fa
fa
-
keyboard
-
o
"></i></a>
<
a
data
-
toggle
=
"modal"
data
-
target
=
"#keyboardShortcutsModal"
><
i
class
="
fa
fa
-
keyboard
-
o
"></i></a>
@stop
@stop
...
@@ -135,20 +15,3 @@
...
@@ -135,20 +15,3 @@
<dd>{{ trans('user::users.navigation.back to index') }}</dd>
<dd>{{ trans('user::users.navigation.back to index') }}</dd>
</dl>
</dl>
@stop
@stop
@push('js-stack')
<script>
$( document ).ready(function() {
$('[data-toggle="
tooltip
"]').tooltip();
$(document).keypressAction({
actions: [
{ key: 'b', route: "
<?=
route
(
'admin.user.role.index'
)
?>
" }
]
});
$('input[type="checkbox"].flat-blue, input[type="radio"].flat-blue').iCheck({
checkboxClass: 'icheckbox_flat-blue',
radioClass: 'iradio_flat-blue'
});
});
</script>
@endpush
Modules/User/Resources/views/admin/users/index.blade.php
View file @
f79554db
@
extends
(
'layouts.master'
)
@
extends
(
'layouts.master'
)
@
section
(
'content-header'
)
@
section
(
'content-header'
)
<h1>
{{ trans('user::users.title.users') }}
</h1>
<ol
class=
"breadcrumb"
>
<li><a
href=
"{{ route('dashboard.index') }}"
><i
class=
"fa fa-dashboard"
></i>
{{ trans('core::core.breadcrumb.home') }}
</a></li>
<li
class=
"active"
>
{{ trans('user::users.breadcrumb.users') }}
</li>
</ol>
@
stop
@
stop
@
section
(
'content'
)
@
section
(
'content'
)
<div
class=
"row"
>
<div
class=
"col-xs-12"
>
<div
class=
"row"
>
<div
class=
"btn-group pull-right"
style=
"margin: 0 15px 15px 0;"
>
<a
href=
"{{ route('admin.user.user.create') }}"
class=
"btn btn-primary btn-flat"
style=
"padding: 4px 10px;"
>
<i
class=
"fa fa-pencil"
></i>
{{ trans('user::users.button.new-user') }}
</a>
</div>
</div>
<div
class=
"box box-primary"
>
<div
class=
"box-header"
>
</div>
<!-- /.box-header -->
<div
class=
"box-body"
>
<table
class=
"data-table table table-bordered table-hover"
>
<thead>
<tr>
<th>
Id
</th>
<th>
{{ trans('user::users.table.first-name') }}
</th>
<th>
{{ trans('user::users.table.last-name') }}
</th>
<th>
{{ trans('user::users.table.email') }}
</th>
<th>
{{ trans('user::users.table.created-at') }}
</th>
<th
data-sortable=
"false"
>
{{ trans('user::users.table.actions') }}
</th>
</tr>
</thead>
<tbody>
<?php
if
(
isset
(
$users
))
:
?>
<?php
foreach
(
$users
as
$user
)
:
?>
<tr>
<td>
<a
href=
"{{ route('admin.user.user.edit', [$user->id]) }}"
>
{{ $user->id }}
</a>
</td>
<td>
<a
href=
"{{ route('admin.user.user.edit', [$user->id]) }}"
>
{{ $user->first_name }}
</a>
</td>
<td>
<a
href=
"{{ route('admin.user.user.edit', [$user->id]) }}"
>
{{ $user->last_name }}
</a>
</td>
<td>
<a
href=
"{{ route('admin.user.user.edit', [$user->id]) }}"
>
{{ $user->email }}
</a>
</td>
<td>
<a
href=
"{{ route('admin.user.user.edit', [$user->id]) }}"
>
{{ $user->created_at }}
</a>
</td>
<td>
<div
class=
"btn-group"
>
<a
href=
"{{ route('admin.user.user.edit', [$user->id]) }}"
class=
"btn btn-default btn-flat"
><i
class=
"fa fa-pencil"
></i></a>
<?php
if
(
$user
->
id
!=
$currentUser
->
id
)
:
?>
<button
class=
"btn btn-danger btn-flat"
data-toggle=
"modal"
data-target=
"#modal-delete-confirmation"
data-action-target=
"{{ route('admin.user.user.destroy', [$user->id]) }}"
><i
class=
"fa fa-trash"
></i></button>
<?php
endif
;
?>
</div>
</td>
</tr>
<?php
endforeach
;
?>
<?php
endif
;
?>
</tbody>
<tfoot>
<tr>
<th>
Id
</th>
<th>
{{ trans('user::users.table.first-name') }}
</th>
<th>
{{ trans('user::users.table.last-name') }}
</th>
<th>
{{ trans('user::users.table.email') }}
</th>
<th>
{{ trans('user::users.table.created-at') }}
</th>
<th>
{{ trans('user::users.table.actions') }}
</th>
</tr>
</tfoot>
</table>
<!-- /.box-body -->
</div>
<!-- /.box -->
</div>
<!-- /.col (MAIN) -->
</div>
</div>
@include('core::partials.delete-modal')
@
stop
@
stop
@push('js-stack')
@
section
(
'footer'
)
<?php
$locale
=
App
::
getLocale
();
?>
<
a
data
-
toggle
=
"modal"
data
-
target
=
"#keyboardShortcutsModal"
><
i
class
="
fa
fa
-
keyboard
-
o
"></i></a>
<script
type=
"text/javascript"
>
@stop
$
(
document
).
ready
(
function
()
{
@section('shortcuts')
$
(
document
).
keypressAction
({
<dl class="
dl
-
horizontal
">
actions
:
[
<dt><code>c</code></dt>
{
key
:
'
c
'
,
route
:
"
<?=
route
(
'admin.user.user.create'
)
?>
"
}
<dd>{{ trans('user::users.button.new-user') }}</dd>
]
</dl>
});
@stop
});
$
(
function
()
{
$
(
'
.data-table
'
).
dataTable
({
"
paginate
"
:
true
,
"
lengthChange
"
:
true
,
"
filter
"
:
true
,
"
sort
"
:
true
,
"
info
"
:
true
,
"
autoWidth
"
:
true
,
"
order
"
:
[[
0
,
"
desc
"
]],
"
language
"
:
{
"
url
"
:
'
<?php
echo
Module
::
asset
(
"core:js/vendor/datatables/
{
$locale
}
.json"
)
?>
'
}
});
});
</script>
@endpush
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