kopia lustrzana https://github.com/wagtail/wagtail
fixed all linter errors... ignored modal js
rodzic
3319d87195
commit
d28e9ab3d6
wagtail
wagtailadmin
templates/wagtailadmin/chooser
wagtaildocs/static/wagtaildocs/js
hallo-plugins
wagtailembeds/static/wagtailembeds/js/hallo-plugins
wagtailforms/static/wagtailforms/js
wagtailimages
static/wagtailimages/js
templates/wagtailimages/chooser
wagtailsearch/templates/wagtailsearch/queries
wagtailsnippets
static/wagtailsnippets/js
templates/wagtailsnippets/chooser
22
.jscsrc
22
.jscsrc
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"validateIndentation": 4,
|
||||
"safeContextKeyword": ["_this", "widget"],
|
||||
"safeContextKeyword": ["_this", "widget", "jcropapi"],
|
||||
"requireSpaceBeforeKeywords": [
|
||||
"else",
|
||||
"while",
|
||||
|
@ -13,8 +13,24 @@
|
|||
"**/vendor/**/*.js",
|
||||
"./wagtail/wagtailadmin/templates/wagtailadmin/edit_handlers/inline_panel.js",
|
||||
"./wagtail/wagtailsearch/templates/wagtailsearch/editorspicks/includes/editorspicks_formset.js",
|
||||
"./wagtail/wagtailusers/templates/wagtailusers/groups/includes/page_permissions_formset.js"
|
||||
"./wagtail/wagtailusers/templates/wagtailusers/groups/includes/page_permissions_formset.js",
|
||||
"./wagtail/wagtailsnippets/templates/wagtailsnippets/chooser/chosen.js",
|
||||
"./wagtail/wagtailimages/templates/wagtailimages/chooser/image_chosen.js",
|
||||
"./wagtail/wagtailimages/templates/wagtailimages/chooser/chooser.js",
|
||||
"./wagtail/wagtailsearch/templates/wagtailsearch/queries/chooser/chooser.js",
|
||||
"./wagtail/wagtailimages/templates/wagtailimages/chooser/select_format.js",
|
||||
"./wagtail/wagtailembeds/templates/wagtailembeds/chooser/embed_chosen.js",
|
||||
"./wagtail/wagtailembeds/templates/wagtailembeds/chooser/chooser.js",
|
||||
"./wagtail/wagtaildocs/templates/wagtaildocs/chooser/chooser.js",
|
||||
"./wagtail/wagtaildocs/templates/wagtaildocs/chooser/document_chosen.js",
|
||||
"./wagtail/wagtailadmin/templates/wagtailadmin/page_privacy/set_privacy.js",
|
||||
"./wagtail/wagtailadmin/templates/wagtailadmin/chooser/external_link_chosen.js",
|
||||
"./wagtail/wagtailadmin/templates/wagtailadmin/chooser/external_link.js",
|
||||
"./wagtail/wagtailadmin/templates/wagtailadmin/chooser/email_link.js",
|
||||
"./wagtail/wagtailadmin/templates/wagtailadmin/chooser/browse.js",
|
||||
"./wagtail/wagtailadmin/templates/wagtailadmin/page_privacy/set_privacy_done.js"
|
||||
],
|
||||
"fileExtensions": [".js"],
|
||||
"preset":"airbnb"
|
||||
"preset":"airbnb",
|
||||
"requireCamelCaseOrUpperCaseIdentifiers": "ignoreProperties"
|
||||
}
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
|
||||
return function(elementPrefix) {
|
||||
var sequence = Sequence({
|
||||
'prefix': elementPrefix,
|
||||
'onInitializeMember': function(sequenceMember) {
|
||||
prefix: elementPrefix,
|
||||
onInitializeMember: function(sequenceMember) {
|
||||
/* initialize child block's JS behaviour */
|
||||
if (opts.childInitializer) {
|
||||
opts.childInitializer(sequenceMember.prefix + '-value');
|
||||
|
@ -24,20 +24,25 @@
|
|||
$('#' + sequenceMember.prefix + '-moveup').click(function() {
|
||||
sequenceMember.moveUp();
|
||||
});
|
||||
|
||||
$('#' + sequenceMember.prefix + '-movedown').click(function() {
|
||||
sequenceMember.moveDown();
|
||||
});
|
||||
},
|
||||
'onEnableMoveUp': function(sequenceMember) {
|
||||
|
||||
onEnableMoveUp: function(sequenceMember) {
|
||||
$('#' + sequenceMember.prefix + '-moveup').removeClass('disabled');
|
||||
},
|
||||
'onDisableMoveUp': function(sequenceMember) {
|
||||
|
||||
onDisableMoveUp: function(sequenceMember) {
|
||||
$('#' + sequenceMember.prefix + '-moveup').addClass('disabled');
|
||||
},
|
||||
'onEnableMoveDown': function(sequenceMember) {
|
||||
|
||||
onEnableMoveDown: function(sequenceMember) {
|
||||
$('#' + sequenceMember.prefix + '-movedown').removeClass('disabled');
|
||||
},
|
||||
'onDisableMoveDown': function(sequenceMember) {
|
||||
|
||||
onDisableMoveDown: function(sequenceMember) {
|
||||
$('#' + sequenceMember.prefix + '-movedown').addClass('disabled');
|
||||
}
|
||||
});
|
||||
|
|
|
@ -4,7 +4,7 @@ Operations on a sequence of items, common to both ListBlock and StreamBlock.
|
|||
|
||||
These assume the presence of a container element named "{prefix}-container" for each list item, and
|
||||
certain hidden fields such as "{prefix}-deleted" as defined in sequence_member.html, but make no assumptions
|
||||
about layout or visible controls within the block.
|
||||
about layout or visible controls within the block.
|
||||
|
||||
For example, they don't assume the presence of a 'delete' button - it's up to the specific subclass
|
||||
(list.js / stream.js) to attach this to the SequenceMember.delete method.
|
||||
|
@ -23,24 +23,30 @@ CODE FOR SETTING UP SPECIFIC UI WIDGETS, SUCH AS DELETE BUTTONS OR MENUS, DOES N
|
|||
self.delete = function() {
|
||||
sequence.deleteMember(self);
|
||||
};
|
||||
|
||||
self.prependMember = function(template) {
|
||||
sequence.insertMemberBefore(self, template);
|
||||
};
|
||||
|
||||
self.appendMember = function(template) {
|
||||
sequence.insertMemberAfter(self, template);
|
||||
};
|
||||
|
||||
self.moveUp = function() {
|
||||
sequence.moveMemberUp(self);
|
||||
};
|
||||
|
||||
self.moveDown = function() {
|
||||
sequence.moveMemberDown(self);
|
||||
};
|
||||
|
||||
self._markDeleted = function() {
|
||||
/* set this list member's hidden 'deleted' flag to true */
|
||||
$('#' + self.prefix + '-deleted').val('1');
|
||||
/* hide the list item */
|
||||
self.container.fadeOut();
|
||||
};
|
||||
|
||||
self._markAdded = function() {
|
||||
self.container.hide();
|
||||
self.container.slideDown();
|
||||
|
@ -50,15 +56,18 @@ CODE FOR SETTING UP SPECIFIC UI WIDGETS, SUCH AS DELETE BUTTONS OR MENUS, DOES N
|
|||
$('.input input,.input textarea,.input .richtext', self.container).first().focus();
|
||||
}, 250);
|
||||
};
|
||||
|
||||
self.getIndex = function() {
|
||||
return parseInt(indexField.val(), 10);
|
||||
};
|
||||
|
||||
self.setIndex = function(i) {
|
||||
indexField.val(i);
|
||||
};
|
||||
|
||||
return self;
|
||||
};
|
||||
|
||||
window.Sequence = function(opts) {
|
||||
var self = {};
|
||||
var list = $('#' + opts.prefix + '-list');
|
||||
|
|
|
@ -21,12 +21,15 @@
|
|||
self.inner.animate({height: self.blocklist.outerHeight()}, 250, 'swing', function() {
|
||||
$(this).height('auto');
|
||||
});
|
||||
|
||||
self.container.removeClass('stream-menu-closed');
|
||||
};
|
||||
|
||||
self.hide = function() {
|
||||
self.inner.animate({height: 0}, 250)
|
||||
self.container.addClass('stream-menu-closed');
|
||||
};
|
||||
|
||||
self.toggle = function() {
|
||||
if (self.container.hasClass('stream-menu-closed')) {
|
||||
self.show();
|
||||
|
@ -67,8 +70,8 @@
|
|||
|
||||
return function(elementPrefix) {
|
||||
var sequence = Sequence({
|
||||
'prefix': elementPrefix,
|
||||
'onInitializeMember': function(sequenceMember) {
|
||||
prefix: elementPrefix,
|
||||
onInitializeMember: function(sequenceMember) {
|
||||
/* initialize child block's JS behaviour */
|
||||
var blockTypeName = $('#' + sequenceMember.prefix + '-type').val();
|
||||
var blockOpts = childBlocksByName[blockTypeName];
|
||||
|
@ -81,43 +84,49 @@
|
|||
$('#' + sequenceMember.prefix + '-delete').click(function() {
|
||||
sequenceMember.delete();
|
||||
});
|
||||
|
||||
/* initialise move up/down buttons */
|
||||
$('#' + sequenceMember.prefix + '-moveup').click(function() {
|
||||
sequenceMember.moveUp();
|
||||
});
|
||||
|
||||
$('#' + sequenceMember.prefix + '-movedown').click(function() {
|
||||
sequenceMember.moveDown();
|
||||
});
|
||||
|
||||
/* Set up the 'append a block' menu that appears after the block */
|
||||
StreamBlockMenu({
|
||||
'childBlocks': opts.childBlocks,
|
||||
'id': sequenceMember.prefix + '-appendmenu',
|
||||
'onChooseBlock': function(childBlock) {
|
||||
childBlocks: opts.childBlocks,
|
||||
id: sequenceMember.prefix + '-appendmenu',
|
||||
onChooseBlock: function(childBlock) {
|
||||
var template = listMemberTemplates[childBlock.name];
|
||||
sequenceMember.appendMember(template);
|
||||
}
|
||||
});
|
||||
},
|
||||
'onEnableMoveUp': function(sequenceMember) {
|
||||
|
||||
onEnableMoveUp: function(sequenceMember) {
|
||||
$('#' + sequenceMember.prefix + '-moveup').removeClass('disabled');
|
||||
},
|
||||
'onDisableMoveUp': function(sequenceMember) {
|
||||
|
||||
onDisableMoveUp: function(sequenceMember) {
|
||||
$('#' + sequenceMember.prefix + '-moveup').addClass('disabled');
|
||||
},
|
||||
'onEnableMoveDown': function(sequenceMember) {
|
||||
|
||||
onEnableMoveDown: function(sequenceMember) {
|
||||
$('#' + sequenceMember.prefix + '-movedown').removeClass('disabled');
|
||||
},
|
||||
'onDisableMoveDown': function(sequenceMember) {
|
||||
|
||||
onDisableMoveDown: function(sequenceMember) {
|
||||
$('#' + sequenceMember.prefix + '-movedown').addClass('disabled');
|
||||
}
|
||||
});
|
||||
|
||||
/* Set up the 'prepend a block' menu that appears above the first block in the sequence */
|
||||
StreamBlockMenu({
|
||||
'childBlocks': opts.childBlocks,
|
||||
'id': elementPrefix + '-prependmenu',
|
||||
'onChooseBlock': function(childBlock) {
|
||||
childBlocks: opts.childBlocks,
|
||||
id: elementPrefix + '-prependmenu',
|
||||
onChooseBlock: function(childBlock) {
|
||||
var template = listMemberTemplates[childBlock.name];
|
||||
sequence.insertMemberAtStart(template);
|
||||
}
|
||||
|
|
|
@ -29,7 +29,9 @@ $(function() {
|
|||
var footerHeight = $('.footer', $(this)).height();
|
||||
});
|
||||
};
|
||||
|
||||
fitNav();
|
||||
|
||||
$(window).resize(function() {
|
||||
fitNav();
|
||||
});
|
||||
|
@ -44,6 +46,7 @@ $(function() {
|
|||
$(this).closest('fieldset').addClass('focused');
|
||||
$(this).closest('li').addClass('focused');
|
||||
});
|
||||
|
||||
$(document).on('blur mouseout', 'input,textarea,select', function() {
|
||||
$(this).closest('.field').removeClass('focused');
|
||||
$(this).closest('fieldset').removeClass('focused');
|
||||
|
@ -55,6 +58,7 @@ $(function() {
|
|||
e.preventDefault();
|
||||
$(this).tab('show');
|
||||
});
|
||||
|
||||
$(document).on('click', '.tab-toggle', function(e) {
|
||||
e.preventDefault();
|
||||
$('.tab-nav a[href="' + $(this).attr('href') + '"]').click();
|
||||
|
@ -84,8 +88,8 @@ $(function() {
|
|||
|
||||
/* Header search behaviour */
|
||||
if (window.headerSearch) {
|
||||
var search_current_index = 0;
|
||||
var search_next_index = 0;
|
||||
var searchCurrentIndex = 0;
|
||||
var searchNextIndex = 0;
|
||||
|
||||
$(window.headerSearch.termInput).on('input', function() {
|
||||
clearTimeout($.data(this, 'timer'));
|
||||
|
@ -97,21 +101,22 @@ $(function() {
|
|||
$(window.headerSearch.termInput).trigger('focus');
|
||||
|
||||
function search() {
|
||||
var workingClasses = "icon-spinner";
|
||||
var workingClasses = 'icon-spinner';
|
||||
|
||||
$(window.headerSearch.termInput).parent().addClass(workingClasses);
|
||||
search_next_index++;
|
||||
var index = search_next_index;
|
||||
searchNextIndex++;
|
||||
var index = searchNextIndex;
|
||||
$.ajax({
|
||||
url: window.headerSearch.url,
|
||||
data: {q: $(window.headerSearch.termInput).val()},
|
||||
success: function(data, status) {
|
||||
if (index > search_current_index) {
|
||||
search_current_index = index;
|
||||
if (index > searchCurrentIndex) {
|
||||
searchCurrentIndex = index;
|
||||
$(window.headerSearch.targetOutput).html(data).slideDown(800);
|
||||
window.history.pushState(null, "Search results", "?q=" + $(window.headerSearch.termInput).val());
|
||||
window.history.pushState(null, 'Search results', '?q=' + $(window.headerSearch.termInput).val());
|
||||
}
|
||||
},
|
||||
|
||||
complete: function() {
|
||||
$(window.headerSearch.termInput).parent().removeClass(workingClasses);
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ $(function() {
|
|||
// Dynamically load menu on request.
|
||||
$(document).on('click', '.dl-trigger', function() {
|
||||
var $this = $(this);
|
||||
|
||||
|
||||
// Close all submenus
|
||||
$('.nav-main .submenu-active, .nav-wrapper').removeClass('submenu-active');
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// Generated by CoffeeScript 1.6.2
|
||||
(function() {
|
||||
(function(jQuery) {
|
||||
return jQuery.widget("IKS.hallohr", {
|
||||
return jQuery.widget('IKS.hallohr', {
|
||||
options: {
|
||||
editable: null,
|
||||
toolbar: null,
|
||||
|
@ -11,14 +11,14 @@
|
|||
populateToolbar: function(toolbar) {
|
||||
var buttonElement, buttonset;
|
||||
|
||||
buttonset = jQuery("<span class=\"" + this.widgetName + "\"></span>");
|
||||
buttonset = jQuery('<span class="' + this.widgetName + '"></span>');
|
||||
buttonElement = jQuery('<span></span>');
|
||||
buttonElement.hallobutton({
|
||||
uuid: this.options.uuid,
|
||||
editable: this.options.editable,
|
||||
label: "Horizontal rule",
|
||||
command: "insertHorizontalRule",
|
||||
icon: "icon-horizontalrule",
|
||||
label: 'Horizontal rule',
|
||||
command: 'insertHorizontalRule',
|
||||
icon: 'icon-horizontalrule',
|
||||
cssClass: this.options.buttonCssClass
|
||||
});
|
||||
buttonset.append(buttonElement);
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
(function() {
|
||||
(function(jQuery) {
|
||||
return jQuery.widget("IKS.hallorequireparagraphs", {
|
||||
return jQuery.widget('IKS.hallorequireparagraphs', {
|
||||
options: {
|
||||
editable: null,
|
||||
uuid: '',
|
||||
blockElements: ["dd", "div", "dl", "figure", "form", "ul", "ol", "table", "p", "h1", "h2", "h3", "h4", "h5", "h6"]
|
||||
blockElements: ['dd', 'div', 'dl', 'figure', 'form', 'ul', 'ol', 'table', 'p', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6']
|
||||
},
|
||||
cleanupContentClone: function(el) {
|
||||
// if the editable element contains no block-level elements wrap the contents in a <P>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// Generated by CoffeeScript 1.6.2
|
||||
(function() {
|
||||
(function($) {
|
||||
return $.widget("IKS.hallowagtaillink", {
|
||||
return $.widget('IKS.hallowagtaillink', {
|
||||
options: {
|
||||
uuid: '',
|
||||
editable: null
|
||||
|
@ -16,6 +16,7 @@
|
|||
node = widget.options.editable.getSelection().commonAncestorContainer;
|
||||
return $(node).parents('a').get(0);
|
||||
};
|
||||
|
||||
button = $('<span></span>');
|
||||
button.hallobutton({
|
||||
uuid: this.options.uuid,
|
||||
|
@ -27,8 +28,9 @@
|
|||
return button.hallobutton('checked', !!getEnclosingLink());
|
||||
}
|
||||
});
|
||||
|
||||
toolbar.append(button);
|
||||
return button.on("click", function(event) {
|
||||
return button.on('click', function(event) {
|
||||
var enclosingLink, lastSelection, url;
|
||||
|
||||
enclosingLink = getEnclosingLink();
|
||||
|
|
|
@ -18,7 +18,7 @@ function ModalWorkflow(opts) {
|
|||
|
||||
// set default contents of container
|
||||
var container = $('<div class="modal fade" tabindex="-1" role="dialog" aria-hidden="true">\n <div class="modal-dialog">\n <div class="modal-content">\n <button type="button" class="close icon text-replace icon-cross" data-dismiss="modal" aria-hidden="true">×</button>\n <div class="modal-body"></div>\n </div><!-- /.modal-content -->\n </div><!-- /.modal-dialog -->\n</div>');
|
||||
|
||||
|
||||
// add container to body and hide it, so content can be added to it before display
|
||||
$('body').append(container);
|
||||
container.modal('hide');
|
||||
|
|
|
@ -11,10 +11,10 @@ function createPageChooser(id, pageType, openAtParentId) {
|
|||
}
|
||||
|
||||
ModalWorkflow({
|
||||
'url': initialUrl,
|
||||
'urlParams': {'page_type': pageType},
|
||||
'responses': {
|
||||
'pageChosen': function(pageData) {
|
||||
url: initialUrl,
|
||||
urlParams: { page_type: pageType },
|
||||
responses: {
|
||||
pageChosen: function(pageData) {
|
||||
input.val(pageData.id);
|
||||
openAtParentId = pageData.parentId;
|
||||
pageTitle.text(pageData.title);
|
||||
|
|
|
@ -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() {
|
|||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
});
|
||||
|
|
|
@ -2,9 +2,9 @@ $(function() {
|
|||
/* Interface to set permissions from the explorer / editor */
|
||||
$('a.action-set-privacy').click(function() {
|
||||
ModalWorkflow({
|
||||
'url': this.href,
|
||||
'responses': {
|
||||
'setPermission': function(isPublic) {
|
||||
url: this.href,
|
||||
responses: {
|
||||
setPermission: function(isPublic) {
|
||||
if (isPublic) {
|
||||
$('.privacy-indicator').removeClass('private').addClass('public');
|
||||
} else {
|
||||
|
|
|
@ -3,7 +3,7 @@ $(function() {
|
|||
|
||||
$('.nav-main .submenu-trigger').on('click', function() {
|
||||
if ($(this).closest('li').find('.nav-submenu').length) {
|
||||
|
||||
|
||||
// Close explorer menu, although it may not be instantiated yet
|
||||
if ($explorer.data('dlmenu') && $explorer.dlmenu('isOpen')) {
|
||||
$explorer.dlmenu('closeMenu');
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
"use strict";
|
||||
'use strict';
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
var body = document.querySelectorAll('body')[0];
|
||||
var nav = document.querySelectorAll('nav')[0];
|
||||
var className = 'ready';
|
||||
var has_pm = window.postMessage;
|
||||
var hasPostMessage = window.postMessage;
|
||||
|
||||
if (has_pm) {
|
||||
parent.postMessage("fh=" + nav.offsetHeight, '*');
|
||||
if (hasPostMessage) {
|
||||
parent.postMessage('fh=' + nav.offsetHeight, '*');
|
||||
}
|
||||
|
||||
if (body.classList) {
|
||||
|
|
|
@ -1,18 +1,22 @@
|
|||
(function(w, d) {
|
||||
"use strict";
|
||||
'use strict';
|
||||
|
||||
var l, f, t, frame_height;
|
||||
var l, f, t, frameHeight;
|
||||
|
||||
function callback(e) {
|
||||
var h;
|
||||
if (e.origin !== w.wagtail.userbar.origin) {return;};
|
||||
if (e.origin !== w.wagtail.userbar.origin) {
|
||||
return;
|
||||
};
|
||||
|
||||
// Get the height from the passed data.
|
||||
try {
|
||||
h = Number(e.data.replace(/.*fh=(\d+)(?:&|$)/, '$1'));
|
||||
if (!isNaN(h) && h > 0 && h !== frame_height) {
|
||||
|
||||
// TODO: frameHeight is always undefined
|
||||
if (!isNaN(h) && h > 0 && h !== frameHeight) {
|
||||
f.style.opacity = 1;
|
||||
f.style.height = h + "px";
|
||||
f.style.height = h + 'px';
|
||||
}
|
||||
} catch (e) {}
|
||||
}
|
||||
|
@ -27,14 +31,14 @@
|
|||
}
|
||||
}
|
||||
|
||||
l = d.createElement('link');
|
||||
l = d.createElement('link');
|
||||
l.rel = 'stylesheet';
|
||||
l.href = w.wagtail.static_root + 'scss/userbar_embed.css';
|
||||
|
||||
f = d.createElement('iframe');
|
||||
f.id = 'wagtail-userbar';
|
||||
f.frameborder = '0';
|
||||
f.allowtransparency = 'true';
|
||||
f.id = 'wagtail-userbar';
|
||||
f.frameborder = '0';
|
||||
f.allowtransparency = 'true';
|
||||
f.scrolling = 'no';
|
||||
f.src = w.wagtail.userbar.src;
|
||||
|
||||
|
@ -43,7 +47,7 @@
|
|||
f.style.opacity = 0;
|
||||
}
|
||||
|
||||
t = d.getElementsByTagName('title')[0];
|
||||
t = d.getElementsByTagName('title')[0];
|
||||
t.parentNode.insertBefore(l, t.nextSibling);
|
||||
d.body.appendChild(f);
|
||||
}(window, document));
|
||||
|
|
|
@ -5,7 +5,10 @@ var searchUrl = $('form.search-form', modal.body).attr('action');
|
|||
function search() {
|
||||
$.ajax({
|
||||
url: searchUrl,
|
||||
data: {q: $('#id_q', modal.body).val(), 'results_only': true},
|
||||
data: {
|
||||
q: $('#id_q', modal.body).val(),
|
||||
results_only: true
|
||||
},
|
||||
success: function(data, status) {
|
||||
$('.page-results', modal.body).html(data);
|
||||
ajaxifySearchResults();
|
||||
|
|
|
@ -6,9 +6,9 @@ function createDocumentChooser(id) {
|
|||
|
||||
$('.action-choose', chooserElement).click(function() {
|
||||
ModalWorkflow({
|
||||
'url': window.chooserUrls.documentChooser,
|
||||
'responses': {
|
||||
'documentChosen': function(docData) {
|
||||
url: window.chooserUrls.documentChooser,
|
||||
responses: {
|
||||
documentChosen: function(docData) {
|
||||
input.val(docData.id);
|
||||
docTitle.text(docData.title);
|
||||
chooserElement.removeClass('blank');
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// Generated by CoffeeScript 1.6.2
|
||||
(function() {
|
||||
(function($) {
|
||||
return $.widget("IKS.hallowagtaildoclink", {
|
||||
return $.widget('IKS.hallowagtaildoclink', {
|
||||
options: {
|
||||
uuid: '',
|
||||
editable: null
|
||||
|
@ -19,7 +19,7 @@
|
|||
command: null
|
||||
});
|
||||
toolbar.append(button);
|
||||
return button.on("click", function(event) {
|
||||
return button.on('click', function(event) {
|
||||
var lastSelection;
|
||||
|
||||
lastSelection = widget.options.editable.getSelection();
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// Generated by CoffeeScript 1.6.2
|
||||
(function() {
|
||||
(function($) {
|
||||
return $.widget("IKS.hallowagtailembeds", {
|
||||
return $.widget('IKS.hallowagtailembeds', {
|
||||
options: {
|
||||
uuid: '',
|
||||
editable: null
|
||||
|
@ -18,12 +18,15 @@
|
|||
icon: 'icon-media',
|
||||
command: null
|
||||
});
|
||||
|
||||
toolbar.append(button);
|
||||
return button.on("click", function(event) {
|
||||
|
||||
return button.on('click', function(event) {
|
||||
var insertionPoint, lastSelection;
|
||||
|
||||
lastSelection = widget.options.editable.getSelection();
|
||||
insertionPoint = $(lastSelection.endContainer).parentsUntil('.richtext').last();
|
||||
|
||||
return ModalWorkflow({
|
||||
url: window.chooserUrls.embedsChooser,
|
||||
responses: {
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
$(function() {
|
||||
|
||||
|
||||
});
|
||||
|
|
|
@ -40,10 +40,12 @@ $(function() {
|
|||
data.context.find('.left').each(function(index, elm) {
|
||||
$(elm).append(data.files[index].name);
|
||||
});
|
||||
|
||||
data.context.find('.preview .thumb').each(function(index, elm) {
|
||||
$(elm).addClass('hasthumb')
|
||||
$(elm).append(data.files[index].preview);
|
||||
});
|
||||
|
||||
}).done(function() {
|
||||
data.context.find('.start').prop('disabled', false);
|
||||
if ((that._trigger('added', e, data) !== false) &&
|
||||
|
@ -67,7 +69,7 @@ $(function() {
|
|||
var itemElement = $(data.context);
|
||||
itemElement.removeClass('upload-uploading').addClass('upload-failure');
|
||||
},
|
||||
|
||||
|
||||
progress: function(e, data) {
|
||||
if (e.isDefaultPrevented()) {
|
||||
return false;
|
||||
|
@ -81,7 +83,7 @@ $(function() {
|
|||
).html(progress + '%');
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
progressall: function(e, data) {
|
||||
var progress = parseInt(data.loaded / data.total * 100, 10);
|
||||
$('#overall-progress').addClass('active').attr('aria-valuenow', progress).find('.bar').css(
|
||||
|
@ -93,25 +95,25 @@ $(function() {
|
|||
$('#overall-progress').removeClass('active').find('.bar').css('width', '0%');
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
done: function(e, data) {
|
||||
var itemElement = $(data.context);
|
||||
var response = $.parseJSON(data.result);
|
||||
|
||||
if (response.success) {
|
||||
if (response.success) {
|
||||
itemElement.addClass('upload-success')
|
||||
|
||||
$('.right', itemElement).append(response.form);
|
||||
|
||||
|
||||
// run tagit enhancement
|
||||
$('.tag_field input', itemElement).tagit(window.tagit_opts);
|
||||
} else {
|
||||
itemElement.addClass('upload-failure');
|
||||
$('.right .error_messages', itemElement).append(response.error_message);
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
|
||||
fail: function(e, data) {
|
||||
var itemElement = $(data.context);
|
||||
itemElement.addClass('upload-failure');
|
||||
|
@ -120,10 +122,10 @@ $(function() {
|
|||
always: function(e, data) {
|
||||
var itemElement = $(data.context);
|
||||
itemElement.removeClass('upload-uploading').addClass('upload-complete');
|
||||
},
|
||||
}
|
||||
});
|
||||
|
||||
// ajax-enhance forms added on done()
|
||||
// ajax-enhance forms added on done()
|
||||
$('#upload-list').on('submit', 'form', function(e) {
|
||||
var form = $(this);
|
||||
var itemElement = form.closest('#upload-list > li');
|
||||
|
@ -145,7 +147,7 @@ $(function() {
|
|||
$('#upload-list').on('click', '.delete', function(e) {
|
||||
var form = $(this).closest('form');
|
||||
var itemElement = form.closest('#upload-list > li');
|
||||
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
var CSRFToken = $('input[name="csrfmiddlewaretoken"]', form).val();
|
||||
|
@ -153,8 +155,6 @@ $(function() {
|
|||
$.post(this.href, {csrfmiddlewaretoken: CSRFToken}, function(data) {
|
||||
if (data.success) {
|
||||
itemElement.slideUp(function() {$(this).remove()});
|
||||
} else {
|
||||
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
@ -3,7 +3,7 @@ var jcropapi;
|
|||
function setupJcrop(image, original, focalPointOriginal, fields) {
|
||||
image.Jcrop({
|
||||
trueSize: [original.width, original.height],
|
||||
bgColor: "rgb(192, 192, 192)",
|
||||
bgColor: 'rgb(192, 192, 192)',
|
||||
onSelect: function(box) {
|
||||
var x = Math.floor((box.x + box.x2) / 2);
|
||||
var y = Math.floor((box.y + box.y2) / 2);
|
||||
|
@ -15,12 +15,13 @@ function setupJcrop(image, original, focalPointOriginal, fields) {
|
|||
fields.width.val(w);
|
||||
fields.height.val(h);
|
||||
},
|
||||
|
||||
onRelease: function() {
|
||||
fields.x.val(focalPointOriginal.x);
|
||||
fields.y.val(focalPointOriginal.y);
|
||||
fields.width.val(focalPointOriginal.width);
|
||||
fields.height.val(focalPointOriginal.height);
|
||||
},
|
||||
}
|
||||
}, function() {
|
||||
jcropapi = this
|
||||
});
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// Generated by CoffeeScript 1.6.2
|
||||
(function() {
|
||||
(function($) {
|
||||
return $.widget("IKS.hallowagtailimage", {
|
||||
return $.widget('IKS.hallowagtailimage', {
|
||||
options: {
|
||||
uuid: '',
|
||||
editable: null
|
||||
|
@ -19,7 +19,7 @@
|
|||
command: null
|
||||
});
|
||||
toolbar.append(button);
|
||||
return button.on("click", function(event) {
|
||||
return button.on('click', function(event) {
|
||||
var insertionPoint, lastSelection;
|
||||
|
||||
lastSelection = widget.options.editable.getSelection();
|
||||
|
|
|
@ -6,15 +6,15 @@ function createImageChooser(id) {
|
|||
|
||||
$('.action-choose', chooserElement).click(function() {
|
||||
ModalWorkflow({
|
||||
'url': window.chooserUrls.imageChooser,
|
||||
'responses': {
|
||||
'imageChosen': function(imageData) {
|
||||
url: window.chooserUrls.imageChooser,
|
||||
responses: {
|
||||
imageChosen: function(imageData) {
|
||||
input.val(imageData.id);
|
||||
previewImage.attr({
|
||||
'src': imageData.preview.url,
|
||||
'width': imageData.preview.width,
|
||||
'height': imageData.preview.height,
|
||||
'alt': imageData.title
|
||||
src: imageData.preview.url,
|
||||
width: imageData.preview.width,
|
||||
height: imageData.preview.height,
|
||||
alt: imageData.title
|
||||
});
|
||||
chooserElement.removeClass('blank');
|
||||
editLink.attr('href', imageData.edit_link);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
$(function() {
|
||||
"use strict";
|
||||
'use strict';
|
||||
|
||||
$('.image-url-generator').each(function() {
|
||||
var $this = $(this);
|
||||
|
@ -57,12 +57,12 @@ $(function() {
|
|||
// Fields with width and height
|
||||
$.getJSON(generatorUrl.replace('__filterspec__', filterSpec))
|
||||
.done(function(data) {
|
||||
$result.val(data['url']);
|
||||
$preview.attr('src', data['preview_url']);
|
||||
$result.val(data.url);
|
||||
$preview.attr('src', data.preview_url);
|
||||
$loadingMask.removeClass('loading');
|
||||
})
|
||||
.fail(function(data) {
|
||||
$result.val(data.responseJSON['error']);
|
||||
$result.val(data.responseJSON.error);
|
||||
$preview.attr('src', '');
|
||||
$loadingMask.removeClass('loading');
|
||||
});
|
||||
|
|
|
@ -78,7 +78,7 @@ function(modal) {
|
|||
});
|
||||
|
||||
{% url 'wagtailadmin_tag_autocomplete' as autocomplete_url %}
|
||||
|
||||
|
||||
/* Add tag entry interface (with autocompletion) to the tag field of the image upload form */
|
||||
$('#id_tags', modal.body).tagit({
|
||||
autocomplete: {source: "{{ autocomplete_url|addslashes }}"}
|
||||
|
|
|
@ -6,9 +6,9 @@ function createQueryChooser(id) {
|
|||
var initialUrl = '{% url "wagtailsearch_queries_chooser" %}';
|
||||
|
||||
ModalWorkflow({
|
||||
'url': initialUrl,
|
||||
'responses': {
|
||||
'queryChosen': function(queryData) {
|
||||
url: initialUrl,
|
||||
responses: {
|
||||
queryChosen: function(queryData) {
|
||||
input.val(queryData.querystring);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,9 +6,9 @@ function createSnippetChooser(id, contentType) {
|
|||
|
||||
$('.action-choose', chooserElement).click(function() {
|
||||
ModalWorkflow({
|
||||
'url': window.chooserUrls.snippetChooser + contentType + '/',
|
||||
'responses': {
|
||||
'snippetChosen': function(snippetData) {
|
||||
url: window.chooserUrls.snippetChooser + contentType + '/',
|
||||
responses: {
|
||||
snippetChosen: function(snippetData) {
|
||||
input.val(snippetData.id);
|
||||
docTitle.text(snippetData.string);
|
||||
chooserElement.removeClass('blank');
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
function(modal) {
|
||||
function initModal(modal) {
|
||||
|
||||
var listingUrl = $('#snippet-chooser-list', modal.body).data('url');
|
||||
|
||||
function ajaxifyLinks (context) {
|
||||
function ajaxifyLinks(context) {
|
||||
$('a.snippet-choice', modal.body).click(function() {
|
||||
modal.loadUrl(this.href);
|
||||
return false;
|
||||
});
|
||||
|
||||
$('.pagination a', context).click(function() {
|
||||
var page = this.getAttribute("data-page");
|
||||
var page = this.getAttribute('data-page');
|
||||
setPage(page);
|
||||
return false;
|
||||
});
|
||||
|
@ -19,17 +19,20 @@ function(modal) {
|
|||
|
||||
$.ajax({
|
||||
url: listingUrl,
|
||||
data: {p: page},
|
||||
dataType: "html",
|
||||
data: { p: page },
|
||||
dataType: 'html',
|
||||
success: function(data, status, xhr) {
|
||||
var response = eval('(' + data + ')');
|
||||
$(modal.body).html(response.html);
|
||||
|
||||
if (response.onload) {
|
||||
response.onload(self);
|
||||
}
|
||||
|
||||
ajaxifyLinks($('#snippet-chooser-list'));
|
||||
}
|
||||
});
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue