diff --git a/assets/css/src/form_editor.styl b/assets/css/src/form_editor.styl index 67ed105838..73d02c8c0f 100644 --- a/assets/css/src/form_editor.styl +++ b/assets/css/src/form_editor.styl @@ -99,6 +99,7 @@ handle_icon = '../img/handle.png' /* MailPoet Form wrapper */ #mailpoet_form_wrapper position: relative + margin: 20px 0 0 0 /* MailPoet Form container */ #mailpoet_form_container diff --git a/assets/js/src/segments/form.jsx b/assets/js/src/segments/form.jsx index b339f60825..04ac4d8cb6 100644 --- a/assets/js/src/segments/form.jsx +++ b/assets/js/src/segments/form.jsx @@ -42,11 +42,7 @@ define( return (

- Segment Back to list + Segment

- Subscriber Back to list + Subscriber

setupChangelog(); $this->setupPublicAPI(); $this->runQueueSupervisor(); + $this->setupShortcodes(); $this->setupHooks(); $this->setupImages(); } @@ -125,6 +126,10 @@ class Initializer { $changelog->init(); } + function setupShortcodes() { + $shortcodes = new Shortcodes(); + $shortcodes->init(); + } function setupHooks() { $hooks = new Hooks(); $hooks->init(); diff --git a/lib/Config/Shortcodes.php b/lib/Config/Shortcodes.php new file mode 100644 index 0000000000..b7e2716eb4 --- /dev/null +++ b/lib/Config/Shortcodes.php @@ -0,0 +1,26 @@ + 0) { + $form_widget = new \MailPoet\Form\Widget(); + return $form_widget->widget(array( + 'form' => (int)$params['id'], + 'form_type' => 'shortcode' + )); + } + } +} \ No newline at end of file diff --git a/lib/Form/Widget.php b/lib/Form/Widget.php index f1a6af5d4c..f670e03aac 100644 --- a/lib/Form/Widget.php +++ b/lib/Form/Widget.php @@ -36,9 +36,9 @@ class Widget extends \WP_Widget { return parent::__construct( 'mailpoet_form', - __("MailPoet Subscription Form"), + __('MailPoet Form'), array( - 'title' => __("Newsletter subscription form"), + 'description' => __('Add a newsletter subscription form.') ) ); } @@ -196,24 +196,6 @@ class Widget extends \WP_Widget { } } -// mailpoet shortcodes -// form shortcode -add_shortcode('mailpoet_form', 'mailpoet_form_shortcode'); -add_shortcode('wysija_form', 'mailpoet_form_shortcode'); - -function mailpoet_form_shortcode($params = array()) { - // IMPORTANT: this is to make sure MagicMember won't scan our form and find [user_list] as a code they should replace. - remove_shortcode('user_list'); - - if(isset($params['id']) && (int)$params['id'] > 0) { - $form_widget = new \MailPoet\Form\Widget(); - return $form_widget->widget(array( - 'form' => (int)$params['id'], - 'form_type' => 'shortcode' - )); - } -} - // set the content filter to replace the shortcode if(isset($_GET['mailpoet_page']) && strlen(trim($_GET['mailpoet_page'])) > 0) { switch($_GET['mailpoet_page']) { diff --git a/lib/Mailer/MailPoet.php b/lib/Mailer/MailPoet.php index 10763a9363..a62216e35c 100644 --- a/lib/Mailer/MailPoet.php +++ b/lib/Mailer/MailPoet.php @@ -70,7 +70,7 @@ class MailPoet { 'Content-Type' => 'application/json', 'Authorization' => $this->auth() ), - 'body' => json_encode($body) + 'body' => $body ); } } \ No newline at end of file diff --git a/views/form/editor.html b/views/form/editor.html index 31fca1db67..31efdff869 100644 --- a/views/form/editor.html +++ b/views/form/editor.html @@ -9,10 +9,6 @@ class="add-new-h2" href="javascript:;" ><%= __('Edit name' ) %> - <%= __('List of forms' ) %> <% endblock %> @@ -122,29 +118,36 @@

-

<%= __('Shortcodes') %>

+

<%= __('Position') %>

- <%= __("You can easily add this form to your theme's in the [link]Widgets area[/link]") + <%= __("Add this form to your sidebar or footer in the [link]Widgets[/link].") | replace({ '[link]': '', '[/link]': '' }) | raw %> -

+

- <%= __('%sHTML%s, %sPHP%s, %siframe%s and %sshortcode%s versions are also available.', 'wysija-newsletters') + <%= __("Copy and paste this [link]shortcode[/link] into a post or page alternatively.") + | replace({ + '[link]': '', + '[/link]': '' + }) + | raw + %> +

+

+ <%= __('%sHTML%s, %sPHP%s and %siframe%s versions are also available.', 'wysija-newsletters') | format( '', '', '', '', '', - '', - '', '' ) | raw @@ -519,7 +522,7 @@ var name = $(this).siblings('.mailpoet_form_field').attr('wysija_name'); if(window.confirm( - "<%= __('Do you really want to delete this custom field?') %>" + "<%= __('Deleting this field here will delete the data associated to it for all you users. Confirm you want to delete.') %>" )) { MailPoet.Ajax.post({ endpoint: 'customFields', diff --git a/views/form/templates/blocks/html.hbs b/views/form/templates/blocks/html.hbs index 323cc70d76..9ae3b42e71 100644 --- a/views/form/templates/blocks/html.hbs +++ b/views/form/templates/blocks/html.hbs @@ -1,9 +1,7 @@ {{#if params.text}} -

- {{#if params.nl2br}} - {{{ nl2br params.text }}} - {{else}} - {{{ params.text }}} - {{/if}} -

+ {{#ifCond params.nl2br '==' '1'}} + {{{ nl2br params.text }}} + {{else}} + {{{ params.text }}} + {{/ifCond}} {{/if}} \ No newline at end of file diff --git a/views/form/templates/blocks/submit.hbs b/views/form/templates/blocks/submit.hbs index 0d21a9874f..177137fc98 100644 --- a/views/form/templates/blocks/submit.hbs +++ b/views/form/templates/blocks/submit.hbs @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file