#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"?>
<project version="4">
<component name="PublishConfigData" serverName="Development">
<component name="PublishConfigData" autoUpload="On explicit save action" serverName="Development">
<serverData>
<paths name="Development">
<serverdata>
@ -10,5 +10,6 @@
</serverdata>
</paths>
</serverData>
<option name="myAutoUpload" value="ON_EXPLICIT_SAVE" />
</component>
</project>

View File

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

View File

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

View File

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

View File

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

View File

@ -2,21 +2,15 @@
@section('title', trans('admin.list_groups_title'))
@section('breadcrumb')
<div class="breadcrumb">
<div class="container">
<ol class="breadcrumb">
<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>
<li class="breadcrumb-item"><a href="{{ route('home') }}"><i class="fa fa-fw fa-home"></i></a></li>
<li class="breadcrumb-item"><a href="{{ route('admin') }}">@lang('navigation.breadcrumb.admin')</a></li>
<li class="breadcrumb-item active">@lang('navigation.breadcrumb.groups')</li>
@endsection
@section('content')
<div class="container">
<div class="row">
<div class="col-xs-12">
<div class="col">
<h1>@yield('title')</h1>
<div class="alert alert-info" style="margin-bottom: 30px;">
<p><i class="fa fa-fw fa-info"></i> @lang('admin.list_groups_intro')</p>
@ -36,11 +30,10 @@
@foreach ($groups as $group)
<tr>
<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>
</td>
<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>
</td>
</tr>
@ -53,7 +46,7 @@
</div>
<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>
</div>
@endif