#9: Groups now uses the new Bootstrap v4 look

This commit is contained in:
Andy Heathershaw 2017-03-25 21:21:22 +00:00
parent 83ba49568e
commit d15ff4ec6f
6 changed files with 105 additions and 116 deletions

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="PublishConfigData" serverName="Development"> <component name="PublishConfigData" autoUpload="On explicit save action" serverName="Development">
<serverData> <serverData>
<paths name="Development"> <paths name="Development">
<serverdata> <serverdata>
@ -10,5 +10,6 @@
</serverdata> </serverdata>
</paths> </paths>
</serverData> </serverData>
<option name="myAutoUpload" value="ON_EXPLICIT_SAVE" />
</component> </component>
</project> </project>

View File

@ -85,7 +85,7 @@ class GroupController extends Controller
* @param int $id * @param int $id
* @return \Illuminate\Http\Response * @return \Illuminate\Http\Response
*/ */
public function edit($id) public function edit(Request $request, $id)
{ {
$this->authorize('admin-access'); $this->authorize('admin-access');
@ -95,6 +95,11 @@ class GroupController extends Controller
App::abort(404); App::abort(404);
} }
if (!$request->session()->has('_old_input'))
{
$request->session()->flash('_old_input', $group->toArray());
}
return Theme::render('admin.edit_group', ['group' => $group]); return Theme::render('admin.edit_group', ['group' => $group]);
} }

View File

@ -2,47 +2,42 @@
@section('title', trans('admin.create_group')) @section('title', trans('admin.create_group'))
@section('breadcrumb') @section('breadcrumb')
<div class="breadcrumb"> <li class="breadcrumb-item"><a href="{{ route('home') }}"><i class="fa fa-fw fa-home"></i></a></li>
<div class="container"> <li class="breadcrumb-item"><a href="{{ route('admin') }}">@lang('navigation.breadcrumb.admin')</a></li>
<ol class="breadcrumb"> <li class="breadcrumb-item"><a href="{{ route('groups.index') }}">@lang('navigation.breadcrumb.groups')</a></li>
<li><a href="{{ route('home') }}"><i class="fa fa-fw fa-home"></i></a></li> <li class="breadcrumb-item active">@lang('navigation.breadcrumb.create_group')</li>
<li><a href="{{ route('admin') }}">@lang('navigation.breadcrumb.admin')</a></li>
<li><a href="{{ route('groups.index') }}">@lang('navigation.breadcrumb.groups')</a></li>
<li class="active">@lang('navigation.breadcrumb.create_group')</li>
</ol>
</div>
</div>
@endsection @endsection
@section('content') @section('content')
<div class="container"> <div class="container">
<div class="row"> <div class="row">
<div class="col-xs-12"> <div class="col">
<h1>@yield('title')</h1> <h1>@yield('title')</h1>
<p>@lang('admin.create_group_intro')</p> <p>@lang('admin.create_group_intro')</p>
<hr/> <hr/>
{!! Form::open(['route' => 'groups.store', 'method' => 'POST']) !!} <form action="{{ route('groups.store') }}" method="post">
{{ csrf_field() }}
<div class="row"> <div class="row">
<div class="col-md-6 col-md-offset-3"> <div class="col-md-6 offset-md-3">
<div class="form-group{{ $errors->has('name') ? ' has-error' : '' }}"> <div class="form-group{{ $errors->has('name') ? ' has-danger' : '' }}">
{!! Form::label('name', trans('forms.name_label'), ['class' => 'control-label']) !!} <label class="form-control-label" for="group-name">@lang('forms.name_label')</label>
{!! Form::text('name', old('name'), ['class' => 'form-control']) !!} <input type="text" class="form-control" id="group-name" name="name" value="{{ old('name') }}">
@if ($errors->has('name')) @if ($errors->has('name'))
<span class="help-block"> <div class="form-control-feedback">
<strong>{{ $errors->first('name') }}</strong> <strong>{{ $errors->first('name') }}</strong>
</span> </div>
@endif @endif
</div> </div>
<div class="form-actions"> <div class="text-right">
<a href="{{ route('groups.index') }}" class="btn btn-default">@lang('forms.cancel_action')</a> <a href="{{ route('groups.index') }}" class="btn btn-link">@lang('forms.cancel_action')</a>
<button class="btn btn-success" type="submit"><i class="fa fa-fw fa-check"></i> @lang('forms.create_action')</button> <button class="btn btn-success" type="submit"><i class="fa fa-fw fa-check"></i> @lang('forms.create_action')</button>
</div> </div>
</div> </div>
</div> </div>
{!! Form::close() !!} </form>
</div> </div>
</div> </div>
</div> </div>

