fix roles

This commit is contained in:
Ludovic CANDELLIER
2022-01-30 00:30:21 +01:00
parent b4057c28d0
commit 5799eb36fc
32 changed files with 206 additions and 330 deletions

View File

@@ -10,8 +10,8 @@
<div class="alert alert-info"> <div class="alert alert-info">
@lang('boilerplate::auth.firstlogin.intro') @lang('boilerplate::auth.firstlogin.intro')
</div> </div>
@component('boilerplate::input', ['name' => 'password', 'placeholder' => 'boilerplate::auth.fields.password', 'append-text' => 'fas fa-lock', 'type' => 'password', 'autofocus' => true])@endcomponent @component('boilerplate::password', ['name' => 'password', 'placeholder' => 'boilerplate::auth.fields.password', 'autofocus' => true])@endcomponent
@component('boilerplate::input', ['name' => 'password_confirmation', 'placeholder' => 'boilerplate::auth.fields.password_confirm', 'append-text' => 'fas fa-lock', 'type' => 'password'])@endcomponent @component('boilerplate::password', ['name' => 'password_confirmation', 'placeholder' => 'boilerplate::auth.fields.password_confirm', 'check' => false])@endcomponent
<div class="form-group text-center"> <div class="form-group text-center">
<button type="submit" class="btn btn-primary">@lang('boilerplate::auth.firstlogin.button')</button> <button type="submit" class="btn btn-primary">@lang('boilerplate::auth.firstlogin.button')</button>
</div> </div>

View File

@@ -7,13 +7,19 @@
<meta name="robots" content="noindex, nofollow"> <meta name="robots" content="noindex, nofollow">
<meta name="csrf-token" content="{{ csrf_token() }}"> <meta name="csrf-token" content="{{ csrf_token() }}">
<title>{{ $title }} | {{ config('app.name') }}</title> <title>{{ $title }} | {{ config('app.name') }}</title>
<link rel="shortcut icon" href="{{ config('boilerplate.theme.favicon') ?? mix('favicon.svg', '/assets/vendor/boilerplate') }}">
@stack('plugin-css')
<link rel="stylesheet" href="{{ mix('/plugins/fontawesome/fontawesome.min.css', '/assets/vendor/boilerplate') }}"> <link rel="stylesheet" href="{{ mix('/plugins/fontawesome/fontawesome.min.css', '/assets/vendor/boilerplate') }}">
<link rel="stylesheet" href="{{ mix('/adminlte.min.css', '/assets/vendor/boilerplate') }}"> <link rel="stylesheet" href="{{ mix('/adminlte.min.css', '/assets/vendor/boilerplate') }}">
<link rel="shortcut icon" href="{{ config('boilerplate.theme.favicon') ?? mix('favicon.svg', '/assets/vendor/boilerplate') }}">
<link rel="preconnect" href="https://fonts.gstatic.com"> <link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=Source+Sans+Pro:ital,wght@0,300;0,400;0,700;1,400&display=swap" rel="stylesheet"> <link href="https://fonts.googleapis.com/css2?family=Source+Sans+Pro:ital,wght@0,300;0,400;0,700;1,400&display=swap" rel="stylesheet">
@stack('css')
</head> </head>
<body class="hold-transition {{ $bodyClass ?? 'login-page'}}"> <body class="hold-transition {{ $bodyClass ?? 'login-page'}}">
@yield('content') @yield('content')
<script src="{{ mix('/bootstrap.min.js', '/assets/vendor/boilerplate') }}"></script>
<script src="{{ mix('/admin-lte.min.js', '/assets/vendor/boilerplate') }}"></script>
<script src="{{ mix('/boilerplate.min.js', '/assets/vendor/boilerplate') }}"></script>
@stack('js')
</body> </body>
</html> </html>

View File

@@ -7,8 +7,8 @@
@component('boilerplate::auth.loginbox') @component('boilerplate::auth.loginbox')
<p class="login-box-msg text-sm">@lang('boilerplate::auth.login.intro')</p> <p class="login-box-msg text-sm">@lang('boilerplate::auth.login.intro')</p>
{!! Form::open(['route' => 'boilerplate.login', 'method' => 'post', 'autocomplete'=> 'off']) !!} {!! Form::open(['route' => 'boilerplate.login', 'method' => 'post', 'autocomplete'=> 'off']) !!}
@component('boilerplate::input', ['name' => 'email', 'placeholder' => 'boilerplate::auth.fields.email', 'append-text' => 'fas fa-envelope', 'type' => 'email'])@endcomponent @component('boilerplate::input', ['name' => 'email', 'placeholder' => 'boilerplate::auth.fields.email', 'append-text' => 'fas fa-fw fa-envelope', 'type' => 'email'])@endcomponent
@component('boilerplate::input', ['name' => 'password', 'placeholder' => 'boilerplate::auth.fields.password', 'append-text' => 'fas fa-lock', 'type' => 'password'])@endcomponent @component('boilerplate::password', ['name' => 'password', 'placeholder' => 'boilerplate::auth.fields.password', 'check' => false])@endcomponent
<div class="d-flex flex-wrap align-items-center justify-content-between"> <div class="d-flex flex-wrap align-items-center justify-content-between">
@component('boilerplate::icheck', ['name' => 'remember', 'checked' => old('remember') == 'on', 'label' => 'boilerplate::auth.login.rememberme', 'class' => 'text-sm'])@endcomponent @component('boilerplate::icheck', ['name' => 'remember', 'checked' => old('remember') == 'on', 'label' => 'boilerplate::auth.login.rememberme', 'class' => 'text-sm'])@endcomponent
<button type="submit" class="btn btn-primary mb-3">@lang('boilerplate::auth.login.signin')</button> <button type="submit" class="btn btn-primary mb-3">@lang('boilerplate::auth.login.signin')</button>

View File

@@ -5,9 +5,9 @@
<p class="login-box-msg text-sm">@lang('boilerplate::auth.password_reset.intro')</p> <p class="login-box-msg text-sm">@lang('boilerplate::auth.password_reset.intro')</p>
{!! Form::open(['route' => 'boilerplate.password.reset.post', 'method' => 'post', 'autocomplete'=> 'off']) !!} {!! Form::open(['route' => 'boilerplate.password.reset.post', 'method' => 'post', 'autocomplete'=> 'off']) !!}
{!! Form::hidden('token', $token) !!} {!! Form::hidden('token', $token) !!}
@component('boilerplate::input', ['name' => 'email', 'placeholder' => 'boilerplate::auth.fields.email', 'append-text' => 'fas fa-envelope', 'type' => 'email', 'value' => $email, 'autofocus' => true])@endcomponent @component('boilerplate::input', ['name' => 'email', 'placeholder' => 'boilerplate::auth.fields.email', 'append-text' => 'fas fa-fw fa-envelope', 'type' => 'email', 'value' => $email, 'autofocus' => true])@endcomponent
@component('boilerplate::input', ['name' => 'password', 'placeholder' => 'boilerplate::auth.fields.password', 'append-text' => 'fas fa-lock', 'type' => 'password'])@endcomponent @component('boilerplate::password', ['name' => 'password', 'placeholder' => 'boilerplate::auth.fields.password'])@endcomponent
@component('boilerplate::input', ['name' => 'password_confirmation', 'placeholder' => 'boilerplate::auth.fields.password_confirm', 'append-text' => 'fas fa-lock', 'type' => 'password'])@endcomponent @component('boilerplate::password', ['name' => 'password_confirmation', 'placeholder' => 'boilerplate::auth.fields.password_confirm', 'check' => false])@endcomponent
<div class="row"> <div class="row">
<div class="col-12 text-center"> <div class="col-12 text-center">
<button class="btn btn-primary" type="submit">@lang('boilerplate::auth.password_reset.submit')</button> <button class="btn btn-primary" type="submit">@lang('boilerplate::auth.password_reset.submit')</button>

