From 837d9dfe6c846183ae74528b86efb1d60be77d82 Mon Sep 17 00:00:00 2001 From: Floorb <132411956+Neetpone@users.noreply.github.com> Date: Mon, 18 Apr 2022 13:54:01 -0400 Subject: [PATCH] Small form cleanup, re-add loader --- includes/common.php | 12 ++++++------ js/data_tables.js | 1 + login.php | 5 ----- theme/bulma/archive.php | 28 ++++++++++++++++++++++++++-- theme/bulma/common.php | 4 ++-- theme/bulma/errors.php | 2 +- theme/bulma/login.php | 6 +++--- theme/bulma/main.php | 2 +- theme/bulma/profile.php | 2 +- theme/bulma/view.php | 4 ++-- 10 files changed, 43 insertions(+), 23 deletions(-) diff --git a/includes/common.php b/includes/common.php index 671cd0e..e4abb93 100644 --- a/includes/common.php +++ b/includes/common.php @@ -242,20 +242,20 @@ $total_page_views = PageView::select('tpage')->orderBy('id', 'desc')->first()->t $total_unique_views = PageView::select('tvisit')->orderBy('id', 'desc')->first()->tvisit; $current_user = SessionHelper::currentUser(); -$current_ability = new AbilityHelper($current_user); function can(string $action, mixed $subject) : bool { - global $current_ability; + global $current_user; + static $current_ability = null; + + if ($current_ability === null) { + $current_ability = new AbilityHelper($current_user); + } return $current_ability->can($action, $subject); } -//SessionHelper::setupCsrfToken(); - $script_bundles = []; /* Security headers */ header('X-Frame-Options: SAMEORIGIN'); header('X-Content-Type-Options: nosniff'); - -//ob_start(); diff --git a/js/data_tables.js b/js/data_tables.js index 9f88b0c..25ab3e6 100644 --- a/js/data_tables.js +++ b/js/data_tables.js @@ -147,6 +147,7 @@ class DataTable { _loadEntries() { new Promise(this.ajaxCallback) .then(data => { + this.element.classList.remove('hidden'); this.unfilteredData = data.data; this._updateFilter(this.options.preFilter); }); diff --git a/login.php b/login.php index 337e8cc..7a00cf6 100644 --- a/login.php +++ b/login.php @@ -7,11 +7,6 @@ use PonePaste\Helpers\SessionHelper; use PonePaste\Models\User; use PonePaste\Models\UserSession; -// Current Date & User IP -$date = date('jS F Y'); -$ip = $_SERVER['REMOTE_ADDR']; - - // Check if already logged in if ($current_user !== null) { header("Location: ./"); diff --git a/theme/bulma/archive.php b/theme/bulma/archive.php index 6a2bb2d..c33f5ba 100644 --- a/theme/bulma/archive.php +++ b/theme/bulma/archive.php @@ -25,6 +25,29 @@ padding-left: 0.25rem; content: '▲'; } + + .hidden { + display: none; + visibility: hidden; + opacity: 0; + } + + table.hidden + .loading_container { + position: absolute; + top: 0; + left: 0; + bottom: 0; + right: 0; + width: 100%; + height: 100vh; + z-index: 99999999; + background-image: url('/img/loader.gif'); /* your icon gif file path */ + background-repeat: no-repeat; + background-color: #FFF; + background-position: center; + } + +
@@ -55,7 +78,7 @@  per page - +
@@ -64,7 +87,6 @@ - @@ -75,6 +97,8 @@ +
+
diff --git a/theme/bulma/common.php b/theme/bulma/common.php index 2ce6f91..89bc393 100644 --- a/theme/bulma/common.php +++ b/theme/bulma/common.php @@ -145,7 +145,7 @@ $flashes = getFlashes();