View File

@ -2,32 +2,31 @@
@section('title', trans('admin.delete_group', ['name' => $group->name])) @section('title', trans('admin.delete_group', ['name' => $group->name]))
@section('breadcrumb') @section('breadcrumb')
<div class="breadcrumb"> <li class="breadcrumb-item"><a href="{{ route('home') }}"><i class="fa fa-fw fa-home"></i></a></li>
<div class="container"> <li class="breadcrumb-item"><a href="{{ route('admin') }}">@lang('navigation.breadcrumb.admin')</a></li>
<ol class="breadcrumb"> <li class="breadcrumb-item"><a href="{{ route('groups.index') }}">@lang('navigation.breadcrumb.groups')</a></li>
<li><a href="{{ route('home') }}"><i class="fa fa-fw fa-home"></i></a></li> <li class="breadcrumb-item active">@lang('navigation.breadcrumb.delete_group')</li>
<li><a href="{{ route('admin') }}">@lang('navigation.breadcrumb.admin')</a></li>
<li><a href="{{ route('groups.index') }}">@lang('navigation.breadcrumb.groups')</a></li>
<li class="active">@lang('navigation.breadcrumb.delete_group')</li>
</ol>
</div>
</div>
@endsection @endsection
@section('content') @section('content')
<div class="container"> <div class="container">
<div class="row"> <div class="row">
<div class="col-xs-12"> <div class="col-md-8 offset-md-2">
<h1>@yield('title')</h1> <div class="card card-outline-danger">
<div class="card-header card-danger">@yield('title')</div>
<div class="card-block">
<p>@lang('admin.delete_group_confirm', ['name' => $group->name])</p> <p>@lang('admin.delete_group_confirm', ['name' => $group->name])</p>
<div class="alert alert-danger"> <p class="text-danger"><b>@lang('admin.delete_group_warning')</b></p>
@lang('admin.delete_group_warning')
</div> <div class="text-right">
<div class="form-actions"> <form action="{{ route('groups.destroy', [$group->id]) }}" method="post">
{!! Form::open(['route' => ['groups.destroy', $group->id], 'method' => 'DELETE']) !!} {{ csrf_field() }}
<a href="{{ route('groups.index') }}" class="btn btn-default">@lang('forms.cancel_action')</a> {{ method_field('DELETE') }}
<a href="{{ route('groups.index') }}" class="btn btn-link">@lang('forms.cancel_action')</a>
<button type="submit" class="btn btn-danger"><i class="fa fa-fw fa-trash"></i> @lang('forms.delete_action')</button> <button type="submit" class="btn btn-danger"><i class="fa fa-fw fa-trash"></i> @lang('forms.delete_action')</button>
{!! Form::close() !!} </form>
</div>
</div>
</div> </div>
</div> </div>
</div> </div>

View File

