Skip to content

Commit 2d21606

Browse files
author
Alban Bailly
committed
adding checkboxes to CMS
1 parent 8d4b259 commit 2d21606

File tree

5 files changed

+84
-15
lines changed

5 files changed

+84
-15
lines changed

gatsby-config.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,15 @@ module.exports = {
2626
]
2727
},
2828
plugins: [
29-
`gatsby-plugin-netlify-cms`,
29+
{
30+
resolve: "gatsby-plugin-netlify-cms",
31+
options: {
32+
modulePath: `${__dirname}/src/cms/index.js`,
33+
options: {
34+
manualInit: true
35+
}
36+
}
37+
},
3038
`gatsby-transformer-remark`,
3139
{
3240
resolve: `gatsby-source-filesystem`,

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
"gatsby-transformer-sharp": "^2.1.13",
2525
"json-schema-ref-parser": "^6.1.0",
2626
"netlify-cms-app": "^2.9.1",
27+
"netlify-cms-widget-inline-select": "^1.3.1",
2728
"postcss-easy-import": "^3.0.0",
2829
"prop-types": "^15.6.2",
2930
"react": "^16.7.0",

src/cms/index.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import CMS from "netlify-cms-app";
2+
import {
3+
InlineSelectControl,
4+
InlineSelectPreview
5+
} from "netlify-cms-widget-inline-select";
6+
7+
CMS.registerWidget("inline-select", InlineSelectControl, InlineSelectPreview);
8+
9+
CMS.init();

static/admin/config.yml

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ media_folder: "static/assets" # Media files will be stored in the repo under sta
88
public_folder: "/assets" # The src attribute for uploaded media will begin with /images/uploads
99

1010
collections:
11-
1211
- name: "changelog" # Used in routes, e.g., /admin/collections/blog
1312

1413
label: "Changelogs" # Used in the UI
@@ -20,7 +19,6 @@ collections:
2019
slug: "{{slug}}" # Filename template, e.g., YYYY-MM-DD-title.md
2120

2221
fields: # The fields for each document, usually in front matter
23-
2422
- label: "Title"
2523
name: "title"
2624
widget: "string"
@@ -34,15 +32,11 @@ collections:
3432
- label: "Changelog Type"
3533
name: "changelog"
3634
required: true
37-
widget: list
38-
field: {
39-
label: "Category",
40-
name: "category",
41-
widget: "select",
42-
options: ["API", "Cloud Manager"]
43-
}
35+
widget: inline-select
36+
multiple: true
37+
options: ["API", "Cloud Manager"]
4438

4539
- label: "Content"
4640
name: "body"
4741
widget: "markdown"
48-
required: true
42+
required: true

yarn.lock

Lines changed: 61 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -719,7 +719,7 @@
719719
resolved "https://registry.yarnpkg.com/@emotion/hash/-/hash-0.6.6.tgz#62266c5f0eac6941fece302abad69f2ee7e25e44"
720720
integrity sha512-ojhgxzUHZ7am3D2jHkMzPpsBAiB005GF5YU4ea+8DNPybMk01JJUM9V9YRlF/GE95tcOm8DxQvWA2jq19bGalQ==
721721

722-
"@emotion/[email protected]":
722+
"@emotion/[email protected]", "@emotion/is-prop-valid@^0.7.3":
723723
version "0.7.3"
724724
resolved "https://registry.yarnpkg.com/@emotion/is-prop-valid/-/is-prop-valid-0.7.3.tgz#a6bf4fa5387cbba59d44e698a4680f481a8da6cc"
725725
integrity sha512-uxJqm/sqwXw3YPA5GXX365OBcJGFtxUVkB6WyezqFHlNe9jqUWH5ur2O2M8dGBz61kn1g3ZBlzUunFQXQIClhA==
@@ -790,7 +790,7 @@
790790
resolved "https://registry.yarnpkg.com/@emotion/stylis/-/stylis-0.7.1.tgz#50f63225e712d99e2b2b39c19c70fff023793ca5"
791791
integrity sha512-/SLmSIkN13M//53TtNxgxo57mcJk/UJIDFRKwOiLIBEyBHEcipgR6hNMQ/59Sl4VjCJ0Z/3zeAZyvnSLPG/1HQ==
792792

793-
"@emotion/[email protected]":
793+
"@emotion/[email protected]", "@emotion/unitless@^0.7.0":
794794
version "0.7.3"
795795
resolved "https://registry.yarnpkg.com/@emotion/unitless/-/unitless-0.7.3.tgz#6310a047f12d21a1036fb031317219892440416f"
796796
integrity sha512-4zAPlpDEh2VwXswwr/t8xGNDGg8RQiPxtxZ3qQEXyQsBV39ptTdESCjuBvGze1nLMVrxmTIKmnO/nAV8Tqjjzg==
@@ -1713,6 +1713,16 @@ babel-plugin-remove-graphql-queries@^2.5.5:
17131713
version "2.5.5"
17141714
resolved "https://registry.yarnpkg.com/babel-plugin-remove-graphql-queries/-/babel-plugin-remove-graphql-queries-2.5.5.tgz#c6f49f7131076415b5fa206c8ad3a308c1e8d05a"
17151715

1716+
"babel-plugin-styled-components@>= 1":
1717+
version "1.10.0"
1718+
resolved "https://registry.yarnpkg.com/babel-plugin-styled-components/-/babel-plugin-styled-components-1.10.0.tgz#ff1f42ad2cc78c21f26b62266b8f564dbc862939"
1719+
integrity sha512-sQVKG8irFXx14ZfaK1bBePirfkacl3j8nZwSZK+ZjsbnadRHKQTbhXbe/RB1vT6Vgkz45E+V95LBq4KqdhZUNw==
1720+
dependencies:
1721+
"@babel/helper-annotate-as-pure" "^7.0.0"
1722+
"@babel/helper-module-imports" "^7.0.0"
1723+
babel-plugin-syntax-jsx "^6.18.0"
1724+
lodash "^4.17.10"
1725+
17161726
babel-plugin-syntax-dynamic-import@^6.18.0:
17171727
version "6.18.0"
17181728
resolved "https://registry.yarnpkg.com/babel-plugin-syntax-dynamic-import/-/babel-plugin-syntax-dynamic-import-6.18.0.tgz#8d6a26229c83745a9982a441051572caa179b1da"
@@ -2296,6 +2306,11 @@ camelcase@^5.0.0:
22962306
version "5.0.0"
22972307
resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-5.0.0.tgz#03295527d58bd3cd4aa75363f35b2e8d97be2f42"
22982308

2309+
camelize@^1.0.0:
2310+
version "1.0.0"
2311+
resolved "https://registry.yarnpkg.com/camelize/-/camelize-1.0.0.tgz#164a5483e630fa4321e5af07020e531831b2609b"
2312+
integrity sha1-FkpUg+Yw+kMh5a8HAg5TGDGyYJs=
2313+
22992314
caniuse-api@^3.0.0:
23002315
version "3.0.0"
23012316
resolved "https://registry.yarnpkg.com/caniuse-api/-/caniuse-api-3.0.0.tgz#5e4d90e2274961d46291997df599e3ed008ee4c0"
@@ -2955,6 +2970,11 @@ crypto@^1.0.1:
29552970
resolved "https://registry.yarnpkg.com/crypto/-/crypto-1.0.1.tgz#2af1b7cad8175d24c8a1b0778255794a21803037"
29562971
integrity sha512-VxBKmeNcqQdiUQUW2Tzq0t377b54N2bMtXO/qiLa+6eRRmmC4qT3D4OnTGoT/U6O9aklQ/jTwbOtRMTTY8G0Ig==
29572972

2973+
css-color-keywords@^1.0.0:
2974+
version "1.0.0"
2975+
resolved "https://registry.yarnpkg.com/css-color-keywords/-/css-color-keywords-1.0.0.tgz#fea2616dc676b2962686b3af8dbdbe180b244e05"
2976+
integrity sha1-/qJhbcZ2spYmhrOvjb2+GAskTgU=
2977+
29582978
[email protected], css-color-names@^0.0.4:
29592979
version "0.0.4"
29602980
resolved "https://registry.yarnpkg.com/css-color-names/-/css-color-names-0.0.4.tgz#808adc2e79cf84738069b646cb20ec27beb629e0"
@@ -3017,6 +3037,15 @@ css-selector-tokenizer@^0.7.0:
30173037
fastparse "^1.1.1"
30183038
regexpu-core "^1.0.0"
30193039

3040+
css-to-react-native@^2.2.2:
3041+
version "2.3.1"
3042+
resolved "https://registry.yarnpkg.com/css-to-react-native/-/css-to-react-native-2.3.1.tgz#cf0f61e0514846e2d4dc188b0886e29d8bef64a2"
3043+
integrity sha512-yO+oEx1Lf+hDKasqQRVrAvzMCz825Huh1VMlEEDlRWyAhFb/FWb6I0KpEF1PkyKQ7NEdcx9d5M2ZEWgJAsgPvQ==
3044+
dependencies:
3045+
camelize "^1.0.0"
3046+
css-color-keywords "^1.0.0"
3047+
postcss-value-parser "^3.3.0"
3048+
30203049
30213050
version "1.0.0-alpha.28"
30223051
resolved "https://registry.yarnpkg.com/css-tree/-/css-tree-1.0.0-alpha.28.tgz#8e8968190d886c9477bc8d61e96f61af3f7ffa7f"
@@ -7786,7 +7815,7 @@ netlify-cms-lib-util@^2.3.2:
77867815
js-sha256 "^0.9.0"
77877816
localforage "^1.7.3"
77887817

7789-
netlify-cms-ui-default@^2.6.2:
7818+
netlify-cms-ui-default@^2.6.0, netlify-cms-ui-default@^2.6.2:
77907819
version "2.6.2"
77917820
resolved "https://registry.yarnpkg.com/netlify-cms-ui-default/-/netlify-cms-ui-default-2.6.2.tgz#04d428f11590f58db00ea464503a2139a2bec059"
77927821
integrity sha512-zpPGMCrWzsmMP+7dpdmrLYCSHW0dWLBDe6o8gTv+RiKfxUEQAOvGeIAJelf8sstffYXu7kHdckuBmrJRASs9tw==
@@ -7824,6 +7853,17 @@ netlify-cms-widget-image@^2.3.2:
78247853
resolved "https://registry.yarnpkg.com/netlify-cms-widget-image/-/netlify-cms-widget-image-2.3.2.tgz#6e9a68c58ae64bf773b39449b917fdd39be8b527"
78257854
integrity sha512-KpndHKa//nKfKZIdsrRFiS9k1Bt8UWmxVv5c8csLpxOffhUiW/sfVBtyZHc0CSIqOrgDz0Arhar7KNO090d//g==
78267855

7856+
netlify-cms-widget-inline-select@^1.3.1:
7857+
version "1.3.1"
7858+
resolved "https://registry.yarnpkg.com/netlify-cms-widget-inline-select/-/netlify-cms-widget-inline-select-1.3.1.tgz#6ba6da1c596c42df4b0a6eb9d02773139311c77b"
7859+
integrity sha512-cN7mRiGjulQsvtBK99K6pca9J5exBh3qm0uATY/vxru4JE+ZOFZI294TItjumhc78LnzdVvA77VloUmKnW3d/Q==
7860+
dependencies:
7861+
netlify-cms-ui-default "^2.6.0"
7862+
prop-types "^15.6.2"
7863+
react-immutable-proptypes "^2.1.0"
7864+
styled-components "^4.1.3"
7865+
uuid "^3.3.2"
7866+
78277867
netlify-cms-widget-list@^2.3.2:
78287868
version "2.3.2"
78297869
resolved "https://registry.yarnpkg.com/netlify-cms-widget-list/-/netlify-cms-widget-list-2.3.2.tgz#9f0141c6a595416a3b5c215f9d3fdfdcc358d3fd"
@@ -11438,6 +11478,23 @@ style-loader@^0.21.0:
1143811478
loader-utils "^1.1.0"
1143911479
schema-utils "^0.4.5"
1144011480

11481+
styled-components@^4.1.3:
11482+
version "4.2.0"
11483+
resolved "https://registry.yarnpkg.com/styled-components/-/styled-components-4.2.0.tgz#811fbbec4d64c7189f6c7482b9eb6fefa7fefef7"
11484+
integrity sha512-L/LzkL3ZbBhqIVHdR7DbYujy4tqvTNRfc+4JWDCYyhTatI+8CRRQUmdaR0+ARl03DWsfKLhjewll5uNLrqrl4A==
11485+
dependencies:
11486+
"@babel/helper-module-imports" "^7.0.0"
11487+
"@emotion/is-prop-valid" "^0.7.3"
11488+
"@emotion/unitless" "^0.7.0"
11489+
babel-plugin-styled-components ">= 1"
11490+
css-to-react-native "^2.2.2"
11491+
memoize-one "^5.0.0"
11492+
prop-types "^15.5.4"
11493+
react-is "^16.6.0"
11494+
stylis "^3.5.0"
11495+
stylis-rule-sheet "^0.0.10"
11496+
supports-color "^5.5.0"
11497+
1144111498
stylehacks@^4.0.0:
1144211499
version "4.0.1"
1144311500
resolved "https://registry.yarnpkg.com/stylehacks/-/stylehacks-4.0.1.tgz#3186595d047ab0df813d213e51c8b94e0b9010f2"
@@ -11472,7 +11529,7 @@ supports-color@^3.2.3:
1147211529
dependencies:
1147311530
has-flag "^1.0.0"
1147411531

11475-
supports-color@^5.1.0, supports-color@^5.3.0, supports-color@^5.4.0:
11532+
supports-color@^5.1.0, supports-color@^5.3.0, supports-color@^5.4.0, supports-color@^5.5.0:
1147611533
version "5.5.0"
1147711534
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f"
1147811535
dependencies:

0 commit comments

Comments
 (0)