From 6db826c8a4bd3f18db1eb90c67b98cd54ee574c5 Mon Sep 17 00:00:00 2001 From: Deon George Date: Sat, 14 Aug 2021 11:11:20 +1000 Subject: [PATCH] Some datatables consistency --- .../dataTables.conditionalPaging.js | 82 +++++++++++++++++++ resources/views/domain/home.blade.php | 37 +++++++-- resources/views/domain/view.blade.php | 64 +++++++++++---- resources/views/echoarea/home.blade.php | 55 ++++++++++--- resources/views/filearea/home.blade.php | 55 ++++++++++--- .../views/layouts/partials/sidebar.blade.php | 2 +- resources/views/system/home.blade.php | 56 +++++++------ resources/views/system/ours.blade.php | 63 ++++++++------ resources/views/user/home.blade.php | 51 +++++++++--- resources/views/zone/home.blade.php | 39 ++++----- 10 files changed, 373 insertions(+), 131 deletions(-) create mode 100644 public/plugin/dataTables/dataTables.conditionalPaging.js diff --git a/public/plugin/dataTables/dataTables.conditionalPaging.js b/public/plugin/dataTables/dataTables.conditionalPaging.js new file mode 100644 index 0000000..4fb7fae --- /dev/null +++ b/public/plugin/dataTables/dataTables.conditionalPaging.js @@ -0,0 +1,82 @@ +/** + * @summary ConditionalPaging + * @description Hide paging controls when the amount of pages is <= 1 + * @version 1.0.0 + * @file dataTables.conditionalPaging.js + * @author Matthew Hasbach (https://github.com/mjhasbach) + * @contact hasbach.git@gmail.com + * @copyright Copyright 2015 Matthew Hasbach + * + * License MIT - http://datatables.net/license/mit + * + * This feature plugin for DataTables hides paging controls when the amount + * of pages is <= 1. The controls can either appear / disappear or fade in / out + * + * @example + * $('#myTable').DataTable({ + * conditionalPaging: true + * }); + * + * @example + * $('#myTable').DataTable({ + * conditionalPaging: { + * style: 'fade', + * speed: 500 // optional + * } + * }); + */ + +(function(window, document, $) { + $(document).on('init.dt', function(e, dtSettings) { + if ( e.namespace !== 'dt' ) { + return; + } + + var options = dtSettings.oInit.conditionalPaging || $.fn.dataTable.defaults.conditionalPaging; + + if ($.isPlainObject(options) || options === true) { + var config = $.isPlainObject(options) ? options : {}, + api = new $.fn.dataTable.Api(dtSettings), + speed = 'slow', + conditionalPaging = function(e) { + var $paging = $(api.table().container()).find('div.dataTables_paginate'), + pages = api.page.info().pages; + + if (e instanceof $.Event) { + if (pages <= 1) { + if (config.style === 'fade') { + $paging.stop().fadeTo(speed, 0); + } + else { + $paging.css('visibility', 'hidden'); + } + } + else { + if (config.style === 'fade') { + $paging.stop().fadeTo(speed, 1); + } + else { + $paging.css('visibility', ''); + } + } + } + else if (pages <= 1) { + if (config.style === 'fade') { + $paging.css('opacity', 0); + } + else { + $paging.css('visibility', 'hidden'); + } + } + }; + + if ( config.speed !== undefined ) { + speed = config.speed; + } + + conditionalPaging(); + + api.on('draw.dt', conditionalPaging); + } + }); +})(window, document, jQuery); diff --git a/resources/views/domain/home.blade.php b/resources/views/domain/home.blade.php index a43a49f..f00e0cd 100644 --- a/resources/views/domain/home.blade.php +++ b/resources/views/domain/home.blade.php @@ -10,12 +10,12 @@

In FTN network addresses, a domain is the 5th dimension and used when a system supports 5D addressing, ie: zone:net/node.point@domain.

Domains are used with zones to uniquely identify a FTN network.

Some legacy Fidonet software is not 5D aware and may behave unexpectedly when a domain is used

+

This system is aware of the following domains @can('admin',(new \App\Models\Domain))(you can add more)@endcan:

-
-

This system is aware of the following domains:

+
@if (\App\Models\Domain::count() == 0) @can('admin',(new \App\Models\Domain)) @@ -24,7 +24,7 @@

There are no domains - you need to ask an admin to create one for you.

@endcan @else - +
@@ -36,11 +36,6 @@ - @can('admin',(new \App\Models\Domain)) - - - - @endcan @foreach (\App\Models\Domain::orderBy('name')->with(['zones'])->get() as $oo) @@ -58,12 +53,38 @@ @endsection @section('page-scripts') + + + + + + + @append diff --git a/resources/views/domain/view.blade.php b/resources/views/domain/view.blade.php index 3463237..bb9c961 100644 --- a/resources/views/domain/view.blade.php +++ b/resources/views/domain/view.blade.php @@ -28,7 +28,7 @@
@if($o->echoareas->count())

This network provides the following Echomail areas:

-
ID
Add New Domain
{{ $oo->id }}
+
@@ -72,7 +72,7 @@
@if($o->fileareas->count())

This network provides the following File areas:

-
+
@@ -105,7 +105,7 @@

The following systems are members of this network.

-
Filearea
+
@@ -162,26 +162,60 @@ @endsection @section('page-scripts') - + - + @append \ No newline at end of file diff --git a/resources/views/echoarea/home.blade.php b/resources/views/echoarea/home.blade.php index d3d0a55..79ee281 100644 --- a/resources/views/echoarea/home.blade.php +++ b/resources/views/echoarea/home.blade.php @@ -14,7 +14,7 @@
-

This system is aware of the following echoareas:

+

This system is aware of the following echoareas @can('admin',(new \App\Models\Echoarea))(you can add more)@endcan:

@if (\App\Models\Echoarea::count() == 0) @can('admin',(new \App\Models\Echoarea)) @@ -23,7 +23,7 @@

There are no echoareas - you need to ask an admin to create one for you.

@endcan @else -
System
+
@@ -35,11 +35,6 @@ - @can('admin',(new \App\Models\Echoarea)) - - - - @endcan @foreach (\App\Models\Echoarea::orderBy('name')->with(['domain'])->get() as $oo) @@ -57,12 +52,48 @@ @endsection @section('page-scripts') - + + + + + @append diff --git a/resources/views/filearea/home.blade.php b/resources/views/filearea/home.blade.php index 34589f2..1be2673 100644 --- a/resources/views/filearea/home.blade.php +++ b/resources/views/filearea/home.blade.php @@ -14,7 +14,7 @@
-

This system is aware of the following fileareas:

+

This system is aware of the following fileareas @can('admin',(new \App\Models\Filearea))(you can add more)@endcan:

@if (\App\Models\Filearea::count() == 0) @can('admin',(new \App\Models\Filearea)) @@ -23,7 +23,7 @@

There are no fileareas - you need to ask an admin to create one for you.

@endcan @else -
ID
Add New Echoarea
{{ $oo->id }}
+
@@ -35,11 +35,6 @@ - @can('admin',(new \App\Models\Filearea)) - - - - @endcan @foreach (\App\Models\Filearea::orderBy('name')->with(['domain'])->get() as $oo) @@ -57,12 +52,48 @@ @endsection @section('page-scripts') - + + + + + @append diff --git a/resources/views/layouts/partials/sidebar.blade.php b/resources/views/layouts/partials/sidebar.blade.php index 879df69..b4a83c5 100644 --- a/resources/views/layouts/partials/sidebar.blade.php +++ b/resources/views/layouts/partials/sidebar.blade.php @@ -18,7 +18,7 @@ @can('admin')
Users
-
Create
+
Create
List
@endcan diff --git a/resources/views/system/home.blade.php b/resources/views/system/home.blade.php index 43db0bc..c721ac5 100644 --- a/resources/views/system/home.blade.php +++ b/resources/views/system/home.blade.php @@ -13,7 +13,7 @@
-

This system is aware of the following systems:

+

This system is aware of the following systems @can('admin',(new \App\Models\System))(you can add more)@endcan:

@if (\App\Models\System::count() == 0) @can('admin',(new \App\Models\System)) @@ -22,11 +22,7 @@

There are no systems - you need to ask an admin to create one for you.

@endcan @else - @can('admin',(new \App\Models\System)) -

You can Add New System.

- @endcan - -
ID
Add New Filearea
{{ $oo->id }}
+
@@ -66,32 +62,44 @@ @endsection @section('page-scripts') - + - + @append diff --git a/resources/views/system/ours.blade.php b/resources/views/system/ours.blade.php index b3bffb4..b4ac7c2 100644 --- a/resources/views/system/ours.blade.php +++ b/resources/views/system/ours.blade.php @@ -13,7 +13,7 @@ @else

These BBS systems are configured here.

-
ID
+
@@ -36,7 +36,7 @@ - + @endforeach @@ -48,39 +48,52 @@ @endsection @section('page-scripts') - + + @append diff --git a/resources/views/user/home.blade.php b/resources/views/user/home.blade.php index 1c01ab8..8bf266c 100644 --- a/resources/views/user/home.blade.php +++ b/resources/views/user/home.blade.php @@ -5,9 +5,15 @@ @section('content')
+
+
+

System Users

+
+
+
-

Current Users:

-
Domain{{ $oo->system->sysop }} {{ $oo->system->location }} {{ $oo->system->last_session ? $oo->system->last_session->format('Y-m-d H:i') : '-' }}{{ join(',',$oo->system->addresses->where('zone_id',$oo->zone_id)->pluck('ftn')->toArray()) }}{{ $oo->system->addresses->where('zone_id',$oo->zone_id)->pluck('ftn4d')->join(', ') }} {{ $oo->system->zt_id }}
+

This system is aware of the following users @can('admin',(new \App\Models\User))(you can add more)@endcan:

+
@@ -20,11 +26,6 @@ - @can('admin',(new \App\Models\User)) - - - - @endcan @foreach (\App\Models\User::orderBy('email')->cursor() as $oo) @@ -42,12 +43,38 @@ @endsection @section('page-scripts') - + + + + @append diff --git a/resources/views/zone/home.blade.php b/resources/views/zone/home.blade.php index 4c034bc..f517693 100644 --- a/resources/views/zone/home.blade.php +++ b/resources/views/zone/home.blade.php @@ -10,13 +10,12 @@

In FTN network addresses, a zone is the 3rd dimension and used when a system supports 3D (or better) addressing, ie: zone:net/node.point@domain.

Zones are used with domains to uniquely identify a FTN network. Within an FTN network there can be multiple zones with the same domain.

It is rare that a domain has multiple zones - unless it grows quite large. Zones can also be used to group systems into a common boundary.

+

This system is aware of the following zones in each domain @can('admin',(new \App\Models\Zone))(you can add more)@endcan:

-

This system is aware of the following zones in each domain:

- @if (\App\Models\Zone::count() == 0) @can('admin',(new \App\Models\Zone))

There are no zones setup, to set up your first.

@@ -24,10 +23,7 @@

There are no zones - you need to ask an admin to create one for you.

@endcan @else - @can('admin',(new \App\Models\Domain)) -

You can Add New Zone.

- @endcan -
ID
Add New User
{{ $oo->id }}
+
@@ -54,15 +50,11 @@ @endsection @section('page-scripts') -{{-- - - ---}} - + - +
Domain