View File

@@ -4,11 +4,11 @@
@component('boilerplate::auth.loginbox') @component('boilerplate::auth.loginbox')
<p class="login-box-msg text-sm">@lang('boilerplate::auth.register.intro')</p> <p class="login-box-msg text-sm">@lang('boilerplate::auth.register.intro')</p>
{!! Form::open(['route' => 'boilerplate.register', 'method' => 'post', 'autocomplete'=> 'off']) !!} {!! Form::open(['route' => 'boilerplate.register', 'method' => 'post', 'autocomplete'=> 'off']) !!}
@component('boilerplate::input', ['name' => 'first_name', 'placeholder' => 'boilerplate::auth.fields.first_name', 'append-text' => 'fas fa-user', 'autofocus' => true])@endcomponent @component('boilerplate::input', ['name' => 'first_name', 'placeholder' => 'boilerplate::auth.fields.first_name', 'append-text' => 'fas fa-fw fa-user', 'autofocus' => true])@endcomponent
@component('boilerplate::input', ['name' => 'last_name', 'placeholder' => 'boilerplate::auth.fields.last_name', 'append-text' => 'fas fa-user'])@endcomponent @component('boilerplate::input', ['name' => 'last_name', 'placeholder' => 'boilerplate::auth.fields.last_name', 'append-text' => 'far fa-fw fa-user'])@endcomponent
@component('boilerplate::input', ['name' => 'email', 'placeholder' => 'boilerplate::auth.fields.email', 'append-text' => 'fas fa-envelope', 'type' => 'email'])@endcomponent @component('boilerplate::input', ['name' => 'email', 'placeholder' => 'boilerplate::auth.fields.email', 'append-text' => 'fas fa-fw fa-envelope', 'type' => 'email'])@endcomponent
@component('boilerplate::input', ['name' => 'password', 'placeholder' => 'boilerplate::auth.fields.password', 'append-text' => 'fas fa-lock', 'type' => 'password'])@endcomponent @component('boilerplate::password', ['name' => 'password', 'placeholder' => 'boilerplate::auth.fields.password'])@endcomponent
@component('boilerplate::input', ['name' => 'password_confirmation', 'placeholder' => 'boilerplate::auth.fields.password_confirm', 'append-text' => 'fas fa-lock', 'type' => 'password'])@endcomponent @component('boilerplate::password', ['name' => 'password_confirmation', 'placeholder' => 'boilerplate::auth.fields.password_confirm', 'check' => false])@endcomponent
<div class="mb-3"> <div class="mb-3">
<div class="col-12 text-right"> <div class="col-12 text-right">
<button type="submit" class="btn btn-primary"> <button type="submit" class="btn btn-primary">

View File

@@ -1,6 +1,6 @@
<div class="card{{ isset($tabs) ? ($outline ? ' card-outline card-outline-tabs' : ' card-tabs') : ($outline ? ' card-outline' : '') }} card-{{ $color ?? config('boilerplate.theme.card.default_color', 'info') }}{{ ($bgColor ?? null) ? ' bg-'.$bgColor : '' }}{{ $collapsed ? ' collapsed-card' : '' }}{{ !empty($class) ? ' '.$class : '' }}"{!! empty($attributes) ? '' : ' '.$attributes !!}> <div class="card{{ $tabs ? ($outline ? ' card-outline card-outline-tabs' : ' card-tabs') : ($outline ? ' card-outline' : '') }} card-{{ $color ?? config('boilerplate.theme.card.default_color', 'info') }}{{ ($bgColor ?? null) ? ' bg-'.$bgColor : '' }}{{ $collapsed ? ' collapsed-card' : '' }}{{ !empty($class) ? ' '.$class : '' }}"{!! empty($attributes) ? '' : ' '.$attributes !!}>
@if($title ?? false || $header ?? false || $tools ?? false || $maximize || $reduce || $close) @if($title ?? false || $header ?? false || $tools ?? false || $maximize || $reduce || $close)
<div class="card-header{{ isset($tabs) ? ($outline ? ' p-0' : ' p-0 pt-1') : '' }} border-bottom-0"> <div class="card-header{{ $tabs ? ($outline ? ' p-0' : ' p-0 pt-1') : '' }} border-bottom-0">
@if($header ?? false) @if($header ?? false)
{!! $header !!} {!! $header !!}
@else @else

View File

@@ -1,6 +1,6 @@
<div class="form-group{{ !empty($class) ? ' '.$class : '' }}"> <div class="form-group{{ !empty($class) ? ' '.$class : '' }}">
<div class="icheck-{{ $color ?? 'primary' }}"{!! !empty($attributes) ? ' '.$attributes : '' !!}> <div class="icheck-{{ $color ?? 'primary' }}"{!! !empty($attributes) ? ' '.$attributes : '' !!}>
<input type="{{ $type ?? 'checkbox' }}" id="{{ $id }}"{{ $checked ? ' checked' : '' }}{{ $disabled ? ' disabled' : '' }}{!! !empty($name) ? ' name="'.$name.'"' : '' !!}{!! !empty($value) ? ' value="'.$value.'"' : '' !!}> <input type="{{ $type ?? 'checkbox' }}" id="{{ $id }}"{{ (!empty($name) ? old($name, $checked ?? false) : $checked ?? false) ? ' checked' : '' }}{{ $disabled ? ' disabled' : '' }}{!! !empty($name) ? ' name="'.$name.'"' : '' !!}{!! !empty($value) ? ' value="'.$value.'"' : '' !!} autocomplete="off">
<label for="{{ $id }}" class="font-weight-normal">@lang($label ?? '')</label> <label for="{{ $id }}" class="font-weight-normal">@lang($label ?? '')</label>
</div> </div>
</div> </div>

View File

@@ -4,9 +4,9 @@
The name attribute has not been set The name attribute has not been set
</code> </code>
@else @else
<div class="form-group{{ isset($groupClass) ? ' '.$groupClass : '' }}"{{ isset($groupId) ? ' id="'.$groupId.'"' : '' }}> <div class="form-group{{ isset($groupClass) ? ' '.$groupClass : '' }}"{!! isset($groupId) ? ' id="'.$groupId.'"' : '' !!}>
@isset($label) @isset($label)
{!! Form::label($name, __($label)) !!} <label>{!! __($label) !!}</label>
@endisset @endisset
@if($prepend || $prependText || $append || $appendText) @if($prepend || $prependText || $append || $appendText)
<div class="input-group"> <div class="input-group">

View File

