forked from GNUsocial/gnu-social
Added reset button
Rearranged swatch layout Added background image upload input file
This commit is contained in:
parent
62d2229573
commit
0c442e459e
@ -82,7 +82,16 @@ class DesignsettingsAction extends AccountSettingsAction
|
|||||||
$this->element('legend', null, _('Change background image'));
|
$this->element('legend', null, _('Change background image'));
|
||||||
$this->elementStart('ul', 'form_data');
|
$this->elementStart('ul', 'form_data');
|
||||||
$this->elementStart('li');
|
$this->elementStart('li');
|
||||||
$this->element('p', null, _('Upload background image'));
|
$this->element('label', array('for' => 'design_ background-image_file'),
|
||||||
|
_('Upload file'));
|
||||||
|
$this->element('input', array('name' => 'design_background-image_file',
|
||||||
|
'type' => 'file',
|
||||||
|
'id' => 'design_background-image_file'));
|
||||||
|
$this->element('p', 'form_guide', _('You can upload your personal background image. The maximum file size is 2Mb.'));
|
||||||
|
$this->element('input', array('name' => 'MAX_FILE_SIZE',
|
||||||
|
'type' => 'hidden',
|
||||||
|
'id' => 'MAX_FILE_SIZE',
|
||||||
|
'value' => ImageFile::maxFileSizeInt()));
|
||||||
$this->elementEnd('li');
|
$this->elementEnd('li');
|
||||||
$this->elementEnd('ul');
|
$this->elementEnd('ul');
|
||||||
$this->elementEnd('fieldset');
|
$this->elementEnd('fieldset');
|
||||||
@ -108,15 +117,22 @@ class DesignsettingsAction extends AccountSettingsAction
|
|||||||
$userSwatch = ($userSwatch) ? json_decode($userSwatch, true) : $defaultSwatch;
|
$userSwatch = ($userSwatch) ? json_decode($userSwatch, true) : $defaultSwatch;
|
||||||
|
|
||||||
$s = 0;
|
$s = 0;
|
||||||
$labelSwatch = array('Background color',
|
$labelSwatch = array('Background',
|
||||||
'Content background color',
|
'Content',
|
||||||
'Sidebar background color',
|
'Sidebar',
|
||||||
'Text color',
|
'Text',
|
||||||
'Link color');
|
'Links');
|
||||||
foreach($userSwatch as $propertyvalue => $value) {
|
foreach($userSwatch as $propertyvalue => $value) {
|
||||||
$foo = array_values($value); //Is this necessary? $value[0] doesn't work because of invalid key
|
$foo = array_values($value);
|
||||||
$this->elementStart('li');
|
$this->elementStart('li');
|
||||||
$this->input("swatch-".$s, $labelSwatch[$s], $foo[0]);
|
$this->element('label', array('for' => 'swatch-'.$s), _($labelSwatch[$s]));
|
||||||
|
$this->element('input', array('name' => 'swatch-'.$s, //prefer swatch[$s] ?
|
||||||
|
'type' => 'text',
|
||||||
|
'id' => 'swatch-'.$s,
|
||||||
|
'class' => 'swatch',
|
||||||
|
'maxlength' => '7',
|
||||||
|
'size' => '7',
|
||||||
|
'value' => $foo[0]));
|
||||||
$this->elementEnd('li');
|
$this->elementEnd('li');
|
||||||
$s++;
|
$s++;
|
||||||
}
|
}
|
||||||
@ -125,6 +141,10 @@ class DesignsettingsAction extends AccountSettingsAction
|
|||||||
$this->elementEnd('fieldset');
|
$this->elementEnd('fieldset');
|
||||||
|
|
||||||
$this->submit('save', _('Save'));
|
$this->submit('save', _('Save'));
|
||||||
|
$this->element('input', array('type' => 'reset',
|
||||||
|
'value' => 'Reset',
|
||||||
|
'class' => 'form_action-secondary'));
|
||||||
|
|
||||||
/*TODO: Check submitted form values:
|
/*TODO: Check submitted form values:
|
||||||
json_encode(form values)
|
json_encode(form values)
|
||||||
if submitted Swatch == DefaultSwatch, don't store in DB.
|
if submitted Swatch == DefaultSwatch, don't store in DB.
|
||||||
|
@ -43,7 +43,7 @@ $(document).ready(function() {
|
|||||||
$('#color-picker').hide();
|
$('#color-picker').hide();
|
||||||
|
|
||||||
var f = $.farbtastic('#color-picker', UpdateColors);
|
var f = $.farbtastic('#color-picker', UpdateColors);
|
||||||
var swatches = $('#settings_design_color input');
|
var swatches = $('#settings_design_color .swatch');
|
||||||
|
|
||||||
swatches
|
swatches
|
||||||
.each(UpdateColors)
|
.each(UpdateColors)
|
||||||
|
@ -1161,6 +1161,17 @@ width:400px;
|
|||||||
margin-right:28px;
|
margin-right:28px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#settings_design_color .form_data li {
|
||||||
|
width:33%;
|
||||||
|
}
|
||||||
|
#settings_design_color .form_data label {
|
||||||
|
float:none;
|
||||||
|
}
|
||||||
|
#settings_design_color .form_data .swatch {
|
||||||
|
padding:11px;
|
||||||
|
margin-left:0;
|
||||||
|
}
|
||||||
|
|
||||||
.instructions ul {
|
.instructions ul {
|
||||||
list-style-position:inside;
|
list-style-position:inside;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user