Skip to content

Commit

Permalink
Merge branch 'wip-laravel-11' into twig-node-migration
Browse files Browse the repository at this point in the history
# Conflicts:
#	composer.json
  • Loading branch information
LukeTowers committed Sep 26, 2024
2 parents f2f4928 + ea440b8 commit a35b1b0
Show file tree
Hide file tree
Showing 20 changed files with 2,614 additions and 47 deletions.
Binary file added .github/assets/sponsor-route4me.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ Winter CMS development is financially supported by the generosity of the followi

### Organizations

[![Route4Me logo, Route Planning and Route Mapping](https://raw.githubusercontent.com/wintercms/winter/develop/.github/assets/sponsor-route4me.png)](https://route4me.com/?utm_source=wintercms)

Route4Me is a [Premium Sponsor to the Winter CMS Open Collective](https://opencollective.com/wintercms).

[![Froala logo](https://froala.com/wp-content/uploads/2019/10/froala.svg)](https://froala.com/wysiwyg-editor/)

Froala provides a perpetual, Enterprise license to Winter CMS which allows us and our users to use the Froala WYSIWYG Editor in Winter CMS powered projects.
Expand Down
27 changes: 19 additions & 8 deletions modules/backend/assets/ui/js/build/vendor.js

Large diffs are not rendered by default.

56 changes: 27 additions & 29 deletions modules/backend/behaviors/ListController.php
Original file line number Diff line number Diff line change
Expand Up @@ -235,39 +235,37 @@ public function makeList($definition = null)
if (isset($listConfig->filter)) {
$filterConfig = $this->makeConfig($listConfig->filter);

if (!empty($filterConfig->scopes)) {
$widget->cssClasses[] = 'list-flush';

$filterConfig->alias = $widget->alias . 'Filter';
$filterWidget = $this->makeWidget(\Backend\Widgets\Filter::class, $filterConfig);
$filterWidget->bindToController();

/*
* Filter the list when the scopes are changed
*/
$filterWidget->bindEvent('filter.update', function () use ($widget, $filterWidget) {
return $widget->onFilter();
});
$widget->cssClasses[] = 'list-flush';

/*
* Filter Widget with extensibility
*/
$filterWidget->bindEvent('filter.extendScopes', function () use ($filterWidget) {
$this->controller->listFilterExtendScopes($filterWidget);
});
$filterConfig->alias = $widget->alias . 'Filter';
$filterWidget = $this->makeWidget(\Backend\Widgets\Filter::class, $filterConfig);
$filterWidget->bindToController();

/*
* Extend the query of the list of options
*/
$filterWidget->bindEvent('filter.extendQuery', function ($query, $scope) {
$this->controller->listFilterExtendQuery($query, $scope);
});
/*
* Filter the list when the scopes are changed
*/
$filterWidget->bindEvent('filter.update', function () use ($widget, $filterWidget) {
return $widget->onFilter();
});

// Apply predefined filter values
$widget->addFilter([$filterWidget, 'applyAllScopesToQuery']);
/*
* Filter Widget with extensibility
*/
$filterWidget->bindEvent('filter.extendScopes', function () use ($filterWidget) {
$this->controller->listFilterExtendScopes($filterWidget);
});

$this->filterWidgets[$definition] = $filterWidget;
}
/*
* Extend the query of the list of options
*/
$filterWidget->bindEvent('filter.extendQuery', function ($query, $scope) {
$this->controller->listFilterExtendQuery($query, $scope);
});

// Apply predefined filter values
$widget->addFilter([$filterWidget, 'applyAllScopesToQuery']);

$this->filterWidgets[$definition] = $filterWidget;
}

return $widget;
Expand Down
11 changes: 8 additions & 3 deletions modules/backend/console/CreateController.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class CreateController extends BaseScaffoldCommand
{controller : The name of the controller to generate. <info>(eg: Posts)</info>}
{--force : Overwrite existing files with generated files.}
{--model= : Defines the model name to use. If not provided, the singular name of the controller is used.}
{--sidebar : Create stubs for form-with-sidebar layout}
{--uninspiring : Disable inspirational quotes}
';

Expand All @@ -47,10 +48,7 @@ class CreateController extends BaseScaffoldCommand
'scaffold/controller/_list_toolbar.stub' => 'controllers/{{lower_name}}/_list_toolbar.php',
'scaffold/controller/config_form.stub' => 'controllers/{{lower_name}}/config_form.yaml',
'scaffold/controller/config_list.stub' => 'controllers/{{lower_name}}/config_list.yaml',
'scaffold/controller/create.stub' => 'controllers/{{lower_name}}/create.php',
'scaffold/controller/index.stub' => 'controllers/{{lower_name}}/index.php',
'scaffold/controller/preview.stub' => 'controllers/{{lower_name}}/preview.php',
'scaffold/controller/update.stub' => 'controllers/{{lower_name}}/update.php',
'scaffold/controller/controller.stub' => 'controllers/{{studly_name}}.php',
];

Expand All @@ -69,6 +67,13 @@ protected function prepareVars(): array
$model = Str::singular($vars['name']);
}
$vars['model'] = $model;
$vars['sidebar'] = $this->option('sidebar');

$layout = $this->option('sidebar') ? 'sidebar' : 'standard';

$this->stubs["scaffold/controller/{$layout}/create.stub"] = 'controllers/{{lower_name}}/create.php';
$this->stubs["scaffold/controller/{$layout}/update.stub"] = 'controllers/{{lower_name}}/update.php';
$this->stubs["scaffold/controller/{$layout}/preview.stub"] = 'controllers/{{lower_name}}/preview.php';

return $vars;
}
Expand Down
4 changes: 4 additions & 0 deletions modules/backend/console/scaffold/controller/controller.stub
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,9 @@ class {{ studly_name }} extends Controller
parent::__construct();

BackendMenu::setContext('{{ plugin_code }}', '{{ lower_plugin }}', '{{ lower_name }}');
{% if sidebar %}

$this->bodyClass = 'compact-container';
{% endif -%}
}
}
64 changes: 64 additions & 0 deletions modules/backend/console/scaffold/controller/sidebar/create.stub
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<?php Block::put('breadcrumb') ?>
<ul>
<li><a href="<?= Backend::url('{{ controller_url }}') ?>"><?= e(trans('{{ model_lang_key }}.label_plural')) ?></a></li>
<li><?= e(trans($this->pageTitle)) ?></li>
</ul>
<?php Block::endPut() ?>

