Change validation to controllers and partial

This commit is contained in:
Joseph Cohen
2015-01-09 20:21:29 -06:00
parent 996aceadcf
commit f47fb9823e
22 changed files with 117 additions and 208 deletions
+6
View File
@@ -51,4 +51,10 @@ body.dashboard {
margin-right: 0;
}
}
.alerts {
.alert h5 {
margin-top: 5px;
}
}
}
+1 -10
View File
@@ -13,16 +13,7 @@
<div class="content-wrapper">
<div class="row">
<div class="col-sm-12">
@if($component = Session::get('component'))
<div class="alert alert-{{ $component->isValid() ? 'success' : 'danger' }}">
@if($component->isValid())
{{ sprintf("<strong>%s</strong> %s", trans('dashboard.notifications.awesome'), trans('dashboard.components.add.success')) }}
@else
{{ sprintf("<strong>%s</strong> %s", trans('dashboard.notifications.whoops'), trans('dashboard.components.add.failure').' '.$component->getErrors()) }}
@endif
</div>
@endif
@include('partials.dashboard.errors')
<form name="CreateComponentForm" class="form-vertical" role="form" action="/dashboard/components/add" method="POST">
<fieldset>
<div class="form-group">
+1 -10
View File
@@ -13,16 +13,7 @@
<div class="content-wrapper">
<div class="row">
<div class="col-sm-12">
@if($savedComponent = Session::get('savedComponent'))
<div class="alert alert-{{ $savedComponent->isValid() ? 'success' : 'danger' }}">
@if($savedComponent->isValid())
{{ sprintf("<strong>%s</strong> %s", trans('dashboard.notifications.awesome'), trans('dashboard.components.edit.success')) }}
@else
{{ sprintf("<strong>%s</strong> %s", trans('dashboard.notifications.whoops'), trans('dashboard.components.edit.failure').' '.$component->getErrors()) }}
@endif
</div>
@endif
@include('partials.dashboard.errors')
<form name="EditComponentForm" class="form-vertical" role="form" action="/dashboard/components/{{ $component->id }}/edit" method="POST">
<fieldset>
<div class="form-group">
@@ -13,16 +13,7 @@
<div class="content-wrapper">
<div class="row">
<div class="col-sm-12">
@if($group = Session::get('group'))
<div class="alert alert-{{ $group->isValid() ? 'success' : 'danger' }}">
@if($group->isValid())
{{ sprintf("<strong>%s</strong> %s", trans('dashboard.notifications.awesome'), trans('dashboard.components.groups.add.success')) }}
@else
{{ sprintf("<strong>%s</strong> %s", trans('dashboard.notifications.whoops'), trans('dashboard.components.groups.add.failure').' '.$group->getErrors()) }}
@endif
</div>
@endif
@include('partials.dashboard.errors')
<form name="CreateComponentGroupForm" class="form-vertical" role="form" action="/dashboard/components/groups/add" method="POST">
<fieldset>
<div class="form-group">
+1 -10
View File
@@ -13,16 +13,7 @@
<div class="content-wrapper">
<div class="row">
<div class="col-md-12">
@if($incident = Session::get('incident'))
<div class="alert alert-{{ $incident->isValid() ? 'success' : 'danger' }}">
@if($incident->isValid())
{{ sprintf("<strong>%s</strong> %s", trans('dashboard.notifications.awesome'), trans('dashboard.incidents.add.success')) }}
@else
{{ sprintf("<strong>%s</strong> %s", trans('dashboard.notifications.whoops'), trans('dashboard.incidents.add.failure').' '.$incident->getErrors()) }}
@endif
</div>
@endif
@include('partials.dashboard.errors')
{{ Form::open(['name' => 'IncidentForm', 'class' => 'form-vertical', 'role' => 'form']) }}
<fieldset>
<div class="form-group">
@@ -13,6 +13,7 @@
<div class="content-wrapper">
<div class="row">
<div class="col-md-12">
@include('partials.dashboard.errors')
{{ Form::open(['name' => 'IncidentForm', 'class' => 'form-vertical', 'role' => 'form']) }}
<fieldset>
<div class="form-group">
@@ -16,6 +16,7 @@
<div class="content-wrapper header-fixed">
<div class="row">
<div class="col-sm-12">
@include('partials.dashboard.errors')
<p class="lead">{{ trans_choice('dashboard.incidents.logged', $incidents->count(), ['count' => $incidents->count()]) }}</p>
<div class="striped-list">
@@ -13,16 +13,7 @@
<div class="content-wrapper">
<div class="row">
<div class="col-md-12">
@if($template = Session::get('template'))
<div class="alert alert-{{ $template->isValid() ? 'success' : 'danger' }}">
@if($template->isValid())
{{ sprintf("<strong>%s</strong> %s", trans('dashboard.notifications.awesome'), trans('dashboard.incidents.templates.add.success')) }}
@else
{{ sprintf("<strong>%s</strong> %s", trans('dashboard.notifications.whoops'), trans('dashboard.incidents.templates.add.failure').' '.$template->getErrors()) }}
@endif
</div>
@endif
@include('partials.dashboard.errors')
{{ Form::open(['name' => 'IncidentTemplateForm', 'class' => 'form-vertical', 'role' => 'form']) }}
<fieldset>
<div class="form-group">
@@ -10,13 +10,7 @@
<div class="col-sm-12">
<form id="settings-form" name="SettingsForm" class="form-vertical" role="form" action="/dashboard/settings" method="POST" enctype="multipart/form-data">
<h4 class="sub-header" id="application-setup">{{ trans('dashboard.settings.app-setup.app-setup') }}</h4>
@if(($saved = Session::get('saved')))
<div class="alert alert-success"><strong>{{ trans('dashboard.settings.edit.success') }}</strong></div>
@elseif(Session::has('error_message'))
<div class="alert alert-danger"><strong>{{ Session::get('error_message') }}</strong></div>
@endif
@include('partials.dashboard.errors')
<fieldset>
<div class="row">
<div class="col-xs-12">
@@ -10,13 +10,7 @@
<div class="col-sm-12">
<form name="SettingsForm" class="form-vertical" role="form" action="/dashboard/settings" method="POST">
<h4 class="sub-header" id="security">{{ trans('dashboard.settings.security.security') }}</h4>
@if($saved = Session::get('saved'))
<div class="alert alert-success"><strong>{{ trans('dashboard.settings.edit.success') }}</strong></div>
@elseif(Session::has('saved'))
<div class="alert alert-danger"><strong>{{ trans('dashboard.settings.edit.failure') }}</strong></div>
@endif
@include('partials.dashboard.errors')
<fieldset>
<div class="row">
<div class="col-xs-12">
@@ -10,13 +10,7 @@
<div class="col-sm-12">
<form name="SettingsForm" class="form-vertical" role="form" action="/dashboard/settings" method="POST">
<h4 class="sub-header" id="stylesheet">{{ trans('dashboard.settings.stylesheet.stylesheet') }}</h4>
@if($saved = Session::get('saved'))
<div class="alert alert-success"><strong>{{ trans('dashboard.settings.edit.success') }}</strong></div>
@elseif(Session::has('saved'))
<div class="alert alert-danger"><strong>{{ trans('dashboard.settings.edit.failure') }}</strong></div>
@endif
@include('partials.dashboard.errors')
<fieldset>
<div class="row">
<div class="col-xs-12">
+1 -7
View File
@@ -10,13 +10,7 @@
<div class="col-sm-12">
<form name="SettingsForm" class="form-vertical" role="form" action="/dashboard/settings" method="POST">
<h4 class="sub-header" id="theme">{{ trans('dashboard.settings.theme.theme') }}</h4>
@if($saved = Session::get('saved'))
<div class="alert alert-success"><strong>{{ trans('dashboard.settings.edit.success') }}</strong></div>
@elseif(Session::has('saved'))
<div class="alert alert-danger"><strong>{{ trans('dashboard.settings.edit.failure') }}</strong></div>
@endif
@include('partials.dashboard.errors')
<fieldset>
<div class="row">
<div class="col-xs-6">
+1 -10
View File
@@ -12,16 +12,7 @@
<div class="content-wrapper">
<div class="row">
<div class="col-sm-12">
@if($created = Session::get('created'))
<div class="alert alert-success">
{{ sprintf("<strong>%s</strong> %s", trans('dashboard.notifications.awesome'), trans('dashboard.team.add.success')) }}
</div>
@elseif($errors = Session::get('errors'))
<div class="alert alert-danger">
{{ sprintf("<strong>%s</strong> %s", trans('dashboard.notifications.whoops'), trans('dashboard.team.add.failure')) }}
</div>
@endif
@include('partials.dashboard.errors')
<form name="UserForm" class="form-vertical" role="form" action="/dashboard/team/add" method="POST">
<fieldset>
<div class="form-group">
+1 -10
View File
@@ -12,16 +12,7 @@
<div class="content-wrapper">
<div class="row">
<div class="col-sm-12">
@if($updated = Session::get('updated'))
<div class="alert alert-{{ $updated ? 'success' : 'danger' }}">
@if($updated)
{{ sprintf("<strong>%s</strong> %s", trans('dashboard.notifications.awesome'), trans('dashboard.team.edit.success')) }}
@else
{{ sprintf("<strong>%s</strong> %s", trans('dashboard.notifications.whoops'), trans('dashboard.team.edit.failure')) }}
@endif
</div>
@endif
@include('partials.dashboard.errors')
<form name="UserForm" class="form-vertical" role="form" action="/dashboard/team/{{ $user->id }}" method="POST">
<fieldset>
<div class="form-group">
+1 -10
View File
@@ -12,16 +12,7 @@
<div class="content-wrapper">
<div class="row">
<div class="col-sm-12">
@if($updated = Session::get('updated'))
<div class="alert alert-{{ $updated ? 'success' : 'danger' }}">
@if($updated)
{{ sprintf("<strong>%s</strong> %s", trans('dashboard.notifications.awesome'), trans('dashboard.team.edit.success')) }}
@else
{{ sprintf("<strong>%s</strong> %s", trans('dashboard.notifications.whoops'), trans('dashboard.team.edit.failure')) }}
@endif
</div>
@endif
@include('partials.dashboard.errors')
<form name="UserForm" class="form-vertical" role="form" action="/dashboard/user" method="POST">
<fieldset>
<div class="form-group">
@@ -0,0 +1,15 @@
<div class="alerts">
<div class="alert alert-{{ $level }} alert-dismissible" role="alert">
<button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">&times;</span></button>
@if(isset($title)) <h5>{{ $title }}</h5> @endif
@if(is_array($message))
<ul class="list-unstyled">
@foreach ($message as $msg)
<li>{{ $msg }}</li>
@endforeach
</ul>
@else
{{ $message }}
@endif
</div>
</div>
@@ -0,0 +1,15 @@
@if ($errors->any())
@include('partials.dashboard._error', ['level' => 'danger', 'title' => Session::get('title'), 'message' => $errors->all(':message')])
@endif
@if ($message = Session::get('success'))
@include('partials.dashboard._error', ['level' => 'success', 'title' => Session::get('title'), 'message' => $message])
@endif
@if ($message = Session::get('warning'))
@include('partials.dashboard._error', ['level' => 'warning', 'title' => Session::get('title'), 'message' => $message])
@endif
@if ($message = Session::get('info'))
@include('partials.dashboard._error', ['level' => 'info', 'title' => Session::get('title'), 'message' => $message])
@endif