Updated all React components to their latest version
- updated code due to deprecated warnings (mostly router stuff & input default value) - set default sender based on settings when creating new newsletter - fixed erroneous UTC offset when displaying dates (PHP takes care of it)
This commit is contained in:
@@ -7,7 +7,10 @@ function(
|
||||
var FormFieldText = React.createClass({
|
||||
render: function() {
|
||||
var value = this.props.item[this.props.field.name];
|
||||
if(!value) { value = null; }
|
||||
if(value === undefined) {
|
||||
value = this.props.field.defaultValue || '';
|
||||
}
|
||||
|
||||
return (
|
||||
<input
|
||||
type="text"
|
||||
@@ -21,7 +24,6 @@ function(
|
||||
id={ 'field_'+this.props.field.name }
|
||||
value={ value }
|
||||
placeholder={ this.props.field.placeholder }
|
||||
defaultValue={ this.props.field.defaultValue }
|
||||
onChange={ this.props.onValueChange }
|
||||
{...this.props.field.validation}
|
||||
/>
|
||||
|
@@ -13,10 +13,11 @@ define(
|
||||
Router,
|
||||
FormField
|
||||
) {
|
||||
|
||||
var Form = React.createClass({
|
||||
mixins: [
|
||||
Router.History
|
||||
],
|
||||
contextTypes: {
|
||||
router: React.PropTypes.object.isRequired
|
||||
},
|
||||
getDefaultProps: function() {
|
||||
return {
|
||||
params: {},
|
||||
@@ -68,7 +69,7 @@ define(
|
||||
loading: false,
|
||||
item: {}
|
||||
}, function() {
|
||||
this.history.pushState(null, '/new');
|
||||
this.context.router.push('/new');
|
||||
}.bind(this));
|
||||
} else {
|
||||
this.setState({
|
||||
@@ -118,7 +119,16 @@ define(
|
||||
if(this.props.onSuccess !== undefined) {
|
||||
this.props.onSuccess();
|
||||
} else {
|
||||
this.history.pushState(null, '/')
|
||||
var isChrome = (/Chrome/.test(navigator.userAgent))
|
||||
&& (/Google Inc/.test(navigator.vendor));
|
||||
if(
|
||||
(isChrome && history.length > 2)
|
||||
|| (!isChrome && history.length > 1)
|
||||
) {
|
||||
this.context.router.goBack();
|
||||
} else {
|
||||
this.context.router.push('/');
|
||||
}
|
||||
}
|
||||
|
||||
if(this.props.params.id !== undefined) {
|
||||
|
Reference in New Issue
Block a user