@@ -1,11 +1,11 @@
@if(empty($name)) @if(empty($name))
<code>&lt;x-boilerplate::select2> The name attribute has not been set</code> <code>&lt;x-boilerplate::select2> The name attribute has not been set</code>
@else @else
<div class="form-group"> <div class="form-group{{ isset($groupClass) ? ' '.$groupClass : '' }}"{!! isset($groupId) ? ' id="'.$groupId.'"' : '' !!}>
@isset($label) @isset($label)
{{ Form::label($name, __($label)) }} <label for="{{ $id }}">{!! __($label) !!}</label>
@endisset @endisset
<select id="{{ $id }}" name="{{ $name }}" class="form-control{{ $errors->first($name,' is-invalid') }}{{ isset($class) ? ' '.$class : '' }}"{!! !empty($attributes) ? ' '.$attributes : '' !!} style="visibility:hidden;height:1rem"> <select id="{{ $id }}" name="{{ $name }}" class="form-control{{ $errors->first($name,' is-invalid') }}{{ isset($class) ? ' '.$class : '' }}"{!! !empty($attributes) ? ' '.$attributes : '' !!} style="visibility:hidden;height:1rem" autocomplete="off">
@if(!isset($multiple)) @if(!isset($multiple))
<option></option> <option></option>
@endif @endif
@@ -24,10 +24,11 @@
<div class="error-bubble"><div>{{ $message }}</div></div> <div class="error-bubble"><div>{{ $message }}</div></div>
@enderror @enderror
</div> </div>
@include('boilerplate::load.select2') @include('boilerplate::load.async.select2')
@push('js') @component('boilerplate::minify')
<script> <script>
$(function () { whenAssetIsLoaded('select2', () => {
let parent = $('#{{ $id }}').parent();
$('#{{ $id }}').select2({ $('#{{ $id }}').select2({
placeholder: '{{ $placeholder ?? '' }}', placeholder: '{{ $placeholder ?? '' }}',
allowClear: {{ $allowClear }}, allowClear: {{ $allowClear }},
@@ -36,15 +37,17 @@
minimumInputLength: {{ $minimumInputLength ?? 0 }}, minimumInputLength: {{ $minimumInputLength ?? 0 }},
minimumResultsForSearch: {{ $minimumResultsForSearch ?? 10 }}, minimumResultsForSearch: {{ $minimumResultsForSearch ?? 10 }},
width: '100%', width: '100%',
@isset($ajax) dropdownAutoWidth: true,
dropdownParent: parent,
@isset($ajax)
ajax: { ajax: {
delay: 200, delay: 200,
url: '{{ $ajax }}', url: '{{ $ajax }}',
method: 'post' method: 'post'
} }
@endisset @endisset
}); })
}); })
</script> </script>
@endpush @endcomponent
@endif @endif

View File

@@ -1,13 +1,37 @@
@if(empty($name)) @if(empty($name))
<code>&lt;x-boilerplate::tinymce>The name attribute has not been set</code> <code>&lt;x-boilerplate::tinymce>The name attribute has not been set</code>
@else @else
<textarea id="{{ $id }}"{!! !empty($attributes) ? ' '.$attributes : '' !!} style="visibility:hidden">{!! $value ?? $slot ?? '' !!}</textarea> <div class="form-group{{ isset($groupClass) ? ' '.$groupClass : '' }}"{!! isset($groupId) ? ' id="'.$groupId.'"' : '' !!}>
@if($hasMediaManager) @isset($label)
@include('boilerplate-media-manager::load.tinymce') <label for="{{ $id }}">{!! __($label) !!}</label>
@else @endisset
@include('boilerplate::load.tinymce') <textarea id="{{ $id }}" name="{{ $name }}"{!! !empty($attributes) ? ' '.$attributes : '' !!} style="visibility:hidden">{!! old($name, $value ?? $slot ?? '') !!}</textarea>
@if($help ?? false)
<small class="form-text text-muted">@lang($help)</small>
@endif @endif
@push('js') @error($name)
<script>$(function(){$('#{{ $id }}').tinymce({})});</script> <div class="error-bubble"><div>{{ $message }}</div></div>
@endpush @enderror
</div>
@include('boilerplate::load.async.tinymce')
@component('boilerplate::minify')
<script>
whenAssetIsLoaded('{!! mix('/plugins/tinymce/tinymce.min.js', '/assets/vendor/boilerplate') !!}', () => {
tinymce.init({
selector: '#{{ $id }}',
toolbar_sticky: {{ ($sticky ?? false) ? 'true' : 'false' }},
@if(setting('darkmode', false) && config('boilerplate.theme.darkmode'))
skin : "boilerplate-dark",
content_css: 'boilerplate-dark',
@else
skin : "oxide",
content_css: null,
@endif
@if(App::getLocale() !== 'en')
language: '{{ App::getLocale() }}'
@endif
});
});
</script>
@endcomponent
@endif @endif

View File

@@ -22,13 +22,11 @@
{{ Config::get('boilerplate.locale.languages.'.App::getLocale().'.label') }} {{ Config::get('boilerplate.locale.languages.'.App::getLocale().'.label') }}
</a> </a>
<div class="dropdown-menu dropdown-menu-right" style="left: inherit; right: 0px;"> <div class="dropdown-menu dropdown-menu-right" style="left: inherit; right: 0px;">
@foreach(collect(config('boilerplate.locale.languages'))->map(function($e){return $e['label'];})->toArray() as $lang => $label) @foreach(collect(config('boilerplate.locale.languages'))->map(function($e){return $e['label'];})->toArray() as $lang => $label)
@if ($lang !== App::getLocale()) @if ($lang !== App::getLocale())
<a href="{{ route('boilerplate.lang.switch', $lang) }}" class="dropdown-item"> <a href="{{ route('boilerplate.lang.switch', $lang) }}" class="dropdown-item">{{ $label }}</a>
{{ $label }} @endif
</a> @endforeach
@endif
@endforeach
</div> </div>
</li> </li>
@endif @endif
@@ -46,7 +44,7 @@
@if(setting('darkmode', false)) @if(setting('darkmode', false))
<i class="fas fa-fw fa-sun"></i> <i class="fas fa-fw fa-sun"></i>
@else @else
<i class="far fa-moon"></i> <i class="far fa-fw fa-moon"></i>
@endif @endif
</a> </a>
</li> </li>

View File

