Skip to content
This repository has been archived by the owner on Oct 21, 2024. It is now read-only.

Commit

Permalink
Add disabled and readOnly properties on form elements and size proper…
Browse files Browse the repository at this point in the history
…ty for delete button
  • Loading branch information
vsimitsis committed Jul 19, 2018
1 parent 3c80f4d commit a80d98d
Show file tree
Hide file tree
Showing 21 changed files with 62 additions and 37 deletions.
2 changes: 1 addition & 1 deletion resources/views/buttons/delete.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
@slot('action', $action)
@slot('method', 'DELETE')

<button type="button" class="btn btn-delete" data-confirm="{{ $confirm ?? 'Are you sure you want to delete this?' }}">
<button type="button" class="btn btn-{{ $size ?? 'sm' }} btn-delete" data-confirm="{{ $confirm ?? 'Are you sure you want to delete this?' }}">
<i class="fas fa-trash"></i> Delete {{ $label ?? '' }}
</button>
@endcomponent
Expand Down
2 changes: 1 addition & 1 deletion resources/views/buttons/edit.blade.php
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
@can('update', $model)
<a class="btn btn-{{ $size or 'sm' }} btn-edit" href="{{ $url }}"><i class="fas fa-edit"></i> Edit</a>
<a class="btn btn-{{ $size ?? 'sm' }} btn-edit" href="{{ $url }}"><i class="fas fa-edit"></i> Edit</a>
@endcan
2 changes: 1 addition & 1 deletion resources/views/buttons/view.blade.php
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
@can('view', $model)
<a class="btn btn-{{ $size or 'sm' }} btn-primary" href="{{ $url }}"><i class="fas fa-eye"></i> View</a>
<a class="btn btn-{{ $size ?? 'sm' }} btn-primary" href="{{ $url }}"><i class="fas fa-eye"></i> View</a>
@endcan
6 changes: 3 additions & 3 deletions resources/views/card.blade.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<div class="card {{ $class or '' }} {{ !empty($icon) || !empty($image) ? 'with-icon' : '' }}">
<div class="card {{ $class ?? '' }} {{ !empty($icon) || !empty($image) ? 'with-icon' : '' }}">
@isset($icon)
<div class="icon bg-{{ $color or 'primary' }}">
<div class="icon bg-{{ $color ?? 'primary' }}">
<i class="fa-fw fas fa-{{ $icon }}"></i>
</div>
@endisset

@isset($image)
<div class="image bg-{{ $color or 'primary' }}">
<div class="image bg-{{ $color ?? 'primary' }}">
<img src="{{ $image }}">
</div>
@endisset
Expand Down
8 changes: 7 additions & 1 deletion resources/views/forms/checkbox.blade.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
<div class="form-group">
<div class="checkbox">
<label>
<input type="checkbox" name="{{ $name }}" class="{{ $class or '' }}" value="{{ $value or 1 }}" @if(isset($checked) && $checked) checked @endif> {{ $label }}
<input type="checkbox"
name="{{ $name }}"
class="{{ $class ?? '' }}"
value="{{ $value ?? 1 }}"
{{ isset($required) && $required ? 'required' : '' }}
{{ isset($disabled) && $disabled ? 'disabled' : '' }}
> {{ $label }}
</label>
</div>
</div>
4 changes: 2 additions & 2 deletions resources/views/forms/input-html.blade.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<div class="form-group {{ $errors->has($name) ? 'has-error' : '' }}">
<label for="{{ $id or $name }}" class="control-label">{{ $label }}</label>
<label for="{{ $id ?? $name }}" class="control-label">{{ $label }}</label>

<textarea id="{{ $id or $name }}" name="{{ $name }}" class="form-control html-editor" @isset($uploadUrl) data-upload="{{ $uploadUrl }}" @endisset>{!! old($name, $value ?? '') !!}</textarea>
<textarea id="{{ $id ?? $name }}" name="{{ $name }}" class="form-control html-editor" @isset($uploadUrl) data-upload="{{ $uploadUrl }}" @endisset>{!! old($name, $value ?? '') !!}</textarea>

@if ($errors->has($name))
<div class="form-error text-danger">
Expand Down
6 changes: 3 additions & 3 deletions resources/views/forms/input-number.blade.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<div class="form-group {{ $errors->has($name) ? 'has-error' : '' }}">
<label for="{{ $id or $name }}" class="control-label {{ $class or '' }}">{{ $label }}</label>
<input id="{{ $id or $name }}" name="{{ $name }}" type="number" @isset($step) step="{{ $step }}" @endisset @isset($min) min="{{ $min }}" @endisset @isset($max) max="{{ $max }}" @endisset
class="form-control" value="{{ old($name, $value ?? '') }}" {{ isset($required) && $required ? 'required' : '' }}>
<label for="{{ $id ?? $name }}" class="control-label {{ $class ?? '' }}">{{ $label }}</label>
<input id="{{ $id ?? $name }}" name="{{ $name }}" type="number" @isset($step) step="{{ $step }}" @endisset @isset($min) min="{{ $min }}" @endisset @isset($max) max="{{ $max }}" @endisset
class="form-control" value="{{ old($name, $value ?? '') }}" {{ isset($required) && $required ? 'required' : '' }} {{ isset($readOnly) && $readOnly ? 'readonly' : '' }} {{ isset($disabled) && $disabled ? 'disabled' : '' }}>

