Merge pull request #235 from mailpoet/alc

Editor: ALC fixes
This commit is contained in:
Marco
2015-11-20 23:00:47 +01:00
10 changed files with 298 additions and 33 deletions

View File

@ -306,7 +306,7 @@ define([
_.each(postTypes, function(type) { _.each(postTypes, function(type) {
select.append(jQuery('<option>', { select.append(jQuery('<option>', {
value: type.name, value: type.name,
text: type.labels.singular_name, text: type.label,
})); }));
}); });
select.val(selectedValue); select.val(selectedValue);

View File

@ -214,7 +214,6 @@ define([
this.model.set(field, value); this.model.set(field, value);
}, },
onBeforeDestroy: function() { onBeforeDestroy: function() {
console.log('Calling close');
MailPoet.Modal.close(); MailPoet.Modal.close();
}, },
}); });

View File

@ -344,7 +344,7 @@ define([
_.each(postTypes, function(type) { _.each(postTypes, function(type) {
select.append(jQuery('<option>', { select.append(jQuery('<option>', {
value: type.name, value: type.name,
text: type.labels.singular_name, text: type.label,
})); }));
}); });
select.val(selectedValue); select.val(selectedValue);

View File

@ -0,0 +1,264 @@
// Generated by CoffeeScript 1.9.2
/**
@license Sticky-kit v1.1.2 | WTFPL | Leaf Corcoran 2015 | http://leafo.net
*/
(function() {
var $, win;
$ = this.jQuery || window.jQuery;
win = $(window);
$.fn.stick_in_parent = function(opts) {
var doc, elm, enable_bottoming, fn, i, inner_scrolling, len, manual_spacer, offset_top, outer_width, parent_selector, recalc_every, sticky_class;
if (opts == null) {
opts = {};
}
sticky_class = opts.sticky_class, inner_scrolling = opts.inner_scrolling, recalc_every = opts.recalc_every, parent_selector = opts.parent, offset_top = opts.offset_top, manual_spacer = opts.spacer, enable_bottoming = opts.bottoming;
if (offset_top == null) {
offset_top = 0;
}
if (parent_selector == null) {
parent_selector = void 0;
}
if (inner_scrolling == null) {
inner_scrolling = true;
}
if (sticky_class == null) {
sticky_class = "is_stuck";
}
doc = $(document);
if (enable_bottoming == null) {
enable_bottoming = true;
}
outer_width = function(el) {
var _el, computed, w;
if (window.getComputedStyle) {
_el = el[0];
computed = window.getComputedStyle(el[0]);
w = parseFloat(computed.getPropertyValue("width")) + parseFloat(computed.getPropertyValue("margin-left")) + parseFloat(computed.getPropertyValue("margin-right"));
if (computed.getPropertyValue("box-sizing") !== "border-box") {
w += parseFloat(computed.getPropertyValue("border-left-width")) + parseFloat(computed.getPropertyValue("border-right-width")) + parseFloat(computed.getPropertyValue("padding-left")) + parseFloat(computed.getPropertyValue("padding-right"));
}
return w;
} else {
return el.outerWidth(true);
}
};
fn = function(elm, padding_bottom, parent_top, parent_height, top, height, el_float, detached) {
var bottomed, detach, fixed, last_pos, last_scroll_height, offset, parent, recalc, recalc_and_tick, recalc_counter, spacer, tick;
if (elm.data("sticky_kit")) {
return;
}
elm.data("sticky_kit", true);
last_scroll_height = doc.height();
parent = elm.parent();
if (parent_selector != null) {
parent = parent.closest(parent_selector);
}
if (!parent.length) {
throw "failed to find stick parent";
}
fixed = false;
bottomed = false;
spacer = manual_spacer != null ? manual_spacer && elm.closest(manual_spacer) : $("<div />");
if (spacer) {
spacer.css('position', elm.css('position'));
}
recalc = function() {
var border_top, padding_top, restore;
if (detached) {
return;
}
last_scroll_height = doc.height();
border_top = parseInt(parent.css("border-top-width"), 10);
padding_top = parseInt(parent.css("padding-top"), 10);
padding_bottom = parseInt(parent.css("padding-bottom"), 10);
parent_top = parent.offset().top + border_top + padding_top;
parent_height = parent.height();
if (fixed) {
fixed = false;
bottomed = false;
if (manual_spacer == null) {
elm.insertAfter(spacer);
spacer.detach();
}
elm.css({
position: "",
top: "",
width: "",
bottom: ""
}).removeClass(sticky_class);
restore = true;
}
top = elm.offset().top - (parseInt(elm.css("margin-top"), 10) || 0) - offset_top;
height = elm.outerHeight(true);
el_float = elm.css("float");
if (spacer) {
spacer.css({
width: outer_width(elm),
height: height,
display: elm.css("display"),
"vertical-align": elm.css("vertical-align"),
"float": el_float
});
}
if (restore) {
return tick();
}
};
recalc();
last_pos = void 0;
offset = offset_top;
recalc_counter = recalc_every;
tick = function() {
var css, delta, recalced, scroll, will_bottom, win_height;
if (detached) {
return;
}
recalced = false;
if (recalc_counter != null) {
recalc_counter -= 1;
if (recalc_counter <= 0) {
recalc_counter = recalc_every;
recalc();
recalced = true;
}
}
if (!recalced && doc.height() !== last_scroll_height) {
recalc();
recalced = true;
}
scroll = win.scrollTop();
if (last_pos != null) {
delta = scroll - last_pos;
}
last_pos = scroll;
if (fixed) {
if (enable_bottoming) {
will_bottom = scroll + height + offset > parent_height + parent_top;
if (bottomed && !will_bottom) {
bottomed = false;
elm.css({
position: "fixed",
bottom: "",
top: offset
}).trigger("sticky_kit:unbottom");
}
}
if (scroll < top) {
fixed = false;
offset = offset_top;
if (manual_spacer == null) {
if (el_float === "left" || el_float === "right") {
elm.insertAfter(spacer);
}
spacer.detach();
}
css = {
position: "",
width: "",
top: ""
};
elm.css(css).removeClass(sticky_class).trigger("sticky_kit:unstick");
}
if (inner_scrolling) {
win_height = win.height();
if (height + offset_top > win_height) {
if (!bottomed) {
offset -= delta;
offset = Math.max(win_height - height, offset);
offset = Math.min(offset_top, offset);
if (fixed) {
elm.css({
top: offset + "px"
});
}
}
}
}
} else {
if (scroll > top) {
fixed = true;
css = {
position: "fixed",
top: offset
};
css.width = elm.css("box-sizing") === "border-box" ? elm.outerWidth() + "px" : elm.width() + "px";
elm.css(css).addClass(sticky_class);
if (manual_spacer == null) {
elm.after(spacer);
if (el_float === "left" || el_float === "right") {
spacer.append(elm);
}
}
elm.trigger("sticky_kit:stick");
}
}
if (fixed && enable_bottoming) {
if (will_bottom == null) {
will_bottom = scroll + height + offset > parent_height + parent_top;
}
if (!bottomed && will_bottom) {
bottomed = true;
if (parent.css("position") === "static") {
parent.css({
position: "relative"
});
}
return elm.css({
position: "absolute",
bottom: padding_bottom,
top: "auto"
}).trigger("sticky_kit:bottom");
}
}
};
recalc_and_tick = function() {
recalc();
return tick();
};
detach = function() {
detached = true;
win.off("touchmove", tick);
win.off("scroll", tick);
win.off("resize", recalc_and_tick);
$(document.body).off("sticky_kit:recalc", recalc_and_tick);
elm.off("sticky_kit:detach", detach);
elm.removeData("sticky_kit");
elm.css({
position: "",
bottom: "",
top: "",
width: ""
});
parent.position("position", "");
if (fixed) {
if (manual_spacer == null) {
if (el_float === "left" || el_float === "right") {
elm.insertAfter(spacer);
}
spacer.remove();
}
return elm.removeClass(sticky_class);
}
};
win.on("touchmove", tick);
win.on("scroll", tick);
win.on("resize", recalc_and_tick);
$(document.body).on("sticky_kit:recalc", recalc_and_tick);
elm.on("sticky_kit:detach", detach);
return setTimeout(tick, 0);
};
for (i = 0, len = this.length; i < len; i++) {
elm = this[i];
fn($(elm));
}
return this;
};
}).call(this);

View File

@ -14,7 +14,7 @@ class PostListTransformer {
function transform($posts) { function transform($posts) {
$results = array(); $results = array();
$use_divider = (bool)$this->args['showDivider']; $use_divider = $this->args['showDivider'] === 'true';
foreach ($posts as $index => $post) { foreach ($posts as $index => $post) {
if ($use_divider && $index > 0) { if ($use_divider && $index > 0) {

View File

@ -22,7 +22,7 @@ class PostTransformer {
$content = $content_manager->filterContent($content); $content = $content_manager->filterContent($content);
$structure_transformer = new StructureTransformer(); $structure_transformer = new StructureTransformer();
$structure = $structure_transformer->transform($content, (bool)$this->args['imagePadded']); $structure = $structure_transformer->transform($content, $this->args['imagePadded'] === 'true');
$structure = $this->appendFeaturedImage( $structure = $this->appendFeaturedImage(
$post, $post,

View File

@ -5,8 +5,7 @@
}, },
"napa": { "napa": {
"blob": "eligrey/Blob.js.git", "blob": "eligrey/Blob.js.git",
"filesaver": "eligrey/FileSaver.js.git", "filesaver": "eligrey/FileSaver.js.git"
"sticky-kit": "leafo/sticky-kit.git"
}, },
"dependencies": { "dependencies": {
"backbone": "1.2.3", "backbone": "1.2.3",

View File

@ -37,26 +37,6 @@
<hr class="mailpoet_separator" /> <hr class="mailpoet_separator" />
<div class="mailpoet_form_field">
<div class="mailpoet_form_field_radio_option">
<label>
<input type="radio" name="mailpoet_automated_latest_content_display_type" class="mailpoet_automated_latest_content_display_type" value="excerpt" {{#ifCond model.displayType '==' 'excerpt'}}CHECKED{{/ifCond}}/>
<%= __('Excerpt') %>
</label>
</div>
<div class="mailpoet_form_field_radio_option">
<label>
<input type="radio" name="mailpoet_automated_latest_content_display_type" class="mailpoet_automated_latest_content_display_type" value="full" {{#ifCond model.displayType '==' 'full'}}CHECKED{{/ifCond}}/>
<%= __('Full post') %>
</label>
</div>
<div class="mailpoet_form_field_radio_option">
<label>
<input type="radio" name="mailpoet_automated_latest_content_display_type" class="mailpoet_automated_latest_content_display_type" value="titleOnly" {{#ifCond model.displayType '==' 'titleOnly'}}CHECKED{{/ifCond}} />
<%= __('Title only') %>
</label>
</div>
</div>
<div class="mailpoet_form_field"> <div class="mailpoet_form_field">
<a href="javascript:;" class="mailpoet_automated_latest_content_show_display_options"><%= __('Display options') %></a> <a href="javascript:;" class="mailpoet_automated_latest_content_show_display_options"><%= __('Display options') %></a>
@ -66,6 +46,27 @@
<a href="javascript:;" class="mailpoet_automated_latest_content_hide_display_options"><%= __('Hide display options') %></a> <a href="javascript:;" class="mailpoet_automated_latest_content_hide_display_options"><%= __('Hide display options') %></a>
</div> </div>
<div class="mailpoet_form_field">
<div class="mailpoet_form_field_radio_option">
<label>
<input type="radio" name="mailpoet_automated_latest_content_display_type" class="mailpoet_automated_latest_content_display_type" value="excerpt" {{#ifCond model.displayType '==' 'excerpt'}}CHECKED{{/ifCond}}/>
<%= __('Excerpt') %>
</label>
</div>
<div class="mailpoet_form_field_radio_option">
<label>
<input type="radio" name="mailpoet_automated_latest_content_display_type" class="mailpoet_automated_latest_content_display_type" value="full" {{#ifCond model.displayType '==' 'full'}}CHECKED{{/ifCond}}/>
<%= __('Full post') %>
</label>
</div>
<div class="mailpoet_form_field_radio_option">
<label>
<input type="radio" name="mailpoet_automated_latest_content_display_type" class="mailpoet_automated_latest_content_display_type" value="titleOnly" {{#ifCond model.displayType '==' 'titleOnly'}}CHECKED{{/ifCond}} />
<%= __('Title only') %>
</label>
</div>
</div>
<div class="mailpoet_form_field"> <div class="mailpoet_form_field">
<div class="mailpoet_form_field_title"><%= __('Title Format') %></div> <div class="mailpoet_form_field_title"><%= __('Title Format') %></div>
<div class="mailpoet_form_field_radio_option"> <div class="mailpoet_form_field_radio_option">
@ -251,7 +252,7 @@
</div> </div>
<div class="mailpoet_form_field"> <div class="mailpoet_form_field">
<div class="mailpoet_form_field_title mailpoet_form_field_title_small mailpoet_form_field_title_inline"><%= __('Sort by') %></div> <div class="mailpoet_form_field_title mailpoet_form_field_title_small"><%= __('Sort by') %></div>
<div class="mailpoet_form_field_radio_option"> <div class="mailpoet_form_field_radio_option">
<label> <label>
<input type="radio" name="mailpoet_automated_latest_content_sort_by" class="mailpoet_automated_latest_content_sort_by" value="newest" {{#ifCond model.sortBy '==' 'newest'}}CHECKED{{/ifCond}}/> <input type="radio" name="mailpoet_automated_latest_content_sort_by" class="mailpoet_automated_latest_content_sort_by" value="newest" {{#ifCond model.sortBy '==' 'newest'}}CHECKED{{/ifCond}}/>
@ -268,7 +269,7 @@
<div class="mailpoet_automated_latest_content_non_title_list_options {{#ifCond model.displayType '==' 'titleOnly'}}{{#ifCond model.titleFormat '==' 'ul'}}mailpoet_hidden{{/ifCond}}{{/ifCond}}"> <div class="mailpoet_automated_latest_content_non_title_list_options {{#ifCond model.displayType '==' 'titleOnly'}}{{#ifCond model.titleFormat '==' 'ul'}}mailpoet_hidden{{/ifCond}}{{/ifCond}}">
<div class="mailpoet_form_field"> <div class="mailpoet_form_field">
<div class="mailpoet_form_field_title mailpoet_form_field_title_small mailpoet_form_field_title_inline"><%= __('Show divider between posts') %></div> <div class="mailpoet_form_field_title mailpoet_form_field_title_small"><%= __('Show divider between posts') %></div>
<div class="mailpoet_form_field_radio_option"> <div class="mailpoet_form_field_radio_option">
<label> <label>
<input type="radio" name="mailpoet_automated_latest_content_show_divider"class="mailpoet_automated_latest_content_show_divider" value="true" {{#if model.showDivider}}CHECKED{{/if}}/> <input type="radio" name="mailpoet_automated_latest_content_show_divider"class="mailpoet_automated_latest_content_show_divider" value="true" {{#if model.showDivider}}CHECKED{{/if}}/>
@ -281,7 +282,7 @@
<%= __('No') %> <%= __('No') %>
</label> </label>
</div> </div>
<div class="mailpoet_form_field_input_option"> <div>
<a href="javascript:;" class="mailpoet_automated_latest_content_select_divider"><%= __('Select divider') %></a> <a href="javascript:;" class="mailpoet_automated_latest_content_select_divider"><%= __('Select divider') %></a>
</div> </div>
</div> </div>

View File

@ -2,7 +2,9 @@
<div class="mailpoet_settings_posts_selection"></div> <div class="mailpoet_settings_posts_selection"></div>
<div class="mailpoet_settings_posts_display_options mailpoet_hidden"></div> <div class="mailpoet_settings_posts_display_options mailpoet_hidden"></div>
<div class="mailpoet_settings_posts_controls"> <div class="mailpoet_settings_posts_controls">
<div class="mailpoet_form_field">
<a href="javascript:;" class="mailpoet_settings_posts_show_post_selection mailpoet_hidden"><%= __('Back to selection') %></a>
<a href="javascript:;" class="mailpoet_settings_posts_show_display_options"><%= __('Display options') %></a>
</div>
<input type="button" class="mailpoet_button mailpoet_button_primary mailpoet_settings_posts_insert_selected" value="<%= __('Insert selected') %>" /> <input type="button" class="mailpoet_button mailpoet_button_primary mailpoet_settings_posts_insert_selected" value="<%= __('Insert selected') %>" />
<a href="javascript:;" class="mailpoet_settings_posts_show_post_selection mailpoet_hidden"><%= __('Back to selection') %></a>
<a href="javascript:;" class="mailpoet_settings_posts_show_display_options"><%= __('Display options') %></a>
</div> </div>

View File

@ -23,7 +23,7 @@ baseConfig = {
'handlebars': 'handlebars/dist/handlebars.js', 'handlebars': 'handlebars/dist/handlebars.js',
'backbone.marionette': 'backbone.marionette/lib/backbone.marionette', 'backbone.marionette': 'backbone.marionette/lib/backbone.marionette',
'backbone.supermodel$': 'backbone.supermodel/build/backbone.supermodel.js', 'backbone.supermodel$': 'backbone.supermodel/build/backbone.supermodel.js',
'sticky-kit': 'sticky-kit/jquery.sticky-kit', 'sticky-kit': 'vendor_static/jquery.sticky-kit.js',
'interact$': 'interact.js/interact.js', 'interact$': 'interact.js/interact.js',
'spectrum$': 'spectrum-colorpicker/spectrum.js', 'spectrum$': 'spectrum-colorpicker/spectrum.js',
'blob$': 'blob/Blob.js', 'blob$': 'blob/Blob.js',