removed edit page in settings + manage subscription update

This commit is contained in:
Jonathan Labreuille
2016-03-16 09:56:07 +01:00
parent 72882aaf2b
commit e28451d410
6 changed files with 25 additions and 40 deletions

View File

@ -25,18 +25,24 @@ class Radio extends Base {
$html .= 'name="'.$field_name.'" ';
$html .= 'value="'.esc_attr($option['value']).'" ';
if(is_array($option['value'])) {
$value = key($option['value']);
$label = reset($option['value']);
} else {
$value = $option['value'];
$label = $option['value'];
}
$html .= 'value="'.esc_attr($value).'" ';
$html .= (
(isset($option['is_checked']) && $option['is_checked'])
||
(self::getFieldValue($block) === $option['value'])
(self::getFieldValue($block) === $value)
) ? 'checked="checked"' : '';
$html .= $field_validation;
$html .= ' /> '.esc_attr($option['value']);
$html .= ' /> '.esc_attr($label);
$html .= '</label>';
}

View File

@ -18,7 +18,12 @@ class Select extends Base {
$html .= '<option value="">'.static::getFieldLabel($block).'</option>';
}
foreach($block['params']['values'] as $option) {
$options = (!empty($block['params']['values'])
? $block['params']['values']
: array()
);
foreach($options as $option) {
$is_selected = (
(isset($option['is_checked']) && $option['is_checked'])
||

View File

@ -67,8 +67,7 @@ class Pages {
'title' => $page->post_title,
'preview_url' => add_query_arg(array(
'preview' => 1
), get_permalink($page->ID)),
'edit_url' => get_edit_post_link($page->ID)
), get_permalink($page->ID))
);
}
}

View File

@ -235,7 +235,7 @@ class Pages {
),
array(
'id' => 'status',
'type' => 'select',
'type' => 'radio',
'params' => array(
'label' => __('Status'),
'values' => array(
@ -254,14 +254,6 @@ class Pages {
'is_checked' => (
$subscriber->status === Subscriber::STATUS_UNSUBSCRIBED
)
),
array(
'value' => array(
Subscriber::STATUS_UNCONFIRMED => __('Unconfirmed')
),
'is_checked' => (
$subscriber->status === Subscriber::STATUS_UNCONFIRMED
)
)
)
)

View File

@ -139,18 +139,6 @@
$(this).removeAttr('target');
}
});
// page edit
$('.mailpoet_page_edit').on('click', function() {
var selection = $(this).siblings('.mailpoet_page_selection');
if(selection.length > 0) {
$(this).attr('href', $(selection).find('option[value="'+$(selection).val()+'"]').data('edit-url'));
$(this).attr('target', '_blank');
} else {
$(this).attr('href', 'javascript:;');
$(this).removeAttr('target');
}
});
});
});
</script>

View File

@ -197,7 +197,7 @@
<!-- edit subscription-->
<tr>
<th scope="row">
<label for="subscription_edit_page">
<label for="subscription_manage_page">
<%= __('Manage Subscription page') %>
<p class="description">
<%= __('The page your subscribers see when they click on "Manage your subscription" in your emails.') %>
@ -208,15 +208,14 @@
<p>
<select
class="mailpoet_page_selection"
id="subscription_edit_page"
name="subscription[edit_page]"
id="subscription_manage_page"
name="subscription[manage_page]"
>
<% for page in pages %>
<option
value="<%= page.id %>"
data-preview-url="<%= page.preview_url|raw %>&amp;mailpoet_action=edit"
data-edit-url="<%= page.edit_url|raw %>"
<% if(page.id == settings.subscription.edit_page) %>
data-preview-url="<%= page.preview_url|raw %>&amp;mailpoet_action=manage"
<% if(page.id == settings.subscription.manage_page) %>
selected="selected"
<% endif %>
><%= page.title %></option>
@ -226,11 +225,7 @@
class="mailpoet_page_preview"
href="javascript:;"
title="<%= __('Preview page') %>"
><%= __('Preview') %></a>&nbsp;|&nbsp;<a
class="mailpoet_page_edit"
href="javascript:;"
title="<%= __('Edit page') %>"
><%= __('Edit') %></a>
><%= __('Preview') %></a>
</p>
<p>
<label><%= __('Subscribers can choose from these lists:') %></label>