Skip to content

Commit a47e716

Browse files
committed
The much awaited SS4 update
1 parent 1084bca commit a47e716

27 files changed

+837
-516
lines changed

.editorconfig

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# For more information about the properties used in this file,
2-
# please see the EditorConfig documentation:
3-
# http://editorconfig.org
1+
# http://EditorConfig.org
2+
3+
root = true
44

55
[*]
66
charset = utf-8
@@ -10,8 +10,8 @@ indent_style = space
1010
insert_final_newline = true
1111
trim_trailing_whitespace = true
1212

13-
[{*.yml,package.json}]
14-
indent_size = 2
15-
16-
# The indent size used in the package.json file cannot be changed:
13+
[*.yml]
14+
# The indent size used in the `package.json` file cannot be changed
1715
# https://github.com/npm/npm/pull/3180#issuecomment-16336516
16+
indent_size = 2
17+
indent_style = space

.eslintrc.js

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
module.exports = {
2+
parser: '@babel/eslint-parser',
3+
parserOptions: {
4+
requireConfigFile: false,
5+
babelOptions: {
6+
presets: ['@babel/preset-react']
7+
},
8+
},
9+
env: {
10+
browser: true,
11+
commonjs: true,
12+
es6: true,
13+
},
14+
plugins: [
15+
'react',
16+
],
17+
extends: [
18+
'eslint:recommended',
19+
'plugin:react/recommended',
20+
],
21+
rules: {
22+
'no-console': 'off',
23+
'arrow-parens': ['error', 'as-needed'],
24+
'no-const-assign': 'error',
25+
'prefer-template': 'off',
26+
},
27+
settings: {
28+
react: {
29+
version: 'detect',
30+
},
31+
},
32+
};

.gitignore

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
### Thumbnails ###
2+
._*
3+
Thumbs.db
4+
5+
### Folder Config ###
6+
.DS_Store
7+
Desktop.ini
8+
9+
### Log Files ###
10+
*.log
11+
12+
### SQL Files ###
13+
*.sql
14+
15+
### Node.js Packages ###
16+
/**/node_modules
17+
18+
### Sass Cache ###
19+
.sass-cache

.nvmrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
v16.13.0

.scrutinizer.yml

-69
This file was deleted.

LICENSE

-20
This file was deleted.

README.textile README.md

+29-27
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,29 @@
1-
h1. SilverStripe Colour Picker Field
2-
3-
Does what it says on the box - provides a pop-up colour picker functionality, turning a text field into a colour picker field.
4-
5-
!https://raw.github.com/ninty9notout/silverstripe-colourpicker/master/colourpicker.png!
6-
7-
Uses the "jQuery MiniColors":http://labs.abeautifulsite.net/jquery-minicolors/ plugin by "A Beautiful Site":http://www.abeautifulsite.net/ for the colour picker, while using the built in entwine library to successfully bind the MiniColors plugin to the necessary elements.
8-
9-
h2. Usage
10-
11-
There are various way to install this, but the easiest is to download the repository and add it to your SilverStripe root.
12-
13-
Once installed, you can use the following to initialise the colour picker field using the following:
14-
15-
bc. new ColourPicker($name, $title)
16-
17-
h2. Contributing
18-
19-
This field was made because a simple colour picker was required for a project, and existing colour picker fields that are out there were unsatisfactory. Please note that is still very young. The plan it to fully utilise MiniColors various functionalities as needed in the future.
20-
21-
Have any changes in mind?
22-
23-
# Fork from "GitHub":https://github.com/ninty9notout/silverstripe-colourpicker
24-
# Do your thing
25-
# Make a pull request
26-
# ???
27-
# Profit
1+
# SilverStripe Colour Picker Field
2+
3+
Does what it says on the box - provides a pop-up colour picker functionality, turning a text field into a colour picker field.
4+
5+
!https://raw.github.com/ninty9notout/silverstripe-colourpicker/master/colourpicker.png!
6+
7+
Uses the "jQuery MiniColors":http://labs.abeautifulsite.net/jquery-minicolors/ plugin by "A Beautiful Site":http://www.abeautifulsite.net/ for the colour picker, while using the built in entwine library to successfully bind the MiniColors plugin to the necessary elements.
8+
9+
## Usage
10+
11+
There are various way to install this, but the easiest is to download the repository and add it to your SilverStripe root.
12+
13+
Once installed, you can use the following to initialise the colour picker field using the following:
14+
15+
```
16+
new ColourPicker($name, $title)
17+
```
18+
19+
## Contributing
20+
21+
This field was made because a simple colour picker was required for a project, and existing colour picker fields that are out there were unsatisfactory. Please note that is still very young. The plan it to fully utilise MiniColors various functionalities as needed in the future.
22+
23+
Have any changes in mind?
24+
25+
# Fork from "GitHub":https://github.com/ninty9notout/silverstripe-colourpicker
26+
# Do your thing
27+
# Make a pull request
28+
# ???
29+
# Profit

