diff --git a/dispatch/static/manager/src/js/components/ImageStore.js b/dispatch/static/manager/src/js/components/ImageStore.js
index 421f4ee8d..6058a5e83 100644
--- a/dispatch/static/manager/src/js/components/ImageStore.js
+++ b/dispatch/static/manager/src/js/components/ImageStore.js
@@ -1,69 +1,69 @@
-var _ = require('lodash');
+var _ = require('lodash')
var ImageStore = function(){
- return {
- images: [],
- dump: function(images){
- this.images = images;
- },
- append: function(images){
- this.images = this.images.concat(images);
- },
- addTemp: function(name, thumb){
- var tempImage = {
- tempName: name,
- thumb: thumb,
- }
- this.images.unshift(tempImage);
- },
- updateProgress: function(name, progress){
- var i = _.findIndex(this.images, {tempName: name})
- this.images[i].progress = progress;
- },
- updateImage: function(id, callback){
- dispatch.find('image', id, function(data){
- var i = _.findIndex(this.images, {id: id});
- this.images[i] = data;
- callback();
- }.bind(this))
- },
- updateImageWithData: function(data){
- var i = _.findIndex(this.images, {id: data.id});
- this.images[i] = data;
- },
- updateAttachment: function(attachment_id, data){
- var i = _.findIndex(this.images, {attachment_id: attachment_id});
- this.images[i] = data;
- },
- replaceTemp: function(name, image){
- var i = _.findIndex(this.images, {tempName: name});
- this.images[i] = image;
- },
- getImage: function(id){
- var i = _.findIndex(this.images, {id: id});
- return this.images[i];
- },
- getImages: function(ids){
- var images = [];
- _.forEach(ids, function(id, index){
- images.push(this.getImage(id));
- }.bind(this));
- return images;
- },
- removeImage: function(id){
- _.remove(this.images, function(n) {
- return n.id == id;
- });
- },
- removeAttachment: function(attachment_id) {
- _.remove(this.images, function(n) {
- return n.attachment_id == attachment_id;
- });
- },
- all: function(){
- return this.images;
- }
+ return {
+ images: [],
+ dump: function(images){
+ this.images = images
+ },
+ append: function(images){
+ this.images = this.images.concat(images)
+ },
+ addTemp: function(name, thumb){
+ var tempImage = {
+ tempName: name,
+ thumb: thumb,
+ }
+ this.images.unshift(tempImage)
+ },
+ updateProgress: function(name, progress){
+ var i = _.findIndex(this.images, {tempName: name})
+ this.images[i].progress = progress
+ },
+ updateImage: function(id, callback){
+ dispatch.find('image', id, function(data){
+ var i = _.findIndex(this.images, {id: id})
+ this.images[i] = data
+ callback()
+ }.bind(this))
+ },
+ updateImageWithData: function(data){
+ var i = _.findIndex(this.images, {id: data.id})
+ this.images[i] = data
+ },
+ updateAttachment: function(attachment_id, data){
+ var i = _.findIndex(this.images, {attachment_id: attachment_id})
+ this.images[i] = data
+ },
+ replaceTemp: function(name, image){
+ var i = _.findIndex(this.images, {tempName: name})
+ this.images[i] = image
+ },
+ getImage: function(id){
+ var i = _.findIndex(this.images, {id: id})
+ return this.images[i]
+ },
+ getImages: function(ids){
+ var images = []
+ _.forEach(ids, function(id, index){
+ images.push(this.getImage(id))
+ }.bind(this))
+ return images
+ },
+ removeImage: function(id){
+ _.remove(this.images, function(n) {
+ return n.id == id
+ })
+ },
+ removeAttachment: function(attachment_id) {
+ _.remove(this.images, function(n) {
+ return n.attachment_id == attachment_id
+ })
+ },
+ all: function(){
+ return this.images
}
+ }
}
-module.exports = ImageStore;
+module.exports = ImageStore
diff --git a/dispatch/static/manager/src/js/components/ItemEditor/ListItemToolbar.js b/dispatch/static/manager/src/js/components/ItemEditor/ListItemToolbar.js
index 8fad89262..311af1da2 100644
--- a/dispatch/static/manager/src/js/components/ItemEditor/ListItemToolbar.js
+++ b/dispatch/static/manager/src/js/components/ItemEditor/ListItemToolbar.js
@@ -20,7 +20,7 @@ export default function ListItemToolbar(props) {
intent={Intent.DANGER}
disabled={props.isNew}
onConfirm={() => props.deleteListItem()}>
-
Delete
+
Delete
)
@@ -29,7 +29,7 @@ export default function ListItemToolbar(props) {
props.goBack()}>
- Back
+ Back
{props.isNew ? newTitle : editTitle}
@@ -37,7 +37,7 @@ export default function ListItemToolbar(props) {
props.saveListItem()}>
- {props.isNew ? 'Save' : 'Update'}
+ {props.isNew ? 'Save' : 'Update'}
{props.extraButton}
{props.deleteListItem ? deleteButton : null}
diff --git a/dispatch/static/manager/src/js/components/ItemEditor/index.js b/dispatch/static/manager/src/js/components/ItemEditor/index.js
index 26d7ef43d..ec87aa5e6 100644
--- a/dispatch/static/manager/src/js/components/ItemEditor/index.js
+++ b/dispatch/static/manager/src/js/components/ItemEditor/index.js
@@ -11,7 +11,7 @@ const NEW_LISTITEM_ID = 'new'
class ItemEditor extends React.Component {
- componentWillMount() {
+ componentDidMount() {
if (this.props.isNew) {
// Create empty listItem
this.props.setListItem({ id: NEW_LISTITEM_ID })
@@ -19,9 +19,7 @@ class ItemEditor extends React.Component {
// Fetch listItem
this.props.getListItem(this.props.token, this.props.itemId)
}
- }
- componentDidMount() {
if (this.props.route) {
confirmNavigation(
this.props.router,
diff --git a/dispatch/static/manager/src/js/components/ItemList/ItemListHeader.js b/dispatch/static/manager/src/js/components/ItemList/ItemListHeader.js
index e53278e59..08d384019 100644
--- a/dispatch/static/manager/src/js/components/ItemList/ItemListHeader.js
+++ b/dispatch/static/manager/src/js/components/ItemList/ItemListHeader.js
@@ -21,7 +21,8 @@ export default function ItemListHeader(props) {
const toolbarLeft = (
- props.actions.toggleAllItems(props.items.ids)} />
diff --git a/dispatch/static/manager/src/js/components/ItemList/ItemListSearchBar.js b/dispatch/static/manager/src/js/components/ItemList/ItemListSearchBar.js
index fd1d33a08..f39b1069c 100644
--- a/dispatch/static/manager/src/js/components/ItemList/ItemListSearchBar.js
+++ b/dispatch/static/manager/src/js/components/ItemList/ItemListSearchBar.js
@@ -13,7 +13,7 @@ export default class ItemListSearchBar extends React.Component {
this.handleSubmit = this.handleSubmit.bind(this)
}
- componentWillReceiveProps(nextProps) {
+ UNSAFE_componentWillReceiveProps(nextProps) {
this.setState({ query: nextProps.query || '' })
}
diff --git a/dispatch/static/manager/src/js/components/ModalContainer.js b/dispatch/static/manager/src/js/components/ModalContainer.js
index 7a09a6432..caa1238a7 100644
--- a/dispatch/static/manager/src/js/components/ModalContainer.js
+++ b/dispatch/static/manager/src/js/components/ModalContainer.js
@@ -5,7 +5,7 @@ require('../../styles/components/modal_container.scss')
export default function ModalContainer(props) {
return (
)
diff --git a/dispatch/static/manager/src/js/components/PageEditor/PageContentEditor.js b/dispatch/static/manager/src/js/components/PageEditor/PageContentEditor.js
index fd66859ab..3f9d5656b 100644
--- a/dispatch/static/manager/src/js/components/PageEditor/PageContentEditor.js
+++ b/dispatch/static/manager/src/js/components/PageEditor/PageContentEditor.js
@@ -18,7 +18,7 @@ const embeds = [
export default class PageContentEditor extends React.Component {
render() {
return (
-
+
- Basic fields
- Featured image
- Template
- SEO
+ Basic fields
+ Featured image
+ Template
+ SEO
diff --git a/dispatch/static/manager/src/js/components/PageEditor/PageToolbar.js b/dispatch/static/manager/src/js/components/PageEditor/PageToolbar.js
index 28a74d9f4..361046342 100644
--- a/dispatch/static/manager/src/js/components/PageEditor/PageToolbar.js
+++ b/dispatch/static/manager/src/js/components/PageEditor/PageToolbar.js
@@ -30,7 +30,7 @@ export default function PageToolbar(props) {
props.previewPage()}>
- Preview
+ Preview
props.update('slug', e.target.value) } />
+ onChange={e => props.update('slug', e.target.value)} />
props.update('snippet', e.target.value) } />
+ onChange={e => props.update('snippet', e.target.value)} />
diff --git a/dispatch/static/manager/src/js/components/PersonEditor/PersonForm.js b/dispatch/static/manager/src/js/components/PersonEditor/PersonForm.js
index c2c900931..21dbca988 100644
--- a/dispatch/static/manager/src/js/components/PersonEditor/PersonForm.js
+++ b/dispatch/static/manager/src/js/components/PersonEditor/PersonForm.js
@@ -41,7 +41,7 @@ export default class PersonForm extends React.Component {
placeholder='Full Name'
value={this.props.listItem.full_name || ''}
fill={true}
- onChange={ e => this.props.update('full_name', e.target.value) } />
+ onChange={e => this.props.update('full_name', e.target.value)} />
this.props.update('slug', e.target.value) } />
+ onChange={e => this.props.update('slug', e.target.value)} />
this.props.update('facebook_url', e.target.value) } />
+ onChange={e => this.props.update('facebook_url', e.target.value)} />
this.props.update('twitter_url', e.target.value) } />
+ onChange={e => this.props.update('twitter_url', e.target.value)} />
this.props.update('description', e.target.value) } />
+ onChange={e => this.props.update('description', e.target.value)} />
)
diff --git a/dispatch/static/manager/src/js/components/PlaceholderBar.js b/dispatch/static/manager/src/js/components/PlaceholderBar.js
index 38b64ce8f..2e32ac556 100644
--- a/dispatch/static/manager/src/js/components/PlaceholderBar.js
+++ b/dispatch/static/manager/src/js/components/PlaceholderBar.js
@@ -4,6 +4,6 @@ require('../../styles/components/placeholder_bar.scss')
export default function PlaceholderBar() {
return (
-
+
)
}
diff --git a/dispatch/static/manager/src/js/components/PollEditor/Poll.js b/dispatch/static/manager/src/js/components/PollEditor/Poll.js
index e873eb79b..392642e07 100644
--- a/dispatch/static/manager/src/js/components/PollEditor/Poll.js
+++ b/dispatch/static/manager/src/js/components/PollEditor/Poll.js
@@ -17,9 +17,9 @@ class Poll extends Component {
let answers = []
let votes = []
let pollQuestion = this.props.question ? this.props.question : 'Poll Question'
- if(this.props.answers) {
- for(let answer of this.props.answers) {
- if(answer['name'] !== '') {
+ if (this.props.answers) {
+ for (let answer of this.props.answers) {
+ if (answer['name'] !== '') {
answers.push(answer['name'])
} else {
answers.push('Answer')
@@ -33,7 +33,7 @@ class Poll extends Component {
let temp = votes.filter((item) => {return item === 0})
let noVotes = false
- if(temp.length === votes.length) {
+ if (temp.length === votes.length) {
//no votes yet, populate with dummy data for better poll visualization
votes[0] = 2
votes[1] = 1
@@ -50,11 +50,11 @@ class Poll extends Component {
}
getPollResult(index, votes) {
- if(this.state.showResults) {
+ if (this.state.showResults) {
let width = 0
let total = votes.reduce((acc, val) => { return acc + val })
- if(total !== 0) {
+ if (total !== 0) {
width = String((100*votes[index]/total).toFixed(0)) + '%'
}
@@ -82,27 +82,30 @@ class Poll extends Component {
{pollQuestion}
)
diff --git a/dispatch/static/manager/src/js/components/SectionEditor/SectionForm.js b/dispatch/static/manager/src/js/components/SectionEditor/SectionForm.js
index 984867c1c..b07d474de 100644
--- a/dispatch/static/manager/src/js/components/SectionEditor/SectionForm.js
+++ b/dispatch/static/manager/src/js/components/SectionEditor/SectionForm.js
@@ -15,7 +15,7 @@ export default function SectionForm(props) {
placeholder='Name'
value={props.listItem.name || ''}
fill={true}
- onChange={ e => props.update('name', e.target.value) } />
+ onChange={e => props.update('name', e.target.value)} />
props.update('slug', e.target.value) } />
+ onChange={e => props.update('slug', e.target.value)} />
diff --git a/dispatch/static/manager/src/js/components/TagEditor/TagForm.js b/dispatch/static/manager/src/js/components/TagEditor/TagForm.js
index 1f2b4637b..b417742d5 100644
--- a/dispatch/static/manager/src/js/components/TagEditor/TagForm.js
+++ b/dispatch/static/manager/src/js/components/TagEditor/TagForm.js
@@ -14,7 +14,7 @@ export default function TagForm(props) {
placeholder='Name'
value={props.listItem.name || ''}
fill={true}
- onChange={ e => props.update('name', e.target.value) } />
+ onChange={e => props.update('name', e.target.value)} />
)
diff --git a/dispatch/static/manager/src/js/components/TopicEditor/TopicForm.js b/dispatch/static/manager/src/js/components/TopicEditor/TopicForm.js
index 29550b2f1..19067fc83 100644
--- a/dispatch/static/manager/src/js/components/TopicEditor/TopicForm.js
+++ b/dispatch/static/manager/src/js/components/TopicEditor/TopicForm.js
@@ -14,7 +14,7 @@ export default function TopicForm(props) {
placeholder='Name'
value={props.listItem.name || ''}
fill={true}
- onChange={ e => props.update('name', e.target.value) } />
+ onChange={e => props.update('name', e.target.value)} />
)
diff --git a/dispatch/static/manager/src/js/components/VideoEditor/VideoForm.js b/dispatch/static/manager/src/js/components/VideoEditor/VideoForm.js
index 5024c6a6d..1493fd7fa 100644
--- a/dispatch/static/manager/src/js/components/VideoEditor/VideoForm.js
+++ b/dispatch/static/manager/src/js/components/VideoEditor/VideoForm.js
@@ -15,7 +15,7 @@ export default function VideoForm(props) {
placeholder='Title'
value={props.listItem.title || ''}
fill={true}
- onChange={ e => props.update('title', e.target.value) } />
+ onChange={e => props.update('title', e.target.value)} />
props.update('url', e.target.value) } />
+ onChange={e => props.update('url', e.target.value)} />
diff --git a/dispatch/static/manager/src/js/components/WidgetFields.js b/dispatch/static/manager/src/js/components/WidgetFields.js
index c9989bfca..7e5cb7c59 100644
--- a/dispatch/static/manager/src/js/components/WidgetFields.js
+++ b/dispatch/static/manager/src/js/components/WidgetFields.js
@@ -16,7 +16,7 @@ class WidgetFieldsComponent extends React.Component {
return (
- {fields}
+ {fields}
)
}
diff --git a/dispatch/static/manager/src/js/components/ZoneEditor/index.js b/dispatch/static/manager/src/js/components/ZoneEditor/index.js
index bd6cd96b9..fd9d360c2 100644
--- a/dispatch/static/manager/src/js/components/ZoneEditor/index.js
+++ b/dispatch/static/manager/src/js/components/ZoneEditor/index.js
@@ -14,7 +14,7 @@ import FieldGroup from '../fields/FieldGroup'
class ZoneEditorComponent extends React.Component {
- componentWillMount() {
+ componentDidMount() {
this.props.getZone(this.props.token, this.props.zoneId)
}
diff --git a/dispatch/static/manager/src/js/components/fields/IntegerField.js b/dispatch/static/manager/src/js/components/fields/IntegerField.js
index 191578052..64831b03c 100644
--- a/dispatch/static/manager/src/js/components/fields/IntegerField.js
+++ b/dispatch/static/manager/src/js/components/fields/IntegerField.js
@@ -6,6 +6,8 @@ export default class IntegerField extends React.Component {
constructor(props) {
super(props)
+ this.textInput = React.createRef()
+
this.state = {
selectionStart: 0,
selectionEnd: 0
@@ -13,7 +15,7 @@ export default class IntegerField extends React.Component {
}
onChange(val) {
- let { selectionStart, selectionEnd } = this.refs.input.refs.input
+ let { selectionStart, selectionEnd } = this.textInput.current.input.current
const initialLength = val.length
val = val.replace(/[^\d-]+/g, '')
@@ -36,7 +38,7 @@ export default class IntegerField extends React.Component {
componentDidUpdate() {
//put the caret back in the correct place
- this.refs.input.refs.input.setSelectionRange(
+ this.textInput.current.input.current.setSelectionRange(
this.state.selectionStart,
this.state.selectionEnd)
}
@@ -44,7 +46,7 @@ export default class IntegerField extends React.Component {
render() {
return (
(
-// this.updateField(field.name, data)} />
-// )) : null
-//
-// if (fields) {
-// fields = (
-//
-// {fields}
-//
-// )
-// }
-// =======
+ // <<<<<<< HEAD
+ // let fields = widget ? widget.fields.map((field) => (
+ // this.updateField(field.name, data)} />
+ // )) : null
+ //
+ // if (fields) {
+ // fields = (
+ //
+ // {fields}
+ //
+ // )
+ // }
+ // =======
const fields = widget && widget.fields.length ? (
this.updateField(name, data)} />
) : null
-// >>>>>>> develop
+ // >>>>>>> develop
return (
@@ -81,7 +81,7 @@ export default class WidgetFieldComponent extends React.Component {
selected={this.getWidgetId()}
update={widgetId => this.handleWidgetChange(widgetId)} />
- {fields}
+ {fields}
)
}
diff --git a/dispatch/static/manager/src/js/components/inputs/DateTimeInput.js b/dispatch/static/manager/src/js/components/inputs/DateTimeInput.js
index be1cc097e..8428b23bd 100644
--- a/dispatch/static/manager/src/js/components/inputs/DateTimeInput.js
+++ b/dispatch/static/manager/src/js/components/inputs/DateTimeInput.js
@@ -12,7 +12,7 @@ function ensureDate(date) {
let ret = date
if (!(date instanceof Date)) {
const time_ms = Date.parse(date)
- if(isNaN(time_ms)) {
+ if (isNaN(time_ms)) {
ret = null
} else {
ret = new Date(time_ms)
diff --git a/dispatch/static/manager/src/js/components/inputs/ImageInput.js b/dispatch/static/manager/src/js/components/inputs/ImageInput.js
index 8d24645d8..aeba9d135 100644
--- a/dispatch/static/manager/src/js/components/inputs/ImageInput.js
+++ b/dispatch/static/manager/src/js/components/inputs/ImageInput.js
@@ -17,7 +17,7 @@ function Image(props) {
-
+
)
@@ -90,11 +90,11 @@ class ImageInputComponent extends React.Component {
onClick={() => this.removeImage(image.id)} />
)} />
+ onClick={() => this.chooseImage()}>{this.props.many ? 'Add image' : (this.props.selected ? 'Change image' : 'Select image')}
+
{(this.props.selected && this.props.removable) &&
}
+ onClick={() => this.removeImage()}>{'Remove image'}
+ }