1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-18 04:22:10 +02:00

Some AdminThemeUikit updates, mostly related to processwire/processwire-issues#480

This commit is contained in:
Ryan Cramer
2018-03-12 09:02:00 -04:00
parent 0c760171bd
commit 20f02cddf9
6 changed files with 76 additions and 32 deletions

View File

@@ -348,6 +348,9 @@ class Config extends WireData {
* 'siteOnly' => true,
* '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
@@ -382,7 +385,14 @@ class Config extends WireData {
}
} else {
// 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);
}
} else if($numArgs === 1) {

View File

@@ -24,10 +24,10 @@ class AdminThemeUikit extends AdminThemeFramework implements Module, Configurabl
public static function getModuleInfo() {
return array(
'title' => 'Uikit',
'version' => 23,
'version' => 24,
'summary' => 'Uikit v3 admin theme',
'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 = '';
$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) {
// button
@@ -210,8 +216,10 @@ class AdminThemeUikit extends AdminThemeFramework implements Module, Configurabl
}
// determine column width class
if($columnWidth && $columnWidth < 100) {
if($columnWidth < 16) $columnWidth = 16;
if($columnWidth < 10) {
$columnWidth = 100;
} else if($columnWidth && $columnWidth < 100) {
if($columnWidth < $minColumnWidth) $columnWidth = $minColumnWidth;
foreach($widths as $pct => $uk) {
$pct = (int) $pct;
if($columnWidth >= $pct) {

View File

@@ -268,48 +268,73 @@ function AdminThemeUikitConfig(AdminTheme $adminTheme, InputfieldWrapper $inputf
/*
// The following is just for development/testing
$fieldset = $modules->get('InputfieldFieldset');
$fieldset->label = 'Test fieldset';
$inputfields->add($fieldset);
$f = $modules->get('InputfieldRadios');
$f->attr('name', 'test_radios');
$f->label = 'Test radios';
$f->addOption(1, 'Option 1');
$f->addOption(2, 'Option 2');
$f->addOption(3, 'Option 3');
$f->columnWidth = 30;
$inputfields->add($f);
$f->columnWidth = 35;
$fieldset->add($f);
$f = $modules->get('InputfieldText');
$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->attr('name', 'test_text1');
$f->label = 'Test text 1';
$f->showIf = 'test_radios=1';
$f->columnWidth = 35;
$inputfields->add($f);
$f = $modules->get('InputfieldText');
$f->label = 'Test text 1';
$f->columnWidth = 20;
$fieldset->add($f);
$f = $modules->get('InputfieldText');
$f->attr('name', 'test_text2');
$f->label = 'Test text 2';
$f->showIf = 'test_radios=1|2';
$f->columnWidth = 35;
$inputfields->add($f);
$f->label = 'Test text 2';
//$f->showIf = 'test_radios=1|2';
$f->columnWidth = 20;
$fieldset->add($f);
// These inputfields should appear as a second row
$f = $modules->get('InputfieldText');
$f->attr('name', 'test_text3');
$f->label = 'Test text 3';
$f->columnWidth = 35;
$inputfields->add($f);
$f->columnWidth = 20;
$f->showIf = 'test_radios=1';
$fieldset->add($f);
$f = $modules->get('InputfieldText');
$f->attr('name', 'test_text4');
$f->label = 'Test text 4';
$f->columnWidth = 25;
$inputfields->add($f);
$f->columnWidth = 20;
$fieldset->add($f);
$f = $modules->get('InputfieldText');
$f->attr('name', 'test_text5');
$f->label = 'Test text 5';
//$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;
$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);
*/
}

View File

@@ -108,10 +108,10 @@ $config->set('ProcessList', array(
'showIcon' => true,
));
$buttonClassKey = $config->wire('hooks')->isHooked('InputfieldImage::renderButtons()') ? '_buttonClass' : 'buttonClass';
$buttonClassKey = $config->wire('hooks')->isHooked('InputfieldImage::renderButtons()') ? '_buttonClass' : 'buttonClass';
$config->set('InputfieldImage', array(
// only use custom classes if renderButtons is not hooked
$buttonClassKey => 'uk-button uk-button-small uk-button-text uk-margin-small-right',
$buttonClassKey => 'uk-button uk-button-small uk-button-text uk-margin-small-right',
'buttonText' => '{out}',
));

View File

@@ -1,7 +1,7 @@
/**
* 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
// this is called when an Inputfield is shown or hidden
function updateInputfieldRow($inputfield) {
if(!$inputfield) return;
var $inputfields = $inputfield.parent().children('.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 w = 0; // current 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) {
if(!debug) return;
@@ -646,7 +647,7 @@ var ProcessWireAdminTheme = {
if(!w || w >= 100) {
// 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;
widthHidden = 0;
lastW = 0;
@@ -678,7 +679,7 @@ var ProcessWireAdminTheme = {
if(debug) consoleLog('B: starting new row', $inputfield);
} else if(width + w > 100) {
// start new row and update width for last column
expandLastInputfield($lastInputfield);
if($lastInputfield) expandLastInputfield($lastInputfield);
width = 0;
isFirstColumn = true;
if(debug) consoleLog('C: start new row because width would exceed 100%', $inputfield);
@@ -712,7 +713,7 @@ var ProcessWireAdminTheme = {
width += w;
lastW = w;
$lastInputfield = $inputfield;
$lastInputfield = isLastColumn ? null : $inputfield;
ukGridClass(w, $inputfield);
});

File diff suppressed because one or more lines are too long