@ -2,32 +2,28 @@
@section('title', trans('admin.edit_group_title', ['group_name' => $group->name])) @section('title', trans('admin.edit_group_title', ['group_name' => $group->name]))
@section('breadcrumb') @section('breadcrumb')
<div class="breadcrumb"> <li class="breadcrumb-item"><a href="{{ route('home') }}"><i class="fa fa-fw fa-home"></i></a></li>
<div class="container"> <li class="breadcrumb-item"><a href="{{ route('admin') }}">@lang('navigation.breadcrumb.admin')</a></li>
<ol class="breadcrumb"> <li class="breadcrumb-item"><a href="{{ route('groups.index') }}">@lang('navigation.breadcrumb.groups')</a></li>
<li><a href="{{ route('home') }}"><i class="fa fa-fw fa-home"></i></a></li> <li class="breadcrumb-item active">@lang('navigation.breadcrumb.edit_group')</li>
<li><a href="{{ route('admin') }}">@lang('navigation.breadcrumb.admin')</a></li>
<li><a href="{{ route('groups.index') }}">@lang('navigation.breadcrumb.groups')</a></li>
<li class="active">@lang('navigation.breadcrumb.edit_group')</li>
</ol>
</div>
</div>
@endsection @endsection
@section('content') @section('content')
<div class="container"> <div class="container">
<div class="row"> <div class="row">
<div class="col-xs-12"> <div class="col">
<h1>@yield('title')</h1> <h1>@yield('title')</h1>
<p>@lang('admin.edit_group_intro')</p> <p>@lang('admin.edit_group_intro')</p>
<hr/> <hr/>
{!! Form::model($group, ['route' => ['groups.update', $group->id], 'method' => 'PUT']) !!} <form action="{{ route('groups.update', [$group->id]) }}" method="post">
{{ csrf_field() }}
{{ method_field('PUT') }}
<div> <div>
{{-- Nav tabs --}} {{-- Nav tabs --}}
<ul class="nav nav-tabs" role="tablist"> <ul class="nav nav-tabs" role="tablist">
<li role="presentation" class="active"><a href="#details-tab" aria-controls="details-tab" role="tab" data-toggle="tab"><i class="fa fa-fw fa-info-circle"></i> @lang('admin.group_details_tab')</a></li> @include(Theme::viewName('partials.tab'), ['active_tab' => 'details', 'tab_name' => 'details', 'tab_icon' => 'info-circle', 'tab_text' => trans('admin.group_details_tab')])
<li role="presentation"><a href="#users-tab" aria-controls="groups-tab" role="tab" data-toggle="tab"><i class="fa fa-fw fa-users"></i> @lang('admin.group_users_tab')</a></li> @include(Theme::viewName('partials.tab'), ['active_tab' => 'details', 'tab_name' => 'users', 'tab_icon' => 'users', 'tab_text' => trans('admin.group_users_tab')])
</ul> </ul>
{{-- Tab panes --}} {{-- Tab panes --}}
@ -35,20 +31,20 @@
{{-- Details --}} {{-- Details --}}
<div role="tabpanel" class="tab-pane active" id="details-tab"> <div role="tabpanel" class="tab-pane active" id="details-tab">
<div class="row"> <div class="row">
<div class="col-md-6 col-md-offset-3"> <div class="col-md-6 offset-md-3">
<div class="form-group{{ $errors->has('name') ? ' has-error' : '' }}"> <div class="form-group{{ $errors->has('name') ? ' has-danger' : '' }}">
{!! Form::label('name', trans('forms.name_label'), ['class' => 'control-label']) !!} <label class="form-control-label" for="group-name">@lang('forms.name_label')</label>
{!! Form::text('name', old('name'), ['class' => 'form-control']) !!} <input type="text" class="form-control" id="group-name" name="name" value="{{ old('name') }}">
@if ($errors->has('name')) @if ($errors->has('name'))
<span class="help-block"> <div class="form-control-feedback">
<strong>{{ $errors->first('name') }}</strong> <strong>{{ $errors->first('name') }}</strong>
</span> </div>
@endif @endif
</div> </div>
<div class="form-actions"> <div class="text-right">
<a href="{{ route('groups.index') }}" class="btn btn-default">@lang('forms.cancel_action')</a> <a href="{{ route('groups.index') }}" class="btn btn-link">@lang('forms.cancel_action')</a>
<button class="btn btn-success" type="submit"><i class="fa fa-fw fa-check"></i> @lang('forms.save_action')</button> <button class="btn btn-success" type="submit"><i class="fa fa-fw fa-check"></i> @lang('forms.save_action')</button>
</div> </div>
</div> </div>
@ -61,17 +57,17 @@
<p>@lang('admin.group_users_message', ['group_name' => $group->name])</p> <p>@lang('admin.group_users_message', ['group_name' => $group->name])</p>
<ul class="nav nav-pills"> <ul class="nav nav-pills">
@foreach ($group->users as $user) @foreach ($group->users as $user)
<li><a href="{{ route('users.edit', [$user->id]) }}">{{ $user->name }}</a></li> <li class="nav-item"><a class="nav-link" href="{{ route('users.edit', [$user->id]) }}">{{ $user->name }}</a></li>
@endforeach @endforeach
</ul> </ul>
@else @else
<p class="text-danger">@lang('admin.group_no_users_message')</p> <p class="text-danger">@lang('admin.group_no_users_message')</p>
<p><a class="btn btn-default" href="{{ route('users.index') }}">@lang('admin.users_title')</a></p> <div><a class="btn btn-secondary" href="{{ route('users.index') }}">@lang('admin.users_title')</a></div>
@endif @endif
</div> </div>
</div> </div>
</div> </div>
{!! Form::close() !!} </form>
</div> </div>
</div> </div>
</div> </div>

