Skip to content

Commit

Permalink
Merge branch 'develop' into 1.1
Browse files Browse the repository at this point in the history
# Conflicts:
#	composer.json
  • Loading branch information
LukeTowers committed Feb 15, 2022
2 parents 8cfd582 + 869a718 commit ec46549
Show file tree
Hide file tree
Showing 188 changed files with 7,998 additions and 1,777 deletions.
6 changes: 1 addition & 5 deletions .github/ISSUE_TEMPLATE/1_BUG_REPORT.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ body:
label: PHP Version
description: Please provide us the branch of PHP version. For example, for PHP version 7.4.9, select `7.4`, or for PHP version 8.0.1, select `8.0`.
options:
- 8.1
- 8.0
- 7.4
- 7.3
Expand Down Expand Up @@ -71,8 +72,3 @@ body:
attributes:
label: Workaround
description: If you have a workaround, please detail it here, for the benefit of other users who encounter the issue.
- type: textarea
id: other_details
attributes:
label: Any further details?
description: If some other information is needed to describe this issue, please specify it here.
21 changes: 21 additions & 0 deletions .github/workflows/code-quality.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,24 @@ jobs:
- name: Run code quality checks (on pull request)
if: github.event_name == 'pull_request'
run: ./.github/workflows/utilities/phpcs-pr ${{ github.base_ref }}
codeQualityJS:
runs-on: ubuntu-latest
name: JavaScript
steps:
- name: Checkout changes
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Install Node
uses: actions/setup-node@v1
with:
node-version: 12

- name: Install Node dependencies
working-directory: ./modules/system/assets/js/snowboard
run: npm install

- name: Run code quality checks
working-directory: ./modules/system/assets/js/snowboard
run: npx eslint .
2 changes: 2 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,11 @@ jobs:
node-version: 12

- name: Install Node dependencies
working-directory: ./tests/js
run: npm install

- name: Run tests
working-directory: ./tests/js
run: npm run test
phpUnitTests:
strategy:
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,6 @@ _ide_helper.php
.DS_Store
package-lock.json
/node_modules

# Ignore generated public directory from `winter:mirror public`
public
6 changes: 3 additions & 3 deletions .gitpod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ vscode:

github:
prebuilds:
master: true
master: false
branches: false
pullRequests: true
pullRequests: false
pullRequestsFromForks: false
addCheck: true
addCheck: false
addComment: false
addBadge: true
5 changes: 0 additions & 5 deletions .jshintrc

This file was deleted.

5 changes: 5 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"recommendations": [
"wintercms.winter-cms"
]
}
29 changes: 29 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"files.associations": {
"**/modules/*/behaviors/*/partials/*.htm": "php",
"**/modules/*/controllers/*.htm": "php",
"**/modules/*/formwidgets/*/partials/*.htm": "php",
"**/modules/*/layouts/*.htm": "php",
"**/modules/*/models/*/*.htm": "php",
"**/modules/*/partials/*.htm": "php",
"**/modules/*/reportwidgets/*/partials/*.htm": "php",
"**/modules/*/views/mail/*.htm": "wintercms",
"**/modules/*/widgets/*/partials/*.htm": "php",

"**/plugins/*/*/behaviors/*/partials/*.htm": "php",
"**/plugins/*/*/components/*/*.htm": "twig",
"**/plugins/*/*/controllers/*/*.htm": "php",
"**/plugins/*/*/formwidgets/*/partials/*.htm": "php",
"**/plugins/*/*/layouts/*.htm": "php",
"**/plugins/*/*/models/*/*.htm": "php",
"**/plugins/*/*/partials/*.htm": "php",
"**/plugins/*/*/reportwidgets/*/partials/*.htm": "php",
"**/plugins/*/*/views/mail/*.htm": "wintercms",
"**/plugins/*/*/widgets/*/partials/*.htm": "php",

"**/themes/*/content/**/*.htm": "wintercms",
"**/themes/*/layouts/*.htm": "wintercms",
"**/themes/*/pages/**/*.htm": "wintercms",
"**/themes/*/partials/**/*.htm": "wintercms"
}
}
8 changes: 7 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"source": "https://github.com/wintercms/winter"
},
"require": {
"php": ">=7.2.9",
"php": "^7.2.9|^8.0",
"winter/storm": "~1.1.2",
"winter/wn-system-module": "~1.1.2",
"winter/wn-backend-module": "~1.1.2",
Expand Down Expand Up @@ -83,5 +83,11 @@
"replace": false,
"merge-dev": false
}
},
"config": {
"allow-plugins": {
"composer/installers": true,
"wikimedia/composer-merge-plugin": true
}
}
}
34 changes: 25 additions & 9 deletions config/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,22 @@