<?php if (!$this->fatalError): ?>

<?php Block::put('form-contents') ?>
<div class="layout">

<div class="layout-row">
<?= $this->formRenderOutsideFields() ?>
<?= $this->formRenderPrimaryTabs() ?>
</div>

<div class="form-buttons">
<div class="loading-indicator-container">
<button
type="button"
data-request="onSave"
data-hotkey="ctrl+s, cmd+s"
data-load-indicator="<?= e(trans('backend::lang.form.creating_name', ['name' => trans('{{ model_lang_key }}.label')])); ?>"
class="btn btn-primary">
<?= e(trans('backend::lang.form.create')); ?>
</button>
<button
type="button"
data-request="onSave"
data-request-data="close:1"
data-hotkey="ctrl+enter, cmd+enter"
data-load-indicator="<?= e(trans('backend::lang.form.creating_name', ['name' => trans('{{ model_lang_key }}.label')])); ?>"
class="btn btn-default">
<?= e(trans('backend::lang.form.create_and_close')); ?>
</button>
<span class="btn-text">
or <a href="<?= Backend::url('{{ controller_url }}') ?>"><?= e(trans('backend::lang.form.cancel')); ?></a>
</span>
</div>
</div>

</div>
<?php Block::endPut() ?>

<?php Block::put('form-sidebar') ?>
<div class="hide-tabs"><?= $this->formRenderSecondaryTabs() ?></div>
<?php Block::endPut() ?>

<?php Block::put('body') ?>
<?= Form::open(['class'=>'layout stretch']) ?>
<?= $this->makeLayout('form-with-sidebar') ?>
<?= Form::close() ?>
<?php Block::endPut() ?>

<?php else: ?>
<div class="control-breadcrumb">
<?= Block::placeholder('breadcrumb') ?>
</div>
<div class="padded-container">
<p class="flash-message static error"><?= e(trans($this->fatalError)) ?></p>
<p><a href="<?= Backend::url('{{ controller_url }}') ?>" class="btn btn-default"><?= e(trans('backend::lang.form.return_to_list')); ?></a></p>
</div>
<?php endif ?>
39 changes: 39 additions & 0 deletions modules/backend/console/scaffold/controller/sidebar/preview.stub
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php Block::put('breadcrumb') ?>
<ul>
<li><a href="<?= Backend::url('{{ controller_url }}') ?>"><?= e(trans('{{ model_lang_key }}.label_plural')) ?></a></li>
<li><?= e(trans($this->pageTitle)) ?></li>
</ul>
<?php Block::endPut() ?>

