Rename back to leenooks/laravel, start to use components for html widgets, updated login form to include passkey
This commit is contained in:
parent
01e77cb807
commit
12496101e1
@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "laravel/leenooks",
|
||||
"name": "leenooks/laravel",
|
||||
"description": "Leenooks standard templates and tools.",
|
||||
"keywords": ["laravel","leenooks"],
|
||||
"license": "MIT",
|
||||
|
18
resources/components/form/base.blade.php
Normal file
18
resources/components/form/base.blade.php
Normal file
@ -0,0 +1,18 @@
|
||||
<div class="form-group">
|
||||
@if(isset($label))
|
||||
<label for="{{ $id ?? $name }}">{{ $label }}</label>
|
||||
@endisset
|
||||
<div class="input-group has-validation">
|
||||
@isset($icon)
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fas fa-fw {{ $icon }}"></i></span>
|
||||
</div>
|
||||
@endisset()
|
||||
{{ $slot }}
|
||||
<span class="invalid-feedback" role="alert">
|
||||
@error($name)
|
||||
{{ $message }}
|
||||
@enderror
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
3
resources/components/form/email.blade.php
Normal file
3
resources/components/form/email.blade.php
Normal file
@ -0,0 +1,3 @@
|
||||
<x-leenooks::form.base {{ $attributes }}>
|
||||
<input type="email" class="form-control {{ $classes ?? ''}}@error($name) is-invalid @enderror" id="{{ $id ?? $name }}" name="{{ $name }}" value="{{ old($name,$value ?? "") }}">
|
||||
</x-leenooks::form.base>
|
3
resources/components/form/password.blade.php
Normal file
3
resources/components/form/password.blade.php
Normal file
@ -0,0 +1,3 @@
|
||||
<x-leenooks::form.base {{ $attributes }}>
|
||||
<input type="password" class="form-control {{ $classes ?? ''}}@error($name) is-invalid @enderror" id="{{ $id ?? $name }}" name="{{ $name }}" value="{{ old($name,$value ?? "") }}">
|
||||
</x-leenooks::form.base>
|
42
resources/components/form/select.blade.php
Normal file
42
resources/components/form/select.blade.php
Normal file
@ -0,0 +1,42 @@
|
||||
<x-leenooks::form.base {{ $attributes }}>
|
||||
<select class="form-control @error($name) is-invalid @enderror" id="{{ $id }}" name="{{ $name }}">
|
||||
@if(isset($addvalues) && $addvalues)
|
||||
<option id="new"></option>
|
||||
@endif
|
||||
|
||||
@empty($groupby)
|
||||
@foreach($options as $option)
|
||||
@continue(! Arr::get($option,'value'))
|
||||
<option value="{{ Arr::get($option,'id') }}" @selected(Arr::get($option,'id') == old($name,$value))>{{ Arr::get($option,'value') }}</option>
|
||||
@endforeach
|
||||
@else
|
||||
@foreach($options->groupBy($groupby) as $group)
|
||||
<optgroup label="{{ $groupby == 'active' ? (Arr::get($group->first(),$groupby) ? 'Active' : 'Not Active') : Arr::get($group->first(),$groupby) }}">
|
||||
@foreach($group as $option)
|
||||
@empty(Arr::get($option,'value')) @continue @endempty
|
||||
<option value="{{ Arr::get($option,'id') }}" @selected(Arr::get($option,'id') == old($old,$value))>{{ Arr::get($option,'value') }}</option>
|
||||
@endforeach
|
||||
</optgroup>
|
||||
@endforeach
|
||||
@endempty
|
||||
</select>
|
||||
</x-leenooks::form.base>
|
||||
|
||||
@section('page-scripts')
|
||||
@css(select2)
|
||||
@js(select2,autofocus)
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
$('#{{ $id }}').select2({
|
||||
dropdownAutoWidth: true,
|
||||
width: 'style',
|
||||
@isset($addvalues)
|
||||
tags: true,
|
||||
placeholder: '',
|
||||
allowClear: true,
|
||||
@endisset
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@append
|
3
resources/components/form/text.blade.php
Normal file
3
resources/components/form/text.blade.php
Normal file
@ -0,0 +1,3 @@
|
||||
<x-leenooks::form.base {{ $attributes }}>
|
||||
<input type="text" class="form-control {{ $classes ?? ''}}@error($name) is-invalid @enderror" id="{{ $id ?? $name }}" name="{{ $name }}" value="{{ old($name,$value ?? "") }}">
|
||||
</x-leenooks::form.base>
|
1
resources/components/success.blade.php
Normal file
1
resources/components/success.blade.php
Normal file
@ -0,0 +1 @@
|
||||
<button {{ $attributes->class(['btn','btn-sm','btn-success']) }}>{{ $slot }}</button>
|
@ -76,11 +76,20 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- /.col -->
|
||||
<div class="col-4">
|
||||
<button type="submit" name="submit" class="btn btn-primary mr-0 float-right">Sign In</button>
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<button type="submit" name="submit" class="btn btn-sm btn-primary float-right">Sign In</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12 pt-2">
|
||||
<button type="button" id="passkey" class="btn btn-sm btn-primary float-right"><i class="bi bi-key"></i> Passkey</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.col -->
|
||||
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@ -102,4 +111,18 @@
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.login-box -->
|
||||
@endsection
|
||||
@endsection
|
||||
|
||||
@section('page-scripts')
|
||||
<!-- Passkeys -->
|
||||
<script type='text/javascript' src='{{ asset('/passkey/passkey.js') }}'></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
$('#passkey').on('click',function() {
|
||||
passkey_check('{{ csrf_token() }}','/passkey/loggedin');
|
||||
return false;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@append
|
@ -27,6 +27,8 @@
|
||||
})
|
||||
})
|
||||
</script>
|
||||
|
||||
@yield('page-scripts')
|
||||
@show
|
||||
</body>
|
||||
</html>
|
@ -1,57 +0,0 @@
|
||||
<div class="form-group">
|
||||
<label for="{{ $id }}">{{ $label }}</label>
|
||||
<div class="input-group has-validation">
|
||||
@empty($icon)
|
||||
@else
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa-fw {{ $icon }}"></i></span>
|
||||
</div>
|
||||
@endempty()
|
||||
|
||||
<select class="form-control @error($id) is-invalid @enderror" id="{{ $id }}" name="{{ $name ?? $id}}">
|
||||
@if(! isset($addvalues) || ! $addvalues)
|
||||
<option id="new"></option>
|
||||
@endif
|
||||
@empty($groupby)
|
||||
@foreach($options as $option)
|
||||
@empty(Arr::get($option,'value')) @continue @endempty
|
||||
<option value="{{ Arr::get($option,'id') }}" @if(Arr::get($option,'id') == old($old,$value))selected @endif>{{ Arr::get($option,'value') }}</option>
|
||||
@endforeach
|
||||
@else
|
||||
@foreach($options->groupBy($groupby) as $group)
|
||||
<optgroup label="{{ $groupby == 'active' ? (Arr::get($group->first(),$groupby) ? 'Active' : 'Not Active') : Arr::get($group->first(),$groupby) }}">
|
||||
@foreach($group as $option)
|
||||
@empty(Arr::get($option,'value')) @continue @endempty
|
||||
<option value="{{ Arr::get($option,'id') }}" @if(Arr::get($option,'id') == old($old,$value))selected @endif>{{ Arr::get($option,'value') }}</option>
|
||||
@endforeach
|
||||
</optgroup>
|
||||
@endforeach
|
||||
@endempty
|
||||
</select>
|
||||
|
||||
<span class="invalid-feedback" role="alert">
|
||||
@error($id)
|
||||
{{ $message }}
|
||||
@enderror
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@section('page-scripts')
|
||||
@css(select2)
|
||||
@js(select2,autofocus)
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
$('#{{ $id }}').select2({
|
||||
dropdownAutoWidth: true,
|
||||
width: 'style',
|
||||
@isset($addvalues)
|
||||
tags: true,
|
||||
placeholder: '',
|
||||
allowClear: true,
|
||||
@endisset
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@append
|
@ -1,17 +0,0 @@
|
||||
<div class="form-group">
|
||||
<label for="{{ $id }}">{{ $label }}</label>
|
||||
<div class="input-group has-validation">
|
||||
@empty($icon)
|
||||
@else
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa-fw {{ $icon }}"></i></span>
|
||||
</div>
|
||||
@endempty()
|
||||
<input type="text" class="form-control {{ $classes ?? ''}}@error($id) is-invalid @enderror" id="{{ $id }}" name="{{ $name ?: $id }}" value="{{ old($old ?? $name,$value) }}">
|
||||
<span class="invalid-feedback" role="alert">
|
||||
@error($id)
|
||||
{{ $message }}
|
||||
@enderror
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
@ -1 +0,0 @@
|
||||
@if(session()->has('success'))<span class="ml-3 pt-0 pb-0 pr-1 pl-1 btn btn-outline-success float-right"><small>{{ session()->get('success') }}</small></span>@endif
|
@ -2,8 +2,10 @@
|
||||
|
||||
namespace Leenooks\Providers;
|
||||
|
||||
use Illuminate\Support\Facades\Blade;
|
||||
use Leenooks\Http\Middleware\GuestUser;
|
||||
use Illuminate\Routing\Router;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
/**
|
||||
@ -13,7 +15,7 @@ use Illuminate\Support\ServiceProvider;
|
||||
*/
|
||||
class LeenooksServiceProvider extends ServiceProvider
|
||||
{
|
||||
private $_path = '';
|
||||
private string $_path = '';
|
||||
|
||||
/**
|
||||
* Bootstrap the application services.
|
||||
@ -31,10 +33,12 @@ class LeenooksServiceProvider extends ServiceProvider
|
||||
|
||||
$this->loadViewsFrom($this->_path.'/resources/themes/metronic/views/', 'metronic');
|
||||
|
||||
// Enable a Collect::recursive() function
|
||||
\Illuminate\Support\Collection::macro('recursive', function () {
|
||||
return $this->map(function ($value) {
|
||||
//Blade::componentNamespace('Leenooks\\Components','leenooks');
|
||||
Blade::anonymousComponentPath($this->_path.'/resources/components', 'leenooks');
|
||||
|
||||
// Enable a Collect::recursive() function
|
||||
Collection::macro('recursive', function () {
|
||||
return $this->map(function ($value) {
|
||||
if (is_array($value) || is_object($value)) {
|
||||
return collect($value)->recursive();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user