From 0e9d64edb76db4a6203ebd3a4989acccb1b0e1e6 Mon Sep 17 00:00:00 2001
From: Jack Wilkinson <31214002+jaxwilko@users.noreply.github.com>
Date: Fri, 8 Nov 2024 09:28:06 +0000
Subject: [PATCH 1/9] Remove redundent vite logic (#1249)
---
modules/system/console/asset/vite/ViteWatch.php | 11 -----------
1 file changed, 11 deletions(-)
diff --git a/modules/system/console/asset/vite/ViteWatch.php b/modules/system/console/asset/vite/ViteWatch.php
index aee89ac1db..b58e0d3e0f 100644
--- a/modules/system/console/asset/vite/ViteWatch.php
+++ b/modules/system/console/asset/vite/ViteWatch.php
@@ -57,17 +57,6 @@ protected function createCommand(string $configPath): array
return array_values($command);
}
- /**
- * Create the public dir if required
- */
- protected function beforeExecution(string $configPath): void
- {
- $publicDir = dirname($configPath) . '/public';
- if (!File::exists($publicDir)) {
- File::makeDirectory($publicDir);
- }
- }
-
/**
* Handle the cleanup of this command if a termination signal is received
*/
From 225457a468a901ba6304047a8a091ff93eb07eb4 Mon Sep 17 00:00:00 2001
From: AIC BV <89913092+AIC-BV@users.noreply.github.com>
Date: Sun, 10 Nov 2024 05:11:17 +0100
Subject: [PATCH 2/9] Fix deprecated meta tag (#1250)
---
modules/backend/layouts/_head.php | 2 +-
modules/backend/layouts/auth.php | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/modules/backend/layouts/_head.php b/modules/backend/layouts/_head.php
index 0ff93ceb75..16c794cb2d 100644
--- a/modules/backend/layouts/_head.php
+++ b/modules/backend/layouts/_head.php
@@ -1,7 +1,7 @@
-
+
diff --git a/modules/backend/layouts/auth.php b/modules/backend/layouts/auth.php
index ec65941199..a227a7a06f 100644
--- a/modules/backend/layouts/auth.php
+++ b/modules/backend/layouts/auth.php
@@ -4,7 +4,7 @@
-
+
From a16458f48f66aacfb72b00d01cce686de6e53180 Mon Sep 17 00:00:00 2001
From: Marc Jauvin
Date: Wed, 13 Nov 2024 16:23:07 -0500
Subject: [PATCH 3/9] Revert applyFiltersFromModel change (#1126)
Reverts changes to original behavior - too many problems.
Related: #1222
#927 was originally intended to solve the issue logged in #950 where if you hide a field by default, and then want to unhide it dynamically in filterFields() it does not get saved because disabled and hidden fields are skipped by default in Form->getSaveData(); so the proposed fix was to apply model filtering logic immediately before processing the save data; however that caused issues (#1036) because the model was no longer populated the same way when calling filterFields() at that point in the request and the filterFields() method could be called multiple times.
The solution to the original issue would have been to use the client side Trigger API instead; and potentially we could have solved the other issue by looking at how we're populating the model before calling filterFields() but as this functionality isn't well tested we'll just revert for now.
The second change being reverted is #1099 which was an attempt to solve an issue encountered by someone that was caused by the method being called multiple times.
---
modules/backend/widgets/Form.php | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/modules/backend/widgets/Form.php b/modules/backend/widgets/Form.php
index 59ec24e033..ecb078c4d6 100644
--- a/modules/backend/widgets/Form.php
+++ b/modules/backend/widgets/Form.php
@@ -354,7 +354,7 @@ public function setFormValues($data = null)
public function onRefresh()
{
$result = [];
- $saveData = $this->getSaveData(true);
+ $saveData = $this->getSaveData();
/**
* @event backend.form.beforeRefresh
@@ -1172,10 +1172,9 @@ protected function showFieldLabels($field)
/**
* Returns post data from a submitted form.
*/
- public function getSaveData(bool $includeAllFields = false): array
+ public function getSaveData(): array
{
$this->defineFormFields();
- $this->applyFiltersFromModel();
$result = [];
@@ -1194,7 +1193,7 @@ public function getSaveData(bool $includeAllFields = false): array
/*
* Disabled and hidden should be omitted from data set
*/
- if (!$includeAllFields && ($field->disabled || $field->hidden)) {
+ if ($field->disabled || $field->hidden) {
continue;
}
From 64a268b58ec771aa6bfbd822d333a60eadd7b6fc Mon Sep 17 00:00:00 2001
From: Alex Orosciuc
Date: Wed, 13 Nov 2024 22:06:50 +0000
Subject: [PATCH 4/9] Support --isolatable flag on migration command (#1226)
See https://laravel.com/docs/11.x/artisan#isolatable-commands
---
modules/system/console/WinterUp.php | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/modules/system/console/WinterUp.php b/modules/system/console/WinterUp.php
index c774b8e1fc..1b54d1d534 100644
--- a/modules/system/console/WinterUp.php
+++ b/modules/system/console/WinterUp.php
@@ -1,6 +1,7 @@
Date: Wed, 13 Nov 2024 23:10:37 +0100
Subject: [PATCH 5/9] Fix displaying repeater item titles in preview contexts
(#1191)
---
modules/backend/formwidgets/repeater/assets/js/repeater.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/modules/backend/formwidgets/repeater/assets/js/repeater.js b/modules/backend/formwidgets/repeater/assets/js/repeater.js
index 6c80b47733..c72ef23063 100644
--- a/modules/backend/formwidgets/repeater/assets/js/repeater.js
+++ b/modules/backend/formwidgets/repeater/assets/js/repeater.js
@@ -269,7 +269,7 @@
return $textInput.val()
}
} else {
- var $disabledTextInput = $('.text-field:first > .form-control', $target)
+ var $disabledTextInput = $('.form-control:first', $target)
if ($disabledTextInput.length) {
return $disabledTextInput.text()
}
From 6b4f6016e786d3bc3300c06e5bf4a5b468c2d15b Mon Sep 17 00:00:00 2001
From: Marc Jauvin
Date: Fri, 22 Nov 2024 10:35:28 -0500
Subject: [PATCH 6/9] Improve RecordFinder FormWidget (#1254)
make whole field clickable to open the record finder form
add string translation for default prompt
Similar change that was done recently for the FileUpload formwidget (ref. #1229)
---
modules/backend/formwidgets/RecordFinder.php | 6 +++++-
.../formwidgets/recordfinder/partials/_recordfinder.php | 8 +++++++-
modules/backend/lang/en/lang.php | 1 +
modules/backend/lang/fr/lang.php | 1 +
4 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/modules/backend/formwidgets/RecordFinder.php b/modules/backend/formwidgets/RecordFinder.php
index 982e12dc01..0e5799cf0d 100644
--- a/modules/backend/formwidgets/RecordFinder.php
+++ b/modules/backend/formwidgets/RecordFinder.php
@@ -60,7 +60,7 @@ class RecordFinder extends FormWidgetBase
/**
* @var string Prompt to display if no record is selected.
*/
- public $prompt = 'Click the %s button to find a record';
+ public $prompt = null;
/**
* @var int Maximum rows to display for each page.
@@ -144,6 +144,10 @@ public function init()
'modelClass',
]);
+ if (!isset($this->prompt)) {
+ $this->prompt = Lang::get('backend::lang.recordfinder.default_prompt');
+ }
+
if (!$this->useRelation && !class_exists($this->modelClass)) {
throw new ApplicationException(Lang::get('backend::lang.recordfinder.invalid_model_class', ['modelClass' => $this->modelClass]));
}
diff --git a/modules/backend/formwidgets/recordfinder/partials/_recordfinder.php b/modules/backend/formwidgets/recordfinder/partials/_recordfinder.php
index 79ad7f4fe9..3ad24d971a 100644
--- a/modules/backend/formwidgets/recordfinder/partials/_recordfinder.php
+++ b/modules/backend/formwidgets/recordfinder/partials/_recordfinder.php
@@ -10,7 +10,13 @@ class="field-recordfinder loading-indicator-container size-input-text"
data-control="recordfinder"
data-refresh-handler="= $this->getEventHandler('onRefresh') ?>"
data-data-locker="#= $field->getId() ?>">
- >
+
+ data-control="popup"
+ data-size="huge"
+ data-handler="= $this->getEventHandler('onFindRecord') ?>"
+ data-request-data="recordfinder_flag: 1"
+ >
= e($nameValue) ?: 'Undefined' ?>
diff --git a/modules/backend/lang/en/lang.php b/modules/backend/lang/en/lang.php
index 83fabed70e..5c1a96f55b 100644
--- a/modules/backend/lang/en/lang.php
+++ b/modules/backend/lang/en/lang.php
@@ -312,6 +312,7 @@
],
'recordfinder' => [
'find_record' => 'Find Record',
+ 'default_prompt' => 'Click the %s button to find a record',
'invalid_model_class' => 'The provided model class ":modelClass" for the recordfinder is invalid',
'cancel' => 'Cancel',
],
diff --git a/modules/backend/lang/fr/lang.php b/modules/backend/lang/fr/lang.php
index b0250c4d30..251d800c18 100644
--- a/modules/backend/lang/fr/lang.php
+++ b/modules/backend/lang/fr/lang.php
@@ -310,6 +310,7 @@
'return_to_list' => 'Retourner à la liste'
],
'recordfinder' => [
+ 'default_prompt' => 'Cliquer sur %s pour chercher un enregistrement',
'find_record' => 'Trouver un enregistrement',
'invalid_model_class' => "La classe du modèle \":modelClass\" fournie pour le recordfinder n'est pas valide.",
'cancel' => 'Annuler',
From eabd18c68a60bdb08e2bee9059663180d06ac6c9 Mon Sep 17 00:00:00 2001
From: Jack Wilkinson <31214002+jaxwilko@users.noreply.github.com>
Date: Fri, 22 Nov 2024 15:53:27 +0000
Subject: [PATCH 7/9] Vite theme create (#1253)
Replaces #1244. Alters how create:theme [name] tailwind works to generate the default asset configs via the vite:* commands, it also runs an initial compile to ensure styles are generated before first load.
---
modules/cms/console/CreateTheme.php | 52 ++++++++++++++++---
.../scaffold/theme/tailwind/package.stub | 12 -----
.../theme/tailwind/partials/meta/styles.stub | 16 +-----
.../theme/tailwind/partials/site/footer.stub | 4 +-
.../theme/tailwind/tailwind.config.stub | 21 --------
.../scaffold/theme/tailwind/winter.mix.stub | 15 ------
modules/system/console/asset/AssetCompile.php | 5 +-
modules/system/console/asset/AssetCreate.php | 27 ++++++++--
modules/system/console/asset/AssetInstall.php | 4 +-
.../config/tailwind/postcss.config.js.fixture | 1 -
.../system/console/asset/mix/MixCompile.php | 2 +-
.../system/console/asset/mix/MixCreate.php | 4 +-
.../system/console/asset/mix/MixInstall.php | 1 +
modules/system/console/asset/mix/MixWatch.php | 2 +-
.../system/console/asset/vite/ViteCompile.php | 2 +-
.../system/console/asset/vite/ViteCreate.php | 8 ++-
.../system/console/asset/vite/ViteInstall.php | 1 +
.../system/console/asset/vite/ViteWatch.php | 2 +-
18 files changed, 93 insertions(+), 86 deletions(-)
delete mode 100644 modules/cms/console/scaffold/theme/tailwind/package.stub
delete mode 100644 modules/cms/console/scaffold/theme/tailwind/tailwind.config.stub
delete mode 100644 modules/cms/console/scaffold/theme/tailwind/winter.mix.stub
diff --git a/modules/cms/console/CreateTheme.php b/modules/cms/console/CreateTheme.php
index 29a5f91966..71a8036f66 100644
--- a/modules/cms/console/CreateTheme.php
+++ b/modules/cms/console/CreateTheme.php
@@ -35,6 +35,11 @@ class CreateTheme extends GeneratorCommand
*/
protected $nameFrom = 'theme';
+ /**
+ * @var string The scaffold that we are building
+ */
+ protected string $scaffold;
+
/**
* @var array Available theme scaffolds and their types
*/
@@ -68,12 +73,9 @@ class CreateTheme extends GeneratorCommand
'scaffold/theme/tailwind/partials/site/header.stub' => 'partials/site/header.htm',
'scaffold/theme/tailwind/partials/site/footer.stub' => 'partials/site/footer.htm',
'scaffold/theme/tailwind/.gitignore.stub' => '.gitignore',
- 'scaffold/theme/tailwind/package.stub' => 'package.json',
'scaffold/theme/tailwind/README.stub' => 'README.md',
- 'scaffold/theme/tailwind/tailwind.config.stub' => 'tailwind.config.js',
'scaffold/theme/tailwind/theme.stub' => 'theme.yaml',
'scaffold/theme/tailwind/version.stub' => 'version.yaml',
- 'scaffold/theme/tailwind/winter.mix.stub' => 'winter.mix.js',
],
];
@@ -90,12 +92,13 @@ protected function getNameInput(): string
*/
protected function prepareVars(): array
{
- $scaffold = $this->argument('scaffold') ?? 'tailwind';
+ $this->scaffold = $this->argument('scaffold') ?? 'tailwind';
+
$validOptions = $this->suggestScaffoldValues();
- if (!in_array($scaffold, $validOptions)) {
- throw new InvalidArgumentException("$scaffold is not an available theme scaffold type (Available types: " . implode(', ', $validOptions) . ')');
+ if (!in_array($this->scaffold, $validOptions)) {
+ throw new InvalidArgumentException("$this->scaffold is not an available theme scaffold type (Available types: " . implode(', ', $validOptions) . ')');
}
- $this->stubs = $this->themeScaffolds[$scaffold];
+ $this->stubs = $this->themeScaffolds[$this->scaffold];
return [
'code' => $this->getNameInput(),
@@ -146,4 +149,39 @@ public function makeStub($stubName)
$this->files->put($destinationFile, $destinationContent);
}
+
+ public function makeStubs(): void
+ {
+ parent::makeStubs();
+
+ if ($this->scaffold === 'tailwind') {
+ // Set up the vite config files
+ $this->call('vite:create', [
+ 'packageName' => 'theme-' . $this->getNameInput(),
+ '--no-interaction' => true,
+ '--force' => true,
+ '--silent' => true,
+ '--tailwind' => true
+ ]);
+
+ $this->info('Installing NPM dependencies...');
+
+ // Ensure all require packages are available for the new theme and add the new theme to our npm workspaces
+ $this->call('vite:install', [
+ 'assetPackage' => ['theme-' . $this->getNameInput()],
+ '--no-interaction' => true,
+ '--silent' => true,
+ '--disable-tty' => true
+ ]);
+
+ $this->info('Compiling your theme...');
+
+ // Run an initial compile to ensure styles are available for first load
+ $this->call('vite:compile', [
+ '--package' => ['theme-' . $this->getNameInput()],
+ '--no-interaction' => true,
+ '--silent' => true,
+ ]);
+ }
+ }
}
diff --git a/modules/cms/console/scaffold/theme/tailwind/package.stub b/modules/cms/console/scaffold/theme/tailwind/package.stub
deleted file mode 100644
index 51ba79a043..0000000000
--- a/modules/cms/console/scaffold/theme/tailwind/package.stub
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- "name": "{{code}}",
- "private": true,
- "version": "1.0.0",
- "devDependencies": {
- "postcss": "~8.4.x",
- "postcss-import": "~14.1.x",
- "tailwindcss": "~3.0.x"
- },
- "dependencies": {
- }
-}
diff --git a/modules/cms/console/scaffold/theme/tailwind/partials/meta/styles.stub b/modules/cms/console/scaffold/theme/tailwind/partials/meta/styles.stub
index fdcc745eab..154e01dcc7 100644
--- a/modules/cms/console/scaffold/theme/tailwind/partials/meta/styles.stub
+++ b/modules/cms/console/scaffold/theme/tailwind/partials/meta/styles.stub
@@ -1,19 +1,5 @@
==
-find('dist/css/theme.css');
- if ($styles) {
- $this['lastmodified'] = $styles->mtime;
- } else {
- throw new \Exception("Asset files were not detected, try running artisan mix:install && artisan mix:compile -p theme-{{code}}");
- }
-}
-?>
-==
-
+{{ vite(['assets/src/css/theme-{{code}}.css'], 'theme-{{code}}') }}