View File

@ -2,21 +2,15 @@
@section('title', trans('admin.list_groups_title')) @section('title', trans('admin.list_groups_title'))
@section('breadcrumb') @section('breadcrumb')
<div class="breadcrumb"> <li class="breadcrumb-item"><a href="{{ route('home') }}"><i class="fa fa-fw fa-home"></i></a></li>
<div class="container"> <li class="breadcrumb-item"><a href="{{ route('admin') }}">@lang('navigation.breadcrumb.admin')</a></li>
<ol class="breadcrumb"> <li class="breadcrumb-item active">@lang('navigation.breadcrumb.groups')</li>
<li><a href="{{ route('home') }}"><i class="fa fa-fw fa-home"></i></a></li>
<li><a href="{{ route('admin') }}">@lang('navigation.breadcrumb.admin')</a></li>
<li class="active">@lang('navigation.breadcrumb.groups')</li>
</ol>
</div>
</div>
@endsection @endsection
@section('content') @section('content')
<div class="container"> <div class="container">
<div class="row"> <div class="row">
<div class="col-xs-12"> <div class="col">
<h1>@yield('title')</h1> <h1>@yield('title')</h1>
<div class="alert alert-info" style="margin-bottom: 30px;"> <div class="alert alert-info" style="margin-bottom: 30px;">
<p><i class="fa fa-fw fa-info"></i> @lang('admin.list_groups_intro')</p> <p><i class="fa fa-fw fa-info"></i> @lang('admin.list_groups_intro')</p>
@ -36,11 +30,10 @@
@foreach ($groups as $group) @foreach ($groups as $group)
<tr> <tr>
<td> <td>
<span style="font-size: 1.3em;">{{ $group->name }}</span><br/> <a href="{{ route('groups.edit', ['id' => $group->id]) }}"><span style="font-size: 1.3em;">{{ $group->name }}</span></a><br/>
<span class="{{ $group->users()->count() == 0 ? "text-danger" : "text-success" }}">{{ trans_choice('admin.group_number_users', $group->users()->count()) }}</span> <span class="{{ $group->users()->count() == 0 ? "text-danger" : "text-success" }}">{{ trans_choice('admin.group_number_users', $group->users()->count()) }}</span>
</td> </td>
<td class="text-right"> <td class="text-right">
<a href="{{ route('groups.edit', ['id' => $group->id]) }}" class="btn btn-default">@lang('forms.edit_action')</a>
<a href="{{ route('groups.delete', ['id' => $group->id]) }}" class="btn btn-danger">@lang('forms.delete_action')</a> <a href="{{ route('groups.delete', ['id' => $group->id]) }}" class="btn btn-danger">@lang('forms.delete_action')</a>
</td> </td>
</tr> </tr>
@ -53,7 +46,7 @@
</div> </div>
<div class="pull-right" style="margin-top: 10px;"> <div class="pull-right" style="margin-top: 10px;">
<a href="{{ route('users.index') }}" class="btn btn-default">@lang('admin.list_users_title')</a> <a href="{{ route('users.index') }}" class="btn btn-link">@lang('admin.list_users_title')</a>
<a href="{{ route('groups.create') }}" class="btn btn-success"><i class="fa fa-fw fa-plus"></i> @lang('admin.create_group')</a> <a href="{{ route('groups.create') }}" class="btn btn-success"><i class="fa fa-fw fa-plus"></i> @lang('admin.create_group')</a>
</div> </div>
@endif @endif