@@ -14,6 +14,10 @@
<link rel="preconnect" href="https://fonts.gstatic.com"> <link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=Source+Sans+Pro:ital,wght@0,300;0,400;0,700;1,400&display=swap" rel="stylesheet"> <link href="https://fonts.googleapis.com/css2?family=Source+Sans+Pro:ital,wght@0,300;0,400;0,700;1,400&display=swap" rel="stylesheet">
@stack('css') @stack('css')
<script src="{{ mix('/bootstrap.min.js', '/assets/vendor/boilerplate') }}"></script>
<script src="{{ mix('/admin-lte.min.js', '/assets/vendor/boilerplate') }}"></script>
<script src="{{ mix('/boilerplate.min.js', '/assets/vendor/boilerplate') }}"></script>
@stack('plugin-js')
</head> </head>
<body class="layout-fixed layout-navbar-fixed sidebar-mini{{ setting('darkmode', false) && config('boilerplate.theme.darkmode') ? ' dark-mode accent-light' : '' }}{{ setting('sidebar-collapsed', false) ? ' sidebar-collapse' : '' }}"> <body class="layout-fixed layout-navbar-fixed sidebar-mini{{ setting('darkmode', false) && config('boilerplate.theme.darkmode') ? ' dark-mode accent-light' : '' }}{{ setting('sidebar-collapsed', false) ? ' sidebar-collapse' : '' }}">
<div class="wrapper"> <div class="wrapper">
@@ -38,29 +42,28 @@
</aside> </aside>
<div class="control-sidebar-bg"></div> <div class="control-sidebar-bg"></div>
</div> </div>
<script src="{{ mix('/bootstrap.min.js', '/assets/vendor/boilerplate') }}"></script> @component('boilerplate::minify')
<script src="{{ mix('/admin-lte.min.js', '/assets/vendor/boilerplate') }}"></script>
<script src="{{ mix('/boilerplate.min.js', '/assets/vendor/boilerplate') }}"></script>
<script> <script>
$.ajaxSetup({headers: {'X-CSRF-TOKEN': '{{ csrf_token() }}'}}); $.ajaxSetup({headers:{'X-CSRF-TOKEN':'{{ csrf_token() }}'}});
bootbox.setLocale('{{ App::getLocale() }}'); bootbox.setLocale('{{ App::getLocale() }}');
var bpRoutes = { var bpRoutes={
settings: "{{ route('boilerplate.settings', null, false) }}", settings:"{{ route('boilerplate.settings',null,false) }}"
} };
var session = { var session={
keepalive: "{{ route('boilerplate.keepalive', null, false) }}", keepalive:"{{ route('boilerplate.keepalive', null, false) }}",
expire: {{ time() + config('session.lifetime') * 60 }}, expire:{{ time() + config('session.lifetime') * 60 }},
lifetime: {{ config('session.lifetime') * 60 }}, lifetime:{{ config('session.lifetime') * 60 }},
id: "{{ session()->getId() }}" id:"{{ session()->getId() }}"
} };
@if(Session::has('growl')) @if(Session::has('growl'))
@if(is_array(Session::get('growl'))) @if(is_array(Session::get('growl')))
growl("{!! Session::get('growl')[0] !!}", "{{ Session::get('growl')[1] }}"); growl("{!! Session::get('growl')[0] !!}", "{{ Session::get('growl')[1] }}");
@else @else
growl("{{Session::get('growl')}}"); growl("{{Session::get('growl')}}");
@endif @endif
@endif @endif
</script> </script>
@endcomponent
@stack('js') @stack('js')
</body> </body>
</html> </html>

View File

@@ -29,6 +29,6 @@
<script src="/assets/vendor/boilerplate/plugins/codemirror/{{ $script }}"></script> <script src="/assets/vendor/boilerplate/plugins/codemirror/{{ $script }}"></script>
@endforeach @endforeach
@endif @endif
<script>$.fn.codemirror.defaults.theme='{{ $theme ?? 'storm' }}';</script> <script>registerAsset('CodeMirror',()=>{$.fn.codemirror.defaults.theme='{{ $theme ?? 'storm' }}'});</script>
@endpush @endpush
@endonce @endonce

View File

@@ -2,24 +2,26 @@
@push('plugin-css') @push('plugin-css')
<link rel="stylesheet" href="{!! mix('/plugins/datatables/datatables.min.css', '/assets/vendor/boilerplate') !!}"> <link rel="stylesheet" href="{!! mix('/plugins/datatables/datatables.min.css', '/assets/vendor/boilerplate') !!}">
@endpush @endpush
@push('js') @push('plugin-js')
@include('boilerplate::load.moment') @include('boilerplate::load.moment')
<script src="{!! mix('/plugins/datatables/datatables.min.js', '/assets/vendor/boilerplate') !!}"></script> <script src="{!! mix('/plugins/datatables/datatables.min.js', '/assets/vendor/boilerplate') !!}"></script>
<script>$.extend(true,$.fn.dataTable.defaults,{autoWidth:false,language:{url:"{!! mix('/plugins/datatables/i18n/'.$locale.'.json', '/assets/vendor/boilerplate') !!}"}});</script> <script>$.extend(true,$.fn.dataTable.defaults,{autoWidth:false,language:{url:"{!! mix('/plugins/datatables/i18n/'.$locale.'.json', '/assets/vendor/boilerplate') !!}"}});</script>
@endpush @endpush
@endonce
{{-- Plugins --}}
@foreach($plugins as $plugin) @foreach($plugins as $plugin)
@if($$plugin ?? false) @if($$plugin ?? false)
@once @push('plugin-css')
@push('css')
<link rel="stylesheet" href="{!! mix('/plugins/datatables/plugins/'.$plugin.'.bootstrap4.min.css', '/assets/vendor/boilerplate') !!}"> <link rel="stylesheet" href="{!! mix('/plugins/datatables/plugins/'.$plugin.'.bootstrap4.min.css', '/assets/vendor/boilerplate') !!}">
@endpush @endpush
@push('js') @push('plugin-js')
<script src="{!! mix('/plugins/datatables/plugins/dataTables.'.$plugin.'.min.js', '/assets/vendor/boilerplate') !!}"></script> <script src="{!! mix('/plugins/datatables/plugins/dataTables.'.$plugin.'.min.js', '/assets/vendor/boilerplate') !!}"></script>
<script src="{!! mix('/plugins/datatables/plugins/'.$plugin.'.bootstrap4.min.js', '/assets/vendor/boilerplate') !!}"></script> <script src="{!! mix('/plugins/datatables/plugins/'.$plugin.'.bootstrap4.min.js', '/assets/vendor/boilerplate') !!}"></script>
@if($plugin === 'buttons')
<script src="{!! mix('/plugins/datatables/buttons.min.js', '/assets/vendor/boilerplate') !!}"></script>
@endif
@endpush @endpush
@endonce
@endif @endif
@endforeach @endforeach
@push('plugin-js')
<script>registerAsset('datatables')</script>
@endpush
@endonce

View File

@@ -2,10 +2,15 @@
@push('plugin-css') @push('plugin-css')
<link rel="stylesheet" href="{!! mix('/plugins/datepicker/datetimepicker.min.css', '/assets/vendor/boilerplate') !!}"> <link rel="stylesheet" href="{!! mix('/plugins/datepicker/datetimepicker.min.css', '/assets/vendor/boilerplate') !!}">
@endpush @endpush
@push('js') @push('plugin-js')
@include('boilerplate::load.moment') @include('boilerplate::load.moment')
<script src="{!! mix('/plugins/datepicker/datetimepicker.min.js', '/assets/vendor/boilerplate') !!}"></script> <script src="{!! mix('/plugins/datepicker/datetimepicker.min.js', '/assets/vendor/boilerplate') !!}"></script>
@component('boilerplate::minify')
<script> <script>
if(! loadedAssets.includes('datetimepicker')) {
window.loadedAssets.push('datetimepicker');
}
$.fn.datetimepicker.Constructor.Default = $.extend({}, $.fn.datetimepicker.Constructor.Default, { $.fn.datetimepicker.Constructor.Default = $.extend({}, $.fn.datetimepicker.Constructor.Default, {
locale: "{{ App::getLocale() }}", locale: "{{ App::getLocale() }}",
icons: $.extend({}, $.fn.datetimepicker.Constructor.Default.icons, { icons: $.extend({}, $.fn.datetimepicker.Constructor.Default.icons, {
@@ -21,5 +26,6 @@
}) })
}); });
</script> </script>
@endcomponent
@endpush @endpush
@endonce @endonce

View File