'url' => 'http://localhost',

/*
|--------------------------------------------------------------------------
| Asset URL
|--------------------------------------------------------------------------
|
| This URL is used to properly generate URLs for assets, including
| URLs generated by the `| theme` & `| asset` filters in Twig, or the
| `Url::asset()` & `asset()` helpers. If set to null, the URL used will
| be the current hostname or `app.url` config.
|
| 'asset_url' => 'https://cdn.example.com/',
|
*/

'asset_url' => env('ASSET_URL', null),

/*
|--------------------------------------------------------------------------
| Trusted hosts
Expand Down Expand Up @@ -110,13 +126,13 @@
| from your proxy when rewriting the request. This is an integer map value
| so you may specify more than one value.
|
| Possible values (prepended with `Illuminate\Http\Request::`)
| - HEADER_X_FORWARDED_ALL - trust all forwarded headers
| - HEADER_X_FORWARDED_FOR - trust only the proxy IP
| - HEADER_X_FORWARDED_HOST - trust only the proxy hostname
| - HEADER_X_FORWARDED_PORT - trust only the proxy port
| - HEADER_X_FORWARDED_PROTO - trust only the proxy protocol
| - HEADER_X_FORWARDED_AWS_ELB - trust Amazon Elastic Load Balancing header
| Possible values:
| - 'HEADER_X_FORWARDED_ALL' - trust all forwarded headers
| - Illuminate\Http\Request::HEADER_X_FORWARDED_FOR - trust only the proxy IP
| - Illuminate\Http\Request::HEADER_X_FORWARDED_HOST - trust only the proxy hostname
| - Illuminate\Http\Request::HEADER_X_FORWARDED_PORT - trust only the proxy port
| - Illuminate\Http\Request::HEADER_X_FORWARDED_PROTO - trust only the proxy protocol
| - Illuminate\Http\Request::HEADER_X_FORWARDED_AWS_ELB - trust Amazon Elastic Load Balancing headers
|
| Examples:
| - To trust only the hostname, use the following:
Expand All @@ -132,7 +148,7 @@
| - Amazon ELB users should always use the "HEADER_X_FORWARDED_AWS_ELB" option.
*/

'trustedProxyHeaders' => Illuminate\Http\Request::HEADER_X_FORWARDED_ALL,
'trustedProxyHeaders' => 'HEADER_X_FORWARDED_ALL',

/*
|--------------------------------------------------------------------------
Expand Down Expand Up @@ -168,7 +184,7 @@
| backend yet, as this can cause issues in the backend.
|
| Currently supported backend locales are listed in
| Backend\Models\Preference->getLocaleOptions())
| Backend\Models\Preference->getLocaleOptions()
|
*/

Expand Down
22 changes: 11 additions & 11 deletions config/cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,19 +56,19 @@
],

'memcached' => [
'driver' => 'memcached',
'persistent_id' => null,
'driver' => 'memcached',
'persistent_id' => env('MEMCACHED_PERSISTENT_ID'),
'sasl' => [
// env('MEMCACHED_USERNAME'),
// env('MEMCACHED_PASSWORD'),
env('MEMCACHED_USERNAME'),
env('MEMCACHED_PASSWORD'),
],
'options' => [
// Memcached::OPT_CONNECT_TIMEOUT => 2000,
],
'servers' => [
[
'host' => '127.0.0.1',
'port' => 11211,
'host' => env('MEMCACHED_HOST', '127.0.0.1'),
'port' => env('MEMCACHED_PORT', 11211),
'weight' => 100,
],
],
Expand All @@ -81,11 +81,11 @@

'dynamodb' => [
'driver' => 'dynamodb',
'key' => '',
'secret' => '',
'region' => 'us-east-1',
'table' => 'cache',
'endpoint' => '',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
'table' => env('DYNAMODB_CACHE_TABLE', 'cache'),
'endpoint' => env('DYNAMODB_ENDPOINT'),
],

],
Expand Down
17 changes: 0 additions & 17 deletions config/database.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,21 +143,4 @@

],

/*
|--------------------------------------------------------------------------
| Use DB configuration for testing
|--------------------------------------------------------------------------
|
| When running plugin tests Winter CMS by default uses SQLite in memory.
| You can override this behavior by setting `useConfigForTesting` to true.
|
| After that Winter CMS will take DB parameters from the config.
| If file `/config/testing/database.php` exists, config will be read from it,
| but remember that when not specified it will use parameters specified in
| `/config/database.php`.
|
*/

