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 .= '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 .= ( $html .= (
(isset($option['is_checked']) && $option['is_checked']) (isset($option['is_checked']) && $option['is_checked'])
|| ||
(self::getFieldValue($block) === $option['value']) (self::getFieldValue($block) === $value)
) ? 'checked="checked"' : ''; ) ? 'checked="checked"' : '';
$html .= $field_validation; $html .= $field_validation;
$html .= ' /> '.esc_attr($label);
$html .= ' /> '.esc_attr($option['value']);
$html .= '</label>'; $html .= '</label>';
} }

View File

@ -18,7 +18,12 @@ class Select extends Base {
$html .= '<option value="">'.static::getFieldLabel($block).'</option>'; $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 = ( $is_selected = (
(isset($option['is_checked']) && $option['is_checked']) (isset($option['is_checked']) && $option['is_checked'])
|| ||

View File

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

View File

@ -235,7 +235,7 @@ class Pages {
), ),
array( array(
'id' => 'status', 'id' => 'status',
'type' => 'select', 'type' => 'radio',
'params' => array( 'params' => array(
'label' => __('Status'), 'label' => __('Status'),
'values' => array( 'values' => array(
@ -254,14 +254,6 @@ class Pages {
'is_checked' => ( 'is_checked' => (
$subscriber->status === Subscriber::STATUS_UNSUBSCRIBED $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'); $(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> </script>

View File

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