@@ -2,7 +2,7 @@
@push('plugin-css') @push('plugin-css')
<link rel="stylesheet" href="{!! mix('/plugins/fileinput/bootstrap-fileinput.min.css', '/assets/vendor/boilerplate') !!}"> <link rel="stylesheet" href="{!! mix('/plugins/fileinput/bootstrap-fileinput.min.css', '/assets/vendor/boilerplate') !!}">
@endpush @endpush
@push('js') @push('plugin-js')
<script src="{!! mix('/plugins/fileinput/bootstrap-fileinput.min.js', '/assets/vendor/boilerplate') !!}"></script> <script src="{!! mix('/plugins/fileinput/bootstrap-fileinput.min.js', '/assets/vendor/boilerplate') !!}"></script>
<script src="/assets/vendor/boilerplate/plugins/fileinput/themes/fas/theme.min.js"></script> <script src="/assets/vendor/boilerplate/plugins/fileinput/themes/fas/theme.min.js"></script>
<script>$.fn.fileinput.defaults = $.extend({}, $.fn.fileinput.defaults, $.fn.fileinputThemes.fas);</script> <script>$.fn.fileinput.defaults = $.extend({}, $.fn.fileinput.defaults, $.fn.fileinputThemes.fas);</script>
@@ -10,5 +10,6 @@
<script src="/assets/vendor/boilerplate/plugins/fileinput/locales/{{ App::getLocale() }}.js"></script> <script src="/assets/vendor/boilerplate/plugins/fileinput/locales/{{ App::getLocale() }}.js"></script>
<script>$.fn.fileinput.defaults.language='{{ App::getLocale() }}';</script> <script>$.fn.fileinput.defaults.language='{{ App::getLocale() }}';</script>
@endif @endif
<script>registerAsset('fileinput');</script>
@endpush @endpush
@endonce @endonce

View File

@@ -2,11 +2,13 @@
@push('plugin-css') @push('plugin-css')
<link rel="stylesheet" href="{!! mix('/plugins/fullcalendar/main.min.css', '/assets/vendor/boilerplate') !!}"> <link rel="stylesheet" href="{!! mix('/plugins/fullcalendar/main.min.css', '/assets/vendor/boilerplate') !!}">
@endpush @endpush
@push('js') @push('plugin-js')
<script src="{!! mix('/plugins/fullcalendar/fullcalendar.min.js', '/assets/vendor/boilerplate') !!}"></script> <script src="{!! mix('/plugins/fullcalendar/fullcalendar.min.js', '/assets/vendor/boilerplate') !!}"></script>
@if(App::getLocale() !== 'en') @if(App::getLocale() !== 'en')
<script src="{!! mix('/plugins/fullcalendar/locales/'.App::getLocale().'.js', '/assets/vendor/boilerplate') !!}"></script> <script src="{!! mix('/plugins/fullcalendar/locales/'.App::getLocale().'.js', '/assets/vendor/boilerplate') !!}"></script>
<script>$.fn.fullCalendar.options = {locale:"{{ App::getLocale() }}"}</script> <script>registerAsset('fullCalendar',()=>{$.fn.fullCalendar.options = {locale:"{{ App::getLocale() }}"}})</script>
@else
<script>registerAsset('fullCalendar')</script>
@endif @endif
@endpush @endpush
@endonce @endonce

View File

@@ -1,4 +1,4 @@
@once @once
<script src="{!! mix('/plugins/moment/moment-with-locales.min.js', '/assets/vendor/boilerplate') !!}"></script> <script src="{!! mix('/plugins/moment/moment-with-locales.min.js', '/assets/vendor/boilerplate') !!}"></script>
<script>moment.locale('{{ App::getLocale() }}');</script> <script>moment.locale('{{ App::getLocale() }}')</script>
@endonce @endonce

View File

@@ -5,6 +5,23 @@
@push('js') @push('js')
<script src="{!! mix('/plugins/select2/select2.full.min.js', '/assets/vendor/boilerplate') !!}"></script> <script src="{!! mix('/plugins/select2/select2.full.min.js', '/assets/vendor/boilerplate') !!}"></script>
<script src="{!! mix('/plugins/select2/i18n/'.App::getLocale().'.js', '/assets/vendor/boilerplate') !!}"></script> <script src="{!! mix('/plugins/select2/i18n/'.App::getLocale().'.js', '/assets/vendor/boilerplate') !!}"></script>
<script>$.extend(true,$.fn.select2.defaults,{language:'{{ App::getLocale()}}',direction:'@lang('boilerplate::layout.direction')'});$(document).on('select2:open',(e)=>{let t = $(e.target);if(t && t.length){let id=t[0].id||t[0].name;document.querySelector(`input[aria-controls*='${id}']`).focus();}});</script> @component('boilerplate::minify')
<script>
registerAsset('select2', () => {
$.extend(true,$.fn.select2.defaults,{
language:'{{ App::getLocale()}}',
direction:'@lang('boilerplate::layout.direction')'}
);
$(document).on('select2:open',(e) => {
let t = $(e.target);
if(t && t.length) {
let id=t[0].id||t[0].name;
document.querySelector(`input[aria-controls*='${id}']`).focus();
}
});
});
</script>
@endcomponent
@endpush @endpush
@endonce @endonce

View File

@@ -1,5 +1,6 @@
@once @once
@push('js') @push('plugin-js')
@component('boilerplate::minify')
<script src="{!! mix('/plugins/tinymce/tinymce.min.js', '/assets/vendor/boilerplate') !!}"></script> <script src="{!! mix('/plugins/tinymce/tinymce.min.js', '/assets/vendor/boilerplate') !!}"></script>
<script> <script>
tinymce.defaultSettings = { tinymce.defaultSettings = {
@@ -7,7 +8,6 @@
toolbar: "undo redo | styleselect | bold italic underline | customalignleft aligncenter customalignright | link media image | bullist numlist | table | code fullscreen", toolbar: "undo redo | styleselect | bold italic underline | customalignleft aligncenter customalignright | link media image | bullist numlist | table | code fullscreen",
contextmenu: "link image imagetools table spellchecker bold italic underline", contextmenu: "link image imagetools table spellchecker bold italic underline",
toolbar_drawer: "sliding", toolbar_drawer: "sliding",
toolbar_sticky: true,
toolbar_sticky_offset: $('nav.main-header').outerHeight(), toolbar_sticky_offset: $('nav.main-header').outerHeight(),
codemirror: { config: { theme: 'storm' } }, codemirror: { config: { theme: 'storm' } },
menubar: false, menubar: false,
@@ -22,21 +22,35 @@
browser_spellcheck: true, browser_spellcheck: true,
encoding: 'UTF-8', encoding: 'UTF-8',
image_uploadtab: false, image_uploadtab: false,
deprecation_warnings: false,
paste_preprocess: function(plugin, args) { paste_preprocess: function(plugin, args) {
args.content = args.content.replace(/<(\/)*(\\?xml:|meta|link|span|font|del|ins|st1:|[ovwxp]:)((.|\s)*?)>/gi, ''); // Unwanted tags args.content = args.content.replace(/<(\/)*(\\?xml:|meta|link|span|font|del|ins|st1:|[ovwxp]:)((.|\s)*?)>/gi, ''); // Unwanted tags
args.content = args.content.replace(/\s(class|style|type|start)=("(.*?)"|(\w*))/gi, ''); // Unwanted attributes args.content = args.content.replace(/\s(class|style|type|start)=("(.*?)"|(\w*))/gi, ''); // Unwanted attributes
args.content = args.content.replace(/<(p|a|div|span|strike|strong|i|u)[^>]*?>(\s|&nbsp;|<br\/>|\r|\n)*?<\/(p|a|div|span|strike|strong|i|u)>/gi, ''); // Empty tags args.content = args.content.replace(/<(p|a|div|span|strike|strong|i|u)[^>]*?>(\s|&nbsp;|<br\/>|\r|\n)*?<\/(p|a|div|span|strike|strong|i|u)>/gi, ''); // Empty tags
}, },
@if(setting('darkmode', false) && config('boilerplate.theme.darkmode')) @if(setting('darkmode', false) && config('boilerplate.theme.darkmode'))
skin : "boilerplate-dark", skin : "boilerplate-dark",
content_css: 'boilerplate-dark', content_css: 'boilerplate-dark',
@else @else
skin : "oxide", skin : "oxide",
@endif @endif
@if(App::getLocale() !== 'en') @if(App::getLocale() !== 'en')
language: '{{ App::getLocale() }}' language: '{{ App::getLocale() }}',
@endif @endif
@includeWhen($hasMediaManager, 'boilerplate-media-manager::load.mceextend')
}; };
/** Fix for editors removed from the DOM (modal, ajax, ...) **/
setInterval(() => {
if (tinymce.editors.length > 0) {
$(tinymce.editors).each((i,e) => {
if($('#'+e.id).length === 0) {
tinymce.get(e.id).remove();
}
});
}
});
</script> </script>
@endcomponent
@endpush @endpush
@endonce @endonce