@if ($errors->has($name))
<div class="form-error text-danger">
Expand Down
12 changes: 10 additions & 2 deletions resources/views/forms/input-text.blade.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
<div class="form-group {{ $errors->has($name) ? 'has-error' : '' }}">
<label for="{{ $id or $name }}" class="control-label">{{ $label }}</label>
<input id="{{ $id or $name }}" name="{{ $name }}" type="{{ $type or 'text' }}" class="form-control {{ $class or '' }}" value="{{ old($name, $value ?? '') }}" {{ isset($required) && $required ? 'required' : '' }}>
<label for="{{ $id ?? $name }}" class="control-label">{{ $label }}</label>
<input id="{{ $id ?? $name }}"
name="{{ $name }}"
type="{{ $type ?? 'text' }}"
class="form-control {{ $class ?? '' }}"
value="{{ old($name, $value ?? '') }}"
{{ isset($required) && $required ? 'required' : '' }}
{{ isset($readOnly) && $readOnly ? 'readonly' : '' }}
{{ isset($disabled) && $disabled ? 'disabled' : '' }}
>

@if ($errors->has($name))
<div class="form-error text-danger">
Expand Down
5 changes: 3 additions & 2 deletions resources/views/forms/input-textarea.blade.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<div class="form-group {{ $errors->has($name) ? 'has-error' : '' }}">
<label for="{{ $id or $name }}" class="control-label">{{ $label }}</label>
<label for="{{ $id ?? $name }}" class="control-label">{{ $label }}</label>

<textarea id="{{ $id or $name }}" name="{{ $name }}" class="form-control {{ $class or '' }}" @isset($rows) rows="{{ $rows }}" @endisset {{ isset($required) && $required ? 'required' : '' }}>{{ old($name, $value ?? '') }}</textarea>
<textarea id="{{ $id ?? $name }}" name="{{ $name }}"
class="form-control {{ $class ?? '' }}" @isset($rows) rows="{{ $rows }}" @endisset {{ isset($required) && $required ? 'required' : '' }} {{ isset($readOnly) && $readOnly ? 'readonly' : '' }} {{ isset($disabled) && $disabled ? 'disabled' : '' }}>{{ old($name, $value ?? '') }}</textarea>

@if ($errors->has($name))
<div class="form-error text-danger">
Expand Down
9 changes: 7 additions & 2 deletions resources/views/forms/multiselect.blade.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
<div class="form-group {{ $errors->has($name) ? 'has-error' : '' }}">
<label for="{{ $id or $name }}" class="control-label">{{ $label }}</label>
<select multiple id="{{ $id or $name }}" class="form-control {{ $class or '' }}" name="{{ $name }}" {{ isset($required) && $required ? 'required' : '' }}>
<label for="{{ $id ?? $name }}" class="control-label">{{ $label }}</label>
<select multiple id="{{ $id ?? $name }}"
name="{{ $name }}"
class="form-control {{ $class ?? '' }}"
{{ isset($required) && $required ? 'required' : '' }}
{{ isset($disabled) && $disabled ? 'disabled' : '' }}
>
<option></option>
@if(isset($options))
@foreach($options as $key => $label)
Expand Down
9 changes: 7 additions & 2 deletions resources/views/forms/select.blade.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
<div class="form-group {{ $errors->has($name) ? 'has-error' : '' }}">
<label for="{{ $id or $name }}" class="control-label">{{ $label }}</label>
<label for="{{ $id ?? $name }}" class="control-label">{{ $label }}</label>

<select id="{{ $id or $name }}" class="form-control {{ $class or '' }}" name="{{ $name }}" {{ isset($required) && $required ? 'required' : '' }}>
<select id="{{ $id ?? $name }}"
class="form-control {{ $class ?? '' }}"
name="{{ $name }}"
{{ isset($required) && $required ? 'required' : '' }}
{{ isset($disabled) && $disabled ? 'disabled' : '' }}
>
<option></option>

@if(isset($options))
Expand Down
4 changes: 2 additions & 2 deletions resources/views/forms/submit.blade.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<button type="submit" class="btn {{ $class or 'btn-success' }}">
<button type="submit" class="btn {{ $class ?? 'btn-success' }}" {{ isset($disabled) && $disabled ? 'disabled' : '' }}>
@isset($icon)
<i class="fas fa-{{ $icon }}"></i>
@endisset