'useConfigForTesting' => false,

];
16 changes: 10 additions & 6 deletions modules/backend/ServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,48 +143,52 @@ protected function registerBackendPermissions()
'backend.access_dashboard' => [
'label' => 'system::lang.permissions.view_the_dashboard',
'tab' => 'system::lang.permissions.name',
'roles' => [UserRole::CODE_DEVELOPER, UserRole::CODE_PUBLISHER],
],
'backend.manage_default_dashboard' => [
'label' => 'system::lang.permissions.manage_default_dashboard',
'tab' => 'system::lang.permissions.name',
'roles' => UserRole::CODE_DEVELOPER,
'roles' => [UserRole::CODE_DEVELOPER],
],
'backend.manage_users' => [
'label' => 'system::lang.permissions.manage_other_administrators',
'tab' => 'system::lang.permissions.name',
'roles' => UserRole::CODE_DEVELOPER,
'roles' => [UserRole::CODE_DEVELOPER],
],
'backend.impersonate_users' => [
'label' => 'system::lang.permissions.impersonate_users',
'tab' => 'system::lang.permissions.name',
'roles' => UserRole::CODE_DEVELOPER,
'roles' => [UserRole::CODE_DEVELOPER],
],
'backend.manage_preferences' => [
'label' => 'system::lang.permissions.manage_preferences',
'tab' => 'system::lang.permissions.name',
'roles' => [UserRole::CODE_DEVELOPER, UserRole::CODE_PUBLISHER],
],
'backend.manage_editor' => [
'label' => 'system::lang.permissions.manage_editor',
'tab' => 'system::lang.permissions.name',
'roles' => UserRole::CODE_DEVELOPER,
'roles' => [UserRole::CODE_DEVELOPER],
],
'backend.manage_own_editor' => [
'label' => 'system::lang.permissions.manage_own_editor',
'tab' => 'system::lang.permissions.name',
'roles' => [UserRole::CODE_DEVELOPER, UserRole::CODE_PUBLISHER],
],
'backend.manage_branding' => [
'label' => 'system::lang.permissions.manage_branding',
'tab' => 'system::lang.permissions.name',
'roles' => UserRole::CODE_DEVELOPER,
'roles' => [UserRole::CODE_DEVELOPER],
],
'media.manage_media' => [
'label' => 'backend::lang.permissions.manage_media',
'tab' => 'system::lang.permissions.name',
'roles' => [UserRole::CODE_DEVELOPER, UserRole::CODE_PUBLISHER],
],
'backend.allow_unsafe_markdown' => [
'label' => 'backend::lang.permissions.allow_unsafe_markdown',
'tab' => 'system::lang.permissions.name',
'roles' => UserRole::CODE_DEVELOPER,
'roles' => [UserRole::CODE_DEVELOPER],
],
]);
$manager->registerPermissionOwnerAlias('Winter.Backend', 'October.Backend');
Expand Down
16 changes: 8 additions & 8 deletions modules/backend/behaviors/FormController.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
* This behavior is implemented in the controller like so:
*
* public $implement = [
* 'Backend.Behaviors.FormController',
* \Backend\Behaviors\FormController::class,
* ];
*
* public $formConfig = 'config_form.yaml';
Expand Down Expand Up @@ -66,11 +66,6 @@ class FormController extends ControllerBehavior
*/
protected $formWidget;

/**
* @inheritDoc
*/
protected $requiredProperties = ['formConfig'];

/**
* @var array Configuration values that must exist when applying the primary config file.
* - modelClass: Class name for the model
Expand All @@ -93,6 +88,11 @@ class FormController extends ControllerBehavior
*/
protected $model;

/**
* @var mixed Configuration for this behaviour
*/
public $formConfig = 'config_form.yaml';

/**
* Behavior constructor
* @param \Backend\Classes\Controller $controller
Expand All @@ -104,7 +104,7 @@ public function __construct($controller)
/*
* Build configuration
*/
$this->config = $this->makeConfig($controller->formConfig, $this->requiredConfig);
$this->config = $this->makeConfig($controller->formConfig ?: $this->formConfig, $this->requiredConfig);
$this->config->modelClass = Str::normalizeClassName($this->config->modelClass);
}

Expand Down Expand Up @@ -176,7 +176,7 @@ public function initForm($model, $context = null)
/*
* Detected Relation controller behavior
*/
if ($this->controller->isClassExtendedWith('Backend.Behaviors.RelationController')) {
if ($this->controller->isClassExtendedWith(\Backend\Behaviors\RelationController::class)) {
$this->controller->initRelation($model);
}

Expand Down
Loading

0 comments on commit ec46549

Please sign in to comment.