kopia lustrzana https://github.com/wagtail/wagtail
auto formatted js files
rodzic
d5045a620a
commit
3319d87195
|
@ -9,3 +9,4 @@
|
||||||
/.tox/
|
/.tox/
|
||||||
/venv
|
/venv
|
||||||
/node_modules/
|
/node_modules/
|
||||||
|
npm-debug.log
|
||||||
|
|
|
@ -46,7 +46,7 @@ CODE FOR SETTING UP SPECIFIC UI WIDGETS, SUCH AS DELETE BUTTONS OR MENUS, DOES N
|
||||||
self.container.slideDown();
|
self.container.slideDown();
|
||||||
|
|
||||||
// focus first suitable input found
|
// focus first suitable input found
|
||||||
var timeout = setTimeout(function(){
|
var timeout = setTimeout(function() {
|
||||||
$('.input input,.input textarea,.input .richtext', self.container).first().focus();
|
$('.input input,.input textarea,.input .richtext', self.container).first().focus();
|
||||||
}, 250);
|
}, 250);
|
||||||
};
|
};
|
||||||
|
@ -76,8 +76,10 @@ CODE FOR SETTING UP SPECIFIC UI WIDGETS, SUCH AS DELETE BUTTONS OR MENUS, DOES N
|
||||||
countField.val(newIndex + 1);
|
countField.val(newIndex + 1);
|
||||||
return opts.prefix + '-' + newIndex;
|
return opts.prefix + '-' + newIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
function setInitialMoveUpDownState(newMember) {
|
function setInitialMoveUpDownState(newMember) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function postInsertMember(newMember) {
|
function postInsertMember(newMember) {
|
||||||
/* run any supplied initializer functions */
|
/* run any supplied initializer functions */
|
||||||
if (opts.onInitializeMember) {
|
if (opts.onInitializeMember) {
|
||||||
|
@ -121,6 +123,7 @@ CODE FOR SETTING UP SPECIFIC UI WIDGETS, SUCH AS DELETE BUTTONS OR MENUS, DOES N
|
||||||
for (var i = index; i < members.length; i++) {
|
for (var i = index; i < members.length; i++) {
|
||||||
members[i].setIndex(i + 1);
|
members[i].setIndex(i + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
members.splice(index, 0, newMember);
|
members.splice(index, 0, newMember);
|
||||||
newMember.setIndex(index);
|
newMember.setIndex(index);
|
||||||
|
|
||||||
|
@ -147,6 +150,7 @@ CODE FOR SETTING UP SPECIFIC UI WIDGETS, SUCH AS DELETE BUTTONS OR MENUS, DOES N
|
||||||
for (var i = index; i < members.length; i++) {
|
for (var i = index; i < members.length; i++) {
|
||||||
members[i].setIndex(i + 1);
|
members[i].setIndex(i + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
members.splice(index, 0, newMember);
|
members.splice(index, 0, newMember);
|
||||||
newMember.setIndex(index);
|
newMember.setIndex(index);
|
||||||
|
|
||||||
|
@ -176,6 +180,7 @@ CODE FOR SETTING UP SPECIFIC UI WIDGETS, SUCH AS DELETE BUTTONS OR MENUS, DOES N
|
||||||
for (var i = 0; i < members.length; i++) {
|
for (var i = 0; i < members.length; i++) {
|
||||||
members[i].setIndex(i + 1);
|
members[i].setIndex(i + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
members.unshift(newMember);
|
members.unshift(newMember);
|
||||||
newMember.setIndex(0);
|
newMember.setIndex(0);
|
||||||
|
|
||||||
|
@ -224,6 +229,7 @@ CODE FOR SETTING UP SPECIFIC UI WIDGETS, SUCH AS DELETE BUTTONS OR MENUS, DOES N
|
||||||
/* deleting the first member; the new first member cannot move up now */
|
/* deleting the first member; the new first member cannot move up now */
|
||||||
opts.onDisableMoveUp(members[0]);
|
opts.onDisableMoveUp(members[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (index === members.length && members.length > 0 && opts.onDisableMoveDown) {
|
if (index === members.length && members.length > 0 && opts.onDisableMoveDown) {
|
||||||
/* deleting the last member; the new last member cannot move down now */
|
/* deleting the last member; the new last member cannot move down now */
|
||||||
opts.onDisableMoveDown(members[members.length - 1]);
|
opts.onDisableMoveDown(members[members.length - 1]);
|
||||||
|
@ -252,6 +258,7 @@ CODE FOR SETTING UP SPECIFIC UI WIDGETS, SUCH AS DELETE BUTTONS OR MENUS, DOES N
|
||||||
if (opts.onDisableMoveUp) opts.onDisableMoveUp(member);
|
if (opts.onDisableMoveUp) opts.onDisableMoveUp(member);
|
||||||
if (opts.onEnableMoveUp) opts.onEnableMoveUp(swappedMember);
|
if (opts.onEnableMoveUp) opts.onEnableMoveUp(swappedMember);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (oldIndex === (members.length - 1)) {
|
if (oldIndex === (members.length - 1)) {
|
||||||
/*
|
/*
|
||||||
member was previously the last member, and can now move down;
|
member was previously the last member, and can now move down;
|
||||||
|
@ -285,6 +292,7 @@ CODE FOR SETTING UP SPECIFIC UI WIDGETS, SUCH AS DELETE BUTTONS OR MENUS, DOES N
|
||||||
if (opts.onDisableMoveDown) opts.onDisableMoveDown(member);
|
if (opts.onDisableMoveDown) opts.onDisableMoveDown(member);
|
||||||
if (opts.onEnableMoveDown) opts.onEnableMoveDown(swappedMember);
|
if (opts.onEnableMoveDown) opts.onEnableMoveDown(swappedMember);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (oldIndex === 0) {
|
if (oldIndex === 0) {
|
||||||
/*
|
/*
|
||||||
member was previously the first member, and can now move up;
|
member was previously the first member, and can now move up;
|
||||||
|
|
|
@ -13,22 +13,22 @@
|
||||||
self.inner = $('.stream-menu-inner', self.container);
|
self.inner = $('.stream-menu-inner', self.container);
|
||||||
self.blocklist = $('ul', self.inner);
|
self.blocklist = $('ul', self.inner);
|
||||||
|
|
||||||
if(self.container.hasClass('stream-menu-closed')){
|
if (self.container.hasClass('stream-menu-closed')) {
|
||||||
self.inner.css('height',0);
|
self.inner.css('height', 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
self.show = function(){
|
self.show = function() {
|
||||||
self.inner.animate({height: self.blocklist.outerHeight()}, 250, 'swing', function(){
|
self.inner.animate({height: self.blocklist.outerHeight()}, 250, 'swing', function() {
|
||||||
$(this).height('auto');
|
$(this).height('auto');
|
||||||
});
|
});
|
||||||
self.container.removeClass('stream-menu-closed');
|
self.container.removeClass('stream-menu-closed');
|
||||||
};
|
};
|
||||||
self.hide = function(){
|
self.hide = function() {
|
||||||
self.inner.animate({height: 0}, 250)
|
self.inner.animate({height: 0}, 250)
|
||||||
self.container.addClass('stream-menu-closed');
|
self.container.addClass('stream-menu-closed');
|
||||||
};
|
};
|
||||||
self.toggle = function(){
|
self.toggle = function() {
|
||||||
if(self.container.hasClass('stream-menu-closed')){
|
if (self.container.hasClass('stream-menu-closed')) {
|
||||||
self.show();
|
self.show();
|
||||||
} else {
|
} else {
|
||||||
self.hide();
|
self.hide();
|
||||||
|
@ -36,7 +36,7 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
/* set up show/hide on click behaviour */
|
/* set up show/hide on click behaviour */
|
||||||
self.container.click(function(e){
|
self.container.click(function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
self.toggle();
|
self.toggle();
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,36 +1,36 @@
|
||||||
/* generic function for adding a message to message area through JS alone */
|
/* generic function for adding a message to message area through JS alone */
|
||||||
function addMessage(status,text){
|
function addMessage(status, text) {
|
||||||
$('.messages').addClass('new').empty().append('<ul><li class="' + status + '">' + text + '</li></ul>');
|
$('.messages').addClass('new').empty().append('<ul><li class="' + status + '">' + text + '</li></ul>');
|
||||||
var addMsgTimeout = setTimeout(function(){
|
var addMsgTimeout = setTimeout(function() {
|
||||||
$('.messages').addClass('appear');
|
$('.messages').addClass('appear');
|
||||||
clearTimeout(addMsgTimeout);
|
clearTimeout(addMsgTimeout);
|
||||||
}, 100);
|
}, 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
$(function(){
|
$(function() {
|
||||||
// Add class to the body from which transitions may be hung so they don't appear to transition as the page loads
|
// Add class to the body from which transitions may be hung so they don't appear to transition as the page loads
|
||||||
$('body').addClass('ready');
|
$('body').addClass('ready');
|
||||||
|
|
||||||
// Enable toggle to open/close nav
|
// Enable toggle to open/close nav
|
||||||
$(document).on('click', '#nav-toggle', function(){
|
$(document).on('click', '#nav-toggle', function() {
|
||||||
$('body').toggleClass('nav-open');
|
$('body').toggleClass('nav-open');
|
||||||
if(!$('body').hasClass('nav-open')){
|
if (!$('body').hasClass('nav-open')) {
|
||||||
$('body').addClass('nav-closed');
|
$('body').addClass('nav-closed');
|
||||||
}else{
|
} else {
|
||||||
$('body').removeClass('nav-closed');
|
$('body').removeClass('nav-closed');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Resize nav to fit height of window. This is an unimportant bell/whistle to make it look nice
|
// Resize nav to fit height of window. This is an unimportant bell/whistle to make it look nice
|
||||||
var fitNav = function(){
|
var fitNav = function() {
|
||||||
$('.nav-wrapper').css('min-height',$(window).height());
|
$('.nav-wrapper').css('min-height', $(window).height());
|
||||||
$('.nav-main').each(function(){
|
$('.nav-main').each(function() {
|
||||||
var thisHeight = $(this).height();
|
var thisHeight = $(this).height();
|
||||||
var footerHeight = $('.footer', $(this)).height();
|
var footerHeight = $('.footer', $(this)).height();
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
fitNav();
|
fitNav();
|
||||||
$(window).resize(function(){
|
$(window).resize(function() {
|
||||||
fitNav();
|
fitNav();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -39,28 +39,28 @@ $(function(){
|
||||||
// $('.page-editor textarea').autosize();
|
// $('.page-editor textarea').autosize();
|
||||||
|
|
||||||
// Enable nice focus effects on all fields. This enables help text on hover.
|
// Enable nice focus effects on all fields. This enables help text on hover.
|
||||||
$(document).on('focus mouseover', 'input,textarea,select', function(){
|
$(document).on('focus mouseover', 'input,textarea,select', function() {
|
||||||
$(this).closest('.field').addClass('focused');
|
$(this).closest('.field').addClass('focused');
|
||||||
$(this).closest('fieldset').addClass('focused');
|
$(this).closest('fieldset').addClass('focused');
|
||||||
$(this).closest('li').addClass('focused');
|
$(this).closest('li').addClass('focused');
|
||||||
});
|
});
|
||||||
$(document).on('blur mouseout', 'input,textarea,select', function(){
|
$(document).on('blur mouseout', 'input,textarea,select', function() {
|
||||||
$(this).closest('.field').removeClass('focused');
|
$(this).closest('.field').removeClass('focused');
|
||||||
$(this).closest('fieldset').removeClass('focused');
|
$(this).closest('fieldset').removeClass('focused');
|
||||||
$(this).closest('li').removeClass('focused');
|
$(this).closest('li').removeClass('focused');
|
||||||
});
|
});
|
||||||
|
|
||||||
/* tabs */
|
/* tabs */
|
||||||
$(document).on('click', '.tab-nav a', function (e) {
|
$(document).on('click', '.tab-nav a', function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
$(this).tab('show');
|
$(this).tab('show');
|
||||||
});
|
});
|
||||||
$(document).on('click', '.tab-toggle', function(e){
|
$(document).on('click', '.tab-toggle', function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
$('.tab-nav a[href="'+ $(this).attr('href') +'"]').click();
|
$('.tab-nav a[href="' + $(this).attr('href') + '"]').click();
|
||||||
});
|
});
|
||||||
|
|
||||||
$('.dropdown-toggle').bind('click', function(){
|
$('.dropdown-toggle').bind('click', function() {
|
||||||
$(this).closest('.dropdown').toggleClass('open');
|
$(this).closest('.dropdown').toggleClass('open');
|
||||||
|
|
||||||
// Stop event propagating so the "close all dropdowns on body clicks" code (below) doesn't immediately close the dropdown
|
// Stop event propagating so the "close all dropdowns on body clicks" code (below) doesn't immediately close the dropdown
|
||||||
|
@ -68,22 +68,22 @@ $(function(){
|
||||||
});
|
});
|
||||||
|
|
||||||
/* close all dropdowns on body clicks */
|
/* close all dropdowns on body clicks */
|
||||||
$(document).on('click', function(e){
|
$(document).on('click', function(e) {
|
||||||
var relTarg = e.relatedTarget || e.toElement;
|
var relTarg = e.relatedTarget || e.toElement;
|
||||||
if(!$(relTarg).hasClass('dropdown-toggle')){
|
if (!$(relTarg).hasClass('dropdown-toggle')) {
|
||||||
$('.dropdown').removeClass('open');
|
$('.dropdown').removeClass('open');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
/* Dropzones */
|
/* Dropzones */
|
||||||
$('.drop-zone').on('dragover', function(){
|
$('.drop-zone').on('dragover', function() {
|
||||||
$(this).addClass('hovered');
|
$(this).addClass('hovered');
|
||||||
}).on('dragleave dragend drop', function(){
|
}).on('dragleave dragend drop', function() {
|
||||||
$(this).removeClass('hovered');
|
$(this).removeClass('hovered');
|
||||||
});
|
});
|
||||||
|
|
||||||
/* Header search behaviour */
|
/* Header search behaviour */
|
||||||
if(window.headerSearch){
|
if (window.headerSearch) {
|
||||||
var search_current_index = 0;
|
var search_current_index = 0;
|
||||||
var search_next_index = 0;
|
var search_next_index = 0;
|
||||||
|
|
||||||
|
@ -96,7 +96,7 @@ $(function(){
|
||||||
// auto focus on search box
|
// auto focus on search box
|
||||||
$(window.headerSearch.termInput).trigger('focus');
|
$(window.headerSearch.termInput).trigger('focus');
|
||||||
|
|
||||||
function search () {
|
function search() {
|
||||||
var workingClasses = "icon-spinner";
|
var workingClasses = "icon-spinner";
|
||||||
|
|
||||||
$(window.headerSearch.termInput).parent().addClass(workingClasses);
|
$(window.headerSearch.termInput).parent().addClass(workingClasses);
|
||||||
|
@ -112,7 +112,7 @@ $(function(){
|
||||||
window.history.pushState(null, "Search results", "?q=" + $(window.headerSearch.termInput).val());
|
window.history.pushState(null, "Search results", "?q=" + $(window.headerSearch.termInput).val());
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
complete: function(){
|
complete: function() {
|
||||||
$(window.headerSearch.termInput).parent().removeClass(workingClasses);
|
$(window.headerSearch.termInput).parent().removeClass(workingClasses);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -24,7 +24,6 @@ function buildExpandingFormset(prefix, opts) {
|
||||||
opts.onAdd(formCount);
|
opts.onAdd(formCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
formCount++;
|
formCount++;
|
||||||
totalFormsInput.val(formCount);
|
totalFormsInput.val(formCount);
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,41 +1,42 @@
|
||||||
$(function(){
|
$(function() {
|
||||||
var $explorer = $('#explorer');
|
var $explorer = $('#explorer');
|
||||||
var $body = $('body');
|
var $body = $('body');
|
||||||
|
|
||||||
// Dynamically load menu on request.
|
// Dynamically load menu on request.
|
||||||
$(document).on('click', '.dl-trigger', function(){
|
$(document).on('click', '.dl-trigger', function() {
|
||||||
var $this = $(this);
|
var $this = $(this);
|
||||||
|
|
||||||
// Close all submenus
|
// Close all submenus
|
||||||
$('.nav-main .submenu-active, .nav-wrapper').removeClass('submenu-active');
|
$('.nav-main .submenu-active, .nav-wrapper').removeClass('submenu-active');
|
||||||
|
|
||||||
if($explorer.data('dlmenu') && $explorer.dlmenu('isOpen')){
|
if ($explorer.data('dlmenu') && $explorer.dlmenu('isOpen')) {
|
||||||
// if it's already open, allow the menu plugin to close it
|
// if it's already open, allow the menu plugin to close it
|
||||||
return false;
|
return false;
|
||||||
}else{
|
} else {
|
||||||
if(!$explorer.children().length){
|
if (!$explorer.children().length) {
|
||||||
$this.addClass('icon-spinner');
|
$this.addClass('icon-spinner');
|
||||||
$explorer.load($this.data('explorer-menu-url'), function() {
|
$explorer.load($this.data('explorer-menu-url'), function() {
|
||||||
$this.removeClass('icon-spinner');
|
$this.removeClass('icon-spinner');
|
||||||
|
|
||||||
$explorer.addClass('dl-menuwrapper').dlmenu({
|
$explorer.addClass('dl-menuwrapper').dlmenu({
|
||||||
animationClasses : {
|
animationClasses: {
|
||||||
classin : 'dl-animate-in-2',
|
classin: 'dl-animate-in-2',
|
||||||
classout : 'dl-animate-out-2'
|
classout: 'dl-animate-out-2'
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$explorer.dlmenu('openMenu');
|
$explorer.dlmenu('openMenu');
|
||||||
});
|
});
|
||||||
}else{
|
} else {
|
||||||
$explorer.dlmenu('openMenu');
|
$explorer.dlmenu('openMenu');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
// Close menu on ESC key
|
// Close menu on ESC key
|
||||||
$(document).on('keydown click', function(e){
|
$(document).on('keydown click', function(e) {
|
||||||
if($explorer.data('dlmenu') && $explorer.dlmenu('isOpen') && (e.keyCode == 27 || !e.keyCode)){
|
if ($explorer.data('dlmenu') && $explorer.dlmenu('isOpen') && (e.keyCode == 27 || !e.keyCode)) {
|
||||||
$explorer.dlmenu('closeMenu');
|
$explorer.dlmenu('closeMenu');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,31 +1,31 @@
|
||||||
// Generated by CoffeeScript 1.6.2
|
// Generated by CoffeeScript 1.6.2
|
||||||
(function() {
|
(function() {
|
||||||
(function(jQuery) {
|
(function(jQuery) {
|
||||||
return jQuery.widget("IKS.hallohr", {
|
return jQuery.widget("IKS.hallohr", {
|
||||||
options: {
|
options: {
|
||||||
editable: null,
|
editable: null,
|
||||||
toolbar: null,
|
toolbar: null,
|
||||||
uuid: '',
|
uuid: '',
|
||||||
buttonCssClass: null
|
buttonCssClass: null
|
||||||
},
|
},
|
||||||
populateToolbar: function(toolbar) {
|
populateToolbar: function(toolbar) {
|
||||||
var buttonElement, buttonset;
|
var buttonElement, buttonset;
|
||||||
|
|
||||||
buttonset = jQuery("<span class=\"" + this.widgetName + "\"></span>");
|
buttonset = jQuery("<span class=\"" + this.widgetName + "\"></span>");
|
||||||
buttonElement = jQuery('<span></span>');
|
buttonElement = jQuery('<span></span>');
|
||||||
buttonElement.hallobutton({
|
buttonElement.hallobutton({
|
||||||
uuid: this.options.uuid,
|
uuid: this.options.uuid,
|
||||||
editable: this.options.editable,
|
editable: this.options.editable,
|
||||||
label: "Horizontal rule",
|
label: "Horizontal rule",
|
||||||
command: "insertHorizontalRule",
|
command: "insertHorizontalRule",
|
||||||
icon: "icon-horizontalrule",
|
icon: "icon-horizontalrule",
|
||||||
cssClass: this.options.buttonCssClass
|
cssClass: this.options.buttonCssClass
|
||||||
|
});
|
||||||
|
buttonset.append(buttonElement);
|
||||||
|
buttonset.hallobuttonset();
|
||||||
|
return toolbar.append(buttonset);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
buttonset.append(buttonElement);
|
})(jQuery);
|
||||||
buttonset.hallobuttonset();
|
|
||||||
return toolbar.append(buttonset);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
})(jQuery);
|
|
||||||
|
|
||||||
}).call(this);
|
}).call(this);
|
||||||
|
|
|
@ -1,17 +1,17 @@
|
||||||
(function() {
|
(function() {
|
||||||
(function(jQuery) {
|
(function(jQuery) {
|
||||||
return jQuery.widget("IKS.hallorequireparagraphs", {
|
return jQuery.widget("IKS.hallorequireparagraphs", {
|
||||||
options: {
|
options: {
|
||||||
editable: null,
|
editable: null,
|
||||||
uuid: '',
|
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) {
|
cleanupContentClone: function(el) {
|
||||||
// if the editable element contains no block-level elements wrap the contents in a <P>
|
// if the editable element contains no block-level elements wrap the contents in a <P>
|
||||||
if(el.html().length && !jQuery(this.options.blockElements.toString(), el).length){
|
if (el.html().length && !jQuery(this.options.blockElements.toString(), el).length) {
|
||||||
this.options.editable.execute('formatBlock', 'p');
|
this.options.editable.execute('formatBlock', 'p');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
})(jQuery);
|
})(jQuery);
|
||||||
}).call(this);
|
}).call(this);
|
||||||
|
|
|
@ -1,74 +1,77 @@
|
||||||
// Generated by CoffeeScript 1.6.2
|
// Generated by CoffeeScript 1.6.2
|
||||||
(function() {
|
(function() {
|
||||||
(function($) {
|
(function($) {
|
||||||
return $.widget("IKS.hallowagtaillink", {
|
return $.widget("IKS.hallowagtaillink", {
|
||||||
options: {
|
options: {
|
||||||
uuid: '',
|
uuid: '',
|
||||||
editable: null
|
editable: null
|
||||||
},
|
},
|
||||||
populateToolbar: function(toolbar) {
|
populateToolbar: function(toolbar) {
|
||||||
var button, getEnclosingLink, widget;
|
var button, getEnclosingLink, widget;
|
||||||
|
|
||||||
widget = this;
|
widget = this;
|
||||||
getEnclosingLink = function() {
|
getEnclosingLink = function() {
|
||||||
var node;
|
var node;
|
||||||
|
|
||||||
node = widget.options.editable.getSelection().commonAncestorContainer;
|
node = widget.options.editable.getSelection().commonAncestorContainer;
|
||||||
return $(node).parents('a').get(0);
|
return $(node).parents('a').get(0);
|
||||||
};
|
};
|
||||||
button = $('<span></span>');
|
button = $('<span></span>');
|
||||||
button.hallobutton({
|
button.hallobutton({
|
||||||
uuid: this.options.uuid,
|
uuid: this.options.uuid,
|
||||||
editable: this.options.editable,
|
editable: this.options.editable,
|
||||||
label: 'Links',
|
label: 'Links',
|
||||||
icon: 'icon-link',
|
icon: 'icon-link',
|
||||||
command: null,
|
command: null,
|
||||||
queryState: function(event) {
|
queryState: function(event) {
|
||||||
return button.hallobutton('checked', !!getEnclosingLink());
|
return button.hallobutton('checked', !!getEnclosingLink());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
toolbar.append(button);
|
toolbar.append(button);
|
||||||
return button.on("click", function(event) {
|
return button.on("click", function(event) {
|
||||||
var enclosingLink, lastSelection, url;
|
var enclosingLink, lastSelection, url;
|
||||||
|
|
||||||
enclosingLink = getEnclosingLink();
|
enclosingLink = getEnclosingLink();
|
||||||
if (enclosingLink) {
|
if (enclosingLink) {
|
||||||
$(enclosingLink).replaceWith(enclosingLink.innerHTML);
|
$(enclosingLink).replaceWith(enclosingLink.innerHTML);
|
||||||
button.hallobutton('checked', false);
|
button.hallobutton('checked', false);
|
||||||
return widget.options.editable.element.trigger('change');
|
return widget.options.editable.element.trigger('change');
|
||||||
} else {
|
} else {
|
||||||
lastSelection = widget.options.editable.getSelection();
|
lastSelection = widget.options.editable.getSelection();
|
||||||
if (lastSelection.collapsed) {
|
if (lastSelection.collapsed) {
|
||||||
url = window.chooserUrls.pageChooser + '?allow_external_link=true&allow_email_link=true&prompt_for_link_text=true';
|
url = window.chooserUrls.pageChooser + '?allow_external_link=true&allow_email_link=true&prompt_for_link_text=true';
|
||||||
} else {
|
} else {
|
||||||
url = window.chooserUrls.pageChooser + '?allow_external_link=true&allow_email_link=true';
|
url = window.chooserUrls.pageChooser + '?allow_external_link=true&allow_email_link=true';
|
||||||
|
}
|
||||||
|
|
||||||
|
return ModalWorkflow({
|
||||||
|
url: url,
|
||||||
|
responses: {
|
||||||
|
pageChosen: function(pageData) {
|
||||||
|
var a;
|
||||||
|
|
||||||
|
a = document.createElement('a');
|
||||||
|
a.setAttribute('href', pageData.url);
|
||||||
|
if (pageData.id) {
|
||||||
|
a.setAttribute('data-id', pageData.id);
|
||||||
|
a.setAttribute('data-linktype', 'page');
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((!lastSelection.collapsed) && lastSelection.canSurroundContents()) {
|
||||||
|
lastSelection.surroundContents(a);
|
||||||
|
} else {
|
||||||
|
a.appendChild(document.createTextNode(pageData.title));
|
||||||
|
lastSelection.insertNode(a);
|
||||||
|
}
|
||||||
|
|
||||||
|
return widget.options.editable.element.trigger('change');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
return ModalWorkflow({
|
|
||||||
url: url,
|
|
||||||
responses: {
|
|
||||||
pageChosen: function(pageData) {
|
|
||||||
var a;
|
|
||||||
|
|
||||||
a = document.createElement('a');
|
|
||||||
a.setAttribute('href', pageData.url);
|
|
||||||
if (pageData.id) {
|
|
||||||
a.setAttribute('data-id', pageData.id);
|
|
||||||
a.setAttribute('data-linktype', 'page');
|
|
||||||
}
|
|
||||||
if ((!lastSelection.collapsed) && lastSelection.canSurroundContents()) {
|
|
||||||
lastSelection.surroundContents(a);
|
|
||||||
} else {
|
|
||||||
a.appendChild(document.createTextNode(pageData.title));
|
|
||||||
lastSelection.insertNode(a);
|
|
||||||
}
|
|
||||||
return widget.options.editable.element.trigger('change');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
})(jQuery);
|
||||||
});
|
|
||||||
})(jQuery);
|
|
||||||
|
|
||||||
}).call(this);
|
}).call(this);
|
||||||
|
|
|
@ -62,6 +62,7 @@ function ModalWorkflow(opts) {
|
||||||
self.body.html(response.html);
|
self.body.html(response.html);
|
||||||
container.modal('show');
|
container.modal('show');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (response.onload) {
|
if (response.onload) {
|
||||||
// if the response is a function
|
// if the response is a function
|
||||||
response.onload(self);
|
response.onload(self);
|
||||||
|
|
|
@ -9,6 +9,7 @@ function createPageChooser(id, pageType, openAtParentId) {
|
||||||
if (openAtParentId) {
|
if (openAtParentId) {
|
||||||
initialUrl += openAtParentId + '/';
|
initialUrl += openAtParentId + '/';
|
||||||
}
|
}
|
||||||
|
|
||||||
ModalWorkflow({
|
ModalWorkflow({
|
||||||
'url': initialUrl,
|
'url': initialUrl,
|
||||||
'urlParams': {'page_type': pageType},
|
'urlParams': {'page_type': pageType},
|
||||||
|
|
|
@ -127,6 +127,7 @@ function initTagField(id, autocompleteUrl) {
|
||||||
if (val && val[0] != '"' && val.indexOf(' ') > -1) {
|
if (val && val[0] != '"' && val.indexOf(' ') > -1) {
|
||||||
return '"' + val + '"';
|
return '"' + val + '"';
|
||||||
}
|
}
|
||||||
|
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -135,15 +136,15 @@ function initTagField(id, autocompleteUrl) {
|
||||||
function InlinePanel(opts) {
|
function InlinePanel(opts) {
|
||||||
var self = {};
|
var self = {};
|
||||||
|
|
||||||
self.setHasContent = function(){
|
self.setHasContent = function() {
|
||||||
if($('> li', self.formsUl).not(".deleted").length){
|
if ($('> li', self.formsUl).not(".deleted").length) {
|
||||||
self.formsUl.parent().removeClass('empty');
|
self.formsUl.parent().removeClass('empty');
|
||||||
}else{
|
} else {
|
||||||
self.formsUl.parent().addClass('empty');
|
self.formsUl.parent().addClass('empty');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
self.initChildControls = function (prefix) {
|
self.initChildControls = function(prefix) {
|
||||||
var childId = 'inline_child_' + prefix;
|
var childId = 'inline_child_' + prefix;
|
||||||
var deleteInputId = 'id_' + prefix + '-DELETE';
|
var deleteInputId = 'id_' + prefix + '-DELETE';
|
||||||
|
|
||||||
|
@ -205,7 +206,7 @@ function InlinePanel(opts) {
|
||||||
/* Hide container on page load if it is marked as deleted. Remove the error
|
/* 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
|
message so that it doesn't count towards the number of errors on the tab at the
|
||||||
top of the page. */
|
top of the page. */
|
||||||
if ($('#' + deleteInputId).val() === "1" ) {
|
if ($('#' + deleteInputId).val() === "1") {
|
||||||
$('#' + childId).addClass('deleted').hide(0, function() {
|
$('#' + childId).addClass('deleted').hide(0, function() {
|
||||||
self.updateMoveButtonDisabledStates();
|
self.updateMoveButtonDisabledStates();
|
||||||
self.setHasContent();
|
self.setHasContent();
|
||||||
|
@ -226,7 +227,7 @@ function InlinePanel(opts) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
self.animateSwap = function(item1, item2){
|
self.animateSwap = function(item1, item2) {
|
||||||
var parent = self.formsUl;
|
var parent = self.formsUl;
|
||||||
var children = parent.children('li:visible');
|
var children = parent.children('li:visible');
|
||||||
|
|
||||||
|
@ -234,7 +235,7 @@ function InlinePanel(opts) {
|
||||||
// Also set it's relatively calculated height to be an absolute one, to prevent the container collapsing while its children go absolute
|
// Also set it's relatively calculated height to be an absolute one, to prevent the container collapsing while its children go absolute
|
||||||
parent.addClass('moving').css('height', parent.height());
|
parent.addClass('moving').css('height', parent.height());
|
||||||
|
|
||||||
children.each(function(){
|
children.each(function() {
|
||||||
// console.log($(this));
|
// console.log($(this));
|
||||||
$(this).css('top', $(this).position().top);
|
$(this).css('top', $(this).position().top);
|
||||||
}).addClass('moving');
|
}).addClass('moving');
|
||||||
|
@ -242,13 +243,13 @@ function InlinePanel(opts) {
|
||||||
// animate swapping around
|
// animate swapping around
|
||||||
item1.animate({
|
item1.animate({
|
||||||
top:item2.position().top
|
top:item2.position().top
|
||||||
}, 200, function(){
|
}, 200, function() {
|
||||||
parent.removeClass('moving').removeAttr('style');
|
parent.removeClass('moving').removeAttr('style');
|
||||||
children.removeClass('moving').removeAttr('style');
|
children.removeClass('moving').removeAttr('style');
|
||||||
});
|
});
|
||||||
item2.animate({
|
item2.animate({
|
||||||
top:item1.position().top
|
top:item1.position().top
|
||||||
}, 200, function(){
|
}, 200, function() {
|
||||||
parent.removeClass('moving').removeAttr('style');
|
parent.removeClass('moving').removeAttr('style');
|
||||||
children.removeClass('moving').removeAttr('style');
|
children.removeClass('moving').removeAttr('style');
|
||||||
});
|
});
|
||||||
|
@ -264,6 +265,7 @@ function InlinePanel(opts) {
|
||||||
to ensure it's *greater* than previous item */
|
to ensure it's *greater* than previous item */
|
||||||
$('#id_' + newChildPrefix + '-ORDER').val(formCount + 1);
|
$('#id_' + newChildPrefix + '-ORDER').val(formCount + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
self.updateMoveButtonDisabledStates();
|
self.updateMoveButtonDisabledStates();
|
||||||
|
|
||||||
if (opts.onAdd) opts.onAdd();
|
if (opts.onAdd) opts.onAdd();
|
||||||
|
@ -273,66 +275,67 @@ function InlinePanel(opts) {
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
function cleanForSlug(val, useURLify){
|
function cleanForSlug(val, useURLify) {
|
||||||
if(URLify != undefined && useURLify !== false) { // Check to be sure that URLify function exists, and that we want to use it.
|
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);
|
return URLify(val, val.length);
|
||||||
} else { // If not just do the "replace"
|
} 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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function initSlugAutoPopulate(){
|
function initSlugAutoPopulate() {
|
||||||
$('#id_title').on('focus', function(){
|
$('#id_title').on('focus', function() {
|
||||||
$('#id_slug').data('previous-val', $('#id_slug').val());
|
$('#id_slug').data('previous-val', $('#id_slug').val());
|
||||||
$(this).data('previous-val', $(this).val());
|
$(this).data('previous-val', $(this).val());
|
||||||
});
|
});
|
||||||
$('#id_title').on('keyup keydown keypress blur', function(){
|
$('#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'))){
|
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
|
// 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
|
||||||
$('#id_slug').val(cleanForSlug($('#id_title').val()));
|
$('#id_slug').val(cleanForSlug($('#id_title').val()));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function initSlugCleaning(){
|
function initSlugCleaning() {
|
||||||
$('#id_slug').blur(function(){
|
$('#id_slug').blur(function() {
|
||||||
// if a user has just set the slug themselves, don't remove stop words etc, just illegal characters
|
// if a user has just set the slug themselves, don't remove stop words etc, just illegal characters
|
||||||
$(this).val(cleanForSlug($(this).val(), false));
|
$(this).val(cleanForSlug($(this).val(), false));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function initErrorDetection(){
|
function initErrorDetection() {
|
||||||
var errorSections = {};
|
var errorSections = {};
|
||||||
|
|
||||||
// first count up all the errors
|
// first count up all the errors
|
||||||
$('.error-message').each(function(){
|
$('.error-message').each(function() {
|
||||||
var parentSection = $(this).closest('section');
|
var parentSection = $(this).closest('section');
|
||||||
|
|
||||||
if(!errorSections[parentSection.attr('id')]){
|
if (!errorSections[parentSection.attr('id')]) {
|
||||||
errorSections[parentSection.attr('id')] = 0;
|
errorSections[parentSection.attr('id')] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
errorSections[parentSection.attr('id')] = errorSections[parentSection.attr('id')]+1;
|
errorSections[parentSection.attr('id')] = errorSections[parentSection.attr('id')] + 1;
|
||||||
});
|
});
|
||||||
|
|
||||||
// now identify them on each tab
|
// now identify them on each tab
|
||||||
for(var index in errorSections) {
|
for (var index in errorSections) {
|
||||||
$('.tab-nav a[href=#'+ index +']').addClass('errors').attr('data-count', errorSections[index]);
|
$('.tab-nav a[href=#' + index + ']').addClass('errors').attr('data-count', errorSections[index]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function initCollapsibleBlocks(){
|
function initCollapsibleBlocks() {
|
||||||
$(".object.multi-field.collapsible").each(function(){
|
$(".object.multi-field.collapsible").each(function() {
|
||||||
var $li = $(this);
|
var $li = $(this);
|
||||||
var $fieldset = $li.find("fieldset");
|
var $fieldset = $li.find("fieldset");
|
||||||
if($li.hasClass("collapsed")){
|
if ($li.hasClass("collapsed")) {
|
||||||
$fieldset.hide();
|
$fieldset.hide();
|
||||||
}
|
}
|
||||||
$li.find("h2").click(function(){
|
|
||||||
if(!$li.hasClass("collapsed")){
|
$li.find("h2").click(function() {
|
||||||
|
if (!$li.hasClass("collapsed")) {
|
||||||
$li.addClass("collapsed");
|
$li.addClass("collapsed");
|
||||||
$fieldset.hide("slow");
|
$fieldset.hide("slow");
|
||||||
}else{
|
} else {
|
||||||
$li.removeClass("collapsed");
|
$li.removeClass("collapsed");
|
||||||
$fieldset.show("show");
|
$fieldset.show("show");
|
||||||
}
|
}
|
||||||
|
@ -356,22 +359,22 @@ $(function() {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
var $this = $(this);
|
var $this = $(this);
|
||||||
|
|
||||||
if(previewWindow){
|
if (previewWindow) {
|
||||||
previewWindow.close();
|
previewWindow.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
previewWindow = window.open($this.data('placeholder'), $this.data('windowname'));
|
previewWindow = window.open($this.data('placeholder'), $this.data('windowname'));
|
||||||
|
|
||||||
if(/MSIE/.test(navigator.userAgent)){
|
if (/MSIE/.test(navigator.userAgent)) {
|
||||||
// If IE, load contents immediately without fancy effects
|
// If IE, load contents immediately without fancy effects
|
||||||
submitPreview.call($this, false);
|
submitPreview.call($this, false);
|
||||||
} else {
|
} else {
|
||||||
previewWindow.onload = function(){
|
previewWindow.onload = function() {
|
||||||
submitPreview.call($this, true);
|
submitPreview.call($this, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function submitPreview(enhanced){
|
function submitPreview(enhanced) {
|
||||||
var previewDoc = previewWindow.document;
|
var previewDoc = previewWindow.document;
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
|
@ -380,7 +383,7 @@ $(function() {
|
||||||
data: $('#page-edit-form').serialize(),
|
data: $('#page-edit-form').serialize(),
|
||||||
success: function(data, textStatus, request) {
|
success: function(data, textStatus, request) {
|
||||||
if (request.getResponseHeader('X-Wagtail-Preview') == 'ok') {
|
if (request.getResponseHeader('X-Wagtail-Preview') == 'ok') {
|
||||||
if(enhanced){
|
if (enhanced) {
|
||||||
var frame = previewDoc.getElementById('preview-frame');
|
var frame = previewDoc.getElementById('preview-frame');
|
||||||
|
|
||||||
frame = frame.contentWindow || frame.contentDocument.document || frame.contentDocument;
|
frame = frame.contentWindow || frame.contentDocument.document || frame.contentDocument;
|
||||||
|
@ -388,10 +391,12 @@ $(function() {
|
||||||
frame.document.write(data);
|
frame.document.write(data);
|
||||||
frame.document.close();
|
frame.document.close();
|
||||||
|
|
||||||
var hideTimeout = setTimeout(function(){
|
var hideTimeout = setTimeout(function() {
|
||||||
previewDoc.getElementById('loading-spinner-wrapper').className += ' remove';
|
previewDoc.getElementById('loading-spinner-wrapper').className += ' remove';
|
||||||
clearTimeout(hideTimeout);
|
clearTimeout(hideTimeout);
|
||||||
}) // just enough to give effect without adding discernible slowness
|
})
|
||||||
|
|
||||||
|
// just enough to give effect without adding discernible slowness
|
||||||
} else {
|
} else {
|
||||||
previewDoc.open();
|
previewDoc.open();
|
||||||
previewDoc.write(data);
|
previewDoc.write(data);
|
||||||
|
|
|
@ -1,16 +1,16 @@
|
||||||
$(function(){
|
$(function() {
|
||||||
var $explorer = $('#explorer');
|
var $explorer = $('#explorer');
|
||||||
|
|
||||||
$('.nav-main .submenu-trigger').on('click', function(){
|
$('.nav-main .submenu-trigger').on('click', function() {
|
||||||
if($(this).closest('li').find('.nav-submenu').length){
|
if ($(this).closest('li').find('.nav-submenu').length) {
|
||||||
|
|
||||||
// Close explorer menu, although it may not be instantiated yet
|
// Close explorer menu, although it may not be instantiated yet
|
||||||
if($explorer.data('dlmenu') && $explorer.dlmenu('isOpen')){
|
if ($explorer.data('dlmenu') && $explorer.dlmenu('isOpen')) {
|
||||||
$explorer.dlmenu('closeMenu');
|
$explorer.dlmenu('closeMenu');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Close other active submenus first, if any
|
// Close other active submenus first, if any
|
||||||
if($('.nav-wrapper.submenu-active').length && !$(this).closest('li').hasClass('submenu-active')){
|
if ($('.nav-wrapper.submenu-active').length && !$(this).closest('li').hasClass('submenu-active')) {
|
||||||
$('.nav-main .submenu-active, .nav-wrapper').removeClass('submenu-active');
|
$('.nav-main .submenu-active, .nav-wrapper').removeClass('submenu-active');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,8 +20,8 @@ $(function(){
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$(document).on('keydown click', function(e){
|
$(document).on('keydown click', function(e) {
|
||||||
if($('.nav-wrapper.submenu-active').length && (e.keyCode == 27 || !e.keyCode)){
|
if ($('.nav-wrapper.submenu-active').length && (e.keyCode == 27 || !e.keyCode)) {
|
||||||
$('.nav-main .submenu-active, .nav-wrapper').removeClass('submenu-active');
|
$('.nav-main .submenu-active, .nav-wrapper').removeClass('submenu-active');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,17 +1,17 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
document.addEventListener('DOMContentLoaded', function(){
|
document.addEventListener('DOMContentLoaded', function() {
|
||||||
var body = document.querySelectorAll('body')[0];
|
var body = document.querySelectorAll('body')[0];
|
||||||
var nav = document.querySelectorAll('nav')[0];
|
var nav = document.querySelectorAll('nav')[0];
|
||||||
var className = 'ready';
|
var className = 'ready';
|
||||||
var has_pm = window.postMessage;
|
var has_pm = window.postMessage;
|
||||||
|
|
||||||
if(has_pm){
|
if (has_pm) {
|
||||||
parent.postMessage("fh=" + nav.offsetHeight, '*');
|
parent.postMessage("fh=" + nav.offsetHeight, '*');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (body.classList){
|
if (body.classList) {
|
||||||
body.classList.add(className);
|
body.classList.add(className);
|
||||||
}else{
|
} else {
|
||||||
body.className += ' ' + className;
|
body.className += ' ' + className;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,29 +1,29 @@
|
||||||
(function(w,d){
|
(function(w, d) {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
var l, f, t, frame_height;
|
var l, f, t, frame_height;
|
||||||
|
|
||||||
function callback(e){
|
function callback(e) {
|
||||||
var h;
|
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.
|
// Get the height from the passed data.
|
||||||
try{
|
try {
|
||||||
h = Number(e.data.replace( /.*fh=(\d+)(?:&|$)/, '$1' ) );
|
h = Number(e.data.replace(/.*fh=(\d+)(?:&|$)/, '$1'));
|
||||||
if (!isNaN( h ) && h > 0 && h !== frame_height) {
|
if (!isNaN(h) && h > 0 && h !== frame_height) {
|
||||||
f.style.opacity = 1;
|
f.style.opacity = 1;
|
||||||
f.style.height = h + "px";
|
f.style.height = h + "px";
|
||||||
}
|
}
|
||||||
} catch(e){}
|
} catch (e) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!w.wagtail) return;
|
if (!w.wagtail) return;
|
||||||
|
|
||||||
if(w.postMessage){
|
if (w.postMessage) {
|
||||||
if (w.addEventListener) {
|
if (w.addEventListener) {
|
||||||
w.addEventListener('message', callback, false);
|
w.addEventListener('message', callback, false);
|
||||||
} else {
|
} else {
|
||||||
w.attachEvent('onmessage', callback );
|
w.attachEvent('onmessage', callback);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,11 +39,11 @@
|
||||||
f.src = w.wagtail.userbar.src;
|
f.src = w.wagtail.userbar.src;
|
||||||
|
|
||||||
// if postMessage is supported, hide iframe till it is loaded
|
// if postMessage is supported, hide iframe till it is loaded
|
||||||
if(w.postMessage){
|
if (w.postMessage) {
|
||||||
f.style.opacity=0;
|
f.style.opacity = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
t = d.getElementsByTagName('title')[0];
|
t = d.getElementsByTagName('title')[0];
|
||||||
t.parentNode.insertBefore(l, t.nextSibling);
|
t.parentNode.insertBefore(l, t.nextSibling);
|
||||||
d.body.appendChild(f);
|
d.body.appendChild(f);
|
||||||
}(window,document));
|
}(window, document));
|
||||||
|
|
|
@ -1,51 +1,52 @@
|
||||||
// Generated by CoffeeScript 1.6.2
|
// Generated by CoffeeScript 1.6.2
|
||||||
(function() {
|
(function() {
|
||||||
(function($) {
|
(function($) {
|
||||||
return $.widget("IKS.hallowagtaildoclink", {
|
return $.widget("IKS.hallowagtaildoclink", {
|
||||||
options: {
|
options: {
|
||||||
uuid: '',
|
uuid: '',
|
||||||
editable: null
|
editable: null
|
||||||
},
|
},
|
||||||
populateToolbar: function(toolbar) {
|
populateToolbar: function(toolbar) {
|
||||||
var button, widget;
|
var button, widget;
|
||||||
|
|
||||||
widget = this;
|
widget = this;
|
||||||
button = $('<span></span>');
|
button = $('<span></span>');
|
||||||
button.hallobutton({
|
button.hallobutton({
|
||||||
uuid: this.options.uuid,
|
uuid: this.options.uuid,
|
||||||
editable: this.options.editable,
|
editable: this.options.editable,
|
||||||
label: 'Documents',
|
label: 'Documents',
|
||||||
icon: 'icon-file-text-alt',
|
icon: 'icon-file-text-alt',
|
||||||
command: null
|
command: null
|
||||||
});
|
});
|
||||||
toolbar.append(button);
|
toolbar.append(button);
|
||||||
return button.on("click", function(event) {
|
return button.on("click", function(event) {
|
||||||
var lastSelection;
|
var lastSelection;
|
||||||
|
|
||||||
lastSelection = widget.options.editable.getSelection();
|
lastSelection = widget.options.editable.getSelection();
|
||||||
return ModalWorkflow({
|
return ModalWorkflow({
|
||||||
url: window.chooserUrls.documentChooser,
|
url: window.chooserUrls.documentChooser,
|
||||||
responses: {
|
responses: {
|
||||||
documentChosen: function(docData) {
|
documentChosen: function(docData) {
|
||||||
var a;
|
var a;
|
||||||
|
|
||||||
a = document.createElement('a');
|
a = document.createElement('a');
|
||||||
a.setAttribute('href', docData.url);
|
a.setAttribute('href', docData.url);
|
||||||
a.setAttribute('data-id', docData.id);
|
a.setAttribute('data-id', docData.id);
|
||||||
a.setAttribute('data-linktype', 'document');
|
a.setAttribute('data-linktype', 'document');
|
||||||
if ((!lastSelection.collapsed) && lastSelection.canSurroundContents()) {
|
if ((!lastSelection.collapsed) && lastSelection.canSurroundContents()) {
|
||||||
lastSelection.surroundContents(a);
|
lastSelection.surroundContents(a);
|
||||||
} else {
|
} else {
|
||||||
a.appendChild(document.createTextNode(docData.title));
|
a.appendChild(document.createTextNode(docData.title));
|
||||||
lastSelection.insertNode(a);
|
lastSelection.insertNode(a);
|
||||||
}
|
}
|
||||||
return widget.options.editable.element.trigger('change');
|
|
||||||
}
|
return widget.options.editable.element.trigger('change');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
|
||||||
});
|
});
|
||||||
}
|
})(jQuery);
|
||||||
});
|
|
||||||
})(jQuery);
|
|
||||||
|
|
||||||
}).call(this);
|
}).call(this);
|
||||||
|
|
|
@ -1,47 +1,48 @@
|
||||||
// Generated by CoffeeScript 1.6.2
|
// Generated by CoffeeScript 1.6.2
|
||||||
(function() {
|
(function() {
|
||||||
(function($) {
|
(function($) {
|
||||||
return $.widget("IKS.hallowagtailembeds", {
|
return $.widget("IKS.hallowagtailembeds", {
|
||||||
options: {
|
options: {
|
||||||
uuid: '',
|
uuid: '',
|
||||||
editable: null
|
editable: null
|
||||||
},
|
},
|
||||||
populateToolbar: function(toolbar) {
|
populateToolbar: function(toolbar) {
|
||||||
var button, widget;
|
var button, widget;
|
||||||
|
|
||||||
widget = this;
|
widget = this;
|
||||||
button = $('<span></span>');
|
button = $('<span></span>');
|
||||||
button.hallobutton({
|
button.hallobutton({
|
||||||
uuid: this.options.uuid,
|
uuid: this.options.uuid,
|
||||||
editable: this.options.editable,
|
editable: this.options.editable,
|
||||||
label: 'Embed',
|
label: 'Embed',
|
||||||
icon: 'icon-media',
|
icon: 'icon-media',
|
||||||
command: null
|
command: null
|
||||||
});
|
});
|
||||||
toolbar.append(button);
|
toolbar.append(button);
|
||||||
return button.on("click", function(event) {
|
return button.on("click", function(event) {
|
||||||
var insertionPoint, lastSelection;
|
var insertionPoint, lastSelection;
|
||||||
|
|
||||||
lastSelection = widget.options.editable.getSelection();
|
lastSelection = widget.options.editable.getSelection();
|
||||||
insertionPoint = $(lastSelection.endContainer).parentsUntil('.richtext').last();
|
insertionPoint = $(lastSelection.endContainer).parentsUntil('.richtext').last();
|
||||||
return ModalWorkflow({
|
return ModalWorkflow({
|
||||||
url: window.chooserUrls.embedsChooser,
|
url: window.chooserUrls.embedsChooser,
|
||||||
responses: {
|
responses: {
|
||||||
embedChosen: function(embedData) {
|
embedChosen: function(embedData) {
|
||||||
var elem;
|
var elem;
|
||||||
|
|
||||||
elem = $(embedData).get(0);
|
elem = $(embedData).get(0);
|
||||||
lastSelection.insertNode(elem);
|
lastSelection.insertNode(elem);
|
||||||
if (elem.getAttribute('contenteditable') === 'false') {
|
if (elem.getAttribute('contenteditable') === 'false') {
|
||||||
insertRichTextDeleteControl(elem);
|
insertRichTextDeleteControl(elem);
|
||||||
}
|
}
|
||||||
return widget.options.editable.element.trigger('change');
|
|
||||||
}
|
return widget.options.editable.element.trigger('change');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
|
||||||
});
|
});
|
||||||
}
|
})(jQuery);
|
||||||
});
|
|
||||||
})(jQuery);
|
|
||||||
|
|
||||||
}).call(this);
|
}).call(this);
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
$(function(){
|
$(function() {
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
$(function(){
|
$(function() {
|
||||||
// Redirect users that don't support filereader
|
// Redirect users that don't support filereader
|
||||||
if(!$('html').hasClass('filereader')){
|
if (!$('html').hasClass('filereader')) {
|
||||||
document.location.href = window.fileupload_opts.simple_upload_url;
|
document.location.href = window.fileupload_opts.simple_upload_url;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// prevents browser default drag/drop
|
// prevents browser default drag/drop
|
||||||
$(document).bind('drop dragover', function (e) {
|
$(document).bind('drop dragover', function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ $(function(){
|
||||||
acceptFileTypes: window.fileupload_opts.errormessages.accepted_file_types,
|
acceptFileTypes: window.fileupload_opts.errormessages.accepted_file_types,
|
||||||
maxFileSize: window.fileupload_opts.errormessages.max_file_size
|
maxFileSize: window.fileupload_opts.errormessages.max_file_size
|
||||||
},
|
},
|
||||||
add: function (e, data) {
|
add: function(e, data) {
|
||||||
var $this = $(this);
|
var $this = $(this);
|
||||||
var that = $this.data('blueimp-fileupload') || $this.data('fileupload')
|
var that = $this.data('blueimp-fileupload') || $this.data('fileupload')
|
||||||
var li = $($('#upload-list-item').html()).addClass('upload-uploading')
|
var li = $($('#upload-list-item').html()).addClass('upload-uploading')
|
||||||
|
@ -33,27 +33,27 @@ $(function(){
|
||||||
$('#upload-list').append(li);
|
$('#upload-list').append(li);
|
||||||
data.context = li;
|
data.context = li;
|
||||||
|
|
||||||
data.process(function () {
|
data.process(function() {
|
||||||
return $this.fileupload('process', data);
|
return $this.fileupload('process', data);
|
||||||
}).always(function () {
|
}).always(function() {
|
||||||
data.context.removeClass('processing');
|
data.context.removeClass('processing');
|
||||||
data.context.find('.left').each(function(index, elm){
|
data.context.find('.left').each(function(index, elm) {
|
||||||
$(elm).append(data.files[index].name);
|
$(elm).append(data.files[index].name);
|
||||||
});
|
});
|
||||||
data.context.find('.preview .thumb').each(function (index, elm) {
|
data.context.find('.preview .thumb').each(function(index, elm) {
|
||||||
$(elm).addClass('hasthumb')
|
$(elm).addClass('hasthumb')
|
||||||
$(elm).append(data.files[index].preview);
|
$(elm).append(data.files[index].preview);
|
||||||
});
|
});
|
||||||
}).done(function () {
|
}).done(function() {
|
||||||
data.context.find('.start').prop('disabled', false);
|
data.context.find('.start').prop('disabled', false);
|
||||||
if ((that._trigger('added', e, data) !== false) &&
|
if ((that._trigger('added', e, data) !== false) &&
|
||||||
(options.autoUpload || data.autoUpload) &&
|
(options.autoUpload || data.autoUpload) &&
|
||||||
data.autoUpload !== false) {
|
data.autoUpload !== false) {
|
||||||
data.submit()
|
data.submit()
|
||||||
}
|
}
|
||||||
}).fail(function () {
|
}).fail(function() {
|
||||||
if (data.files.error) {
|
if (data.files.error) {
|
||||||
data.context.each(function (index) {
|
data.context.each(function(index) {
|
||||||
var error = data.files[index].error;
|
var error = data.files[index].error;
|
||||||
if (error) {
|
if (error) {
|
||||||
$(this).find('.error_messages').text(error);
|
$(this).find('.error_messages').text(error);
|
||||||
|
@ -63,18 +63,18 @@ $(function(){
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
processfail: function(e, data){
|
processfail: function(e, data) {
|
||||||
var itemElement = $(data.context);
|
var itemElement = $(data.context);
|
||||||
itemElement.removeClass('upload-uploading').addClass('upload-failure');
|
itemElement.removeClass('upload-uploading').addClass('upload-failure');
|
||||||
},
|
},
|
||||||
|
|
||||||
progress: function (e, data) {
|
progress: function(e, data) {
|
||||||
if (e.isDefaultPrevented()) {
|
if (e.isDefaultPrevented()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
var progress = Math.floor(data.loaded / data.total * 100);
|
var progress = Math.floor(data.loaded / data.total * 100);
|
||||||
data.context.each(function () {
|
data.context.each(function() {
|
||||||
$(this).find('.progress').addClass('active').attr('aria-valuenow', progress).find('.bar').css(
|
$(this).find('.progress').addClass('active').attr('aria-valuenow', progress).find('.bar').css(
|
||||||
'width',
|
'width',
|
||||||
progress + '%'
|
progress + '%'
|
||||||
|
@ -82,23 +82,23 @@ $(function(){
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
progressall: function (e, data) {
|
progressall: function(e, data) {
|
||||||
var progress = parseInt(data.loaded / data.total * 100, 10);
|
var progress = parseInt(data.loaded / data.total * 100, 10);
|
||||||
$('#overall-progress').addClass('active').attr('aria-valuenow', progress).find('.bar').css(
|
$('#overall-progress').addClass('active').attr('aria-valuenow', progress).find('.bar').css(
|
||||||
'width',
|
'width',
|
||||||
progress + '%'
|
progress + '%'
|
||||||
).html(progress + '%');
|
).html(progress + '%');
|
||||||
|
|
||||||
if (progress >= 100){
|
if (progress >= 100) {
|
||||||
$('#overall-progress').removeClass('active').find('.bar').css('width','0%');
|
$('#overall-progress').removeClass('active').find('.bar').css('width', '0%');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
done: function (e, data) {
|
done: function(e, data) {
|
||||||
var itemElement = $(data.context);
|
var itemElement = $(data.context);
|
||||||
var response = $.parseJSON(data.result);
|
var response = $.parseJSON(data.result);
|
||||||
|
|
||||||
if(response.success){
|
if (response.success) {
|
||||||
itemElement.addClass('upload-success')
|
itemElement.addClass('upload-success')
|
||||||
|
|
||||||
$('.right', itemElement).append(response.form);
|
$('.right', itemElement).append(response.form);
|
||||||
|
@ -112,19 +112,19 @@ $(function(){
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
fail: function(e, data){
|
fail: function(e, data) {
|
||||||
var itemElement = $(data.context);
|
var itemElement = $(data.context);
|
||||||
itemElement.addClass('upload-failure');
|
itemElement.addClass('upload-failure');
|
||||||
},
|
},
|
||||||
|
|
||||||
always: function(e, data){
|
always: function(e, data) {
|
||||||
var itemElement = $(data.context);
|
var itemElement = $(data.context);
|
||||||
itemElement.removeClass('upload-uploading').addClass('upload-complete');
|
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){
|
$('#upload-list').on('submit', 'form', function(e) {
|
||||||
var form = $(this);
|
var form = $(this);
|
||||||
var itemElement = form.closest('#upload-list > li');
|
var itemElement = form.closest('#upload-list > li');
|
||||||
|
|
||||||
|
@ -132,16 +132,17 @@ $(function(){
|
||||||
|
|
||||||
$.post(this.action, form.serialize(), function(data) {
|
$.post(this.action, form.serialize(), function(data) {
|
||||||
if (data.success) {
|
if (data.success) {
|
||||||
itemElement.slideUp(function(){$(this).remove()});
|
itemElement.slideUp(function() {$(this).remove()});
|
||||||
}else{
|
} else {
|
||||||
form.replaceWith(data.form);
|
form.replaceWith(data.form);
|
||||||
|
|
||||||
// run tagit enhancement on new form
|
// run tagit enhancement on new form
|
||||||
$('.tag_field input', form).tagit(window.tagit_opts);
|
$('.tag_field input', form).tagit(window.tagit_opts);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#upload-list').on('click', '.delete', function(e){
|
$('#upload-list').on('click', '.delete', function(e) {
|
||||||
var form = $(this).closest('form');
|
var form = $(this).closest('form');
|
||||||
var itemElement = form.closest('#upload-list > li');
|
var itemElement = form.closest('#upload-list > li');
|
||||||
|
|
||||||
|
@ -151,11 +152,11 @@ $(function(){
|
||||||
|
|
||||||
$.post(this.href, {csrfmiddlewaretoken: CSRFToken}, function(data) {
|
$.post(this.href, {csrfmiddlewaretoken: CSRFToken}, function(data) {
|
||||||
if (data.success) {
|
if (data.success) {
|
||||||
itemElement.slideUp(function(){$(this).remove()});
|
itemElement.slideUp(function() {$(this).remove()});
|
||||||
}else{
|
} else {
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
var jcropapi;
|
var jcropapi;
|
||||||
|
|
||||||
function setupJcrop(image, original, focalPointOriginal, fields){
|
function setupJcrop(image, original, focalPointOriginal, fields) {
|
||||||
image.Jcrop({
|
image.Jcrop({
|
||||||
trueSize: [original.width, original.height],
|
trueSize: [original.width, original.height],
|
||||||
bgColor: "rgb(192, 192, 192)",
|
bgColor: "rgb(192, 192, 192)",
|
||||||
|
@ -21,7 +21,7 @@ function setupJcrop(image, original, focalPointOriginal, fields){
|
||||||
fields.width.val(focalPointOriginal.width);
|
fields.width.val(focalPointOriginal.width);
|
||||||
fields.height.val(focalPointOriginal.height);
|
fields.height.val(focalPointOriginal.height);
|
||||||
},
|
},
|
||||||
}, function(){
|
}, function() {
|
||||||
jcropapi = this
|
jcropapi = this
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -64,7 +64,7 @@ $(function() {
|
||||||
|
|
||||||
setupJcrop.apply(this, params)
|
setupJcrop.apply(this, params)
|
||||||
|
|
||||||
$(window).resize($.debounce(300, function(){
|
$(window).resize($.debounce(300, function() {
|
||||||
// jcrop doesn't support responsive images so to cater for resizing the browser
|
// jcrop doesn't support responsive images so to cater for resizing the browser
|
||||||
// we have to destroy() it, which doesn't properly do it,
|
// we have to destroy() it, which doesn't properly do it,
|
||||||
// so destory it some more, then re-apply it
|
// so destory it some more, then re-apply it
|
||||||
|
|
|
@ -1,47 +1,48 @@
|
||||||
// Generated by CoffeeScript 1.6.2
|
// Generated by CoffeeScript 1.6.2
|
||||||
(function() {
|
(function() {
|
||||||
(function($) {
|
(function($) {
|
||||||
return $.widget("IKS.hallowagtailimage", {
|
return $.widget("IKS.hallowagtailimage", {
|
||||||
options: {
|
options: {
|
||||||
uuid: '',
|
uuid: '',
|
||||||
editable: null
|
editable: null
|
||||||
},
|
},
|
||||||
populateToolbar: function(toolbar) {
|
populateToolbar: function(toolbar) {
|
||||||
var button, widget;
|
var button, widget;
|
||||||
|
|
||||||
widget = this;
|
widget = this;
|
||||||
button = $('<span></span>');
|
button = $('<span></span>');
|
||||||
button.hallobutton({
|
button.hallobutton({
|
||||||
uuid: this.options.uuid,
|
uuid: this.options.uuid,
|
||||||
editable: this.options.editable,
|
editable: this.options.editable,
|
||||||
label: 'Images',
|
label: 'Images',
|
||||||
icon: 'icon-picture',
|
icon: 'icon-picture',
|
||||||
command: null
|
command: null
|
||||||
});
|
});
|
||||||
toolbar.append(button);
|
toolbar.append(button);
|
||||||
return button.on("click", function(event) {
|
return button.on("click", function(event) {
|
||||||
var insertionPoint, lastSelection;
|
var insertionPoint, lastSelection;
|
||||||
|
|
||||||
lastSelection = widget.options.editable.getSelection();
|
lastSelection = widget.options.editable.getSelection();
|
||||||
insertionPoint = $(lastSelection.endContainer).parentsUntil('.richtext').last();
|
insertionPoint = $(lastSelection.endContainer).parentsUntil('.richtext').last();
|
||||||
return ModalWorkflow({
|
return ModalWorkflow({
|
||||||
url: window.chooserUrls.imageChooser + '?select_format=true',
|
url: window.chooserUrls.imageChooser + '?select_format=true',
|
||||||
responses: {
|
responses: {
|
||||||
imageChosen: function(imageData) {
|
imageChosen: function(imageData) {
|
||||||
var elem;
|
var elem;
|
||||||
|
|
||||||
elem = $(imageData.html).get(0);
|
elem = $(imageData.html).get(0);
|
||||||
lastSelection.insertNode(elem);
|
lastSelection.insertNode(elem);
|
||||||
if (elem.getAttribute('contenteditable') === 'false') {
|
if (elem.getAttribute('contenteditable') === 'false') {
|
||||||
insertRichTextDeleteControl(elem);
|
insertRichTextDeleteControl(elem);
|
||||||
}
|
}
|
||||||
return widget.options.editable.element.trigger('change');
|
|
||||||
}
|
return widget.options.editable.element.trigger('change');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
|
||||||
});
|
});
|
||||||
}
|
})(jQuery);
|
||||||
});
|
|
||||||
})(jQuery);
|
|
||||||
|
|
||||||
}).call(this);
|
}).call(this);
|
||||||
|
|
|
@ -48,9 +48,9 @@ $(function() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Display note about scaled down images if image is large
|
// Display note about scaled down images if image is large
|
||||||
if($widthField.val() > $(window).width()){
|
if ($widthField.val() > $(window).width()) {
|
||||||
$sizeNote.show();
|
$sizeNote.show();
|
||||||
}else{
|
} else {
|
||||||
$sizeNote.hide();
|
$sizeNote.hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,4 +14,4 @@ function createQueryChooser(id) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Ładowanie…
Reference in New Issue