mirror of
https://github.com/processwire/processwire.git
synced 2025-08-21 22:06:12 +02:00
Some AdminThemeUikit updates, mostly related to processwire/processwire-issues#480
This commit is contained in:
@@ -348,6 +348,9 @@ class Config extends WireData {
|
|||||||
* 'siteOnly' => true,
|
* 'siteOnly' => true,
|
||||||
* 'cachePath' => $config->paths->root . '.my-cache/'
|
* 'cachePath' => $config->paths->root . '.my-cache/'
|
||||||
* ]);
|
* ]);
|
||||||
|
*
|
||||||
|
* // To unset a property specify null for first argument and property to unset as second argument
|
||||||
|
* $config->fileCompilerOptions(null, 'siteOnly');
|
||||||
* ~~~~~
|
* ~~~~~
|
||||||
*
|
*
|
||||||
* #pw-internal
|
* #pw-internal
|
||||||
@@ -382,7 +385,14 @@ class Config extends WireData {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// property and value provided
|
// property and value provided
|
||||||
$value[$property] = $arguments[1];
|
if($property === null && is_string($arguments[1])) {
|
||||||
|
// unset property
|
||||||
|
$property = $arguments[1];
|
||||||
|
unset($value[$property]);
|
||||||
|
} else {
|
||||||
|
// set property with value
|
||||||
|
$value[$property] = $arguments[1];
|
||||||
|
}
|
||||||
parent::set($method, $value);
|
parent::set($method, $value);
|
||||||
}
|
}
|
||||||
} else if($numArgs === 1) {
|
} else if($numArgs === 1) {
|
||||||
|
@@ -24,10 +24,10 @@ class AdminThemeUikit extends AdminThemeFramework implements Module, Configurabl
|
|||||||
public static function getModuleInfo() {
|
public static function getModuleInfo() {
|
||||||
return array(
|
return array(
|
||||||
'title' => 'Uikit',
|
'title' => 'Uikit',
|
||||||
'version' => 23,
|
'version' => 24,
|
||||||
'summary' => 'Uikit v3 admin theme',
|
'summary' => 'Uikit v3 admin theme',
|
||||||
'autoload' => 'template=admin',
|
'autoload' => 'template=admin',
|
||||||
'requires' => 'ProcessWire>=3.0.61'
|
'requires' => 'ProcessWire>=3.0.94'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -201,7 +201,13 @@ class AdminThemeUikit extends AdminThemeFramework implements Module, Configurabl
|
|||||||
$themeOffset = '';
|
$themeOffset = '';
|
||||||
$wrapClasses = array();
|
$wrapClasses = array();
|
||||||
|
|
||||||
if($columnWidth < 10) $columnWidth = 100;
|
static $minColumnWidth = null;
|
||||||
|
|
||||||
|
if($minColumnWidth === null) {
|
||||||
|
$widthKeys = array_keys($widths);
|
||||||
|
ksort($widthKeys);
|
||||||
|
$minColumnWidth = (int) reset($widthKeys);
|
||||||
|
}
|
||||||
|
|
||||||
if($inputfield instanceof InputfieldSubmit) {
|
if($inputfield instanceof InputfieldSubmit) {
|
||||||
// button
|
// button
|
||||||
@@ -210,8 +216,10 @@ class AdminThemeUikit extends AdminThemeFramework implements Module, Configurabl
|
|||||||
}
|
}
|
||||||
|
|
||||||
// determine column width class
|
// determine column width class
|
||||||
if($columnWidth && $columnWidth < 100) {
|
if($columnWidth < 10) {
|
||||||
if($columnWidth < 16) $columnWidth = 16;
|
$columnWidth = 100;
|
||||||
|
} else if($columnWidth && $columnWidth < 100) {
|
||||||
|
if($columnWidth < $minColumnWidth) $columnWidth = $minColumnWidth;
|
||||||
foreach($widths as $pct => $uk) {
|
foreach($widths as $pct => $uk) {
|
||||||
$pct = (int) $pct;
|
$pct = (int) $pct;
|
||||||
if($columnWidth >= $pct) {
|
if($columnWidth >= $pct) {
|
||||||
|
@@ -268,48 +268,73 @@ function AdminThemeUikitConfig(AdminTheme $adminTheme, InputfieldWrapper $inputf
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
// The following is just for development/testing
|
// The following is just for development/testing
|
||||||
|
$fieldset = $modules->get('InputfieldFieldset');
|
||||||
|
$fieldset->label = 'Test fieldset';
|
||||||
|
$inputfields->add($fieldset);
|
||||||
|
|
||||||
$f = $modules->get('InputfieldRadios');
|
$f = $modules->get('InputfieldRadios');
|
||||||
$f->attr('name', 'test_radios');
|
$f->attr('name', 'test_radios');
|
||||||
$f->label = 'Test radios';
|
$f->label = 'Test radios';
|
||||||
$f->addOption(1, 'Option 1');
|
$f->addOption(1, 'Option 1');
|
||||||
$f->addOption(2, 'Option 2');
|
$f->addOption(2, 'Option 2');
|
||||||
$f->addOption(3, 'Option 3');
|
$f->addOption(3, 'Option 3');
|
||||||
$f->columnWidth = 30;
|
$f->columnWidth = 35;
|
||||||
$inputfields->add($f);
|
$fieldset->add($f);
|
||||||
|
|
||||||
|
$f = $modules->get('InputfieldText');
|
||||||
|
$f->attr('name', 'test_text0');
|
||||||
|
$f->label = 'Test text 0';
|
||||||
|
//$f->showIf = 'test_radios=1';
|
||||||
|
$f->columnWidth = 65;
|
||||||
|
$fieldset->add($f);
|
||||||
|
|
||||||
$f = $modules->get('InputfieldText');
|
$f = $modules->get('InputfieldText');
|
||||||
$f->attr('name', 'test_text1');
|
$f->attr('name', 'test_text1');
|
||||||
$f->label = 'Test text 1';
|
$f->label = 'Test text 1';
|
||||||
$f->showIf = 'test_radios=1';
|
$f->columnWidth = 20;
|
||||||
$f->columnWidth = 35;
|
$fieldset->add($f);
|
||||||
$inputfields->add($f);
|
|
||||||
|
|
||||||
$f = $modules->get('InputfieldText');
|
$f = $modules->get('InputfieldText');
|
||||||
$f->attr('name', 'test_text2');
|
$f->attr('name', 'test_text2');
|
||||||
$f->label = 'Test text 2';
|
$f->label = 'Test text 2';
|
||||||
$f->showIf = 'test_radios=1|2';
|
//$f->showIf = 'test_radios=1|2';
|
||||||
$f->columnWidth = 35;
|
$f->columnWidth = 20;
|
||||||
$inputfields->add($f);
|
$fieldset->add($f);
|
||||||
|
|
||||||
// These inputfields should appear as a second row
|
// These inputfields should appear as a second row
|
||||||
$f = $modules->get('InputfieldText');
|
$f = $modules->get('InputfieldText');
|
||||||
$f->attr('name', 'test_text3');
|
$f->attr('name', 'test_text3');
|
||||||
$f->label = 'Test text 3';
|
$f->label = 'Test text 3';
|
||||||
$f->columnWidth = 35;
|
$f->columnWidth = 20;
|
||||||
$inputfields->add($f);
|
$f->showIf = 'test_radios=1';
|
||||||
|
$fieldset->add($f);
|
||||||
|
|
||||||
$f = $modules->get('InputfieldText');
|
$f = $modules->get('InputfieldText');
|
||||||
$f->attr('name', 'test_text4');
|
$f->attr('name', 'test_text4');
|
||||||
$f->label = 'Test text 4';
|
$f->label = 'Test text 4';
|
||||||
$f->columnWidth = 25;
|
$f->columnWidth = 20;
|
||||||
$inputfields->add($f);
|
$fieldset->add($f);
|
||||||
|
|
||||||
$f = $modules->get('InputfieldText');
|
$f = $modules->get('InputfieldText');
|
||||||
$f->attr('name', 'test_text5');
|
$f->attr('name', 'test_text5');
|
||||||
$f->label = 'Test text 5';
|
$f->label = 'Test text 5';
|
||||||
//$f->showIf = 'test_radios=3';
|
//$f->showIf = 'test_radios=3';
|
||||||
|
$f->columnWidth = 20;
|
||||||
|
$fieldset->add($f);
|
||||||
|
|
||||||
|
$f = $modules->get('InputfieldText');
|
||||||
|
$f->attr('name', 'test_text6');
|
||||||
|
$f->label = 'Test text 6';
|
||||||
|
//$f->showIf = 'test_radios=3';
|
||||||
$f->columnWidth = 75;
|
$f->columnWidth = 75;
|
||||||
$inputfields->add($f);
|
$fieldset->add($f);
|
||||||
|
|
||||||
|
$f = $modules->get('InputfieldText');
|
||||||
|
$f->attr('name', 'test_text7');
|
||||||
|
$f->label = 'Test text 7';
|
||||||
|
//$f->showIf = 'test_radios=3';
|
||||||
|
$f->columnWidth = 25;
|
||||||
|
$fieldset->add($f);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
}
|
}
|
@@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* ProcessWire Admin Theme jQuery/Javascript
|
* ProcessWire Admin Theme jQuery/Javascript
|
||||||
*
|
*
|
||||||
* Copyright 2017 by Ryan Cramer
|
* Copyright 2018 by Ryan Cramer
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -605,6 +605,7 @@ var ProcessWireAdminTheme = {
|
|||||||
// update widths and classes for Inputfields having the same parent as given $inputfield
|
// update widths and classes for Inputfields having the same parent as given $inputfield
|
||||||
// this is called when an Inputfield is shown or hidden
|
// this is called when an Inputfield is shown or hidden
|
||||||
function updateInputfieldRow($inputfield) {
|
function updateInputfieldRow($inputfield) {
|
||||||
|
if(!$inputfield) return;
|
||||||
|
|
||||||
var $inputfields = $inputfield.parent().children('.Inputfield');
|
var $inputfields = $inputfield.parent().children('.Inputfield');
|
||||||
var $lastInputfield = null; // last non-hidden Inputfield
|
var $lastInputfield = null; // last non-hidden Inputfield
|
||||||
@@ -612,7 +613,7 @@ var ProcessWireAdminTheme = {
|
|||||||
var widthHidden = 0; // amount of width in row occupied by hidden field(s)
|
var widthHidden = 0; // amount of width in row occupied by hidden field(s)
|
||||||
var w = 0; // current Inputfield width
|
var w = 0; // current Inputfield width
|
||||||
var lastW = 0; // last Inputfield non-hidden Inputfield width
|
var lastW = 0; // last Inputfield non-hidden Inputfield width
|
||||||
var debug = false; // verbose console.log messages
|
var debug = true; // verbose console.log messages
|
||||||
|
|
||||||
function consoleLog(msg, $in) {
|
function consoleLog(msg, $in) {
|
||||||
if(!debug) return;
|
if(!debug) return;
|
||||||
@@ -646,7 +647,7 @@ var ProcessWireAdminTheme = {
|
|||||||
|
|
||||||
if(!w || w >= 100) {
|
if(!w || w >= 100) {
|
||||||
// full width column consumes its own row, so we can reset everything here and exit
|
// full width column consumes its own row, so we can reset everything here and exit
|
||||||
if(width < 100) expandLastInputfield($lastInputfield);
|
if(width < 100 && $lastInputfield) expandLastInputfield($lastInputfield);
|
||||||
$lastInputfield = null;
|
$lastInputfield = null;
|
||||||
widthHidden = 0;
|
widthHidden = 0;
|
||||||
lastW = 0;
|
lastW = 0;
|
||||||
@@ -678,7 +679,7 @@ var ProcessWireAdminTheme = {
|
|||||||
if(debug) consoleLog('B: starting new row', $inputfield);
|
if(debug) consoleLog('B: starting new row', $inputfield);
|
||||||
} else if(width + w > 100) {
|
} else if(width + w > 100) {
|
||||||
// start new row and update width for last column
|
// start new row and update width for last column
|
||||||
expandLastInputfield($lastInputfield);
|
if($lastInputfield) expandLastInputfield($lastInputfield);
|
||||||
width = 0;
|
width = 0;
|
||||||
isFirstColumn = true;
|
isFirstColumn = true;
|
||||||
if(debug) consoleLog('C: start new row because width would exceed 100%', $inputfield);
|
if(debug) consoleLog('C: start new row because width would exceed 100%', $inputfield);
|
||||||
@@ -712,7 +713,7 @@ var ProcessWireAdminTheme = {
|
|||||||
|
|
||||||
width += w;
|
width += w;
|
||||||
lastW = w;
|
lastW = w;
|
||||||
$lastInputfield = $inputfield;
|
$lastInputfield = isLastColumn ? null : $inputfield;
|
||||||
ukGridClass(w, $inputfield);
|
ukGridClass(w, $inputfield);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user