|
@@ -1,13 +1,13 @@
|
|
|
-"use strict";
|
|
|
+'use strict';
|
|
|
|
|
|
var halloPlugins = {
|
|
|
- 'halloformat': {},
|
|
|
- 'halloheadings': {formatBlocks: ["p", "h2", "h3", "h4", "h5"]},
|
|
|
- 'hallolists': {},
|
|
|
- 'hallohr': {},
|
|
|
- 'halloreundo': {},
|
|
|
- 'hallowagtaillink': {},
|
|
|
- 'hallorequireparagraphs': {}
|
|
|
+ halloformat: {},
|
|
|
+ halloheadings: {formatBlocks: ['p', 'h2', 'h3', 'h4', 'h5']},
|
|
|
+ hallolists: {},
|
|
|
+ hallohr: {},
|
|
|
+ halloreundo: {},
|
|
|
+ hallowagtaillink: {},
|
|
|
+ hallorequireparagraphs: {}
|
|
|
};
|
|
|
|
|
|
function registerHalloPlugin(name, opts) {
|
|
@@ -75,7 +75,7 @@ function initDateChooser(id) {
|
|
|
$('#' + id).datetimepicker({
|
|
|
timepicker: false,
|
|
|
scrollInput:false,
|
|
|
- format: 'Y-m-d',
|
|
|
+ format: 'Y-m-d'
|
|
|
});
|
|
|
}
|
|
|
}
|
|
@@ -95,7 +95,7 @@ function initTimeChooser(id) {
|
|
|
} else {
|
|
|
$('#' + id).datetimepicker({
|
|
|
datepicker: false,
|
|
|
- format: 'H:i',
|
|
|
+ format: 'H:i'
|
|
|
});
|
|
|
}
|
|
|
}
|
|
@@ -113,7 +113,7 @@ function initDateTimeChooser(id) {
|
|
|
});
|
|
|
} else {
|
|
|
$('#' + id).datetimepicker({
|
|
|
- format: 'Y-m-d H:i',
|
|
|
+ format: 'Y-m-d H:i'
|
|
|
});
|
|
|
}
|
|
|
}
|
|
@@ -137,7 +137,7 @@ function InlinePanel(opts) {
|
|
|
var self = {};
|
|
|
|
|
|
self.setHasContent = function() {
|
|
|
- if ($('> li', self.formsUl).not(".deleted").length) {
|
|
|
+ if ($('> li', self.formsUl).not('.deleted').length) {
|
|
|
self.formsUl.parent().removeClass('empty');
|
|
|
} else {
|
|
|
self.formsUl.parent().addClass('empty');
|
|
@@ -159,6 +159,7 @@ function InlinePanel(opts) {
|
|
|
self.setHasContent();
|
|
|
});
|
|
|
});
|
|
|
+
|
|
|
if (opts.canOrder) {
|
|
|
$('#' + prefix + '-move-up').click(function() {
|
|
|
var currentChild = $('#' + childId);
|
|
@@ -206,12 +207,13 @@ function InlinePanel(opts) {
|
|
|
/* Hide container on page load if it is marked as deleted. Remove the error
|
|
|
message so that it doesn't count towards the number of errors on the tab at the
|
|
|
top of the page. */
|
|
|
- if ($('#' + deleteInputId).val() === "1") {
|
|
|
+ if ($('#' + deleteInputId).val() === '1') {
|
|
|
$('#' + childId).addClass('deleted').hide(0, function() {
|
|
|
self.updateMoveButtonDisabledStates();
|
|
|
self.setHasContent();
|
|
|
});
|
|
|
- $('#' + childId).find(".error-message").remove();
|
|
|
+
|
|
|
+ $('#' + childId).find('.error-message').remove();
|
|
|
}
|
|
|
};
|
|
|
|
|
@@ -247,6 +249,7 @@ function InlinePanel(opts) {
|
|
|
parent.removeClass('moving').removeAttr('style');
|
|
|
children.removeClass('moving').removeAttr('style');
|
|
|
});
|
|
|
+
|
|
|
item2.animate({
|
|
|
top:item1.position().top
|
|
|
}, 200, function() {
|
|
@@ -279,7 +282,7 @@ function cleanForSlug(val, useURLify) {
|
|
|
if (URLify != undefined && useURLify !== false) { // Check to be sure that URLify function exists, and that we want to use it.
|
|
|
return URLify(val, val.length);
|
|
|
} else { // If not just do the "replace"
|
|
|
- return val.replace(/\s/g, "-").replace(/[^A-Za-z0-9\-]/g, "").toLowerCase();
|
|
|
+ return val.replace(/\s/g, '-').replace(/[^A-Za-z0-9\-]/g, '').toLowerCase();
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -288,6 +291,7 @@ function initSlugAutoPopulate() {
|
|
|
$('#id_slug').data('previous-val', $('#id_slug').val());
|
|
|
$(this).data('previous-val', $(this).val());
|
|
|
});
|
|
|
+
|
|
|
$('#id_title').on('keyup keydown keypress blur', function() {
|
|
|
if ($('body').hasClass('create') || (!$('#id_slug').data('previous-val').length || cleanForSlug($('#id_title').data('previous-val')) === $('#id_slug').data('previous-val'))) {
|
|
|
// only update slug if the page is being created from scratch, if slug is completely blank, or if title and slug prior to typing were identical
|
|
@@ -324,20 +328,20 @@ function initErrorDetection() {
|
|
|
}
|
|
|
|
|
|
function initCollapsibleBlocks() {
|
|
|
- $(".object.multi-field.collapsible").each(function() {
|
|
|
+ $('.object.multi-field.collapsible').each(function() {
|
|
|
var $li = $(this);
|
|
|
- var $fieldset = $li.find("fieldset");
|
|
|
- if ($li.hasClass("collapsed")) {
|
|
|
+ var $fieldset = $li.find('fieldset');
|
|
|
+ if ($li.hasClass('collapsed')) {
|
|
|
$fieldset.hide();
|
|
|
}
|
|
|
|
|
|
- $li.find("h2").click(function() {
|
|
|
- if (!$li.hasClass("collapsed")) {
|
|
|
- $li.addClass("collapsed");
|
|
|
- $fieldset.hide("slow");
|
|
|
+ $li.find('h2').click(function() {
|
|
|
+ if (!$li.hasClass('collapsed')) {
|
|
|
+ $li.addClass('collapsed');
|
|
|
+ $fieldset.hide('slow');
|
|
|
} else {
|
|
|
- $li.removeClass("collapsed");
|
|
|
- $fieldset.show("show");
|
|
|
+ $li.removeClass('collapsed');
|
|
|
+ $fieldset.show('show');
|
|
|
}
|
|
|
});
|
|
|
});
|
|
@@ -378,7 +382,7 @@ $(function() {
|
|
|
var previewDoc = previewWindow.document;
|
|
|
|
|
|
$.ajax({
|
|
|
- type: "POST",
|
|
|
+ type: 'POST',
|
|
|
url: $this.data('action'),
|
|
|
data: $('#page-edit-form').serialize(),
|
|
|
success: function(data, textStatus, request) {
|
|
@@ -388,7 +392,7 @@ $(function() {
|
|
|
|
|
|
frame = frame.contentWindow || frame.contentDocument.document || frame.contentDocument;
|
|
|
frame.document.open();
|
|
|
- frame.document.write(data);
|
|
|
+ frame.document.write(data);
|
|
|
frame.document.close();
|
|
|
|
|
|
var hideTimeout = setTimeout(function() {
|
|
@@ -396,10 +400,10 @@ $(function() {
|
|
|
clearTimeout(hideTimeout);
|
|
|
})
|
|
|
|
|
|
- // just enough to give effect without adding discernible slowness
|
|
|
+ // just enough to give effect without adding discernible slowness
|
|
|
} else {
|
|
|
previewDoc.open();
|
|
|
- previewDoc.write(data);
|
|
|
+ previewDoc.write(data);
|
|
|
previewDoc.close()
|
|
|
}
|
|
|
|
|
@@ -410,6 +414,7 @@ $(function() {
|
|
|
document.close();
|
|
|
}
|
|
|
},
|
|
|
+
|
|
|
error: function(xhr, textStatus, errorThrown) {
|
|
|
/* If an error occurs, display it in the preview window so that
|
|
|
we aren't just showing the spinner forever. We preserve the original
|
|
@@ -424,6 +429,6 @@ $(function() {
|
|
|
});
|
|
|
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
});
|
|
|
});
|