Redo the form placement page according the spec

[MAILPOET-2639]
This commit is contained in:
Pavel Dohnal
2020-01-28 10:48:32 +01:00
committed by Jack Kitterhing
parent 353a16fcb5
commit 645e1a825d
2 changed files with 17 additions and 10 deletions

View File

@@ -35,7 +35,7 @@ const FormPlacementPanel = ({ onToggle, isOpened }) => {
const addFormWidgetHint = ReactStringReplace( const addFormWidgetHint = ReactStringReplace(
MailPoet.I18n.t('addFormWidgetHint'), MailPoet.I18n.t('addFormWidgetHint'),
/\[link\](.*?)\[\/link\]/g, /\[link](.*?)\[\/link]/g,
(match) => ( (match) => (
<a key="addFormWidgetHintLink" href="widgets.php" target="_blank">{match}</a> <a key="addFormWidgetHintLink" href="widgets.php" target="_blank">{match}</a>
) )
@@ -43,15 +43,22 @@ const FormPlacementPanel = ({ onToggle, isOpened }) => {
const addFormShortcodeHint = ReactStringReplace( const addFormShortcodeHint = ReactStringReplace(
MailPoet.I18n.t('addFormShortcodeHint'), MailPoet.I18n.t('addFormShortcodeHint'),
/\[link\](.*?)\[\/link\]/g, /(\[link].*\[\/link])|(\[shortcode])/g,
(match) => ( (match) => {
<a key="exportShortcode" href="#" onClick={exportLinkClicked('shortcode')}>{match}</a> if (match === '[shortcode]') {
) return (<code key={match}>{formExports.shortcode}</code>);
}
if (typeof match === 'string' && match.includes('[link]')) {
const link = match.replace(/\[.?link]/g, '');
return (<a key={match} href="TODO KB link" target="_blank">{link}</a>);
}
return match;
}
); );
const addFormPhpIframeHint = ReactStringReplace( const addFormPhpIframeHint = ReactStringReplace(
MailPoet.I18n.t('addFormPhpIframeHint'), MailPoet.I18n.t('addFormPhpIframeHint'),
/\[link\](.*?)\[\/link\]/g, /\[link](.*?)\[\/link]/g,
(match) => { (match) => {
if (match === 'PHP') { if (match === 'PHP') {
return (<a key="exportPHP" href="#" onClick={exportLinkClicked('php')}>{match}</a>); return (<a key="exportPHP" href="#" onClick={exportLinkClicked('php')}>{match}</a>);
@@ -76,8 +83,8 @@ const FormPlacementPanel = ({ onToggle, isOpened }) => {
return ( return (
<Panel> <Panel>
<PanelBody title={MailPoet.I18n.t('formPlacement')} opened={isOpened} onToggle={onToggle}> <PanelBody title={MailPoet.I18n.t('formPlacement')} opened={isOpened} onToggle={onToggle}>
<p>{addFormWidgetHint}</p>
<p>{addFormShortcodeHint}</p> <p>{addFormShortcodeHint}</p>
<p>{addFormWidgetHint}</p>
<p>{addFormPhpIframeHint}</p> <p>{addFormPhpIframeHint}</p>
{getCopyTextArea()} {getCopyTextArea()}
</PanelBody> </PanelBody>

View File

@@ -40,9 +40,9 @@
'customCss': _x('Custom CSS', 'A settings section heading'), 'customCss': _x('Custom CSS', 'A settings section heading'),
'formSaved': __('Form saved.'), 'formSaved': __('Form saved.'),
'customFieldSaved': __('Custom field saved.'), 'customFieldSaved': __('Custom field saved.'),
'addFormWidgetHint': __('Add this form to your sidebar or footer on the [link]Widgets page[/link].'), 'addFormWidgetHint': __('Add this form to a [link]widget area[/link].'),
'addFormShortcodeHint': __('Copy and paste this [link]shortcode[/link] on to a post or page.'), 'addFormShortcodeHint': __('[link]Use Gutenberg block[/link] available on any page or post. Or use the shortcode [shortcode].'),
'addFormPhpIframeHint': __('[link]PHP[/link] and [link]iFrame[/link] versions are also available.'), 'addFormPhpIframeHint': __('Use [link]PHP[/link] or [link]iFrame[/link].'),
'settingsListLabel': __('This form adds the subscribers to these lists'), 'settingsListLabel': __('This form adds the subscribers to these lists'),
'settingsAfterSubmit': __('After submit…'), 'settingsAfterSubmit': __('After submit…'),
'settingsShowMessage': __('Show message'), 'settingsShowMessage': __('Show message'),