-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Id improved, Duplicate work in progress, JSON test
- Loading branch information
1 parent
4f5c518
commit df74dbf
Showing
9 changed files
with
138 additions
and
2 deletions.
There are no files selected for viewing
4 changes: 4 additions & 0 deletions
4
content/test/badges/29c34002-2c38-44d6-ae96-9145618acc93.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"id": "29c34002-2c38-44d6-ae96-9145618acc93", | ||
"title": "Badge A" | ||
} |
4 changes: 4 additions & 0 deletions
4
content/test/badges/825b97a8-7448-41f0-a035-c294d1870430.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"id": "825b97a8-7448-41f0-a035-c294d1870430", | ||
"title": "Badge B" | ||
} |
12 changes: 12 additions & 0 deletions
12
content/test/challenges/6b72310b-eb53-4a2d-a489-471bd0398b7f.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"id": "6b72310b-eb53-4a2d-a489-471bd0398b7f", | ||
"title": "CHallenge", | ||
"hackathon": "6d6fa758-11a5-4029-bb73-16154550453e", | ||
"descriptions": [ | ||
{ | ||
"language": "DE", | ||
"description": "De" | ||
} | ||
], | ||
"badges": [] | ||
} |
11 changes: 11 additions & 0 deletions
11
content/test/hackathons/6d6fa758-11a5-4029-bb73-16154550453e.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"id": "6d6fa758-11a5-4029-bb73-16154550453e", | ||
"title": "Hackathon", | ||
"active": true, | ||
"descriptions": [ | ||
{ | ||
"language": "DE", | ||
"description": "De" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,45 @@ | ||
import CMS from "netlify-cms" | ||
import { UuidControl, UuidPreview } from 'netlify-cms-widget-uuid' | ||
//import { UuidControl, UuidPreview } from 'netlify-cms-widget-uuid' | ||
|
||
CMS.registerWidget('uuid', UuidControl, UuidPreview) | ||
//CMS.registerWidget('uuid', UuidControl, UuidPreview) | ||
|
||
import uuid from 'uuid/v4'; | ||
|
||
/** | ||
* Create the control widget, this will add a form element to the cms UI | ||
*/ | ||
const IdControl = window.createClass({ | ||
getInitialState: function() { return {}; }, | ||
componentDidMount: function() { | ||
// If this widget doesn't have an ID yet we create one using the UUID package | ||
if (!this.props.value) { | ||
this.props.onChange(uuid()); | ||
} | ||
}, | ||
handleChange() { | ||
this.props.onChange(uuid()); | ||
}, | ||
render: function() { | ||
return window.h('p', null, `${this.props.value}`); | ||
}, | ||
|
||
componentDidUpdate: function() { | ||
// If this widget doesn't have an ID yet we create one using the UUID package | ||
if(!this.props.value.includes("NEW")){ | ||
this.props.onChange(this.props.value + "NEW"); | ||
} | ||
} | ||
}); | ||
|
||
/** | ||
* Create the preview widget, this will display the widgets value in the NetlifyCMS preview pane | ||
*/ | ||
const IdPreview = window.createClass({ | ||
getInitialState: function() { console.log(this.props); return {}; }, | ||
render: function() { | ||
return window.h('p', null, `ID: ${this.props.value}`); | ||
} | ||
}); | ||
|
||
// Register the widget. This lets NetlifyCMS know about our custom widget | ||
CMS.registerWidget('uuid', IdControl, IdPreview); |