List and scheduling inputs are disabled instead of being hidden
This commit is contained in:
@@ -101,6 +101,11 @@ define([
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
},
|
},
|
||||||
|
isDisabled: function () {
|
||||||
|
return this.props.item.status == 'sending'
|
||||||
|
&& this.props.item.queue
|
||||||
|
&& this.props.item.queue.status == 'paused';
|
||||||
|
},
|
||||||
loadCachedItems: function () {
|
loadCachedItems: function () {
|
||||||
if(typeof(window['mailpoet_'+this.props.field.endpoint]) !== 'undefined') {
|
if(typeof(window['mailpoet_'+this.props.field.endpoint]) !== 'undefined') {
|
||||||
let items = window['mailpoet_'+this.props.field.endpoint];
|
let items = window['mailpoet_'+this.props.field.endpoint];
|
||||||
@@ -180,6 +185,7 @@ define([
|
|||||||
<select
|
<select
|
||||||
id={ this.props.field.id || this.props.field.name }
|
id={ this.props.field.id || this.props.field.name }
|
||||||
ref="select"
|
ref="select"
|
||||||
|
disabled={this.isDisabled()}
|
||||||
data-placeholder={ this.props.field.placeholder }
|
data-placeholder={ this.props.field.placeholder }
|
||||||
multiple={ this.props.field.multiple }
|
multiple={ this.props.field.multiple }
|
||||||
defaultValue={ this.getSelectedValues() }
|
defaultValue={ this.getSelectedValues() }
|
||||||
|
@@ -253,9 +253,9 @@ define(
|
|||||||
const isPaused = this.state.item.status == 'sending'
|
const isPaused = this.state.item.status == 'sending'
|
||||||
&& this.state.item.queue
|
&& this.state.item.queue
|
||||||
&& this.state.item.queue.status == 'paused';
|
&& this.state.item.queue.status == 'paused';
|
||||||
const fields = (!isPaused)
|
// const fields = (!isPaused)
|
||||||
? this.state.fields
|
// ? this.state.fields
|
||||||
: this.state.fields.filter(field => field.name != 'segments' && field.name != 'options');
|
// : this.state.fields.filter(field => field.name != 'segments' && field.name != 'options');
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<h1>{MailPoet.I18n.t('finalNewsletterStep')}</h1>
|
<h1>{MailPoet.I18n.t('finalNewsletterStep')}</h1>
|
||||||
@@ -264,7 +264,7 @@ define(
|
|||||||
|
|
||||||
<Form
|
<Form
|
||||||
id="mailpoet_newsletter"
|
id="mailpoet_newsletter"
|
||||||
fields={ fields }
|
fields={ this.state.fields }
|
||||||
item={ this.state.item }
|
item={ this.state.item }
|
||||||
loading={ this.state.loading }
|
loading={ this.state.loading }
|
||||||
onChange={this.handleFormChange}
|
onChange={this.handleFormChange}
|
||||||
|
@@ -155,6 +155,7 @@ define(
|
|||||||
name={this.getFieldName()}
|
name={this.getFieldName()}
|
||||||
value={this.getDisplayDate(this.props.value)}
|
value={this.getDisplayDate(this.props.value)}
|
||||||
readOnly={ true }
|
readOnly={ true }
|
||||||
|
disabled={this.props.disabled}
|
||||||
onChange={this.onChange}
|
onChange={this.onChange}
|
||||||
ref="dateInput"
|
ref="dateInput"
|
||||||
{...this.props.validation} />
|
{...this.props.validation} />
|
||||||
@@ -180,6 +181,7 @@ define(
|
|||||||
<select
|
<select
|
||||||
name={this.props.name || 'time'}
|
name={this.props.name || 'time'}
|
||||||
value={this.props.value}
|
value={this.props.value}
|
||||||
|
disabled={this.props.disabled}
|
||||||
onChange={this.props.onChange}
|
onChange={this.props.onChange}
|
||||||
{...this.props.validation}
|
{...this.props.validation}
|
||||||
>
|
>
|
||||||
@@ -235,11 +237,13 @@ define(
|
|||||||
onChange={this.handleChange}
|
onChange={this.handleChange}
|
||||||
displayFormat={dateDisplayFormat}
|
displayFormat={dateDisplayFormat}
|
||||||
storageFormat={dateStorageFormat}
|
storageFormat={dateStorageFormat}
|
||||||
|
disabled={this.props.disabled}
|
||||||
validation={this.props.dateValidation}/>
|
validation={this.props.dateValidation}/>
|
||||||
<TimeSelect
|
<TimeSelect
|
||||||
name="time"
|
name="time"
|
||||||
value={this.state.time}
|
value={this.state.time}
|
||||||
onChange={this.handleChange}
|
onChange={this.handleChange}
|
||||||
|
disabled={this.props.disabled}
|
||||||
validation={this.props.timeValidation} />
|
validation={this.props.timeValidation} />
|
||||||
</span>
|
</span>
|
||||||
);
|
);
|
||||||
@@ -282,6 +286,11 @@ define(
|
|||||||
'data-parsley-errors-container': '#mailpoet_scheduling',
|
'data-parsley-errors-container': '#mailpoet_scheduling',
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
isDisabled: function () {
|
||||||
|
return this.props.item.status == 'sending'
|
||||||
|
&& this.props.item.queue
|
||||||
|
&& this.props.item.queue.status == 'paused';
|
||||||
|
},
|
||||||
render: function () {
|
render: function () {
|
||||||
let schedulingOptions;
|
let schedulingOptions;
|
||||||
|
|
||||||
@@ -292,6 +301,7 @@ define(
|
|||||||
name="scheduledAt"
|
name="scheduledAt"
|
||||||
value={this._getCurrentValue().scheduledAt}
|
value={this._getCurrentValue().scheduledAt}
|
||||||
onChange={this.handleValueChange}
|
onChange={this.handleValueChange}
|
||||||
|
disabled={this.isDisabled()}
|
||||||
dateValidation={this.getDateValidation()} />
|
dateValidation={this.getDateValidation()} />
|
||||||
|
|
||||||
<span>
|
<span>
|
||||||
@@ -308,6 +318,7 @@ define(
|
|||||||
type="checkbox"
|
type="checkbox"
|
||||||
value="1"
|
value="1"
|
||||||
checked={this.isScheduled()}
|
checked={this.isScheduled()}
|
||||||
|
disabled={this.isDisabled()}
|
||||||
name="isScheduled"
|
name="isScheduled"
|
||||||
onChange={this.handleCheckboxChange} />
|
onChange={this.handleCheckboxChange} />
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user