Skip to content

Commit fb0bc84

Browse files
authored
Merge pull request #878 from cakephp/4.next-new-js-css
4.next - New JS & CSS
2 parents 2f944f9 + 85b453e commit fb0bc84

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+2258
-2453
lines changed

.editorconfig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,6 @@ indent_style = space
1010
indent_size = 4
1111
insert_final_newline = true
1212
trim_trailing_whitespace = true
13+
14+
[*.js]
15+
indent_size = 2

.eslintrc.json

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"env": {
3+
"browser": true,
4+
"es2021": true,
5+
"jquery": true
6+
},
7+
"extends": [
8+
"airbnb-base"
9+
],
10+
"parserOptions": {
11+
"ecmaVersion": "latest",
12+
"sourceType": "module"
13+
},
14+
"rules": {
15+
"strict": 0,
16+
"max-len": ["error", { "code": 150 }],
17+
"no-underscore-dangle": ["error", {
18+
"allow": ["__cakeDebugBlockInit", "_arguments"]
19+
}],
20+
"import/extensions": [0, { "<js>": "always" }],
21+
"no-param-reassign": 0,
22+
"no-plusplus": 0,
23+
"class-methods-use-this": 0,
24+
"prefer-rest-params": 0
25+
}
26+
}

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,13 @@ nbproject/*
1717
.svn
1818
errors.err
1919
tags
20+
node_modules
21+
package-lock.json
2022
/.phpunit.result.cache
2123
/nbproject/
2224
/composer.lock
2325
/vendor
2426
/phpunit.xml
27+
/webroot/css/style.css.map
28+
/webroot/mix.js.map
29+
/webroot/mix-manifest.json

.jshintrc

Lines changed: 0 additions & 84 deletions
This file was deleted.

.stickler.yml

Lines changed: 0 additions & 11 deletions
This file was deleted.

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
},
2525
"require": {
2626
"php": ">=7.2",
27-
"cakephp/cakephp": "dev-4.next as 4.4.0",
27+
"cakephp/cakephp": "^4.4.0",
2828
"cakephp/chronos": "^2.0",
2929
"composer/composer": "^1.3 | ^2.0",
3030
"jdorn/sql-formatter": "^1.2"

package.json

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"name": "debug_kit",
3+
"version": "1.0.0",
4+
"description": "CakePHP Debug Kit",
5+
"author": "CakePHP Team",
6+
"license": "MIT",
7+
"homepage": "https://github.com/cakephp/debug_kit#readme",
8+
"bugs": {
9+
"url": "https://github.com/cakephp/debug_kit/issues"
10+
},
11+
"repository": {
12+
"type": "git",
13+
"url": "git+https://github.com/cakephp/debug_kit.git"
14+
},
15+
"keywords": [
16+
"cakephp",
17+
"debug",
18+
"kit"
19+
],
20+
"devDependencies": {
21+
"eslint": "^8.17.0",
22+
"eslint-config-airbnb-base": "^15.0.0",
23+
"eslint-plugin-import": "^2.26.0"
24+
},
25+
"scripts": {
26+
"cs-check": "npx eslint webroot/js/main.js webroot/js/inject-iframe.js webroot/js/modules/*.js",
27+
"cs-fix": "npx eslint webroot/js/main.js webroot/js/inject-iframe.js webroot/js/modules/*.js --fix"
28+
}
29+
}

src/Controller/MailPreviewController.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,8 @@ protected function respondWithPart($email, $partType)
158158
if ($partType === 'text') {
159159
$part = '<pre>' . (string)$part . '</pre>';
160160
}
161-
$response = $response->withStringBody($part);
162161

163-
return $response;
162+
return $response->withStringBody($part);
164163
}
165164

166165
/**
@@ -188,7 +187,7 @@ protected function getMailPreviewClasses()
188187
return [[CorePlugin::classPath($plugin) . 'Mailer/Preview/'], "$plugin."];
189188
});
190189

191-
$appPaths = [App::path('Mailer/Preview'), ''];
190+
$appPaths = [App::classPath('Mailer/Preview'), ''];
192191

193192
return collection([$appPaths])
194193
->append($pluginPaths)

src/Controller/ToolbarController.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,15 @@ public function initialize(): void
4848
public function clearCache()
4949
{
5050
$this->request->allowMethod('post');
51-
if (!$this->request->getData('name')) {
51+
$name = $this->request->getData('name');
52+
if (!$name) {
5253
throw new NotFoundException(__d('debug_kit', 'Invalid cache engine name.'));
5354
}
54-
$result = Cache::clear($this->request->getData('name'));
55-
$this->set('success', $result);
56-
$this->viewBuilder()->setOption('serialize', ['success']);
55+
$success = Cache::clear($name);
56+
$message = $success ?
57+
__d('debug_kit', '{0} cache cleared.', [$name]) :
58+
__d('debug_kit', '{0} cache could not be cleared.', [$name]);
59+
$this->set(compact('success', 'message'));
60+
$this->viewBuilder()->setOption('serialize', ['success', 'message']);
5761
}
5862
}

src/Mailer/MailPreview.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
*/
1515
namespace DebugKit\Mailer;
1616

17-
use Cake\Datasource\ModelAwareTrait;
1817
use Cake\Mailer\MailerAwareTrait;
18+
use Cake\ORM\Locator\LocatorAwareTrait;
1919
use ReflectionClass;
2020
use ReflectionException;
2121
use ReflectionMethod;
@@ -26,7 +26,7 @@
2626
class MailPreview
2727
{
2828
use MailerAwareTrait;
29-
use ModelAwareTrait;
29+
use LocatorAwareTrait;
3030

3131
/**
3232
* Returns the name of an email if it is valid

0 commit comments

Comments
 (0)