<?php if (!$this->fatalError): ?>

<?php Block::put('form-contents') ?>
<div class="layout">

<div class="layout-row">
<?= $this->formRenderOutsideFields() ?>
<?= $this->formRenderPrimaryTabs() ?>
</div>

</div>
<?php Block::endPut() ?>

<?php Block::put('form-sidebar') ?>
<div class="hide-tabs"><?= $this->formRenderSecondaryTabs() ?></div>
<?php Block::endPut() ?>

<?php Block::put('body') ?>
<?= Form::open(['class'=>'layout stretch']) ?>
<?= $this->makeLayout('form-with-sidebar') ?>
<?= Form::close() ?>
<?php Block::endPut() ?>

<?php else: ?>
<div class="control-breadcrumb">
<?= Block::placeholder('breadcrumb') ?>
</div>
<div class="padded-container">
<p class="flash-message static error"><?= e(trans($this->fatalError)) ?></p>
<p><a href="<?= Backend::url('{{ controller_url }}') ?>" class="btn btn-default"><?= e(trans('backend::lang.form.return_to_list')); ?></a></p>
</div>
<?php endif ?>
72 changes: 72 additions & 0 deletions modules/backend/console/scaffold/controller/sidebar/update.stub
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
<?php Block::put('breadcrumb') ?>
<ul>
<li><a href="<?= Backend::url('{{ controller_url }}') ?>"><?= e(trans('{{ model_lang_key }}.label_plural')) ?></a></li>
<li><?= e(trans($this->pageTitle)) ?></li>
</ul>
<?php Block::endPut() ?>

<?php if (!$this->fatalError): ?>

<?php Block::put('form-contents') ?>
<div class="layout">

<div class="layout-row">
<?= $this->formRenderOutsideFields() ?>
<?= $this->formRenderPrimaryTabs() ?>
</div>

<div class="form-buttons">
<div class="loading-indicator-container">
<button
type="button"
data-request="onSave"
data-request-data="redirect:0"
data-hotkey="ctrl+s, cmd+s"
data-load-indicator="<?= e(trans('backend::lang.form.saving_name', ['name' => trans('{{ model_lang_key }}.label')])); ?>"
class="btn btn-primary">
<?= e(trans('backend::lang.form.save')); ?>
</button>
<button
type="button"
data-request="onSave"
data-request-data="close:1"
data-hotkey="ctrl+enter, cmd+enter"
data-load-indicator="<?= e(trans('backend::lang.form.saving_name', ['name' => trans('{{ model_lang_key }}.label')])); ?>"
class="btn btn-default">
<?= e(trans('backend::lang.form.save_and_close')); ?>
</button>
<button
type="button"
class="wn-icon-trash-o btn-icon danger pull-right"
data-request="onDelete"
data-load-indicator="<?= e(trans('backend::lang.form.deleting_name', ['name' => trans('{{ model_lang_key }}.label')])); ?>"
data-request-confirm="<?= e(trans('backend::lang.form.confirm_delete')); ?>">
</button>
<span class="btn-text">
or <a href="<?= Backend::url('{{ controller_url }}') ?>"><?= e(trans('backend::lang.form.cancel')); ?></a>
</span>
</div>
</div>

</div>
<?php Block::endPut() ?>

<?php Block::put('form-sidebar') ?>
<div class="hide-tabs"><?= $this->formRenderSecondaryTabs() ?></div>
<?php Block::endPut() ?>

<?php Block::put('body') ?>
<?= Form::open(['class'=>'layout stretch']) ?>
<?= $this->makeLayout('form-with-sidebar') ?>
<?= Form::close() ?>
<?php Block::endPut() ?>

<?php else: ?>
<div class="control-breadcrumb">
<?= Block::placeholder('breadcrumb') ?>
</div>
<div class="padded-container">
<p class="flash-message static error"><?= e(trans($this->fatalError)) ?></p>
<p><a href="<?= Backend::url('{{ controller_url }}') ?>" class="btn btn-default"><?= e(trans('backend::lang.form.return_to_list')); ?></a></p>
</div>
<?php endif ?>
Loading

0 comments on commit a35b1b0

Please sign in to comment.