{{ $label or 'Submit' }}
{{ $label ?? 'Submit' }}
</button>
2 changes: 1 addition & 1 deletion resources/views/forms/toggle.blade.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div class="togglebutton">
<label>
<input type="checkbox" name="{{ $name }}" class="{{ $class or '' }}" {{ isset($checked) && $checked ? 'checked' : '' }}> {{ $label }}
<input type="checkbox" name="{{ $name }}" class="{{ $class ?? '' }}" {{ isset($checked) && $checked ? 'checked' : '' }}> {{ $label }}
</label>
</div>
4 changes: 2 additions & 2 deletions resources/views/map.blade.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<div class="map material-map" id="{{ $id or 'map' }}" @isset($style)style="{{ $style }}"@endisset></div>
<div class="map material-map" id="{{ $id ?? 'map' }}" @isset($style)style="{{ $style }}"@endisset></div>

@push('scripts')
<script>
$('#{{ $id }}').data('zoom', {{ $zoom or 10 }});
$('#{{ $id }}').data('zoom', {{ $zoom ?? 10 }});
@if(!empty($center))
$('#{{ $id }}').data('center', {!! json_encode($center) !!});
Expand Down
4 changes: 2 additions & 2 deletions resources/views/sidebar-dropdown-link.blade.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<li class="{{ $active or false ? 'active' : '' }}">
<a href="{{ $url or route($route) }}">
<li class="{{ $active ?? false ? 'active' : '' }}">
<a href="{{ $url ?? route($route) }}">
<span class="sidebar-normal">{{ $title }}</span>
</a>
</li>
6 changes: 3 additions & 3 deletions resources/views/sidebar-dropdown.blade.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<li class="{{ $active or false ? 'active' : '' }}">
<a data-toggle="collapse" href="#{{ preg_replace('/([^a-zA-Z0-9]+)/', '_', $title) }}" class="{{ $active or false ? 'show' : '' }}" aria-expanded="{{ $active or false ? 'true' : '' }}">
<li class="{{ $active ?? false ? 'active' : '' }}">
<a data-toggle="collapse" href="#{{ preg_replace('/([^a-zA-Z0-9]+)/', '_', $title) }}" class="{{ $active ?? false ? 'show' : '' }}" aria-expanded="{{ $active ?? false ? 'true' : '' }}">
<i class="fa-fw fa-lg fas fa-{{ $icon }}"></i>
{{ $title }} <span class="arrow"></span>
</a>

<div class="collapse {{ $active or false ? 'in' : '' }}" id="{{ preg_replace('/([^a-zA-Z0-9]+)/', '_', $title) }}" aria-expanded="{{ $active or false ? 'true' : '' }}" style="">
<div class="collapse {{ $active ?? false ? 'in' : '' }}" id="{{ preg_replace('/([^a-zA-Z0-9]+)/', '_', $title) }}" aria-expanded="{{ $active ?? false ? 'true' : '' }}" style="">
<ul class="nav">
{{ $slot }}
</ul>
Expand Down
4 changes: 2 additions & 2 deletions resources/views/sidebar-link.blade.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<li class="{{ $active or false ? 'active' : '' }}">
<a href="{{ $url or route($route) }}">
<li class="{{ $active ?? false ? 'active' : '' }}">
<a href="{{ $url ?? route($route) }}">
<i class="fa-fw fa-lg fas fa-{{ $icon }}"></i>
{{ $title }}

Expand Down
4 changes: 2 additions & 2 deletions resources/views/stats-card.blade.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div class="card card-stats with-icon">
<div class="icon bg-{{ $color or 'primary' }}">
<i class="fa-fw fas fa-{{ $icon or 'info-circle' }}"></i>
<div class="icon bg-{{ $color ?? 'primary' }}">
<i class="fa-fw fas fa-{{ $icon ?? 'info-circle' }}"></i>
</div>

<dt class="title">{{ $title }}</dt>
Expand Down
2 changes: 1 addition & 1 deletion resources/views/tab-card-panel.blade.php
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<div id="{{ $panel }}" class="tab-panel {{ $active or false ? 'active' : '' }}">
<div id="{{ $panel }}" class="tab-panel {{ $active ?? false ? 'active' : '' }}">
{{ $slot }}
</div>
2 changes: 1 addition & 1 deletion resources/views/tab-card-tab.blade.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<li class="tab {{ $active or false ? 'active' : '' }}">
<li class="tab {{ $active ?? false ? 'active' : '' }}">
<a href="#{{ $panel }}">
@isset($icon)
<i class="fa-fw fa-lg fas fa-{{ $icon }}"></i>
Expand Down
2 changes: 1 addition & 1 deletion resources/views/tab-card.blade.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div class="card card-tabs {{ $class or '' }}">
<div class="card card-tabs {{ $class ?? '' }}">
<ul>
{{ $tabs }}
</ul>
Expand Down

0 comments on commit a80d98d

Please sign in to comment.