From 61ae73a9e5e833e7b51604d081d03229f2b7f037 Mon Sep 17 00:00:00 2001 From: Ro Date: Thu, 3 Nov 2022 13:46:36 -0700 Subject: [PATCH] Issue #83 Round 1 First pass for CSS refactor for the dashboard, including the login and index templates. Still rough but the basic structure is in place for both as well as the re-worked css that will be added to the repo later once all the pages have been updated. Lots to do still but a good start. --- brain/controller/APIControl.php | 2 + brain/controller/RouteControl.php | 1 - brain/views/dash/_frame.old.twig | 66 +++++++++++ brain/views/dash/_frame.twig | 52 ++++----- brain/views/dash/forms/login.twig | 26 ++--- brain/views/dash/partials/index.twig | 107 ++++++++---------- brain/views/dash/partials/navigation.twig | 40 +++---- brain/views/dash/partials/recent-meta.twig | 43 +++++++ brain/views/dash/partials/recent-options.twig | 42 ------- brain/views/dash/start.twig | 20 ++-- package.json | 4 +- package.old.json | 43 +++++++ public/assets/images/global/fipamo-logo.svg | 60 +++++----- public/assets/scripts/Start.js | 5 +- src/com/Base.js | 8 +- 15 files changed, 308 insertions(+), 211 deletions(-) create mode 100644 brain/views/dash/_frame.old.twig create mode 100644 brain/views/dash/partials/recent-meta.twig delete mode 100644 brain/views/dash/partials/recent-options.twig create mode 100644 package.old.json diff --git a/brain/controller/APIControl.php b/brain/controller/APIControl.php index dd60058..c9d253a 100644 --- a/brain/controller/APIControl.php +++ b/brain/controller/APIControl.php @@ -226,6 +226,8 @@ class APIControl break; } + var_dump($result); + $response->getBody()->write(json_encode($result)); return $response->withHeader('Content-Type', 'application/json'); } diff --git a/brain/controller/RouteControl.php b/brain/controller/RouteControl.php index ab75386..3ceaa26 100644 --- a/brain/controller/RouteControl.php +++ b/brain/controller/RouteControl.php @@ -34,7 +34,6 @@ class RouteControl switch (isset($args['first']) ? $args['first'] : 'index') { case 'api': //$result = APIControl::post($request, $response, $args); - //var_dump($result); return APIControl::post($request, $response, $args); break; default: diff --git a/brain/views/dash/_frame.old.twig b/brain/views/dash/_frame.old.twig new file mode 100644 index 0000000..4f96798 --- /dev/null +++ b/brain/views/dash/_frame.old.twig @@ -0,0 +1,66 @@ + + + + + + + {% block title %} + {{ title }} + {% endblock %} + + {% block stylesheets %}{% endblock %} + + +
+
+
+ +
+
+ +
+
+ +
+ +
+
+

MESSAGE TEXT

+
+ +
+
+
+
+ {% if status %} + + {% endif %} + {% apply spaceless %} + {% block mainContent %}{% endblock %} + {% endapply %} + +
+ + +
+ + + {% block javascripts %}{% endblock %} + + diff --git a/brain/views/dash/_frame.twig b/brain/views/dash/_frame.twig index 4f96798..f941c1e 100644 --- a/brain/views/dash/_frame.twig +++ b/brain/views/dash/_frame.twig @@ -30,36 +30,32 @@ -
-
- {% if status %} - - {% endif %} + {% if status %} +
{% apply spaceless %} - {% block mainContent %}{% endblock %} + {% endapply %} - -
- - -
- + {% endif %} + +
+ {% apply spaceless %} + {% block mainContent %}{% endblock %} + {% endapply %} +
{% block javascripts %}{% endblock %} diff --git a/brain/views/dash/forms/login.twig b/brain/views/dash/forms/login.twig index 2a8792d..ad86a3f 100644 --- a/brain/views/dash/forms/login.twig +++ b/brain/views/dash/forms/login.twig @@ -1,13 +1,13 @@ -
-
- - -
-
\ No newline at end of file +
+
+ +
+ +
diff --git a/brain/views/dash/partials/index.twig b/brain/views/dash/partials/index.twig index 0ebb0e2..3258b12 100644 --- a/brain/views/dash/partials/index.twig +++ b/brain/views/dash/partials/index.twig @@ -1,58 +1,51 @@ -
-
-
-
- Recent -
- -
-
- {% if data["entryCount"] != 0 %} - {% for page in data['pages'] %} - {% if page.media[0].type == 'mp4' %} - - - - - {{ include("dash/partials/recent-options.twig") }} - - - {% else %} - - - - {{ include("dash/partials/recent-options.twig") }} - - {% endif %} - - {% endfor %} - {% else %} - There are no pages - {% endif %} - -
+
+
+

