BLUE-4: All form validation is now displayed inline with the form.

This commit is contained in:
Andy Heathershaw 2016-10-28 14:05:53 +01:00
parent 640828e244
commit 1157446544
9 changed files with 90 additions and 55 deletions

View File

@ -96,7 +96,7 @@ class DefaultController extends Controller
}
$config->value = $request->request->get($key);
if (in_array($key, $passwordKeys))
if (in_array($key, $passwordKeys) && strlen($config->value) > 0)
{
$config->value = encrypt($config->value);
}

View File

@ -9,6 +9,7 @@ use App\Facade\Theme;
use App\Helpers\FileHelper;
use App\Helpers\ImageHelper;
use App\Helpers\MiscHelper;
use App\Http\Requests\UpdatePhotosBulkRequest;
use App\Photo;
use App\Services\PhotoService;
use App\Upload;
@ -395,7 +396,7 @@ class PhotoController extends Controller
//
}
public function updateBulk(Request $request, $albumId)
public function updateBulk(UpdatePhotosBulkRequest $request, $albumId)
{
$this->authorize('admin-access');

View File

@ -115,5 +115,6 @@ return [
// Added by Andy H. for custom validators
'dir_empty' => 'The path must be an empty folder.',
'is_dir' => 'The folder must be a valid directory.',
'is_writeable' => 'Unable to write to this folder - please check permissions.'
'is_writeable' => 'Unable to write to this folder - please check permissions.',
'photo_name_required' => 'The name field is required.'
];

View File

@ -23,20 +23,16 @@
<p>@lang('admin.create_album_intro2')</p>
<hr/>
@if (count($errors) > 0)
<div class="alert alert-danger">
<ul>
@foreach ($errors->all() as $form_error)
<li>{{ $form_error }}</li>
@endforeach
</ul>
</div>
@endif
{!! Form::open(['route' => 'albums.store', 'method' => 'POST']) !!}
<div class="form-group">
<div class="form-group{{ $errors->has('name') ? ' has-error' : '' }}">
{!! Form::label('name', trans('forms.name_label'), ['class' => 'control-label']) !!}
{!! Form::text('name', old('name'), ['class' => 'form-control']) !!}
@if ($errors->has('name'))
<span class="help-block">
<strong>{{ $errors->first('name') }}</strong>
</span>
@endif
</div>
<div class="form-group">

View File

@ -22,45 +22,59 @@
<p>@lang('admin.create_user_intro')</p>
<hr/>
@if (count($errors) > 0)
<div class="alert alert-danger">
<ul>
@foreach ($errors->all() as $form_error)
<li>{{ $form_error }}</li>
@endforeach
</ul>
</div>
@endif
{!! Form::open(['route' => 'user.store', 'method' => 'POST']) !!}
<div class="row">
<div class="col-sm-6">
<div class="form-group">
<div class="form-group{{ $errors->has('name') ? ' has-error' : '' }}">
{!! Form::label('name', trans('forms.name_label'), ['class' => 'control-label']) !!}
{!! Form::text('name', old('name'), ['class' => 'form-control']) !!}
@if ($errors->has('name'))
<span class="help-block">
<strong>{{ $errors->first('name') }}</strong>
</span>
@endif
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<div class="form-group{{ $errors->has('email') ? ' has-error' : '' }}">
{!! Form::label('email', trans('forms.email_label'), ['class' => 'control-label']) !!}
{!! Form::text('email', old('email'), ['class' => 'form-control']) !!}
@if ($errors->has('email'))
<span class="help-block">
<strong>{{ $errors->first('email') }}</strong>
</span>
@endif
</div>
</div>
</div>
<div class="row">
<div class="col-sm-6">
<div class="form-group">
<div class="form-group{{ $errors->has('password') ? ' has-error' : '' }}">
{!! Form::label('password', trans('forms.password_label'), ['class' => 'control-label']) !!}
{!! Form::password('password', ['class' => 'form-control']) !!}
@if ($errors->has('password'))
<span class="help-block">
<strong>{{ $errors->first('password') }}</strong>
</span>
@endif
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<div class="form-group{{ $errors->has('password_confirmation') ? ' has-error' : '' }}">
{!! Form::label('password_confirmation', trans('forms.password_confirm_label'), ['class' => 'control-label']) !!}
{!! Form::password('password_confirmation', ['class' => 'form-control']) !!}
@if ($errors->has('password_confirmation'))
<span class="help-block">
<strong>{{ $errors->first('password_confirmation') }}</strong>
</span>
@endif
</div>
</div>
</div>

View File

@ -24,20 +24,16 @@
<p>@lang('admin.edit_album_intro2', ['album_name' => $album->name])</p>
<hr/>
@if (count($errors) > 0)
<div class="alert alert-danger">
<ul>
@foreach ($errors->all() as $error)
<li>{{ $error }}</li>
@endforeach
</ul>
</div>
@endif
{!! Form::model($album, ['route' => ['albums.update', $album->id], 'method' => 'PUT']) !!}
<div class="form-group">
<div class="form-group{{ $errors->has('name') ? ' has-error' : '' }}">
{!! Form::label('name', trans('forms.name_label'), ['class' => 'control-label']) !!}
{!! Form::text('name', old('name'), ['class' => 'form-control']) !!}
@if ($errors->has('name'))
<span class="help-block">
<strong>{{ $errors->first('name') }}</strong>
</span>
@endif
</div>
<div class="form-group">

View File

@ -22,45 +22,59 @@
<p>@lang('admin.edit_user_intro')</p>
<hr/>
@if (count($errors) > 0)
<div class="alert alert-danger">
<ul>
@foreach ($errors->all() as $form_error)
<li>{{ $form_error }}</li>
@endforeach
</ul>
</div>
@endif
{!! Form::model($user, ['route' => ['user.update', $user->id], 'method' => 'PUT']) !!}
<div class="row">
<div class="col-sm-6">
<div class="form-group">
<div class="form-group{{ $errors->has('name') ? ' has-error' : '' }}">
{!! Form::label('name', trans('forms.name_label'), ['class' => 'control-label']) !!}
{!! Form::text('name', old('name'), ['class' => 'form-control']) !!}
@if ($errors->has('name'))
<span class="help-block">
<strong>{{ $errors->first('name') }}</strong>
</span>
@endif
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<div class="form-group{{ $errors->has('email') ? ' has-error' : '' }}">
{!! Form::label('email', trans('forms.email_label'), ['class' => 'control-label']) !!}
{!! Form::text('email', old('email'), ['class' => 'form-control']) !!}
@if ($errors->has('email'))
<span class="help-block">
<strong>{{ $errors->first('email') }}</strong>
</span>
@endif
</div>
</div>
</div>
<div class="row">
<div class="col-sm-6">
<div class="form-group">
<div class="form-group{{ $errors->has('password') ? ' has-error' : '' }}">
{!! Form::label('password', trans('forms.password_label'), ['class' => 'control-label']) !!}
{!! Form::password('password', ['class' => 'form-control']) !!}
@if ($errors->has('password'))
<span class="help-block">
<strong>{{ $errors->first('password') }}</strong>
</span>
@endif
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<div class="form-group{{ $errors->has('password_confirmation') ? ' has-error' : '' }}">
{!! Form::label('password_confirmation', trans('forms.password_confirm_label'), ['class' => 'control-label']) !!}
{!! Form::password('password_confirmation', ['class' => 'form-control']) !!}
@if ($errors->has('password_confirmation'))
<span class="help-block">
<strong>{{ $errors->first('password_confirmation') }}</strong>
</span>
@endif
</div>
</div>
</div>

View File

@ -161,9 +161,15 @@
<h4><i class="fa fa-fw fa-info"></i> @lang('admin.album_basic_info_heading')</h4>
<p>@lang('admin.album_basic_info_intro')</p>
<div class="form-group" style="margin-top: 20px;">
<div class="form-group{{ $errors->has('name') ? ' has-error' : '' }}" style="margin-top: 20px;">
{!! Form::label('name', trans('forms.name_label'), ['class' => 'control-label']) !!}
{!! Form::text('name', old('name'), ['class' => 'form-control']) !!}
@if ($errors->has('name'))
<span class="help-block">
<strong>{{ $errors->first('name') }}</strong>
</span>
@endif
</div>
<div class="form-group">

View File

@ -41,9 +41,16 @@
</p>
</div>
<div class="col-xs-12 col-sm-10">
<div class="form-group">
@php($validation_field_name = ('photo.' . $photo->id . '.name'))
<div class="form-group{{ $errors->has($validation_field_name) ? ' has-error' : '' }}">
{!! Form::label($field_prefix . '[name]', trans('forms.name_label'), ['class' => 'control-label']) !!}
{!! Form::text($field_prefix . '[name]', old('name', $photo->name), ['class' => 'form-control']) !!}
@if ($errors->has($validation_field_name))
<span class="help-block">
<strong>{{ $errors->first($validation_field_name) }}</strong>
</span>
@endif
</div>
<div class="form-group">