_config.php

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
1-
<?php
2-
define("COLOURPICKER_DIR", "colourpicker");
3-
define("COLOURPICKER_PATH", BASE_PATH . "/" . COLOURPICKER_DIR);
1+
<?php

_config/config.yml

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
---
2+
Name: silverstripecolourpickercore
3+
After:
4+
- '#coreconfig'
5+
---
6+
7+
---
8+
Name: silverstripecolourpickerfieldtypes
9+
After:
10+
- '#corefieldtypes'
11+
---
12+
13+
SilverStripe\Core\Injector\Injector:
14+
Colour:
15+
class: ninty9notout\SSColourPicker\FieldType\DBColour
16+
DBColour:
17+
class: ninty9notout\SSColourPicker\FieldType\DBColour
18+
19+
---
20+
Name: silverstripecolourpickerscripts
21+
After:
22+
- '#cmsscripts'
23+
---
24+
25+
SilverStripe\Admin\LeftAndMain:
26+
extra_requirements_javascript:
27+
- https://cdn.jsdelivr.net/npm/@claviska/[email protected]/jquery.minicolors.min.js
28+
- '_resources/client/dist/bundle.js'
29+
extra_requirements_css:
30+
- https://cdn.jsdelivr.net/npm/@claviska/[email protected]/jquery.minicolors.min.css
31+
- '_resources/client/dist/bundle.css'

client/dist/bundle.css

+2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client/dist/bundle.css.map

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client/dist/bundle.js