View File

@@ -4,6 +4,7 @@
@include('boilerplate::plugins.demo.datetimepicker') @include('boilerplate::plugins.demo.datetimepicker')
@include('boilerplate::plugins.demo.icheck') @include('boilerplate::plugins.demo.icheck')
@include('boilerplate::plugins.demo.daterangepicker') @include('boilerplate::plugins.demo.daterangepicker')
@include('boilerplate::plugins.demo.colorpicker')
@include('boilerplate::plugins.demo.codemirror') @include('boilerplate::plugins.demo.codemirror')
@include('boilerplate::plugins.demo.fileinput') @include('boilerplate::plugins.demo.fileinput')
@include('boilerplate::plugins.demo.tabs') @include('boilerplate::plugins.demo.tabs')

View File

@@ -1,6 +1,6 @@
@component('boilerplate::card', ['color' => 'warning', 'title' => 'CodeMirror']) @component('boilerplate::card', ['color' => 'warning', 'title' => 'CodeMirror'])
Usage : Usage :
<pre>&lt;x-boilerplate::codemirror name="code">&lt;php echo "My code"; ?>&lt;/x-boilerplate::codemirror></pre> <pre>&lt;x-boilerplate::codemirror name="code">.color { color: red; }&lt;/x-boilerplate::codemirror></pre>
<x-boilerplate::codemirror name="code"><h1>CodeMirror demo</h1> <x-boilerplate::codemirror name="code"><h1>CodeMirror demo</h1>
<style> <style>
.color { .color {

View File

@@ -1,6 +1,7 @@
@include('boilerplate::load.datatables') @include('boilerplate::load.datatables')
@push('js') @push('js')
@component('boilerplate::minify')
<script> <script>
$(function() { $(function() {
$('#dt').dataTable({ $('#dt').dataTable({
@@ -12,18 +13,12 @@
}); });
}); });
</script> </script>
@endcomponent
@endpush @endpush
@component('boilerplate::card', ['color' => 'orange', 'title' => 'Datatables']) @component('boilerplate::card', ['color' => 'orange', 'title' => 'Datatables'])
Usage : Usage :
<pre class="mb-3"> <pre class="mb-3">&lt;x-boilerplate::datatable name="users" /></pre>
&commat;include('boilerplate::load.datatables')
&commat;push('js')
&lt;script>
$('#dt').dataTable();
&lt;/script>
&commat;endpush</pre>
<table class="table table-sm table-striped table-hover" id="dt"> <table class="table table-sm table-striped table-hover" id="dt">
<thead> <thead>
<tr> <tr>
@@ -58,6 +53,7 @@
@slot('footer') @slot('footer')
<div class="small text-muted text-right"> <div class="small text-muted text-right">
<a href="https://sebastienheyd.github.io/boilerplate/components/datatable" target="_blank">component</a> /
<a href="https://sebastienheyd.github.io/boilerplate/plugins/datatables" target="_blank">plugin</a> / <a href="https://sebastienheyd.github.io/boilerplate/plugins/datatables" target="_blank">plugin</a> /
<a href="https://datatables.net/manual/index">datatables</a> <a href="https://datatables.net/manual/index">datatables</a>
</div> </div>

View File

@@ -1,6 +1,7 @@
@include('boilerplate::load.fullcalendar') @include('boilerplate::load.fullcalendar')
@push('js') @push('js')
@component('boilerplate::minify')
<script> <script>
$('#calendar').fullCalendar({ $('#calendar').fullCalendar({
headerToolbar: { headerToolbar: {
@@ -15,6 +16,7 @@
events: 'https://fullcalendar.io/demo-events.json?overload-day' events: 'https://fullcalendar.io/demo-events.json?overload-day'
}) })
</script> </script>
@endcomponent
@endpush @endpush
@component('boilerplate::card', ['color' => 'success', 'title' => 'FullCalendar']) @component('boilerplate::card', ['color' => 'success', 'title' => 'FullCalendar'])

View File

@@ -6,10 +6,10 @@
<pre>&lt;x-boilerplate::select2 name="example" label="Example" :options="['Opt 1', 'Opt 2']" /></pre> <pre>&lt;x-boilerplate::select2 name="example" label="Example" :options="['Opt 1', 'Opt 2']" /></pre>
</div> </div>
<div class="col-md-6"> <div class="col-md-6">
@component('boilerplate::components.form.selects.select2', ['label' => 'Minimal', 'name' => 'select2_dminimal', 'selected' => 1, 'options' => $options, 'allow-clear' => 'true', 'minimum-results-for-search' => 5])@endcomponent @component('boilerplate::components.select2', ['label' => 'Minimal', 'name' => 'select2_dminimal', 'selected' => 1, 'options' => $options, 'allow-clear' => 'true', 'minimum-results-for-search' => 5])@endcomponent
</div> </div>
<div class="col-md-6"> <div class="col-md-6">
@component('boilerplate::components.form.selects.select2', ['label' => 'Multiple', 'name' => 'select2_multiple', 'selected' => [1,3], 'options' => $options, 'multiple' => true])@endcomponent @component('boilerplate::components.select2', ['label' => 'Multiple', 'name' => 'select2_multiple', 'selected' => [1,3], 'options' => $options, 'multiple' => true])@endcomponent
</div> </div>
</div> </div>
@slot('footer') @slot('footer')

View File

@@ -3,7 +3,7 @@
<pre>&lt;x-boilerplate::tinymce name="tinymce"> <pre>&lt;x-boilerplate::tinymce name="tinymce">
&lt;h2>TinyMCE demo&lt;/h2>&lt;p>Lorem ipsum dolor sit amet.&lt;/p> &lt;h2>TinyMCE demo&lt;/h2>&lt;p>Lorem ipsum dolor sit amet.&lt;/p>
&lt;/x-boilerplate::tinymce></pre> &lt;/x-boilerplate::tinymce></pre>
@component('boilerplate::tinymce', ['name' => 'tinymce']) @component('boilerplate::tinymce', ['name' => 'tinymce', 'sticky' => true])
<h2>TinyMCE demo</h2><p>Lorem ipsum dolor sit amet.</p> <h2>TinyMCE demo</h2><p>Lorem ipsum dolor sit amet.</p>
@endcomponent() @endcomponent()
@slot('footer') @slot('footer')

View File

@@ -14,19 +14,28 @@
<a href="{{ route("boilerplate.roles.index") }}" class="btn btn-default" title="@lang('boilerplate::role.list.title')"> <a href="{{ route("boilerplate.roles.index") }}" class="btn btn-default" title="@lang('boilerplate::role.list.title')">
<span class="far fa-arrow-alt-circle-left text-muted"></span> <span class="far fa-arrow-alt-circle-left text-muted"></span>
</a> </a>
@if($role->name !== 'admin')
<span class="btn-group float-right"> <span class="btn-group float-right">
<button type="submit" class="btn btn-primary"> <button type="submit" class="btn btn-primary">
@lang('boilerplate::role.savebutton') @lang('boilerplate::role.savebutton')
</button> </button>
</span> </span>
@endif
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-md-5"> <div class="col-md-5">
@component('boilerplate::card', ['title' => __('boilerplate::role.parameters')]) @component('boilerplate::card', ['title' => __('boilerplate::role.parameters')])
{!! $errors->first('name','<p class="text-danger"><strong>:message</strong></p>') !!} {!! $errors->first('name','<p class="text-danger"><strong>:message</strong></p>') !!}
@if($role->name === 'admin' || $role->name === 'backend_user')
<p><strong>@lang('boilerplate::role.label')</strong><br>{{ $role->display_name }}</p>
<p><strong>@lang('boilerplate::role.description')</strong><br>{{ $role->description }}</p>
@component('boilerplate::input', ['type' => 'hidden', 'name' => 'display_name', 'value' => $role->getAttributes()['display_name']])@endcomponent
@component('boilerplate::input', ['type' => 'hidden', 'name' => 'description', 'value' => $role->getAttributes()['description'] ])@endcomponent
@else
@component('boilerplate::input', ['name' => 'display_name', 'label' => 'boilerplate::role.label', 'value' => $role->display_name])@endcomponent @component('boilerplate::input', ['name' => 'display_name', 'label' => 'boilerplate::role.label', 'value' => $role->display_name])@endcomponent
@component('boilerplate::input', ['name' => 'description', 'label' => 'boilerplate::role.description', 'value' => $role->description])@endcomponent @component('boilerplate::input', ['name' => 'description', 'label' => 'boilerplate::role.description', 'value' => $role->description])@endcomponent
@endif
@endcomponent @endcomponent
</div> </div>
@if(count($permissions_categories) > 0) @if(count($permissions_categories) > 0)
@@ -52,9 +61,12 @@
</div> </div>
</td> </td>
<td> <td>
{{ Form::label('permission_'.$permission->id, $permission->display_name, ['class' => 'mb-0', 'data-toggle' => 'tooltip', 'data-title' => $permission->name]) }}<br /> {{ Form::label('permission_'.$permission->id, $permission->display_name, ['class' => 'mb-0']) }}<br />
<small class="text-muted">{{ $permission->description }}</small> <small class="text-muted">{{ $permission->description }}</small>
</td> </td>
<td class="text-right visible-on-hover">
<span class="badge badge-secondary badge-pill">{{ $permission->name }}</span>
</td>
</tr> </tr>
@endforeach @endforeach
</tbody> </tbody>

View File

@@ -13,82 +13,6 @@
</div> </div>
</div> </div>
@component('boilerplate::card') @component('boilerplate::card')
<div class="table-responsive"> <x-boilerplate::datatable name="roles" />
<table class="table table-striped table-hover va-middle" id="roles-table" style="width:100%">
<thead>
<tr>
<th>{{ __('boilerplate::role.label') }}</th>
<th>{{ __('boilerplate::role.description') }}</th>
<th>{{ __('boilerplate::role.permissions') }}</th>
<th>{{ __('boilerplate::role.list.nbusers') }}</th>
<th>{{-- buttons --}}</th>
</tr>
</thead>
<tbody>
@foreach($roles as $role)
<tr>
<td>
<strong data-toggle="tooltip" data-title="{{ $role->name }}">{{ $role->display_name }}</strong>
</td>
<td>
{{ $role->description }}<br />
</td>
<td>
{!! $role->permissions->implode('display_name', ', ') !!}
</td>
<td>
{{ $role->getNbUsers() }}
</td>
<td class="visible-on-hover" style="width:80px">
<a href="{{ route('boilerplate.roles.edit', $role->id) }}" class="btn btn-sm btn-primary">
<span class="fa fa-fw fa-pencil-alt"></span>
</a>
@if($role->name !== 'admin' &&
!(config('boilerplate.auth.register') && $role->name === config('boilerplate.auth.register_role')) &&
$role->getNbUsers() === 0)
<a href="{{ route('boilerplate.roles.destroy', $role->id) }}" class="btn btn-sm btn-danger destroy">
<span class="fa fa-fw fa-trash"></span>
</a>
@endif
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
@endcomponent @endcomponent
@endsection @endsection
@include('boilerplate::load.datatables')
@push('js')
<script>
$(function () {
$('#roles-table').dataTable({
ordering: false
});
$('#roles-table').on('click', '.destroy', function (e) {
e.preventDefault();
var href = $(this).attr('href');
var line = $(this).closest('tr');
bootbox.confirm("{{ __('boilerplate::role.list.confirmdelete') }}", function (result) {
if (result === false) return;
$.ajax({
url: href,
method: 'delete',
headers: {'X-CSRF-TOKEN': '{{ csrf_token() }}'},
success: function(){
line.remove();
growl("{{ __('boilerplate::role.list.deletesuccess') }}", 'success');
}
});
});
});
});
</script>
@endpush

View File

@@ -50,7 +50,7 @@
<td> <td>
{{ Form::label('role_'.$role->id, $role->display_name, ['class' => 'mb-0 pb-0']) }}<br /> {{ Form::label('role_'.$role->id, $role->display_name, ['class' => 'mb-0 pb-0']) }}<br />
<span class="small">{{ $role->description }}</span><br /> <span class="small">{{ $role->description }}</span><br />
<span class="small text-muted">{{ $role->permissions->implode('display_name', ', ') }}</span> <span class="small text-muted">{!! $role->permissions->implode('display_name', '<br>') !!}</span>
</td> </td>
</tr> </tr>
@endforeach @endforeach

View File

@@ -50,14 +50,14 @@
@endcomponent @endcomponent
@component('boilerplate::card', ['title' => __('boilerplate::users.informations')]) @component('boilerplate::card', ['title' => __('boilerplate::users.informations')])
<div class="row"> <div class="row">
<div class="col-md-6">
@if(Auth::user()->id !== $user->id) @if(Auth::user()->id !== $user->id)
<div class="col-md-6">
@component('boilerplate::select2', ['name' => 'active', 'label' => 'boilerplate::users.status', 'minimum-results-for-search' => '-1']) @component('boilerplate::select2', ['name' => 'active', 'label' => 'boilerplate::users.status', 'minimum-results-for-search' => '-1'])
<option value="1" @if (old('active', $user->active) == '1') selected="selected" @endif>@lang('boilerplate::users.active')</option> <option value="1" @if (old('active', $user->active) == '1') selected="selected" @endif>@lang('boilerplate::users.active')</option>
<option value="0" @if (old('active', $user->active) == '0') selected="selected" @endif>@lang('boilerplate::users.inactive')</option> <option value="0" @if (old('active', $user->active) == '0') selected="selected" @endif>@lang('boilerplate::users.inactive')</option>
@endcomponent @endcomponent
@endif
</div> </div>
@endif
<div class="col-md-6"> <div class="col-md-6">
@component('boilerplate::input', ['name' => 'email', 'label' => 'boilerplate::users.email', 'value' => $user->email])@endcomponent @component('boilerplate::input', ['name' => 'email', 'label' => 'boilerplate::users.email', 'value' => $user->email])@endcomponent
</div> </div>
@@ -70,7 +70,6 @@
@component('boilerplate::input', ['name' => 'last_name', 'label' => 'boilerplate::users.lastname', 'value' => $user->last_name])@endcomponent @component('boilerplate::input', ['name' => 'last_name', 'label' => 'boilerplate::users.lastname', 'value' => $user->last_name])@endcomponent
</div> </div>
</div> </div>
@endcomponent @endcomponent
</div> </div>
<div class="col-md-6"> <div class="col-md-6">
@@ -91,9 +90,9 @@
</div> </div>
</td> </td>
<td> <td>
{{ Form::label('role_'.$role->id, $role->display_name, ['class' => 'mbn']) }}<br /> <div>{{ Form::label('role_'.$role->id, $role->display_name, ['class' => 'mb-0']) }}</div>
<span class="small">{{ $role->description }}</span><br /> <div class="small">{{ $role->description }}</div>
<span class="small text-muted">{{ $role->permissions->implode('display_name', ', ') }}</span> <div class="small text-muted pt-1">{!! $role->permissions->implode('display_name', '<br>') !!}</div>
</td> </td>
</tr> </tr>
@endif @endif

View File

@@ -6,26 +6,6 @@
] ]
]) ])
@section('right-sidebar')
<div id="filters">
<div class="form-group">
<select name="state" class="form-control select2" data-placeholder="@lang('boilerplate::users.list.state')">
<option></option>
<option value="1">@lang('boilerplate::users.active')</option>
<option value="0">@lang('boilerplate::users.inactive')</option>
</select>
</div>
<div class="form-group">
<select name="role" class="form-control select2" data-placeholder="@lang('boilerplate::role.role')">
<option></option>
@foreach($roles as $role)
<option value="{{ $role->name }}">{{ $role->display_name }}</option>
@endforeach
</select>
</div>
</div>
@endsection
@section('content') @section('content')
<div class="row"> <div class="row">
<div class="col-12 mbl"> <div class="col-12 mbl">
@@ -37,124 +17,10 @@
</div> </div>
</div> </div>
@component('boilerplate::card') @component('boilerplate::card')
<div class="table-responsive"> <x-boilerplate::datatable name="users"/>
<table class="table table-striped table-hover va-middle" id="users-list">
<thead>
<tr>
<th>{{-- id --}}</th>
<th>{{-- avatar --}}</th>
<th>@lang('boilerplate::users.list.state')</th>
<th>@lang('boilerplate::users.list.lastname')</th>
<th>@lang('boilerplate::users.list.firstname')</th>
<th>@lang('boilerplate::users.list.email')</th>
<th>@lang('boilerplate::users.list.roles')</th>
<th>@lang('boilerplate::users.list.creationdate')</th>
<th>@lang('boilerplate::users.list.lastconnect')</th>
<th></th>
</tr>
</thead>
</table>
</div>
@endcomponent @endcomponent
@endsection @endsection
@include('boilerplate::load.datatables')
@include('boilerplate::load.select2')
@push('js')
<script>
$('.select2').select2({
minimumResultsForSearch: -1,
allowClear: true,
placeholder: $(this).data('placeholder'),
width: '100%'
});
$(function () {
var oTable = $('#users-list').DataTable({
processing: true,
serverSide: true,
stateSave: true,
order: [[7, "desc"]],
ajax: {
url: '{!! route('boilerplate.users.datatable') !!}',
type: 'post',
},
columns: [
{data: 'id', name: 'id', visible: false},
{data: 'avatar', name: 'avatar', searchable: false, sortable: false, width : '32px'},
{data: 'status', name: 'users.active', searchable: true},
{data: 'last_name', name: 'last_name'},
{data: 'first_name', name: 'first_name'},
{data: 'email', name: 'email'},
{data: 'roles', name: 'roles.name', searchable: false, orderable: false},
{
data: 'created_at',
name: 'users.created_at',
searchable: false,
render: $.fn.dataTable.render.moment('@lang('boilerplate::date.YmdHis')')
},
{
data: 'last_login',
name: 'last_login',
searchable: false,
render: function(date) {
return date === null ? '-' : moment(date).fromNow(date)
}
},
{
data: 'actions',
name: 'actions',
orderable: false,
searchable: false,
width: '80px',
class: 'visible-on-hover text-nowrap'
}
],
fnInitComplete: function() {
$('#users-list_filter').append('<button class="btn btn-default btn-sm ml-2" data-widget="control-sidebar" data-slide="true"><span class="fa fa-filter"></span></button>')
}
});
$('#filters select').on('change', function() {
localStorage.setItem('user_search_'+$(this).attr('name'), $(this).val());
oTable.column(($(this).attr('name') === 'state' ? 2 : 6)).search($(this).val()).draw()
})
if (localStorage.getItem('user_search_state')) {
value = localStorage.getItem('user_search_state');
$('#filters select[name=state]').val(value).trigger('change')
oTable.column(2).search(value).draw();
}
if (localStorage.getItem('user_search_role')) {
value = localStorage.getItem('user_search_role');
$('#filters select[name=role]').val(value).trigger('change')
oTable.column(6).search(value).draw();
}
$(document).on('click', '#users-list .destroy', function (e) {
e.preventDefault();
var href = $(this).attr('href');
bootbox.confirm("@lang('boilerplate::users.list.confirmdelete')", function (result) {
if (result === false) return;
$.ajax({
url: href,
method: 'delete',
success: function () {
oTable.ajax.reload();
growl("@lang('boilerplate::users.list.deletesuccess')", "success");
}
});
});
});
});
</script>
@endpush
@push('css') @push('css')
<style>.img-circle { border:1px solid #CCC }</style> <style>.img-circle { border:1px solid #CCC }</style>
@endpush @endpush

View File

@@ -53,10 +53,10 @@
@component('boilerplate::input', ['name' => 'last_name', 'label' => 'boilerplate::users.lastname', 'value' => $user->last_name])@endcomponent @component('boilerplate::input', ['name' => 'last_name', 'label' => 'boilerplate::users.lastname', 'value' => $user->last_name])@endcomponent
</div> </div>
<div class="col-md-6"> <div class="col-md-6">
@component('boilerplate::input', ['type' => 'password', 'name' => 'password', 'label' => ucfirst(__('boilerplate::auth.fields.password'))])@endcomponent @component('boilerplate::password', ['name' => 'password', 'label' => ucfirst(__('boilerplate::auth.fields.password'))])@endcomponent
</div> </div>
<div class="col-md-6"> <div class="col-md-6">
@component('boilerplate::input', ['type' => 'password', 'name' => 'password_confirmation', 'label' => ucfirst(__('boilerplate::auth.fields.password_confirm'))])@endcomponent @component('boilerplate::password', ['name' => 'password_confirmation', 'label' => ucfirst(__('boilerplate::auth.fields.password_confirm')), 'check' => false])@endcomponent
</div> </div>
</div> </div>
@endcomponent @endcomponent