mirror of
https://github.com/processwire/processwire.git
synced 2025-08-13 10:15:28 +02:00
Updated several modules and classes to better support admin theme customization, consistent with needs in AdminThemeUikit
This commit is contained in:
@@ -659,9 +659,14 @@ function InputfieldColumnWidths($target) {
|
||||
*/
|
||||
function getWidth($item) {
|
||||
if($item.is(".InputfieldStateHidden")) return 0;
|
||||
var style = $item.attr('style');
|
||||
if(typeof style == "undefined" || !style) return $item.width();
|
||||
var pct = parseInt(style.match(/width:\s*(\d+)/i)[1]);
|
||||
var pct = $item.attr('data-colwidth'); // colwidth tracked when NoWidths mode enabled
|
||||
if(typeof pct == "undefined" || !pct.length) {
|
||||
var style = $item.attr('style');
|
||||
if(typeof style == "undefined" || !style) return $item.width();
|
||||
var pct = parseInt(style.match(/width:\s*(\d+)/i)[1]);
|
||||
} else {
|
||||
pct = parseInt(pct);
|
||||
}
|
||||
// store the original width in another attribute, for later retrieval
|
||||
if(!$item.attr('data-original-width')) $item.attr('data-original-width', pct);
|
||||
// consoleLog('getWidth(' + $item.attr('id') + '): ' + pct + '%');
|
||||
@@ -828,6 +833,7 @@ function InputfieldColumnWidths($target) {
|
||||
|
||||
} // updateInputfield
|
||||
|
||||
var numForms = 0;
|
||||
$target.each(function() {
|
||||
|
||||
var $form = $(this);
|
||||
@@ -853,9 +859,14 @@ function InputfieldColumnWidths($target) {
|
||||
$(".InputfieldColumnWidthFirst.InputfieldColumnWidth:visible", $form).each(function() {
|
||||
updateInputfieldRow($(this));
|
||||
});
|
||||
|
||||
numForms++;
|
||||
});
|
||||
|
||||
if(!$('body').hasClass('InputfieldColumnWidthsInit')) {
|
||||
if(!numForms) {
|
||||
// no need to do anything further
|
||||
|
||||
} else if(!$('body').hasClass('InputfieldColumnWidthsInit')) {
|
||||
// initialize monitoring events on first run
|
||||
$('body').addClass('InputfieldColumnWidthsInit');
|
||||
|
||||
@@ -889,6 +900,7 @@ function InputfieldColumnWidths($target) {
|
||||
*/
|
||||
function InputfieldFormBeforeUnloadEvent(e) {
|
||||
var $changes = $(".InputfieldFormConfirm:not(.InputfieldFormSubmitted) .InputfieldStateChanged");
|
||||
if($changes.length == 0) $changes = $('.InputfieldStateConfirmLeave');
|
||||
if($changes.length == 0) return;
|
||||
var msg = $('.InputfieldFormConfirm:eq(0)').attr('data-confirm') + "\n";
|
||||
$changes.each(function() {
|
||||
@@ -928,13 +940,16 @@ function InputfieldStates($target) {
|
||||
var interval;
|
||||
var maxRuns = 10;
|
||||
var runs = 0;
|
||||
var hAdjust = 0.8;
|
||||
|
||||
$("body").append($spinner.hide());
|
||||
|
||||
if($header.is('a') && $header.closest('ul').hasClass('uk-tab')) hAdjust = 0.1;
|
||||
|
||||
$spinner.css({
|
||||
position: 'absolute',
|
||||
top: offset.top - ($spinner.height() + 5),
|
||||
left: offset.left + ($header.width() / 2) + ($spinner.width() * 0.8)
|
||||
left: offset.left + ($header.width() / 2) + ($spinner.width() * hAdjust)
|
||||
}).fadeIn();
|
||||
|
||||
interval = setInterval(function() {
|
||||
|
File diff suppressed because one or more lines are too long
@@ -274,6 +274,7 @@ var ProcessWireAdmin = {
|
||||
var setupDropdownHover = false;
|
||||
var $itemsIcon = $a.children('.pw-has-items-icon');
|
||||
$itemsIcon.removeClass('fa-angle-right').addClass('fa-spinner fa-spin');
|
||||
$ul.css('opacity', 0);
|
||||
|
||||
$.getJSON(url, function(data) {
|
||||
$itemsIcon.removeClass('fa-spinner fa-spin').addClass('fa-angle-right');
|
||||
@@ -308,9 +309,10 @@ var ProcessWireAdmin = {
|
||||
}
|
||||
$ul.append($li);
|
||||
});
|
||||
|
||||
|
||||
$ul.addClass('navJSON')
|
||||
$ul.addClass('length' + parseInt(data.list.length));
|
||||
$ul.addClass('navJSON').addClass('length' + parseInt(data.list.length)).hide();
|
||||
if($ul.children().length) $ul.css('opacity', 1.0).fadeIn('fast');
|
||||
|
||||
// trigger the first call
|
||||
hoverDropdownAjaxItem($a);
|
||||
|
2
wire/templates-admin/scripts/main.min.js
vendored
2
wire/templates-admin/scripts/main.min.js
vendored
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user