+108
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
/*
2+
* ATTENTION: An "eval-source-map" devtool has been used.
3+
* This devtool is neither made for production nor for readable output files.
4+
* It uses "eval()" calls to create a separate source file with attached SourceMaps in the browser devtools.
5+
* If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
6+
* or disable the default devtool with "devtool: false".
7+
* If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
8+
*/
9+
/******/ (() => { // webpackBootstrap
10+
/******/ "use strict";
11+
/******/ var __webpack_modules__ = ({
12+
13+
/***/ "./bundle.js":
14+
/*!*******************!*\
15+
!*** ./bundle.js ***!
16+
\*******************/
17+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
18+
19+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ \"jquery\");\n/* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);\n\njquery__WEBPACK_IMPORTED_MODULE_0___default().noConflict();\njquery__WEBPACK_IMPORTED_MODULE_0___default().entwine('ss', function ($) {\n $('input.colour-picker-field').entwine({\n onmatch: function onmatch() {\n this._super();\n var _this$data = this.data(),\n palette = _this$data.palette;\n if (Array.isArray(palette) === false) {\n palette = [];\n }\n this.minicolors({\n swatches: palette\n });\n },\n onunmatch: function onunmatch() {\n this._super();\n this.minicolors('destroy');\n }\n });\n});//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiLi9idW5kbGUuanMiLCJtYXBwaW5ncyI6Ijs7O0FBQTRCO0FBRTVCQSx3REFBaUIsQ0FBQyxDQUFDO0FBRW5CQSxxREFBYyxDQUFDLElBQUksRUFBRSxVQUFBRyxDQUFDLEVBQUk7RUFDdEJBLENBQUMsQ0FBQywyQkFBMkIsQ0FBQyxDQUFDRCxPQUFPLENBQUM7SUFDbkNFLE9BQU8sV0FBQUEsUUFBQSxFQUFHO01BQ04sSUFBSSxDQUFDQyxNQUFNLENBQUMsQ0FBQztNQUViLElBQUFDLFVBQUEsR0FFSSxJQUFJLENBQUNDLElBQUksQ0FBQyxDQUFDO1FBRFhDLE9BQ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gIH0sXG5cbiAgICAgICAgb251bm1hdGNoKCkge1xuICAgICAgICAgICAgdGhpcy5fc3VwZXIoKTtcblxuICAgICAgICAgICAgdGhpcy5taW5pY29sb3JzKCdkZXN0cm95Jyk7XG4gICAgICAgIH1cbiAgICB9KTtcbn0pO1xuIl0sIm5hbWVzIjpbImpRdWVyeSIsIm5vQ29uZmxpY3QiLCJlbnR3aW5lIiwiJCIsIm9ubWF0Y2giLCJfc3VwZXIiLCJfdGhpcyRkYXRhIiwiZGF0YSIsInBhbGV0dGUiLCJBcnJheSIsImlzQXJyYXkiLCJtaW5pY29sb3JzIiwic3dhdGNoZXMiLCJvbnVubWF0Y2giXSwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///./bundle.js\n");
20+
21+
/***/ }),
22+
23+
/***/ "jquery":
24+
/*!*************************!*\
25+
!*** external "jQuery" ***!
26+
\*************************/
27+
/***/ ((module) => {
28+
29+
module.exports = jQuery;
30+
31+
/***/ })
32+
33+
/******/ });
34+
/************************************************************************/
35+
/******/ // The module cache
36+
/******/ var __webpack_module_cache__ = {};
37+
/******/
38+
/******/ // The require function
39+
/******/ function __webpack_require__(moduleId) {
40+
/******/ // Check if module is in cache
41+
/******/ var cachedModule = __webpack_module_cache__[moduleId];
42+
/******/ if (cachedModule !== undefined) {
43+
/******/ return cachedModule.exports;
44+
/******/ }
45+
/******/ // Create a new module (and put it into the cache)
46+
/******/ var module = __webpack_module_cache__[moduleId] = {
47+
/******/ // no module.id needed
48+
/******/ // no module.loaded needed
49+
/******/ exports: {}
50+
/******/ };
51+
/******/
52+
/******/ // Execute the module function
53+
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
54+
/******/
55+
/******/ // Return the exports of the module
56+
/******/ return module.exports;
57+
/******/ }
58+
/******/
59+
/************************************************************************/
60+
/******/ /* webpack/runtime/compat get default export */
61+
/******/ (() => {
62+
/******/ // getDefaultExport function for compatibility with non-harmony modules
63+
/******/ __webpack_require__.n = (module) => {
64+
/******/ var getter = module && module.__esModule ?
65+
/******/ () => (module['default']) :
66+
/******/ () => (module);
67+
/******/ __webpack_require__.d(getter, { a: getter });
68+
/******/ return getter;
69+
/******/ };
70+
/******/ })();
71+
/******/
72+
/******/ /* webpack/runtime/define property getters */
73+
/******/ (() => {
74+
/******/ // define getter functions for harmony exports
75+
/******/ __webpack_require__.d = (exports, definition) => {
76+
/******/ for(var key in definition) {
77+
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
78+
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
79+
/******/ }
80+
/******/ }
81+
/******/ };
82+
/******/ })();
83+
/******/
84+
/******/ /* webpack/runtime/hasOwnProperty shorthand */
85+
/******/ (() => {
86+
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
87+
/******/ })();
88+
/******/
89+
/******/ /* webpack/runtime/make namespace object */
90+
/******/ (() => {
91+
/******/ // define __esModule on exports
92+
/******/ __webpack_require__.r = (exports) => {
93+
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
94+
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
95+
/******/ }
96+
/******/ Object.defineProperty(exports, '__esModule', { value: true });
97+
/******/ };
98+
/******/ })();
99+
/******/
100+
/************************************************************************/
101+
/******/
102+
/******/ // startup
103+
/******/ // Load entry module and return exports
104+
/******/ // This entry module can't be inlined because the eval-source-map devtool is used.
105+
/******/ var __webpack_exports__ = __webpack_require__("./bundle.js");
106+
/******/
107+
/******/ })()
108+
;

client/dist/bundle.js.map

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client/src/css/bundle.scss

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
.minicolors-theme-default .minicolors-input {
2+
height: auto;
3+
padding-left: 38px!important;
4+
}
5+
6+
.minicolors-theme-default .minicolors-swatch {
7+
border: 0 none;
8+
height: 100%;
9+
left: 0;
10+
overflow: hidden;
11+
top: 0;
12+
width: 32px;
13+
border-radius: 4px 0 0 4px;
14+
box-sizing: border-box;
15+
}

0 commit comments

Comments
 (0)