Skip to content

Commit

Permalink
4.1 Child templates 1/2 (#35874)
Browse files Browse the repository at this point in the history
* New mode for cassiopeia and atum

* DB Changes

* Fix wrong import paths

* SQL for updates

* Deleted files and folder for changing core templates to inheritable

* Better version comments

* Move custom files in core templates to media folder on update

* Better English in the comment

* Fix some paths

* System templates

* Deleted files and folders for system templates

* Move template preview files, too

* Create parent folders if necessary at target path

* Don't delete template previews

* Revert special handling for core template preview images

* move images to the correct folder

* Fix the logos

* One more path fixed

* Revert the tinyMCE changes here

* Fix the roboto path

* Fix the fontawesome path

* .css files imports are relative to the path of the file importing

* Add missing import

* Use realpath instaed of the Path::clean

* RecursiveDirectoryIterator && mkdir

* Meh

* Mehhh

* Update administrator/components/com_admin/script.php

Co-authored-by: Richard Fath <[email protected]>

* No dots and dirs

* Use the flag for the dots

* Update administrator/components/com_admin/script.php

Co-authored-by: Richard Fath <[email protected]>

* sql

* Cassiopeia Roboto

* Update paths to local font schemes in template style parameters on database update

* Roboto font path

Co-authored-by: Richard Fath <[email protected]>
Co-authored-by: Benjamin Trenkle <[email protected]>
  • Loading branch information
3 people authored Nov 30, 2021
1 parent 3ff973c commit 579e20e
Show file tree
Hide file tree
Showing 155 changed files with 471 additions and 210 deletions.
319 changes: 319 additions & 0 deletions administrator/components/com_admin/script.php

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
--
-- Convert core templates to new mode
--
UPDATE `#__template_styles` SET `inheritable` = 1 WHERE `template` = 'atum' AND `client_id` = 1 OR `template` = 'cassiopeia' AND `client_id` = 0;

UPDATE `#__template_styles`
SET `params` = REPLACE(`params`,'"useFontScheme":"templates\\/cassiopeia\\/css\\/','"useFontScheme":"media\\/templates\\/site\\/cassiopeia\\/css\\/')
WHERE `template` = 'cassiopeia'
AND `client_id` = 0;
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
--
-- Convert core templates to new mode
--
UPDATE "#__template_styles" SET "inheritable" = 1 WHERE "template" = 'atum' AND "client_id" = 1 OR "template" = 'cassiopeia' AND "client_id" = 0;

UPDATE "#__template_styles"
SET "params" = REPLACE("params",'"useFontScheme":"templates\\/cassiopeia\\/css\\/','"useFontScheme":"media\\/templates\\/site\\/cassiopeia\\/css\\/')
WHERE "template" = 'cassiopeia'
AND "client_id" = 0;
4 changes: 2 additions & 2 deletions administrator/templates/atum/error_full.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@
// Template params
$logoBrandLarge = $this->params->get('logoBrandLarge')
? Uri::root() . htmlspecialchars($this->params->get('logoBrandLarge'), ENT_QUOTES)
: $this->baseurl . '/templates/' . $this->template . '/images/logos/brand-large.svg';
: Uri::root() . 'media/templates/administrator/atum/images/logos/brand-large.svg';
$logoBrandSmall = $this->params->get('logoBrandSmall')
? Uri::root() . htmlspecialchars($this->params->get('logoBrandSmall'), ENT_QUOTES)
: $this->baseurl . '/templates/' . $this->template . '/images/logos/brand-small.svg';
: Uri::root() . 'media/templates/administrator/atum/images/logos/brand-small.svg';

$logoBrandLargeAlt = empty($this->params->get('logoBrandLargeAlt')) && empty($this->params->get('emptyLogoBrandLargeAlt'))
? 'alt=""'
Expand Down
6 changes: 3 additions & 3 deletions administrator/templates/atum/error_login.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@
// Template params
$logoBrandLarge = $this->params->get('logoBrandLarge')
? Uri::root() . htmlspecialchars($this->params->get('logoBrandLarge'), ENT_QUOTES)
: $this->baseurl . '/templates/' . $this->template . '/images/logos/brand-large.svg';
: Uri::root() . 'media/templates/administrator/atum/images/logos/brand-large.svg';
$loginLogo = $this->params->get('loginLogo')
? Uri::root() . $this->params->get('loginLogo')
: $this->baseurl . '/templates/' . $this->template . '/images/logos/login.svg';
: Uri::root() . 'media/templates/administrator/atum/images/logos/login.svg';
$logoBrandSmall = $this->params->get('logoBrandSmall')
? Uri::root() . htmlspecialchars($this->params->get('logoBrandSmall'), ENT_QUOTES)
: $this->baseurl . '/templates/' . $this->template . '/images/logos/brand-small.svg';
: Uri::root() . 'media/templates/administrator/atum/images/logos/brand-small.svg';

$logoBrandLargeAlt = empty($this->params->get('logoBrandLargeAlt')) && empty($this->params->get('emptyLogoBrandLargeAlt'))
? 'alt=""'
Expand Down
4 changes: 2 additions & 2 deletions administrator/templates/atum/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@
// Template params
$logoBrandLarge = $this->params->get('logoBrandLarge')
? Uri::root() . htmlspecialchars($this->params->get('logoBrandLarge'), ENT_QUOTES)
: $this->baseurl . '/templates/' . $this->template . '/images/logos/brand-large.svg';
: Uri::root() . 'media/templates/administrator/atum/images/logos/brand-large.svg';
$logoBrandSmall = $this->params->get('logoBrandSmall')
? Uri::root() . htmlspecialchars($this->params->get('logoBrandSmall'), ENT_QUOTES)
: $this->baseurl . '/templates/' . $this->template . '/images/logos/brand-small.svg';
: Uri::root() . 'media/templates/administrator/atum/images/logos/brand-small.svg';

$logoBrandLargeAlt = empty($this->params->get('logoBrandLargeAlt')) && empty($this->params->get('emptyLogoBrandLargeAlt'))
? 'alt=""'
Expand Down
6 changes: 3 additions & 3 deletions administrator/templates/atum/login.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@
// Template params
$logoBrandLarge = $this->params->get('logoBrandLarge')
? Uri::root() . htmlspecialchars($this->params->get('logoBrandLarge'), ENT_QUOTES)
: $this->baseurl . '/templates/' . $this->template . '/images/logos/brand-large.svg';
: Uri::root() . 'media/templates/administrator/atum/images/logos/brand-large.svg';
$loginLogo = $this->params->get('loginLogo')
? Uri::root() . $this->params->get('loginLogo')
: $this->baseurl . '/templates/' . $this->template . '/images/logos/login.svg';
: Uri::root() . 'media/templates/administrator/atum/images/logos/login.svg';
$logoBrandSmall = $this->params->get('logoBrandSmall')
? Uri::root() . htmlspecialchars($this->params->get('logoBrandSmall'), ENT_QUOTES)
: $this->baseurl . '/templates/' . $this->template . '/images/logos/brand-small.svg';
: Uri::root() . 'media/templates/administrator/atum/images/logos/brand-small.svg';

$logoBrandLargeAlt = empty($this->params->get('logoBrandLargeAlt')) && empty($this->params->get('emptyLogoBrandLargeAlt'))
? 'alt=""'
Expand Down
37 changes: 0 additions & 37 deletions administrator/templates/atum/scss/vendor/_bootstrap.scss

This file was deleted.

This file was deleted.

This file was deleted.

9 changes: 4 additions & 5 deletions administrator/templates/atum/templateDetails.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<authorEmail>[email protected]</authorEmail>
<copyright>(C) 2016 Open Source Matters, Inc.</copyright>
<description>TPL_ATUM_XML_DESCRIPTION</description>
<inheritable>1</inheritable>
<files>
<filename>component.php</filename>
<filename>cpanel.php</filename>
Expand All @@ -17,15 +18,13 @@
<filename>joomla.asset.json</filename>
<filename>login.php</filename>
<filename>templateDetails.xml</filename>
<filename>template_preview.png</filename>
<filename>template_thumbnail.png</filename>
<folder>css</folder>
<folder>html</folder>
<folder>images</folder>
<folder>scss</folder>
</files>
<media destination="templates/administrator/atum" folder="media">
<folder>js</folder>
<folder>css</folder>
<folder>scss</folder>
<folder>images</folder>
</media>
<positions>
<!-- used directly in the template -->
Expand Down
2 changes: 1 addition & 1 deletion administrator/templates/system/error.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
/** @var \Joomla\CMS\Document\ErrorDocument $this */

// Load template CSS file
$this->getWebAssetManager()->registerAndUseStyle('template.system.error', 'administrator/templates/system/css/error.css');
$this->getWebAssetManager()->registerAndUseStyle('template.system.error', 'media/system/css/system-admin-error.min.css');

// Set page title
$this->setTitle($this->error->getCode() . ' - ' . htmlspecialchars($this->error->getMessage(), ENT_QUOTES, 'UTF-8'));
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ $badge-font-size: .75rem;
$jicon-css-prefix: icon !default;
$fa-css-prefix: fa !default;
$fa-font-path: "../../../../media/vendor/fontawesome-free/webfonts";
$roboto-font-path: "../../../../media/vendor/roboto-fontface/fonts";
$roboto-font-path: "../../../../../media/vendor/roboto-fontface/fonts";

// Font weights
$thin-weight: 100;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Bootstrap functions
@import "../../../../media/vendor/bootstrap/scss/functions";
@import "../../../../../../media/vendor/bootstrap/scss/functions";

// Atum Variables
@import "variables";
Expand All @@ -8,12 +8,12 @@
@import "vendor/bootstrap";

// Fonts
@import "../../../../media/vendor/roboto-fontface/scss/roboto/sass/roboto-fontface";
@import "../../../../../../media/vendor/roboto-fontface/scss/roboto/sass/roboto-fontface";

@import "blocks/global"; // Leave this first

// jQuery Minicolors
@import "../../../../build/media_source/system/scss/jquery-minicolors";
@import "../../../../../../media/system/scss/jquery-minicolors";

// Vendor overrides
@import "vendor/bootstrap/badge";
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// Variables

// Media, Jumbotron & Print removed https://getbootstrap.com/docs/5.0/migration/
// Code is now in reboot https://github.com/twbs/bootstrap/pull/28917/files

@import "../../../../../../../media/vendor/bootstrap/scss/variables";
@import "../../../../../../../media/vendor/bootstrap/scss/mixins";
@import "../root";
@import "../../../../../../../media/vendor/bootstrap/scss/reboot";
@import "../../../../../../../media/vendor/bootstrap/scss/type";
@import "../../../../../../../media/vendor/bootstrap/scss/images";
@import "../../../../../../../media/vendor/bootstrap/scss/containers";
@import "../../../../../../../media/vendor/bootstrap/scss/grid";
@import "../../../../../../../media/vendor/bootstrap/scss/tables";
@import "../../../../../../../media/vendor/bootstrap/scss/forms";
@import "../../../../../../../media/vendor/bootstrap/scss/buttons";
@import "../../../../../../../media/vendor/bootstrap/scss/transitions";
@import "../../../../../../../media/vendor/bootstrap/scss/dropdown";
@import "../../../../../../../media/vendor/bootstrap/scss/accordion";
@import "../../../../../../../media/vendor/bootstrap/scss/button-group";
@import "../../../../../../../media/vendor/bootstrap/scss/nav";
@import "../../../../../../../media/vendor/bootstrap/scss/navbar";
@import "../../../../../../../media/vendor/bootstrap/scss/card";
@import "../../../../../../../media/vendor/bootstrap/scss/breadcrumb";
@import "../../../../../../../media/vendor/bootstrap/scss/pagination";
@import "../../../../../../../media/vendor/bootstrap/scss/badge";
@import "../../../../../../../media/vendor/bootstrap/scss/alert";
@import "../../../../../../../media/vendor/bootstrap/scss/progress";
@import "../../../../../../../media/vendor/bootstrap/scss/list-group";
@import "../../../../../../../media/vendor/bootstrap/scss/close";
@import "../../../../../../../media/vendor/bootstrap/scss/modal";
@import "../../../../../../../media/vendor/bootstrap/scss/tooltip";
@import "../../../../../../../media/vendor/bootstrap/scss/popover";
@import "../../../../../../../media/vendor/bootstrap/scss/carousel";
@import "../../../../../../../media/vendor/bootstrap/scss/utilities";
@import "../../../../../../../media/vendor/bootstrap/scss/utilities/api";
@import "../../../../../../../media/vendor/bootstrap/scss/helpers";
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// Awesomplete
@import "../../../../../../../../node_modules/awesomplete/awesomplete";

.awesomplete {
display: block;
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
@import "../../../../../../media/vendor/bootstrap/scss/functions";
@import "../../../../../../../../media/vendor/bootstrap/scss/functions";

// Atum Variables
@import "../../variables";

@import "../../../../../../media/vendor/bootstrap/scss/variables";
@import "../../../../../../media/vendor/bootstrap/scss/mixins";
@import "../../../../../../../../media/vendor/bootstrap/scss/variables";
@import "../../../../../../../../media/vendor/bootstrap/scss/mixins";

// choices.js
@import "../../../../../../node_modules/choices.js/src/styles/choices";
@import "../../../../../../../../node_modules/choices.js/src/styles/choices";

.choices {
border: 0;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Override the font path
$fa-css-prefix: fa;
$fa-font-path: "../../../../../../vendor/fontawesome-free/webfonts" !default;

// Font Awesome 5 Free
@import "../../../../../../../../media/vendor/fontawesome-free/scss/fontawesome";
@import "../../../../../../../../media/vendor/fontawesome-free/scss/regular";
@import "../../../../../../../../media/vendor/fontawesome-free/scss/solid";

// Brands must be imported last
@import "../../../../../../../../media/vendor/fontawesome-free/scss/brands";

// B/C for Icomoon
@import "../../../../../../system/scss/icomoon";

// RTL override
html[dir=rtl] .float-right {
float: left;
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@import "../../variables";
@import "../../../../../../node_modules/joomla-ui-custom-elements/dist/css/joomla-alert";
@import "../../../../../../../../node_modules/joomla-ui-custom-elements/dist/css/joomla-alert";

// The following is a restyle for the system alerts

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
@import "../../../../../../media/vendor/bootstrap/scss/functions";
@import "../../../../../../../../media/vendor/bootstrap/scss/functions";

// Atum Variables
@import "../../variables";

@import "../../../../../../media/vendor/bootstrap/scss/variables";
@import "../../../../../../media/vendor/bootstrap/scss/mixins";
@import "../../../../../../../../media/vendor/bootstrap/scss/variables";
@import "../../../../../../../../media/vendor/bootstrap/scss/mixins";

// Tabs

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Minicolours
@import "../../../../../../node_modules/@claviska/jquery-minicolors/jquery.minicolors";
@import "../../../../../../../../node_modules/@claviska/jquery-minicolors/jquery.minicolors";

.minicolors-theme-bootstrap {

Expand Down
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Fonts
$roboto-font-path: "../../../../media/vendor/roboto-fontface/fonts" !default;
@import "../../../../media/vendor/roboto-fontface/scss/roboto/sass/roboto-fontface";
$roboto-font-path: "../../../../../vendor/roboto-fontface/fonts" !default;
@import "../../../../../../../media/vendor/roboto-fontface/scss/roboto/sass/roboto-fontface";

:root {
--cassiopeia-font-family-body: "Roboto", sans-serif;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Bootstrap functions
@import "../../../media/vendor/bootstrap/scss/functions";
@import "../../../../../../media/vendor/bootstrap/scss/functions";

// Variables, Functions and Mixins
@import "tools/tools";
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
// Bootstrap functions
@import "../../../media/vendor/bootstrap/scss/functions";
@import "../../../../../../media/vendor/bootstrap/scss/functions";

// Variables, Functions and Mixins
@import "tools/tools";

// Bootstrap
@import "../../../media/vendor/bootstrap/scss/variables";
@import "../../../media/vendor/bootstrap/scss/bootstrap";
@import "../../../../../../media/vendor/bootstrap/scss/variables";
@import "../../../../../../media/vendor/bootstrap/scss/bootstrap";

// jQuery Minicolors
@import "../../../media/system/scss/jquery-minicolors";
@import "../../../../../../media/system/scss/jquery-minicolors";

// Blocks
@import "blocks/global"; // Leave this first
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Vendor
@import "../../../../media/vendor/bootstrap/scss/functions";
@import "../../../../../../../media/vendor/bootstrap/scss/functions";


// Variables
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
@import "../../../../../media/vendor/bootstrap/scss/functions";
@import "../../../../../media/vendor/bootstrap/scss/variables";
@import "../../../../../media/vendor/bootstrap/scss/mixins";
@import "../../../../../../../../media/vendor/bootstrap/scss/functions";
@import "../../../../../../../../media/vendor/bootstrap/scss/variables";
@import "../../../../../../../../media/vendor/bootstrap/scss/mixins";

// choices.js
@import "../../../../../media/vendor/choicesjs/scss/choices";
@import "../../../../../../../../media/vendor/choicesjs/scss/choices";

// Cassiopea Variables, Functions and Mixins
@import "../../tools/tools";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@import "../../tools/tools";
@import "../../../../../media/vendor/joomla-custom-elements/css/joomla-alert.css";
@import "../../../../../../vendor/joomla-custom-elements/css/joomla-alert.css";

// The following is a restyle for the system alerts
#system-message-container {
Expand Down
4 changes: 2 additions & 2 deletions installation/sql/mysql/base.sql
Original file line number Diff line number Diff line change
Expand Up @@ -808,8 +808,8 @@ CREATE TABLE IF NOT EXISTS `#__template_styles` (
--

INSERT INTO `#__template_styles` (`id`, `template`, `client_id`, `home`, `title`, `inheritable`, `parent`, `params`) VALUES
(10, 'atum', 1, '1', 'Atum - Default', 0, '', '{"hue":"hsl(214, 63%, 20%)","bg-light":"#f0f4fb","text-dark":"#495057","text-light":"#ffffff","link-color":"#2a69b8","special-color":"#001b4c","monochrome":"0","loginLogo":"","loginLogoAlt":"","logoBrandLarge":"","logoBrandLargeAlt":"","logoBrandSmall":"","logoBrandSmallAlt":""}'),
(11, 'cassiopeia', 0, '1', 'Cassiopeia - Default', 0, '', '{"brand":"1","logoFile":"","siteTitle":"","siteDescription":"","useFontScheme":"0","colorName":"colors_standard","fluidContainer":"0","stickyHeader":0,"backTop":0}');
(10, 'atum', 1, '1', 'Atum - Default', 1, '', '{"hue":"hsl(214, 63%, 20%)","bg-light":"#f0f4fb","text-dark":"#495057","text-light":"#ffffff","link-color":"#2a69b8","special-color":"#001b4c","monochrome":"0","loginLogo":"","loginLogoAlt":"","logoBrandLarge":"","logoBrandLargeAlt":"","logoBrandSmall":"","logoBrandSmallAlt":""}'),
(11, 'cassiopeia', 0, '1', 'Cassiopeia - Default', 1, '', '{"brand":"1","logoFile":"","siteTitle":"","siteDescription":"","useFontScheme":"0","colorName":"colors_standard","fluidContainer":"0","stickyHeader":0,"backTop":0}');

-- --------------------------------------------------------

Expand Down
Loading

0 comments on commit 579e20e

Please sign in to comment.