init
This commit is contained in:
@@ -0,0 +1,102 @@
|
||||
<!-- date settings and block templates -->
|
||||
<%= partial('form_template_date_years',
|
||||
'form/templatesLegacy/blocks/date_years.hbs',
|
||||
'_settings_date_years'
|
||||
) %>
|
||||
<%= partial('form_template_date_months',
|
||||
'form/templatesLegacy/blocks/date_months.hbs',
|
||||
'_settings_date_months'
|
||||
) %>
|
||||
<%= partial('form_template_date_days',
|
||||
'form/templatesLegacy/blocks/date_days.hbs',
|
||||
'_settings_date_days'
|
||||
) %>
|
||||
<%= partial('form_template_date', 'form/templatesLegacy/blocks/date.hbs') %>
|
||||
|
||||
<!-- field settings -->
|
||||
<%= partial('form_template_field_settings', 'form/templatesLegacy/settings/field.hbs') %>
|
||||
|
||||
<%= partial('field_settings_label',
|
||||
'form/templatesLegacy/settings/label.hbs',
|
||||
'_settings_label'
|
||||
) %>
|
||||
<%= partial('field_settings_label_within',
|
||||
'form/templatesLegacy/settings/label_within.hbs',
|
||||
'_settings_label_within'
|
||||
) %>
|
||||
<%= partial('field_settings_required',
|
||||
'form/templatesLegacy/settings/required.hbs',
|
||||
'_settings_required'
|
||||
) %>
|
||||
<%= partial('field_settings_validate',
|
||||
'form/templatesLegacy/settings/validate.hbs',
|
||||
'_settings_validate'
|
||||
) %>
|
||||
<%= partial('field_settings_values',
|
||||
'form/templatesLegacy/settings/values.hbs',
|
||||
'_settings_values'
|
||||
) %>
|
||||
<%= partial('field_settings_date_default',
|
||||
'form/templatesLegacy/settings/date_default.hbs',
|
||||
'_settings_date_default'
|
||||
) %>
|
||||
<%= partial('field_settings_submit',
|
||||
'form/templatesLegacy/settings/submit.hbs',
|
||||
'_settings_submit'
|
||||
) %>
|
||||
|
||||
<%= partial('field_settings_values_item',
|
||||
'form/templatesLegacy/settings/values_item.hbs') %>
|
||||
<%= partial(
|
||||
'field_settings_date_format',
|
||||
'form/templatesLegacy/settings/date_formats.hbs',
|
||||
'_settings_date_format'
|
||||
) %>
|
||||
<%= partial(
|
||||
'field_settings_date_type',
|
||||
'form/templatesLegacy/settings/date_types.hbs',
|
||||
'_settings_date_type'
|
||||
) %>
|
||||
<%= partial('field_settings_segment_selection_item',
|
||||
'form/templatesLegacy/settings/segment_selection_item.hbs'
|
||||
) %>
|
||||
<%= partial('field_settings_segment_selection',
|
||||
'form/templatesLegacy/settings/segment_selection.hbs',
|
||||
'_settings_segment_selection'
|
||||
) %>
|
||||
|
||||
<!-- custom field: new -->
|
||||
<%= partial('form_template_field_form',
|
||||
'form/templatesLegacy/settings/field_form.hbs'
|
||||
) %>
|
||||
|
||||
<!-- field settings depending on field type -->
|
||||
<script id="form_template_field_text" type="text/x-handlebars-template">
|
||||
{{> _settings_required }}
|
||||
{{> _settings_validate }}
|
||||
</script>
|
||||
|
||||
<script id="form_template_field_textarea" type="text/x-handlebars-template">
|
||||
{{> _settings_required }}
|
||||
{{> _settings_validate }}
|
||||
</script>
|
||||
|
||||
<script id="form_template_field_radio" type="text/x-handlebars-template">
|
||||
{{> _settings_values }}
|
||||
{{> _settings_required }}
|
||||
</script>
|
||||
|
||||
<script id="form_template_field_checkbox" type="text/x-handlebars-template">
|
||||
{{> _settings_values }}
|
||||
{{> _settings_required }}
|
||||
</script>
|
||||
|
||||
<script id="form_template_field_select" type="text/x-handlebars-template">
|
||||
{{> _settings_values }}
|
||||
{{> _settings_required }}
|
||||
</script>
|
||||
|
||||
<script id="form_template_field_date" type="text/x-handlebars-template">
|
||||
{{> _settings_required }}
|
||||
{{> _settings_date_type }}
|
||||
</script>
|
||||
@@ -0,0 +1,215 @@
|
||||
<% extends 'layout.html' %>
|
||||
|
||||
<% block container %>
|
||||
|
||||
<div class="block-editor">
|
||||
<div id="mailpoet_form_edit" class="block-editor__container">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
<% autoescape 'js' %>
|
||||
var mailpoet_form_data = <%= json_encode(form) %>;
|
||||
var mailpoet_form_exports = <%= json_encode(form_exports) %>;
|
||||
var mailpoet_form_segments = <%= json_encode(segments) %>;
|
||||
var mailpoet_custom_fields = <%= json_encode(custom_fields) %>;
|
||||
var mailpoet_date_types = <%= json_encode(date_types) %>;
|
||||
var mailpoet_date_formats = <%= json_encode(date_formats) %>;
|
||||
var mailpoet_month_names = <%= json_encode(month_names) %>;
|
||||
var mailpoet_form_preview_page = <%= json_encode(preview_page_url) %>;
|
||||
var mailpoet_custom_fonts = <%= json_encode(custom_fonts) %>;
|
||||
var mailpoet_translations = <%= json_encode(translations) %>;
|
||||
var mailpoet_all_wp_posts = <%= json_encode(posts) %>;
|
||||
var mailpoet_all_wp_pages = <%= json_encode(pages) %>;
|
||||
var mailpoet_all_wp_categories = <%= json_encode(categories) %>;
|
||||
var mailpoet_all_wp_tags = <%= json_encode(tags) %>;
|
||||
var mailpoet_woocommerce_products = <%= json_encode(products) %>;
|
||||
var mailpoet_woocommerce_categories = <%= json_encode(product_categories) %>;
|
||||
var mailpoet_woocommerce_tags = <%= json_encode(product_tags) %>;
|
||||
var mailpoet_close_icons_url = '<%= image_url("form_close_icon") %>';
|
||||
var mailpoet_tutorial_seen = '<%= editor_tutorial_seen %>';
|
||||
var mailpoet_tutorial_url = '<%= cdn_url('form-editor/tutorial.mp4') %>';
|
||||
var mailpoet_is_administrator = <%= is_administrator ? 'true' : 'false' %>;
|
||||
var mailpoet_form_edit_url = "<%= admin_url('admin.php?page=mailpoet-form-editor&id=') %>";
|
||||
var mailpoet_theme_support_widgets = <%= theme_support_widgets ? 'true' : 'false' %>;
|
||||
var mailpoet_theme_support_fse = <%= theme_support_fse ? 'true' : 'false' %>;
|
||||
<% endautoescape %>
|
||||
</script>
|
||||
|
||||
<style id="mailpoet-form-editor-form-styles"></style>
|
||||
|
||||
<%= localize({
|
||||
'displayForm': __('Display the form'),
|
||||
'enable': __('Enable'),
|
||||
'addFormName': _x('Add form name', 'A placeholder for form name input'),
|
||||
'back': __('Back'),
|
||||
'form': __('Form'),
|
||||
'formSettings': _x('Settings', 'A settings section heading'),
|
||||
'formSettingsStyles': __('Styles'),
|
||||
'formSettingsColor': __('Color'),
|
||||
'formSettingsStylesBackground': __('Background'),
|
||||
'formSettingsStylesBackgroundImage': __('Background Image'),
|
||||
'formSettingsStylesSelectImage': __('Select Image…'),
|
||||
'formSettingsStylesFontSize': __('Font Size'),
|
||||
'formSettingsStylesFont': __('Font'),
|
||||
'formSettingsStylesFontColorInherit': __('Inherit from theme'),
|
||||
'formSettingsInheritStyleFromTheme': __('Inherit style from theme'),
|
||||
'formSettingsDisplayFullWidth': _x('Display Fullwidth', 'A label for checkbox in form style settings'),
|
||||
'formSettingsBold': _x('Bold', 'A label for checkbox in form style settings'),
|
||||
'formSettingsBorderSize': _x('Border Size', 'A label for checkbox in form style settings'),
|
||||
'formSettingsBorderRadius': _x('Border Radius', 'A label for checkbox in form style settings'),
|
||||
'formSettingsInputPadding': _x('Input Padding', 'A label for form style settings'),
|
||||
'formSettingsFormPadding': _x('Form Padding', 'A label for form style settings'),
|
||||
'formSettingsAlignment': _x('Alignment', 'A label for form style settings'),
|
||||
'formSettingsAlignmentLeft': _x('left', 'An alignment value for form editor'),
|
||||
'formSettingsAlignmentCenter': _x('center', 'An alignment value for form editor'),
|
||||
'formSettingsAlignmentRight': _x('right', 'An alignment value for form editor'),
|
||||
'formSettingsBorder': _x('Border', 'A label for checkbox in form style settings'),
|
||||
'formSettingsApplyToAll': __('Apply styles to all inputs'),
|
||||
'formSettingsWidth': _x('Form width', 'A label for form width settings'),
|
||||
'customFieldSettings': _x('Custom field settings', 'A settings section heading'),
|
||||
'customFieldsFormSettings': _x('Form settings', 'A settings section heading'),
|
||||
'formPlacement': _x('Form Placement', 'A settings section heading'),
|
||||
'formPlacementLabel': _x('Form placement', 'A label for a select box'),
|
||||
'customCss': _x('Custom CSS', 'A settings section heading'),
|
||||
'formSaved': __('Form saved.'),
|
||||
'formSavedAppendix': __('Cookies reset — you will see all your dismissed popup forms again.'),
|
||||
'customFieldSaved': __('Custom field saved.'),
|
||||
'placeFixedBarFormOnPages': _x('Fixed bar', 'This is a text on a widget that leads to settings for form placement - form type is fixed bar'),
|
||||
'placeFixedBarFormOnPagesDescription': __('Display your form in a fixed horizontal bar at the top or bottom of posts or pages.'),
|
||||
'placeSlideInFormOnPages': _x('Slide–in', 'This is a text on a widget that leads to settings for form placement - form type is slide in'),
|
||||
'placeSlideInFormOnPagesDescription': __('Display your form in a slide–in form on top of your page content.'),
|
||||
'placePopupFormOnPages': _x('Pop-up', 'This is a text on a widget that leads to settings for form placement - form type is pop-up, it will be displayed on page in a small modal window'),
|
||||
'placePopupFormOnPagesDescription': __('Display your form in a pop-up window.'),
|
||||
'exitIntentTitle': __('Display on exit-intent'),
|
||||
'exitIntentDescription': __('Show the form immediately if the visitor attempts to leave the site.'),
|
||||
'exitIntentSwitch': __('Exit-intent display'),
|
||||
'placeFormBellowPages': _x('Below pages', 'This is a text on a widget that leads to settings for form placement'),
|
||||
'placeFormBellowPagesDescription': __('This form placement allows you to add this form at the end of all the pages or posts, below the content.'),
|
||||
'placeFormOnAllPages': _x('Display on all pages', 'This is a text on a switch if a form should be displayed bellow all pages'),
|
||||
'placeFormOnAllPosts': _x('Display on all posts/products', 'This is a text on a switch if a form should be displayed bellow all posts'),
|
||||
'placeFormOnHomepage': __('Display on the homepage'),
|
||||
'placeFormOthers': _x('Others (widget)', 'Placement of the form using theme widget'),
|
||||
'formPlacementDelay': _x('Display with a delay of', 'Label on a selection of different times'),
|
||||
'formPlacementPlacementPosition': _x('Position', 'Placement of a fixed bar form, on top of the page or on the bottom'),
|
||||
'formPlacementPlacementPositionTop': _x('top', 'Placement of a fixed bar form, on top of the page or on the bottom'),
|
||||
'formPlacementPlacementPositionBottom': _x('bottom', 'Placement of a fixed bar form, on top of the page or on the bottom'),
|
||||
'formPlacementPlacementPositionLeft': _x('left', 'Placement of a slide in form, on the left or right side of the page'),
|
||||
'formPlacementPlacementPositionRight': _x('right', 'Placement of a slide in form, on the left or right side of the page'),
|
||||
'formPlacementDelaySeconds': _x('%1s sec', 'times selection should be in the end "30 sec"'),
|
||||
'formPlacementCookieExpiration': _x('Show form every', 'Label on a selection of different times'),
|
||||
'formPlacementCookieExpirationAlways': _x('Always', 'times selection'),
|
||||
'formPlacementCookieExpirationDay': _x('1 day', 'times selection should be in the end "1 day"'),
|
||||
'formPlacementCookieExpirationDays': _x('%1s days', 'times selection should be in the end "7 days"'),
|
||||
'formPlacementSave': _x('Close', 'Text on a button to save and close a form'),
|
||||
'formPlacementOtherLabel': _x('Shortcode & other', 'Label in the form placement section (Other form placements)'),
|
||||
'animationHeader': __('Show animation on display'),
|
||||
'animationNone': _x('No Animation', 'Value in a selectbox with a list of animations'),
|
||||
'addFormWidgetHint': __('You can add this form to a [link]widget area of your theme[/link] (new tab).'),
|
||||
'addFormFSEHint': __('You can add this form to your site using the [link]site editor[/link] (new tab).'),
|
||||
'addFormShortcodeHint': __('You can also use a block on any page or post, or this shortcode if you prefer [shortcode].'),
|
||||
'addFormPhpIframeHint': __('When needed, use [link]PHP[/link] or an [link]iFrame[/link] HTML element.'),
|
||||
'settingsListLabel': __('This form adds the subscribers to these lists'),
|
||||
'settingsAfterSubmit': __('After submit…'),
|
||||
'settingsShowMessage': __('Show message'),
|
||||
'settingsGoToPage': __('Go to Page'),
|
||||
'settingsPleaseSelectList': __('Please select a list'),
|
||||
'fieldsBlocksCategory': __('Fields'),
|
||||
'customFieldsBlocksCategory': __('Custom Fields'),
|
||||
'layoutBlocksCategory': __('Layout'),
|
||||
'customFieldNumberOfLines': __('Number of lines'),
|
||||
'customFieldSaveCTA': _x('Update custom field', 'Text on the save button'),
|
||||
'customFieldDeleteCTA': _x('Delete this custom field', 'Text on the delete button'),
|
||||
'customFieldDeleteConfirm': __('This field will be deleted for all your subscribers. Are you sure?'),
|
||||
'customFieldTypeText': __('Text Input'),
|
||||
'customFieldTypeTextarea': __('Text Area'),
|
||||
'customFieldTypeRadio': __('Radio buttons'),
|
||||
'customFieldTypeCheckbox': __('Checkbox'),
|
||||
'customFieldTypeSelect': _x('Select', 'Form input type'),
|
||||
'selectPage': _x('Select', 'It is a placeholder in the select box - verb'),
|
||||
'displayOnCategories': __('Display on posts with these categories'),
|
||||
'displayOnAllCategoryArchives': __('Display on all post/product category archives'),
|
||||
'displayOnTags': __('Display on posts with these tags'),
|
||||
'displayOnAllTagArchives': __('Display on all post/product tag archives'),
|
||||
'selectSpecificArchiveTags': __('Select specific tags'),
|
||||
'selectSpecificArchiveCategories': __('Select specific categories'),
|
||||
'customFieldTypeDate': __('Date'),
|
||||
'customFieldDateType': __('Type of date'),
|
||||
'customFieldDateFormat': __('Order'),
|
||||
'customFieldDefaultToday': __('Preselect today’s date'),
|
||||
'customFieldDay': __('Day'),
|
||||
'customFieldMonth': __('Month'),
|
||||
'customFieldYear': __('Year'),
|
||||
'customField1Line': _x('1 line', 'Number of rows in textarea'),
|
||||
'customField2Lines': _x('2 lines', 'Number of rows in textarea'),
|
||||
'customField3Lines': _x('3 lines', 'Number of rows in textarea'),
|
||||
'customField4Lines': _x('4 lines', 'Number of rows in textarea'),
|
||||
'customField5Lines': _x('5 lines', 'Number of rows in textarea'),
|
||||
'customFieldValidateFor': __('Validate for'),
|
||||
'customFieldValidateNothing': __('Nothing'),
|
||||
'customFieldValidateNumbersOnly': __('Numbers only'),
|
||||
'customFieldValidateAlphanumerical': __('Alphanumerical'),
|
||||
'customFieldValidatePhoneNumber': __('Phone number, (+,-,#,(,) and spaces allowed)'),
|
||||
'customFieldAddItem': __('Add item'),
|
||||
'blockMandatory': __('Mandatory field'),
|
||||
'blockFirstName': __('First name'),
|
||||
'blockFirstNameDescription': __('Input field used to catch subscribers’ first names.'),
|
||||
'blockLastName': __('Last name'),
|
||||
'blockLastNameDescription': __('Input field used to catch subscribers’ last names.'),
|
||||
'blockSegmentSelect': __('List selection'),
|
||||
'blockLastNameDescription': __('Allow your subscribers to select which list(s) they want to subscribe to.'),
|
||||
'blockSegmentSelectLabel': __('Select list(s):'),
|
||||
'blockSegmentSelectNoLists': __('Please select at least one list'),
|
||||
'blockSegmentSelectListLabel': __('Select the list that you want to add'),
|
||||
'blockEmail': __('Email'),
|
||||
'blockEmailDescription': __('Input field used to catch subscribers’ email addresses.'),
|
||||
'blockSubmit': __('Submit button'),
|
||||
'blockSubmitDescription': __('Button used to submit the form.'),
|
||||
'blockSubmitLabel': _x('Subscribe!', 'a default value for a subscription form button'),
|
||||
'missingObligatoryBlock': __('Email input or submit is missing. Try reloading the form editor.'),
|
||||
'label': _x('Label', 'settings for a label of an input'),
|
||||
'displayLabelWithinInput': __('Display label within input'),
|
||||
'displayLabel': _x('Display label', 'Settings - if label should be displayed'),
|
||||
'blockDivider': _x('Divider / Spacer', 'The name of the block in the editor'),
|
||||
'blockCustomHtml' : __('Custom HTML'),
|
||||
'blockCustomHtmlDescription': __('Display custom text or HTML code in your form.'),
|
||||
'blockCustomHtmlDefault': __('Subscribe to our newsletter and join [mailpoet_subscribers_count] other subscribers.'),
|
||||
'blockCustomHtmlContentLabel': _x('Custom text', 'Textarea label'),
|
||||
'blockCustomHtmlNl2br': __('Automatically add paragraphs'),
|
||||
'blockAddCustomField': __('Create Custom Field'),
|
||||
'blockAddCustomFieldDescription': __('Create a new custom field for your subscribers.'),
|
||||
'blockAddCustomFieldFormHeading': __('New Custom Field.'),
|
||||
'blockCreateButton': _x('Create', 'Label on form submit button.'),
|
||||
'customFieldName': _x('Field name', 'Label for form field for custom input name'),
|
||||
'selectCustomFieldType': _x('Select a field type', 'Label for form field for custom input type'),
|
||||
'customFieldWithNameExists': __('The custom field [name] already exists. Please choose another name.'),
|
||||
'successMessage': __('This is what the success message looks like.'),
|
||||
'errorMessage': __('This is what the error message looks like.'),
|
||||
'formPreview': __('Form Preview'),
|
||||
'formSettingsStylesFontFamily': __('Font Family'),
|
||||
'formFontsDefaultTheme': __('Theme’s default fonts'),
|
||||
'formFontsStandard': _x('Standard fonts', 'Heading in the font selection list: Arial, Times, ...'),
|
||||
'formFontsCustom': _x('Custom fonts', 'Heading in the font selection list for a list of custom fonts'),
|
||||
'blockSpacerHeight': _x('Height', 'Settings in the spacer block'),
|
||||
'blockSpacerEnableDivider': _x('Enable Divider', 'Settings in the spacer block'),
|
||||
'imagePlacementScale': _x('Scale', 'How a background image will be rendered: scale, fit or tile'),
|
||||
'imagePlacementFit': _x('Fit', 'How a background image will be rendered: scale, fit or tile'),
|
||||
'imagePlacementTile': _x('Tile', 'How a background image will be rendered: scale, fit or tile'),
|
||||
'blockDividerStyle': _x('Divider Style', 'Settings in the divider block (solid, dotted, …)'),
|
||||
'blockDividerStyleSolid': _x('Solid', 'Setting in the divider block'),
|
||||
'blockDividerStyleDashed': _x('Dashed', 'Setting in the divider block'),
|
||||
'blockDividerStyleDotted': _x('Dotted', 'Setting in the divider block'),
|
||||
'blockDividerDividerHeight': _x('Divider Height', 'Settings in the divider block'),
|
||||
'blockDividerDividerWidth': _x('Divider Width', 'Settings in the divider block'),
|
||||
'blockDividerBackground': _x('Background', 'Settings in the divider block'),
|
||||
'validationMessageColor': _x('Message Color', 'heading above the settings'),
|
||||
'successValidationColorTitle': _x('Success', 'A label for the success message color'),
|
||||
'errorValidationColorTitle': _x('Error', 'A label for the error message color'),
|
||||
'formPreviewOthersDisclaimer': __('Psssst. We try our best to show you what the widget might look like, but better check the final result on your website.'),
|
||||
'closeButtonHeading': __('Close Button Style'),
|
||||
'tutorialHeading': __('A video tour of the form editor'),
|
||||
'noName': _x('no name', 'fallback for forms without a name in a form list'),
|
||||
'saveFormFirst': __('Please save the form first!'),
|
||||
'addNewTag': __('Add New Tag'),
|
||||
}) %>
|
||||
<% endblock %>
|
||||
@@ -0,0 +1,14 @@
|
||||
<% block content %>
|
||||
<% if(formType == 'others') %>
|
||||
<div id="mailpoet_widget_preview" class="mailpoet_widget_preview">
|
||||
<div id="sidebar" class="sidebar widget-area si-sidebar-container">
|
||||
<div class="widget si-widget">
|
||||
<%= form | raw %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% else %>
|
||||
<%= post | raw %>
|
||||
<%= form | raw %>
|
||||
<% endif %>
|
||||
<% endblock %>
|
||||
@@ -0,0 +1,83 @@
|
||||
<% block content %>
|
||||
<% if(before_widget) %>
|
||||
<%= before_widget | raw %>
|
||||
<% endif %>
|
||||
|
||||
<% if(title) %>
|
||||
<%= before_title | raw %><%= title | raw %><%= after_title | raw %>
|
||||
<% endif %>
|
||||
|
||||
<div class="
|
||||
mailpoet_form_popup_overlay
|
||||
<% if(animation != '') %>
|
||||
mailpoet_form_overlay_animation_<%= animation %>
|
||||
mailpoet_form_overlay_animation
|
||||
<% endif %>
|
||||
"></div>
|
||||
<div
|
||||
id="<%= form_html_id %>"
|
||||
class="
|
||||
mailpoet_form
|
||||
mailpoet_form_<%= form_type %>
|
||||
mailpoet_form_position_<%= position %>
|
||||
mailpoet_form_animation_<%= animation %>
|
||||
"
|
||||
<% if(is_preview) %>
|
||||
data-is-preview="1"
|
||||
data-editor-url="<%= editor_url %>"
|
||||
<% endif %>
|
||||
>
|
||||
|
||||
<style type="text/css">
|
||||
<%= styles|raw %>
|
||||
</style>
|
||||
|
||||
<form
|
||||
target="_self"
|
||||
method="post"
|
||||
action="<%= admin_url('admin-post.php?action=mailpoet_subscription_form') %>"
|
||||
class="mailpoet_form mailpoet_form_form mailpoet_form_<%= form_type %>"
|
||||
novalidate
|
||||
data-delay="<%= delay %>"
|
||||
data-exit-intent-enabled="<%= enableExitIntent %>"
|
||||
data-font-family="<%= fontFamily %>"
|
||||
data-cookie-expiration-time="<%= cookieFormExpirationTime %>"
|
||||
>
|
||||
<input type="hidden" name="data[form_id]" value="<%= form_id %>" />
|
||||
<input type="hidden" name="token" value="<%= token %>" />
|
||||
<input type="hidden" name="api_version" value="<%= api_version %>" />
|
||||
<input type="hidden" name="endpoint" value="subscribers" />
|
||||
<input type="hidden" name="mailpoet_method" value="subscribe" />
|
||||
|
||||
<%= html | raw %>
|
||||
<div class="mailpoet_message">
|
||||
<p class="mailpoet_validate_success"
|
||||
<% if not(success) %>
|
||||
style="display:none;"
|
||||
<% endif %>
|
||||
><%= form_success_message %>
|
||||
</p>
|
||||
<p class="mailpoet_validate_error"
|
||||
<% if not(error) %>
|
||||
style="display:none;"
|
||||
<% endif %>
|
||||
><% if (error) %>
|
||||
<%= __("An error occurred, make sure you have filled all the required fields.") %>
|
||||
<% endif %>
|
||||
</p>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<% if form_type == 'popup' or form_type == 'fixed_bar' or form_type == 'slide_in' %>
|
||||
<input type="image"
|
||||
class="mailpoet_form_close_icon"
|
||||
alt="<%= __('Close') %>"
|
||||
src='<%= image_url("form_close_icon/" ~ close_button_icon ~ ".svg") %>'
|
||||
/>
|
||||
<% endif %>
|
||||
</div>
|
||||
|
||||
<% if(after_widget) %>
|
||||
<%= after_widget | raw %>
|
||||
<% endif %>
|
||||
<% endblock %>
|
||||
@@ -0,0 +1,75 @@
|
||||
<!DOCTYPE html>
|
||||
<!--[if IE 7]>
|
||||
<html class="ie ie7" <%= language_attributes | raw %>>
|
||||
<![endif]-->
|
||||
<!--[if IE 8]>
|
||||
<html class="ie ie8" <%= language_attributes | raw %>>
|
||||
<![endif]-->
|
||||
<!--[if !(IE 7) & !(IE 8)]><!-->
|
||||
<html <%= language_attributes | raw %>>
|
||||
<script>
|
||||
var additionalHeight = 10,
|
||||
attemptsToAdjust = 3,
|
||||
delayToAdjust = 400,
|
||||
intervalHandle;
|
||||
|
||||
var sendSize = function() {
|
||||
if(!attemptsToAdjust && intervalHandle !== undefined) {
|
||||
window.clearInterval(intervalHandle)
|
||||
return;
|
||||
}
|
||||
window.top.postMessage({MailPoetIframeHeight: document.body.scrollHeight + additionalHeight + 'px'}, '*');
|
||||
attemptsToAdjust--;
|
||||
};
|
||||
|
||||
window.addEventListener('load', function () {
|
||||
sendSize();
|
||||
if(!window.MutationObserver) {
|
||||
intervalHandle = setInterval(sendSize, delayToAdjust);
|
||||
return;
|
||||
}
|
||||
|
||||
var observer = new MutationObserver(sendSize);
|
||||
|
||||
observer.observe(document.body, {
|
||||
childList: true,
|
||||
subtree: true
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<!--<![endif]-->
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width">
|
||||
<meta name="robots" content="noindex, nofollow">
|
||||
<title><%= __('MailPoet Subscription Form') %></title>
|
||||
<style>
|
||||
html {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
*,
|
||||
*:before,
|
||||
*:after {
|
||||
box-sizing: inherit;
|
||||
}
|
||||
body {
|
||||
color: rgb(40, 48, 61);
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
font-size: 16px;
|
||||
font-weight: normal;
|
||||
text-align: left;
|
||||
}
|
||||
</style>
|
||||
<% set allowedHtml = {'link': {'href': [], 'rel': []}} %>
|
||||
<%= fonts_link | wpKses(allowedHtml) %>
|
||||
<link rel="stylesheet" type="text/css" href="<%= mailpoet_public_css_url %>" />
|
||||
<%= scripts | raw %>
|
||||
</head>
|
||||
<body>
|
||||
<%= form | raw %>
|
||||
<script type="text/javascript">
|
||||
var MailPoetForm = <%= json_encode(mailpoet_form) %>;
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1 @@
|
||||
<?php
|
||||
@@ -0,0 +1,18 @@
|
||||
<% extends 'layout.html' %>
|
||||
|
||||
<% block content %>
|
||||
<div class="block-editor">
|
||||
<div id="mailpoet_form_edit_templates">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
<% autoescape 'js' %>
|
||||
var mailpoet_templates = <%= json_encode(templates) %>;
|
||||
var mailpoet_form_edit_url =
|
||||
"<%= admin_url('admin.php?page=mailpoet-form-editor&template_id=') %>";
|
||||
<% endautoescape %>
|
||||
</script>
|
||||
|
||||
<style id="mailpoet-form-editor-form-styles"></style>
|
||||
<% endblock %>
|
||||
@@ -0,0 +1,50 @@
|
||||
{{#if params.label}}
|
||||
<p>
|
||||
<label>{{ params.label }}{{#if params.required}} *{{/if}}</label>
|
||||
</p>
|
||||
{{/if}}
|
||||
{{#ifCond params.date_type "==" "year_month_day"}}
|
||||
{{#unless params.date_format}}
|
||||
{{> _settings_date_months }}
|
||||
{{> _settings_date_days }}
|
||||
{{> _settings_date_years }}
|
||||
{{/unless}}
|
||||
{{#ifCond params.date_format "==" "MM/DD/YYYY"}}
|
||||
{{> _settings_date_months }}
|
||||
{{> _settings_date_days }}
|
||||
{{> _settings_date_years }}
|
||||
{{/ifCond}}
|
||||
{{#ifCond params.date_format "==" "DD/MM/YYYY"}}
|
||||
{{> _settings_date_days }}
|
||||
{{> _settings_date_months }}
|
||||
{{> _settings_date_years }}
|
||||
{{/ifCond}}
|
||||
{{#ifCond params.date_format "==" "YYYY/MM/DD"}}
|
||||
{{> _settings_date_years }}
|
||||
{{> _settings_date_months }}
|
||||
{{> _settings_date_days }}
|
||||
{{/ifCond}}
|
||||
{{/ifCond}}
|
||||
|
||||
{{#ifCond params.date_type "==" "year_month"}}
|
||||
{{#unless params.date_format}}
|
||||
{{> _settings_date_months }}
|
||||
{{> _settings_date_years }}
|
||||
{{/unless}}
|
||||
{{#ifCond params.date_format "==" "MM/YYYY"}}
|
||||
{{> _settings_date_months }}
|
||||
{{> _settings_date_years }}
|
||||
{{/ifCond}}
|
||||
{{#ifCond params.date_format "==" "YYYY/MM"}}
|
||||
{{> _settings_date_years }}
|
||||
{{> _settings_date_months }}
|
||||
{{/ifCond}}
|
||||
{{/ifCond}}
|
||||
|
||||
{{#ifCond params.date_type "==" "year"}}
|
||||
{{> _settings_date_years }}
|
||||
{{/ifCond}}
|
||||
|
||||
{{#ifCond params.date_type "==" "month"}}
|
||||
{{> _settings_date_months }}
|
||||
{{/ifCond}}
|
||||
@@ -0,0 +1,11 @@
|
||||
<% set currentDay = 'now' | date('d') | number_format %>
|
||||
<select id="{{ id }}_days">
|
||||
<option value=""><%= __('Day') %></option>
|
||||
<% for day in 1..31 %>
|
||||
<option
|
||||
<% if(currentDay == day) %>
|
||||
{{#if params.is_default_today}}selected="selected"{{/if}}
|
||||
<% endif %>
|
||||
><%= day %></option>
|
||||
<% endfor %>
|
||||
</select>
|
||||
@@ -0,0 +1,13 @@
|
||||
<% set currentMonth = 'now'|date('n') %>
|
||||
<select id="{{ id }}_months">
|
||||
<option value=""><%= __('Month') %></option>
|
||||
<% for month in 1..12 %>
|
||||
<option
|
||||
<% if(currentMonth == month) %>
|
||||
{{#if params.is_default_today}}selected="selected"{{/if}}
|
||||
<% endif %>
|
||||
>
|
||||
<%= month_names[month - 1] %>
|
||||
</option>
|
||||
<% endfor %>
|
||||
</select>
|
||||
@@ -0,0 +1,13 @@
|
||||
<% set currentYear = "now"|date("Y") %>
|
||||
<% set minYear = currentYear - 100 %>
|
||||
|
||||
<select id="{{ id }}_years">
|
||||
<option value=""><%= __('Year') %></option>
|
||||
<% for year in currentYear..minYear %>
|
||||
<option
|
||||
<% if(currentYear == year) %>
|
||||
{{#if params.is_default_today}}selected="selected"{{/if}}
|
||||
<% endif %>
|
||||
><%= year %></option>
|
||||
<% endfor %>
|
||||
</select>
|
||||
@@ -0,0 +1 @@
|
||||
<?php
|
||||
@@ -0,0 +1 @@
|
||||
<?php
|
||||
@@ -0,0 +1,23 @@
|
||||
<p class="clearfix">
|
||||
<label><%= __("Preselect today's date:") %></label>
|
||||
<span class="group">
|
||||
<label>
|
||||
<input
|
||||
class="mailpoet_radio"
|
||||
type="radio"
|
||||
name="params[is_default_today]"
|
||||
value="1"
|
||||
{{#if params.is_default_today}}checked="checked"{{/if}}
|
||||
/><%= __('Yes') %>
|
||||
</label>
|
||||
<label>
|
||||
<input
|
||||
class="mailpoet_radio"
|
||||
type="radio"
|
||||
name="params[is_default_today]"
|
||||
value=""
|
||||
{{#unless params.is_default_today}}checked="checked"{{/unless}}
|
||||
/><%= __('No') %>
|
||||
</label>
|
||||
</span>
|
||||
</p>
|
||||
@@ -0,0 +1,23 @@
|
||||
<% for date_type, formats in date_formats %>
|
||||
{{#ifCond params.date_type "===" "<%= date_type %>"}}
|
||||
<% if(formats | length == 1) %>
|
||||
<!-- display format as hidden value -->
|
||||
<input type="hidden" name="params[date_format]" value="<%= formats[0] %>" />
|
||||
<% else %>
|
||||
<!-- display label -->
|
||||
<p class="clearfix">
|
||||
<label><%= __('Order') %></label>
|
||||
<!-- display all possible date formats -->
|
||||
<select name="params[date_format]">
|
||||
<% for format in formats %>
|
||||
<option
|
||||
{{#ifCond params.date_format "===" "<%= format %>"}}
|
||||
selected="selected"
|
||||
{{/ifCond}}
|
||||
value="<%= format %>"><%= format %></option>
|
||||
<% endfor %>
|
||||
</select>
|
||||
</p>
|
||||
<% endif %>
|
||||
{{/ifCond}}
|
||||
<% endfor %>
|
||||
@@ -0,0 +1,28 @@
|
||||
<p class="clearfix">
|
||||
<label><%= __('Type of date') %></label>
|
||||
<select name="params[date_type]">
|
||||
<% for type, label in date_types %>
|
||||
<option
|
||||
{{#ifCond params.date_type "==" "<%= type %>"}}
|
||||
selected="selected"
|
||||
{{/ifCond}}
|
||||
data-format="<%= date_formats[type][0] %>" value="<%= type %>"
|
||||
><%= label %></option>
|
||||
<% endfor %>
|
||||
</select>
|
||||
<input type="hidden" name="params[date_format]" value="" />
|
||||
</p>
|
||||
|
||||
<script type="text/javascript">
|
||||
jQuery(function($) {
|
||||
$('select[name="params[date_type]"]').on('change', function() {
|
||||
// set default date format depending on date type
|
||||
$('input[name="params[date_format]"]')
|
||||
.val($(this)
|
||||
.find('option:selected')
|
||||
.data('format'));
|
||||
});
|
||||
// set default format
|
||||
$('select[name="params[date_type]"]').trigger('change');
|
||||
});
|
||||
<{{!}}/script>
|
||||
@@ -0,0 +1,77 @@
|
||||
<form id="form_field_settings" name="form_field_settings" action="" method="post">
|
||||
{{#ifCond type 'in' 'submit'}}
|
||||
{{> _settings_label }}
|
||||
{{/ifCond}}
|
||||
|
||||
{{#ifCond type '==' 'text'}}
|
||||
{{> _settings_label }}
|
||||
{{> _settings_label_within }}
|
||||
{{#ifCond id 'in' 'first_name,last_name' }}
|
||||
{{> _settings_required }}
|
||||
{{/ifCond}}
|
||||
{{/ifCond}}
|
||||
|
||||
{{#ifCond type '==' 'textarea'}}
|
||||
{{> _settings_label }}
|
||||
{{> _settings_label_within }}
|
||||
|
||||
<p class="clearfix">
|
||||
<label><%= __('Number of lines:') %></label>
|
||||
<select name="params[lines]">
|
||||
<% for i in 1..5 %>
|
||||
<option value="<%= i %>"
|
||||
{{#ifCond params.lines '==' <%= i %>}}selected="selected"{{/ifCond}}
|
||||
><%= _n('1 line', '%d lines', i) | format(i) %></option>
|
||||
<% endfor %>
|
||||
</select>
|
||||
</p>
|
||||
{{/ifCond}}
|
||||
|
||||
{{#ifCond type 'in' 'checkbox,radio'}}
|
||||
{{> _settings_label }}
|
||||
{{/ifCond}}
|
||||
|
||||
{{#ifCond type '==' 'segment'}}
|
||||
{{> _settings_label }}
|
||||
{{> _settings_segment_selection }}
|
||||
{{/ifCond}}
|
||||
|
||||
{{#ifCond type '==' 'select'}}
|
||||
{{> _settings_label }}
|
||||
{{> _settings_label_within }}
|
||||
{{/ifCond}}
|
||||
|
||||
{{#ifCond type '==' 'date'}}
|
||||
{{> _settings_label }}
|
||||
{{> _settings_date_default }}
|
||||
{{> _settings_date_format }}
|
||||
{{/ifCond}}
|
||||
|
||||
{{#ifCond type '==' 'html'}}
|
||||
<textarea name="params[text]" class="mailpoet_form_field_settings_text">{{ params.text }}</textarea>
|
||||
<p class="clearfix">
|
||||
<label>
|
||||
<input type="hidden" name="params[nl2br]" value="0" />
|
||||
<input
|
||||
class="mailpoet_checkbox"
|
||||
type="checkbox"
|
||||
name="params[nl2br]"
|
||||
{{#ifCond params.nl2br ">" 0}}checked="checked"{{/ifCond}}
|
||||
value="1"
|
||||
/> <%= __('Automatically add paragraphs') %>
|
||||
</label>
|
||||
</p>
|
||||
{{/ifCond}}
|
||||
|
||||
{{> _settings_submit }}
|
||||
</form>
|
||||
|
||||
<script type="text/javascript">
|
||||
jQuery(function($) {
|
||||
$(document).on('submit', '#form_field_settings', function(e) {
|
||||
// trigger callback
|
||||
MailPoet.Modal.success();
|
||||
return false;
|
||||
});
|
||||
});
|
||||
<{{!}}/script>
|
||||
@@ -0,0 +1,96 @@
|
||||
|
||||
<form
|
||||
id="form_field_new"
|
||||
name="form_field_new"
|
||||
action=""
|
||||
method="post"
|
||||
data-parsley-validate="true"
|
||||
>
|
||||
{{#if id}}<input type="hidden" id="field_id" name="id" value="{{ id }}" />{{/if}}
|
||||
<p>
|
||||
<label for="field_type"><%= __('Select a field type:') %></label>
|
||||
<select
|
||||
id="field_type"
|
||||
name="type"
|
||||
data-parsley-required="true"
|
||||
data-parsley-required-message="<%= __('Please specify a type.') %>"
|
||||
>
|
||||
<option value="">--</option>
|
||||
<option
|
||||
{{#ifCond type '==' 'text'}}selected="selected"{{/ifCond}}
|
||||
value="text"><%= __('Text Input') %>
|
||||
</option>
|
||||
<option
|
||||
{{#ifCond type '==' 'textarea'}}selected="selected"{{/ifCond}}
|
||||
value="textarea"><%= __('Text Area') %>
|
||||
</option>
|
||||
<option
|
||||
{{#ifCond type '==' 'radio'}}selected="selected"{{/ifCond}}
|
||||
value="radio"><%= __('Radio buttons') %>
|
||||
</option>
|
||||
<option
|
||||
{{#ifCond type '==' 'checkbox'}}selected="selected"{{/ifCond}}
|
||||
value="checkbox"><%= __('Checkbox') %>
|
||||
</option>
|
||||
<option
|
||||
{{#ifCond type '==' 'select'}}selected="selected"{{/ifCond}}
|
||||
value="select"><%= _x('Select', 'Form input type') %>
|
||||
</option>
|
||||
<option
|
||||
{{#ifCond type '==' 'date'}}selected="selected"{{/ifCond}}
|
||||
value="date"><%= __('Date') %>
|
||||
</option>
|
||||
</select>
|
||||
</p>
|
||||
<p>
|
||||
<label for="field_name"><%= __("Field name:") %></label>
|
||||
<input
|
||||
id="field_name"
|
||||
type="text"
|
||||
name="name"
|
||||
value="{{ name }}"
|
||||
data-parsley-required="true"
|
||||
data-parsley-required-message="<%= __('Please specify a name.') %>"
|
||||
/>
|
||||
</p>
|
||||
<hr />
|
||||
|
||||
<div class="field_type_form"></div>
|
||||
|
||||
<p class="mailpoet_align_right">
|
||||
<input type="submit" value="<%= __('Done') %>" class="button-primary" />
|
||||
</p>
|
||||
</form>
|
||||
|
||||
<script type="text/javascript">
|
||||
jQuery(function($) {
|
||||
|
||||
$(function() {
|
||||
loadFieldForm();
|
||||
});
|
||||
|
||||
$('#form_field_new #field_type').on('change', function() {
|
||||
loadFieldForm($(this).val());
|
||||
});
|
||||
|
||||
function loadFieldForm(type) {
|
||||
type = (type === undefined) ? $('#form_field_new #field_type').val() : type;
|
||||
if(type !== '') {
|
||||
var template = Handlebars.compile($('#form_template_field_'+type).html()),
|
||||
data = {type: type},
|
||||
field_id = $('#form_field_new #field_id').val();
|
||||
|
||||
if(field_id !== undefined && field_id.length > 0) {
|
||||
var params = $('.mailpoet_form_field[wysija_id="'+field_id+'"]').attr('wysija_params');
|
||||
if(params !== undefined) {
|
||||
data.params = JSON.parse(params);
|
||||
}
|
||||
}
|
||||
// render field template
|
||||
$('#form_field_new .field_type_form').html(template(data));
|
||||
} else {
|
||||
$('#form_field_new .field_type_form').html('');
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
@@ -0,0 +1 @@
|
||||
<?php
|
||||
@@ -0,0 +1,4 @@
|
||||
<p class="clearfix">
|
||||
<label for="label"><%= __('Label:') %></label>
|
||||
<input id="label" type="text" name="params[label]" value="{{ params.label }}" />
|
||||
</p>
|
||||
@@ -0,0 +1,11 @@
|
||||
<p class="clearfix">
|
||||
<label><%= __('Display label within input:') %></label>
|
||||
<span class="group">
|
||||
<label>
|
||||
<input class="mailpoet_radio" type="radio" name="params[label_within]" value="1" {{#if params.label_within}}checked="checked"{{/if}} /><%= __('Yes') %>
|
||||
</label>
|
||||
<label>
|
||||
<input class="mailpoet_radio" type="radio" name="params[label_within]" value="" {{#unless params.label_within}}checked="checked"{{/unless}} /><%= __('No') %>
|
||||
</label>
|
||||
</span>
|
||||
</p>
|
||||
@@ -0,0 +1,20 @@
|
||||
<p class="clearfix">
|
||||
<label><%= __('Is this field mandatory?') %></label>
|
||||
<span class="group">
|
||||
<label>
|
||||
<input type="radio"
|
||||
class="mailpoet_radio"
|
||||
name="params[required]"
|
||||
value="1"
|
||||
{{#if params.required}}checked="checked"{{/if}} /><%= __('Yes') %>
|
||||
</label>
|
||||
<label>
|
||||
<input
|
||||
class="mailpoet_radio"
|
||||
type="radio"
|
||||
name="params[required]"
|
||||
value=""
|
||||
{{#unless params.required}}checked="checked"{{/unless}} /><%= __('No') %>
|
||||
</label>
|
||||
</span>
|
||||
</p>
|
||||
+130
@@ -0,0 +1,130 @@
|
||||
<ul id="mailpoet_segment_selection" class="clearfix"></ul>
|
||||
|
||||
<div id="mailpoet_segment_available_container">
|
||||
<h3><%= __('Select the list that you want to add:') %></h3>
|
||||
|
||||
<select class="mailpoet_segment_available"></select>
|
||||
|
||||
<a href="javascript:;" class="mailpoet_segment_add"><span><%= __('Add') %></span></a>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
jQuery(function($) {
|
||||
<% autoescape false %>
|
||||
var selected_segments = {{#if params.values}}{{{ json_encode params.values }}}
|
||||
{{else}}[]{{/if}};
|
||||
<% endautoescape %>
|
||||
|
||||
$(function() {
|
||||
mailpoet_segment_available_render();
|
||||
mailpoet_segment_selection_render();
|
||||
|
||||
setInputNames();
|
||||
|
||||
// add segment
|
||||
$('.mailpoet_segment_add').on('click', function() {
|
||||
// add currently selected segment to the selection
|
||||
var selected_segment = $('.mailpoet_segment_available :selected');
|
||||
|
||||
// add segment to selection
|
||||
selected_segments.push({
|
||||
id: selected_segment.val(),
|
||||
name: selected_segment.text(),
|
||||
is_checked: 0
|
||||
});
|
||||
|
||||
// remove segment from available segments
|
||||
selected_segment.remove();
|
||||
|
||||
// render selection
|
||||
mailpoet_segment_selection_render();
|
||||
|
||||
setInputNames();
|
||||
});
|
||||
|
||||
// remove segment
|
||||
$('#mailpoet_segment_selection').on('click', '.remove', function(e) {
|
||||
if($('#mailpoet_segment_selection').children().length === 1) {
|
||||
return e.preventDefault();
|
||||
}
|
||||
var element = $(this).parents('li');
|
||||
// remove currently selected segment to the selection
|
||||
var selected_segment = parseInt(element.data('segment'), 10);
|
||||
|
||||
// remove segment from selection
|
||||
selected_segments = selected_segments.filter(function(segment) {
|
||||
return (parseInt(segment.id, 10) !== selected_segment);
|
||||
});
|
||||
|
||||
// remove element
|
||||
element.remove();
|
||||
|
||||
// render available segment
|
||||
mailpoet_segment_available_render();
|
||||
|
||||
setInputNames();
|
||||
});
|
||||
});
|
||||
|
||||
function setupSortableSegments() {
|
||||
// make segment selection sortable
|
||||
Sortable.create('mailpoet_segment_selection', {
|
||||
handles: $$('#mailpoet_segment_selection .handle'),
|
||||
onChange: function(item) {
|
||||
setInputNames();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function mailpoet_segment_available_render() {
|
||||
// clear available segments
|
||||
$('.mailpoet_segment_available').html('');
|
||||
|
||||
var selected_segment_ids = selected_segments.map(function(segment) {
|
||||
return segment.id;
|
||||
});
|
||||
|
||||
// display available segments
|
||||
$.each(mailpoet_segments, function(i, segment) {
|
||||
if($.inArray(segment.id, selected_segment_ids) < 0) {
|
||||
$('.mailpoet_segment_available').append(
|
||||
'<option value="'+segment.id+'">'+segment.name+'</option>'
|
||||
);
|
||||
}
|
||||
});
|
||||
mailpoet_segment_available_toggle();
|
||||
}
|
||||
|
||||
function mailpoet_segment_selection_render() {
|
||||
// segment item template
|
||||
var template = Handlebars.compile(
|
||||
$('#field_settings_segment_selection_item').html()
|
||||
);
|
||||
|
||||
// update view
|
||||
$('#mailpoet_segment_selection').html(
|
||||
template({ segments: selected_segments })
|
||||
);
|
||||
|
||||
mailpoet_segment_available_toggle();
|
||||
}
|
||||
|
||||
function mailpoet_segment_available_toggle() {
|
||||
// toggle visibility of available segments
|
||||
if($('.mailpoet_segment_available option').length === 0) {
|
||||
$('#mailpoet_segment_available_container').hide();
|
||||
} else {
|
||||
$('#mailpoet_segment_available_container').show();
|
||||
}
|
||||
}
|
||||
|
||||
function setInputNames() {
|
||||
$('#mailpoet_segment_selection li').each(function(index, item) {
|
||||
$(item).find('.mailpoet_is_checked').attr('name', 'params[values]['+index+'][is_checked]');
|
||||
$(item).find('.mailpoet_segment_id').attr('name', 'params[values]['+index+'][id]');
|
||||
$(item).find('.mailpoet_segment_name').attr('name', 'params[values]['+index+'][name]');
|
||||
});
|
||||
setupSortableSegments();
|
||||
}
|
||||
});
|
||||
<{{!}}/script>
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
{{#each segments}}
|
||||
<li data-segment="{{ id }}">
|
||||
<label>
|
||||
<input class="mailpoet_segment_id" type="hidden" value="{{ id }}" />
|
||||
<input class="mailpoet_is_checked" type="checkbox" value="1"
|
||||
{{#ifCond is_checked '>' 0}}checked="checked"{{/ifCond}} />
|
||||
<input class="mailpoet_segment_name" type="hidden" value="{{ name }}" />
|
||||
{{ name }}
|
||||
</label>
|
||||
<a class="remove" href="javascript:;"><%= __('Remove') %></a>
|
||||
<a class="handle" href="javascript:;"><%= __('Move') %></a>
|
||||
</li>
|
||||
{{/each}}
|
||||
@@ -0,0 +1,3 @@
|
||||
<p class="mailpoet_align_right">
|
||||
<input type="submit" value="<%= __('Done') %>" class="button-primary" />
|
||||
</p>
|
||||
@@ -0,0 +1,24 @@
|
||||
<p class="clearfix">
|
||||
<label><%= __('Validate for:') %></label>
|
||||
<select name="params[validate]">
|
||||
<option {{#ifCond params.validate '==' ''}}selected="selected"{{/ifCond}}
|
||||
value="">
|
||||
<%= __('Nothing') %>
|
||||
</option>
|
||||
|
||||
<option {{#ifCond params.validate '==' 'number'}}selected="selected"{{/ifCond}}
|
||||
value="number">
|
||||
<%= __('Numbers only') %>
|
||||
</option>
|
||||
|
||||
<option {{#ifCond params.validate '==' 'alphanum'}}selected="selected"{{/ifCond}}
|
||||
value="alphanum">
|
||||
<%= __('Alphanumerical') %>
|
||||
</option>
|
||||
|
||||
<option {{#ifCond params.validate '==' 'phone'}}selected="selected"{{/ifCond}}
|
||||
value="phone">
|
||||
<%= __('Phone number, (+,-,#,(,) and spaces allowed)') %>
|
||||
</option>
|
||||
</select>
|
||||
</p>
|
||||
@@ -0,0 +1,82 @@
|
||||
<div class="mailpoet_multiple_values">
|
||||
<ul></ul>
|
||||
{{#ifCond type 'in' 'radio,select'}}
|
||||
<a href="javascript:;" class="add"><span></span><%= __('Add item') %></a>
|
||||
{{/ifCond}}
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
jQuery(function($) {
|
||||
{{#if params.values}}
|
||||
var field_values = {{{ json_encode params.values }}};
|
||||
{{else}}
|
||||
var field_values = [{ value: '' }];
|
||||
{{/if}}
|
||||
var field_type = "{{ type }}";
|
||||
var template = Handlebars.compile($('#field_settings_values_item').html());
|
||||
|
||||
// set default value for checkbox type if there is no value defined
|
||||
if(field_type === 'checkbox' && field_values.length !== 1) {
|
||||
if(field_values.length > 1) {
|
||||
field_values = [field_values[0]];
|
||||
} else {
|
||||
// push a default empty value
|
||||
field_values = [{}];
|
||||
}
|
||||
}
|
||||
$(function() {
|
||||
// render all values by creating inputs
|
||||
for(var i = 0, count = field_values.length; i < count; i++) {
|
||||
createInput(template, field_values[i]);
|
||||
}
|
||||
// set inputs name
|
||||
setInputNames();
|
||||
|
||||
// add value
|
||||
$('.mailpoet_multiple_values .add').on('click', function() {
|
||||
createInput(template);
|
||||
setInputNames();
|
||||
});
|
||||
// remove value
|
||||
$(document).on('click', '.mailpoet_multiple_values li .remove', function() {
|
||||
$(this).parent('li').remove();
|
||||
setInputNames();
|
||||
});
|
||||
// create an input
|
||||
function createInput(template, values) {
|
||||
var data = values || {};
|
||||
// set field type
|
||||
data.type = field_type;
|
||||
// add input to selection
|
||||
$('.mailpoet_multiple_values ul').append(template(data));
|
||||
}
|
||||
// set input names (since their index is based on their position)
|
||||
function setInputNames() {
|
||||
$('.mailpoet_multiple_values li').each(function(index, item) {
|
||||
$(item).find('.is_checked').attr('name', 'params[values]['+index+'][is_checked]');
|
||||
$(item).find('.value').attr('name', 'params[values]['+index+'][value]');
|
||||
});
|
||||
|
||||
// hide remove button if only one item remains
|
||||
if ($('.mailpoet_multiple_values li').length > 1) {
|
||||
$('.mailpoet_multiple_values .remove').show();
|
||||
} else {
|
||||
$('.mailpoet_multiple_values .remove').hide();
|
||||
}
|
||||
}
|
||||
{{#ifCond type '!=' 'checkbox'}}
|
||||
$('.mailpoet_multiple_values').on('click', '.is_checked', function() {
|
||||
// get click checkbox's state
|
||||
var is_checked = $(this).is(':checked');
|
||||
// uncheck all checkboxes
|
||||
$('.mailpoet_multiple_values .is_checked').removeProp('checked');
|
||||
// toggle clicked checkbox
|
||||
if(is_checked === false) {
|
||||
$(this).removeProp('checked');
|
||||
} else {
|
||||
$(this).prop('checked', 'checked');
|
||||
}
|
||||
});
|
||||
{{/ifCond}}
|
||||
});
|
||||
});
|
||||
<{{!}}/script>
|
||||
@@ -0,0 +1,22 @@
|
||||
<li class="clearfix">
|
||||
{{#ifCond type 'in' 'radio,select'}}
|
||||
<input class="is_checked radio" type="radio" name=""
|
||||
{{#if is_checked}}checked="checked"{{/if}} value="1"/>
|
||||
{{else}}
|
||||
<input class="is_checked checkbox" type="checkbox" name=""
|
||||
{{#if is_checked}}checked="checked"{{/if}} value="1"/>
|
||||
{{/ifCond}}
|
||||
|
||||
<input
|
||||
type="text"
|
||||
name=""
|
||||
class="value"
|
||||
value="{{ value }}"
|
||||
data-parsley-errors-messages-disabled="true"
|
||||
data-parsley-required="true"
|
||||
/>
|
||||
|
||||
{{#ifCond type 'in' 'radio,select'}}
|
||||
<a class="remove" href="javascript:;"><%= __('Remove') %></a>
|
||||
{{/ifCond}}
|
||||
</li>
|
||||
Reference in New Issue
Block a user