Recent

+
+ + + + + + + +
+
+
+ {% if data["entryCount"] != 0 %} + {% for page in data['pages'] %} + {% if page.media[0].type == 'mp4' %} + + + + + {{ include("dash/partials/recent-meta.twig") }} + + + {% else %} + + + + {{ include("dash/partials/recent-meta.twig") }} + + {% endif %} + + {% endfor %} + {% else %} + There are no pages + {% endif %} + +
diff --git a/brain/views/dash/partials/navigation.twig b/brain/views/dash/partials/navigation.twig index 24634c1..10ffc29 100644 --- a/brain/views/dash/partials/navigation.twig +++ b/brain/views/dash/partials/navigation.twig @@ -1,23 +1,25 @@ -
+
- . - - - . - - -
\ No newline at end of file + . + + + + . + + + +
diff --git a/brain/views/dash/partials/recent-meta.twig b/brain/views/dash/partials/recent-meta.twig new file mode 100644 index 0000000..0160efe --- /dev/null +++ b/brain/views/dash/partials/recent-meta.twig @@ -0,0 +1,43 @@ +{% if page.menu == 'true' %} + {% set menu = "true" %} +{% else %} + {% set menu = "false" %} +{% endif %} +{% if page.published == 'true' %} + {% set published = "true" %} +{% else %} + {% set published = "false" %} +{% endif %} +{% if page.featured == 'true' %} + {% set featured = "true" %} +{% else %} + {% set featured = "false" %} +{% endif %} + + diff --git a/brain/views/dash/partials/recent-options.twig b/brain/views/dash/partials/recent-options.twig deleted file mode 100644 index c7e8096..0000000 --- a/brain/views/dash/partials/recent-options.twig +++ /dev/null @@ -1,42 +0,0 @@ -
- {% if page.menu == 'true' %} - {% set menu = "true" %} - {% else %} - {% set menu = "false" %} - {% endif %} - {% if page.published == 'true' %} - {% set published = "true" %} - {% else %} - {% set published = "false" %} - {% endif %} - {% if page.featured == 'true' %} - {% set featured = "true" %} - {% else %} - {% set featured = "false" %} - {% endif %} -
- - - - - -
-
- - {{ page.updated }} - -
- -
\ No newline at end of file diff --git a/brain/views/dash/start.twig b/brain/views/dash/start.twig index ad9d3d0..4f822ca 100644 --- a/brain/views/dash/start.twig +++ b/brain/views/dash/start.twig @@ -5,21 +5,17 @@ {% endblock %} {% block stylesheets %} - + {% endblock %} {% block mainContent %} -
-
- {% if status %} - {% apply spaceless %} - {{ include("dash/partials/index.twig") }} - {% endapply %} - {% else %} - {{ include("dash/forms/login.twig") }} - {% endif %} -
-
+ {% if status %} + {% apply spaceless %} + {{ include("dash/partials/index.twig") }} + {% endapply %} + {% else %} + {{ include("dash/forms/login.twig") }} + {% endif %} {% endblock %} {% block javascripts %} diff --git a/package.json b/package.json index ea57ef7..4f8c99c 100644 --- a/package.json +++ b/package.json @@ -35,8 +35,8 @@ "license": "UNLICENSED", "author": "Are0h", "scripts": { - "watch": "sass --watch src/styles:public/assets/css & npx parcel watch src/com/Start.js --dist-dir public/assets/scripts --public-url /assets/scripts", - "build": "sass src/styles:public/assets/css & npx parcel build src/com/Start.js --dist-dir public/assets/scripts --public-url /assets/scripts" + "watch": "npx parcel watch src/com/Start.js --dist-dir public/assets/scripts --public-url /assets/scripts", + "build": "npx parcel build src/com/Start.js --dist-dir public/assets/scripts --public-url /assets/scripts" }, "description": "Front end script for the most chill blog framework ever.", "repository": "https://code.playvicio.us/Are0h/Fipamo" diff --git a/package.old.json b/package.old.json new file mode 100644 index 0000000..ea57ef7 --- /dev/null +++ b/package.old.json @@ -0,0 +1,43 @@ +{ + "name": "fipamo-dash", + "version": "2.5.1-beta", + "private": true, + "apidoc": { + "name": "Fipamo API", + "version": "1.0.0", + "description": "The most chill API for the most chill blog framework" + }, + "devDependencies": { + "@babel/preset-env": "^7.16.5", + "babel-cli": "^6.26.0", + "eslint": "^8.11.0", + "eslint-plugin-babel": "^5.3.1", + "parcel": "^2.0.1", + "prettier": "^2.6.0", + "stylelint": "^14.8.2", + "stylelint-config-prettier-scss": "^0.0.1", + "stylelint-config-standard-scss": "^3.0.0" + }, + "dependencies": { + "@babel/core": "^7.16.5", + "@babel/eslint-parser": "^7.16.5", + "animejs": "^3.2.1", + "babel-plugin-prismjs": "^2.1.0", + "babel-preset-env": "^1.7.0", + "bulma": "^0.9.3", + "caret-pos": "^2.0.0", + "jsdoc": "^3.6.7", + "minami": "^1.2.3", + "prismjs": "^1.25.0", + "sass": "^1.45.1", + "sortablejs": "^1.14.0" + }, + "license": "UNLICENSED", + "author": "Are0h", + "scripts": { + "watch": "sass --watch src/styles:public/assets/css & npx parcel watch src/com/Start.js --dist-dir public/assets/scripts --public-url /assets/scripts", + "build": "sass src/styles:public/assets/css & npx parcel build src/com/Start.js --dist-dir public/assets/scripts --public-url /assets/scripts" + }, + "description": "Front end script for the most chill blog framework ever.", + "repository": "https://code.playvicio.us/Are0h/Fipamo" +} diff --git a/public/assets/images/global/fipamo-logo.svg b/public/assets/images/global/fipamo-logo.svg index f8d21b5..b8504ab 100644 --- a/public/assets/images/global/fipamo-logo.svg +++ b/public/assets/images/global/fipamo-logo.svg @@ -1,33 +1,33 @@ - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/public/assets/scripts/Start.js b/public/assets/scripts/Start.js index 45dd849..17b9d3b 100644 --- a/public/assets/scripts/Start.js +++ b/public/assets/scripts/Start.js @@ -537,10 +537,10 @@ class Base { // methods //-------------------------- start() { - if (document.getElementById("dash-form") || document.getElementById("dash-init")) { + if (document.getElementById("login") || document.getElementById("dash-init")) { var options = document.getElementsByClassName("init-option"); for(let index = 0; index < options.length; index++)options[index].addEventListener("click", (e)=>this.handleOptions(e)); - if (document.getElementById("dash-form")) document.getElementById("login-btn").addEventListener("click", (e)=>this.handleLogin(e)); + if (document.getElementById("login")) document.getElementById("login-btn").addEventListener("click", (e)=>this.handleLogin(e)); else { document.getElementById("init-blog").addEventListener("click", (e)=>this.handleSetup(e)); document.getElementById("blog-restore").addEventListener("click", (e)=>this.handleRestore(e)); @@ -557,6 +557,7 @@ class Base { let self = this; e.preventDefault(); let authForm = data.formDataToJSON(document.getElementById("login")); + console.log("authform"); notify.alert("Looking, hold up", null); let api = new (0, _fipamoAdminAPIDefault.default)(); this.processing = true; diff --git a/src/com/Base.js b/src/com/Base.js index 5d4b910..d74656a 100644 --- a/src/com/Base.js +++ b/src/com/Base.js @@ -20,15 +20,12 @@ export default class Base { // methods //-------------------------- start() { - if ( - document.getElementById('dash-form') || - document.getElementById('dash-init') - ) { + if (document.getElementById('login') || document.getElementById('dash-init')) { var options = document.getElementsByClassName('init-option'); for (let index = 0; index < options.length; index++) { options[index].addEventListener('click', e => this.handleOptions(e)); } - if (document.getElementById('dash-form')) { + if (document.getElementById('login')) { document .getElementById('login-btn') .addEventListener('click', e => this.handleLogin(e)); @@ -60,6 +57,7 @@ export default class Base { let self = this; e.preventDefault(); let authForm = data.formDataToJSON(document.getElementById('login')); + console.log('authform'); notify.alert('Looking, hold up', null); let api = new FipamoAdminAPI(); this.processing = true;