Add a reference to the skin name in the templates to make it easier to create and modify skins

This commit is contained in:
Nabeel Shahzad
2018-02-03 18:18:09 -06:00
parent 25b86274cf
commit b4908f482e
27 changed files with 117 additions and 105 deletions

View File

@@ -54,11 +54,19 @@ if (!function_exists('skin_view')) {
/**
* Render a skin
* @param $template
* @param array $vars
* @param array $merge_data
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
function skin_view($template, array $vars = [], $merge_data = [])
{
# Add the current skin name so we don't need to hardcode it in the templates
# Makes it a bit easier to create a new skin by modifying an existing one
$merge_data['SKIN_NAME'] = config('phpvms.skin');
$tpl = 'layouts/' . config('phpvms.skin') . '/' . $template;
# TODO: Look for an overridden template in a special folder
return view($tpl, $vars, $merge_data);
}
}

View File

@@ -1,6 +1,6 @@
@extends('layouts.default.app')
@extends("layouts.${SKIN_NAME}.app")
@section('title', 'live map')
@section('content')
{{ Widget::liveMap() }}
@endsection

View File

@@ -48,7 +48,7 @@
</p>
</div>
<div class="collapse navbar-collapse justify-content-end" id="navigation">
@include('layouts.default.nav')
@include("layouts.${SKIN_NAME}.nav")
</div>
</div>
</nav>
@@ -57,7 +57,7 @@
<div class="wrapper">
<div class="clear"></div>
<div class="container-fluid" style="width: 85%!important;">
@include('layouts.default.flash.message')
@include("layouts.${SKIN_NAME}.flash.message")
@yield('content')
</div>
<div class="clearfix" style="height: 200px;"></div>

View File

@@ -1,5 +1,6 @@
@extends('layouts.default.auth.layout')
@extends("layouts.${SKIN_NAME}.auth.layout")
@section('title', 'log in')
@section('content')
<div class="col-md-4 content-center">
<div class="card card-login card-plain">

View File

@@ -1,4 +1,4 @@
@extends('layouts.default.app')
@extends("layouts.${SKIN_NAME}.app")
<!-- Main Content -->
@section('content')

View File

@@ -1,4 +1,4 @@
@extends('layouts.default.app')
@extends("layouts.${SKIN_NAME}.app")
@section('content')
<div class="container">

View File

@@ -1,6 +1,6 @@
@extends('layouts.default.app')
@extends("layouts.${SKIN_NAME}.app")
@section('title', 'registration pending')
@section('content')
<div class="row">
<div class="col-md-12 " style="text-align: center;">

View File

@@ -1,5 +1,6 @@
@extends('layouts.default.app')
@extends("layouts.${SKIN_NAME}.app")
@section('title', 'register')
@section('content')
<div class="row">
<div class="col-sm-3"></div>
@@ -66,7 +67,7 @@
<p class="text-danger">{{ $errors->first('password_confirmation') }}</p>
@endif
@include('layouts.default.auth.toc')
@include("layouts.${SKIN_NAME}.auth.toc")
<div style="width: 100%; text-align: right; padding-top: 20px;">
By registering, you agree to the Term and Conditions<br /><br />

View File

@@ -1,11 +1,12 @@
@extends('layouts.default.app')
@extends("layouts.${SKIN_NAME}.app")
@section('title', 'registration submitted')
@section('content')
<div class="container registered-page">
<h3>Registration Confirmation</h3>
<p>Your application has been submitted. It requires staff member approval, once a staff member has reviewed your application, you will receive an email confirmation.</p>
<h3>Registration Confirmation</h3>
<p>
Your application has been submitted. It requires staff member approval, once a
staff member has reviewed your application, you will receive an email confirmation.
</p>
</div>
@endsection

View File

@@ -1,16 +1,16 @@
@extends('layouts.default.app')
@extends("layouts.${SKIN_NAME}.app")
@section('title', 'registration denied')
@section('content')
<div class="row">
<div class="col-md-12 " style="text-align: center;">
<div class="flex-center position-ref full-height">
<div class="title m-b-md">
<h2 class="description">
your registration was denied. please contact an administrator
</h2>
</div>
<div class="row">
<div class="col-md-12 " style="text-align: center;">
<div class="flex-center position-ref full-height">
<div class="title m-b-md">
<h2 class="description">
your registration was denied. please contact an administrator
</h2>
</div>
</div>
</div>
@endsection()
</div>
@endsection

View File

@@ -1,16 +1,16 @@
@extends('layouts.default.app')
@extends("layouts.${SKIN_NAME}.app")
@section('title', 'account suspended')
@section('content')
<div class="row">
<div class="col-md-12 " style="text-align: center;">
<div class="flex-center position-ref full-height">
<div class="title m-b-md">
<h2 class="description">
your has been suspended. please contact an administrator
</h2>
</div>
<div class="row">
<div class="col-md-12 " style="text-align: center;">
<div class="flex-center position-ref full-height">
<div class="title m-b-md">
<h2 class="description">
your has been suspended. please contact an administrator
</h2>
</div>
</div>
</div>
@endsection()
</div>
@endsection

View File

@@ -1,6 +1,6 @@
@extends('layouts.default.app')
@extends("layouts.${SKIN_NAME}.app")
@section('title', 'dashboard')
@section('content')
<div class="row">
<div class="col-sm-8">
@@ -54,7 +54,7 @@
<div class="nav nav-tabs" role="tablist" style="background: #067ec1; color: #FFF;">
Your Last Report
</div>
@include('layouts.default.pireps.pirep_card', ['pirep' => $last_pirep])
@include("layouts.${SKIN_NAME}.pireps.pirep_card", ['pirep' => $last_pirep])
@endif
{{ Widget::latestNews(['count' => 1]) }}

View File

@@ -1,4 +0,0 @@
<!-- DataTable Bootstrap -->
<link href="https://cdn.datatables.net/1.10.12/css/dataTables.bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="//cdn.datatables.net/1.10.12/css/jquery.dataTables.min.css">
<link rel="stylesheet" href="https://cdn.datatables.net/buttons/1.2.2/css/buttons.bootstrap.min.css">

View File

@@ -1,7 +0,0 @@
<!-- Datatables -->
<script src="https://cdn.datatables.net/1.10.12/js/jquery.dataTables.min.js"></script>
<script src="https://cdn.datatables.net/1.10.12/js/dataTables.bootstrap.min.js"></script>
<script src="https://cdn.datatables.net/buttons/1.2.2/js/dataTables.buttons.min.js"></script>
<script src="https://cdn.datatables.net/buttons/1.2.2/js/buttons.bootstrap.min.js"></script>
<script src="https://cdn.datatables.net/buttons/1.2.2/js/buttons.colVis.min.js"></script>
<script src="{{ asset('vendor/datatables/buttons.server-side.js') }}"></script>

View File

@@ -1,8 +1,12 @@
@extends('layouts.default.app')
@extends("layouts.${SKIN_NAME}.app")
@section('title', 'not authorized')
@section('content')
<div class="container registered-page">
<h3>Unauthorized</h3>
<p>Well, this is embarrassing, you are not authorized to access or perform this function. Click <a href="{{ url()->previous() }}">here</a> to go back to the home page.</p>
<h3>Unauthorized</h3>
<p>
Well, this is embarrassing, you are not authorized to access or perform this function.
Click <a href="{{ url()->previous() }}">here</a> to go back to the home page.
</p>
</div>
@endsection

View File

@@ -1,11 +1,13 @@
@extends('layouts.default.app')
@extends("layouts.${SKIN_NAME}.app")
@section('title', 'not found')
@section('content')
<div class="container registered-page">
<h3>Page Not Found</h3>
<p>Well, this is embarrassing, the page you requested does not exist. Click <a href="{{ url()->previous() }}">here</a> to go back to the home page.
{{ $exception->getMessage() }}
</p>
<h3>Page Not Found</h3>
<p>
Well, this is embarrassing, the page you requested does not exist.
Click <a href="{{ url()->previous() }}">here</a> to go back to the home page.
{{ $exception->getMessage() }}
</p>
</div>
@endsection

View File

@@ -1,23 +1,24 @@
@extends('layouts.default.app')
@extends("layouts.${SKIN_NAME}.app")
@section('title', 'flights')
@section('content')
<div class="row">
@include('flash::message')
<div class="col-md-9">
<h2 class="description">flights</h2>
@include('layouts.default.flights.table')
@include("layouts.${SKIN_NAME}.flights.table")
</div>
<div class="col-md-3">
@include('layouts.default.flights.search')
@include("layouts.${SKIN_NAME}.flights.search")
</div>
</div>
<div class="row">
<div class="col-12 text-center">
{{ $flights->links('layouts.default.pagination.default') }}
{{ $flights->links("layouts.${SKIN_NAME}.pagination.default") }}
</div>
</div>
@endsection
@section('scripts')
<script>
$(document).ready(function() {

View File

@@ -1,4 +1,4 @@
@extends('layouts.default.app')
@extends("layouts.${SKIN_NAME}.app")
@section('title', 'Flight '.$flight->ident)
@section('content')
@@ -49,5 +49,5 @@
</table>
</div>
</div>
@include('layouts.default.flights.map')
@include("layouts.${SKIN_NAME}.flights.map")
@endsection

View File

@@ -1,5 +1,6 @@
@extends('layouts.default.app')
@extends("layouts.${SKIN_NAME}.app")
@section('title', 'welcome!')
@section('content')
<div class="row">
<div class="col-sm-12">

View File

@@ -1,5 +1,6 @@
@extends('layouts.default.app')
@extends("layouts.${SKIN_NAME}.app")
@section('title', 'file pirep')
@section('content')
<div class="row">
<div class="col-md-12">
@@ -7,12 +8,13 @@
@include('flash::message')
{!! Form::open(['route' => 'frontend.pireps.store']) !!}
@include('layouts.default.pireps.fields')
@include("layouts.${SKIN_NAME}.pireps.fields")
{!! Form::close() !!}
</div>
</div>
@endsection
@section('scripts')
<script>
$(document).ready(function() {

View File

@@ -1,4 +1,3 @@
<div class="row">
<div class="col-12">
<table class="table table-full-width">

View File

@@ -1,5 +1,6 @@
@extends('layouts.default.app')
@extends("layouts.${SKIN_NAME}.app")
@section('title', 'pireps')
@section('content')
<div class="row">
<div class="col-md-12">
@@ -10,12 +11,12 @@
</div>
<h2 class="description">pilot reports</h2>
@include('flash::message')
@include('layouts.default.pireps.table')
@include("layouts.${SKIN_NAME}.pireps.table")
</div>
</div>
<div class="row">
<div class="col-12 text-center">
{{ $pireps->links('layouts.default.pagination.default') }}
{{ $pireps->links("layouts.${SKIN_NAME}.pagination.default") }}
</div>
</div>
@endsection

View File

@@ -1,6 +1,6 @@
@extends('layouts.default.app')
@extends("layouts.${SKIN_NAME}.app")
@section('title', 'PIREP '.$pirep->ident)
@section('content')
<div class="row">
<div class="col-md-12">
@@ -72,27 +72,27 @@
</div>
@if(count($pirep->fields) > 0)
<div class="row">
<div class="col-md-12">
<h3 class="description">fields</h3>
<table class="table">
<thead>
<th>Name</th>
<th>Value</th>
</thead>
<tbody>
@foreach($pirep->fields as $field)
<tr>
<td>{!! $field->name !!}</td>
<td>{!! $field->value !!}</td>
</tr>
@endforeach
</tbody>
</table>
<div class="row">
<div class="col-md-12">
<h3 class="description">fields</h3>
<table class="table">
<thead>
<th>Name</th>
<th>Value</th>
</thead>
<tbody>
@foreach($pirep->fields as $field)
<tr>
<td>{!! $field->name !!}</td>
<td>{!! $field->value !!}</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
@endif
@include('layouts.default.pireps.map')
@include("layouts.${SKIN_NAME}.pireps.map")
@endsection

View File

@@ -1 +1,2 @@
@each('layouts.default.pireps.pirep_card', $pireps, 'pirep')
@each("layouts.${SKIN_NAME}.pireps.pirep_card", $pireps, 'pirep')

View File

@@ -1,12 +1,13 @@
@extends('layouts.default.app')
@extends("layouts.${SKIN_NAME}.app")
@section('title', 'edit profile')
@section('content')
<div class="row">
<div class="col-md-12">
<h2 class="description">edit your profile</h2>
@include('flash::message')
{!! Form::model($user, ['route' => ['frontend.profile.update', $user->id], 'method' => 'patch']) !!}
@include('layouts.default.profile.fields')
@include("layouts.${SKIN_NAME}.profile.fields")
{!! Form::close() !!}
</div>
</div>

View File

@@ -1,5 +1,6 @@
@extends('layouts.default.app')
@extends("layouts.${SKIN_NAME}.app")
@section('title', 'profile')
@section('content')
<div class="row profile-page content-center text-color-dark-beige">
<div class="col-md-4" style="text-align:center;">

View File

@@ -1,17 +1,16 @@
@extends('layouts.default.app')
@extends("layouts.${SKIN_NAME}.app")
@section('title', 'Pilots')
@section('content')
<div class="row">
<div class="col-md-12">
<h2 class="description">pilots</h2>
@include('layouts.default.users.table')
@include("layouts.${SKIN_NAME}.users.table")
</div>
</div>
<div class="row">
<div class="col-12 text-center">
{{ $users->links('layouts.default.pagination.default') }}
{{ $users->links("layouts.${SKIN_NAME}.pagination.default") }}
</div>
</div>
@endsection