- Enforces CSV file extension during import file selection
- Updates "no records found" error message
This commit is contained in:
@ -138,6 +138,14 @@ define(
|
|||||||
*/
|
*/
|
||||||
uploadElement.change(function () {
|
uploadElement.change(function () {
|
||||||
MailPoet.Notice.hide();
|
MailPoet.Notice.hide();
|
||||||
|
var ext = this.value.match(/\.(.+)$/)[1];
|
||||||
|
if (ext.toLowerCase() !== 'csv') {
|
||||||
|
this.value = '';
|
||||||
|
MailPoet.Notice.error(MailPoetI18n.wrongFileFormat, {
|
||||||
|
timeout: 3000,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
toggleNextStepButton(
|
toggleNextStepButton(
|
||||||
uploadProcessButtonElement,
|
uploadProcessButtonElement,
|
||||||
(this.value.trim() !== '') ? 'on' : 'off'
|
(this.value.trim() !== '') ? 'on' : 'off'
|
||||||
@ -416,7 +424,10 @@ define(
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
MailPoet.Modal.loading(false);
|
MailPoet.Modal.loading(false);
|
||||||
MailPoet.Notice.error(MailPoetI18n.noValidRecords, {
|
var errorNotice = MailPoetI18n.noValidRecords;
|
||||||
|
errorNotice = errorNotice.replace('[link]', '<a target="_blank" href="http://support.mailpoet.com/knowledgebase/importing-subscribers-with-a-csv-file?utm_source=wpadmin&utm_campaign=import">');
|
||||||
|
errorNotice = errorNotice.replace('[/link]', '</a>');
|
||||||
|
MailPoet.Notice.error(errorNotice, {
|
||||||
timeout: 3000,
|
timeout: 3000,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -19,9 +19,10 @@
|
|||||||
'noMailChimpLists': __('No active lists found.'),
|
'noMailChimpLists': __('No active lists found.'),
|
||||||
'serverError': __('Server error:'),
|
'serverError': __('Server error:'),
|
||||||
'select': __('Select'),
|
'select': __('Select'),
|
||||||
|
'wrongFileFormat': __('Only comma-separated (CSV) file format is supported.'),
|
||||||
'maxPostSizeNotice': __('Your CSV is over %s, and too big to process. Please split the file in two, or more.')|replace({'%s': maxPostSize}),
|
'maxPostSizeNotice': __('Your CSV is over %s, and too big to process. Please split the file in two, or more.')|replace({'%s': maxPostSize}),
|
||||||
'dataProcessingError': __("Your data couldn't be processed. Please make sure it is in the proper format."),
|
'dataProcessingError': __("Your data couldn't be processed. Please make sure it is in the proper format."),
|
||||||
'noValidRecords': __('No valid records were found.'),
|
'noValidRecords': __('No valid records were found. This needs to be in CSV style. See [link]examples in our support site[/link]'),
|
||||||
'importNoticeSkipped': __('%1$s records were skipped due to problems.'),
|
'importNoticeSkipped': __('%1$s records were skipped due to problems.'),
|
||||||
'importNoticeInvalid': __('%1$s emails are not valid : %2$s.'),
|
'importNoticeInvalid': __('%1$s emails are not valid : %2$s.'),
|
||||||
'importNoticeDuplicate': __('%1$s emails appear more than once in your file : %2$s.'),
|
'importNoticeDuplicate': __('%1$s emails appear more than once in your file : %2$s.'),
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
<%=
|
<%=
|
||||||
__('This needs to be in CSV style. See [link]examples in our support site[/link].')
|
__('This needs to be in CSV style. See [link]examples in our support site[/link].')
|
||||||
|replace({
|
|replace({
|
||||||
'[link]': '<a target="_blank" href="http://support.mailpoet.com/knowledgebase/importing-subscribers-with-a-csv-file/main.html?utm_source=wpadmin&utm_campaign=import">',
|
'[link]': '<a target="_blank" href="http://support.mailpoet.com/knowledgebase/importing-subscribers-with-a-csv-file?utm_source=wpadmin&utm_campaign=import">',
|
||||||
'[/link]': '</a>'
|
'[/link]': '</a>'
|
||||||
})
|
})
|
||||||
|raw
|
|raw
|
||||||
@ -65,7 +65,7 @@
|
|||||||
<%=
|
<%=
|
||||||
__('This needs to be in CSV style. See [link]examples in our support site[/link].')
|
__('This needs to be in CSV style. See [link]examples in our support site[/link].')
|
||||||
|replace({
|
|replace({
|
||||||
'[link]': '<a target="_blank" href="http://support.mailpoet.com/knowledgebase/importing-subscribers-with-a-csv-file/main.html?utm_source=wpadmin&utm_campaign=import">',
|
'[link]': '<a target="_blank" href="http://support.mailpoet.com/knowledgebase/importing-subscribers-with-a-csv-file?utm_source=wpadmin&utm_campaign=import">',
|
||||||
'[/link]': '</a>'
|
'[/link]': '</a>'
|
||||||
})
|
})
|
||||||
|raw
|
|raw
|
||||||
@ -74,7 +74,7 @@
|
|||||||
</label>
|
</label>
|
||||||
</th>
|
</th>
|
||||||
<td>
|
<td>
|
||||||
<input type="file" id="file_local">
|
<input type="file" id="file_local" accept=".csv" />
|
||||||
|
|
||||||
<%= __( 'total max upload file size : %s' )|replace({'%s': maxPostSize}) %>
|
<%= __( 'total max upload file size : %s' )|replace({'%s': maxPostSize}) %>
|
||||||
</td>
|
</td>
|
||||||
|
Reference in New Issue
Block a user