fix css for selects with labels, allow for checkboxes with labels

This commit is contained in:
rlx 2011-10-03 15:02:19 +00:00
parent 0b53fc0566
commit 54b7d9de9f
6 changed files with 81 additions and 38 deletions

View file

@ -851,14 +851,9 @@ OxSelect
border-style: solid; border-style: solid;
border-radius: 8px; border-radius: 8px;
} }
.OxSelect.OxSelected, .OxSelect.OxSelected {
.OxSelect.OxSelected > .OxLabel {
border-radius: 8px 8px 0 0; border-radius: 8px 8px 0 0;
} }
.OxSelect > .OxLabel {
float: left;
margin: -1px;
}
.OxSelect > .OxTitle { .OxSelect > .OxTitle {
float: left; float: left;
height: 14px; height: 14px;
@ -871,30 +866,27 @@ OxSelect
white-space: nowrap; white-space: nowrap;
//margin-right: -16px; //margin-right: -16px;
} }
.OxSelect.OxOverlapLeft > .OxTitle {
//padding-left: 20px;
//padding-right: 8px;
//margin-left: -32px;
}
.OxSelect.OxOverlapRight > .OxTitle {
//padding-left: 8px;
//padding-right: 20px;
//margin-right: -32px;
}
.OxSelect > .OxButton { .OxSelect > .OxButton {
float: right; float: right;
margin: -1px; margin: -1px;
} }
.OxSelect.OxOverlapLeft > .OxButton { .OxLabelSelect > .OxLabel {
//padding-left: 15px; float: left;
//padding-right: 1px; margin: -1px;
//margin-left: -16px;
} }
.OxSelect.OxOverlapRight > .OxButton { .OxLabelSelect > .OxTitle {
//padding-left: 1px; border-left-width: 1px;
//padding-right: 15px; border-left-style: solid;
//margin-right: -16px; border-top-left-radius: 8px;
border-bottom-left-radius: 8px;
} }
.OxLabelSelect.OxSelected {
border-bottom-left-radius: 8px;
}
.OxLabelSelect.OxSelected > .OxTitle {
border-bottom-left-radius: 0;
}
/* /*
*/ */

View file

@ -5,11 +5,13 @@ Ox.Checkbox <f:Ox.Element> Checkbox Element
(options) -> <f> Checkbox Element (options) -> <f> Checkbox Element
(options, self) -> <f> Checkbox Element (options, self) -> <f> Checkbox Element
options <o> Options object options <o> Options object
disabled <b> if true, checkbox is disabled
id <s> element id
group <b> if true, checkbox is part of a group
checked <b> if true, checkbox is checked checked <b> if true, checkbox is checked
title <s> text on label disabled <b> if true, checkbox is disabled
group <b> if true, checkbox is part of a group
id <s> element id
label <s> Label (on the left side)
labelWidth <n|64> Label width
title <s> Title (on the right side)
width <n> width in px width <n> width in px
self <o> Shared private variable self <o> Shared private variable
change <!> triggered when checked property changes, passes {checked, id, title} change <!> triggered when checked property changes, passes {checked, id, title}
@ -20,10 +22,12 @@ Ox.Checkbox = function(options, self) {
self = self || {}; self = self || {};
var that = Ox.Element({}, self) var that = Ox.Element({}, self)
.defaults({ .defaults({
disabled: false,
id: '',
group: false,
checked: false, checked: false,
disabled: false,
group: false,
id: '',
label: '',
labelWidth: 64,
overlap: 'none', overlap: 'none',
title: '', title: '',
width: 'auto' width: 'auto'
@ -41,20 +45,31 @@ Ox.Checkbox = function(options, self) {
self.options.width != 'auto' && that.css({ self.options.width != 'auto' && that.css({
width: self.options.width + 'px' width: self.options.width + 'px'
}); });
Ox.print(self.options.width - 16, self.options.label * (self.options.labelWidth - 16))
self.$title = Ox.Label({ self.$title = Ox.Label({
disabled: self.options.disabled, disabled: self.options.disabled,
id: self.options.id + 'Label', id: self.options.id + 'Label',
overlap: 'left', overlap: 'left',
title: self.options.title, title: self.options.title,
width: self.options.width - 16 width: self.options.width - 16
- !!self.options.label * self.options.labelWidth
}) })
.css({ .css({float: 'right'})
float: 'right'
})
.click(clickTitle) .click(clickTitle)
.appendTo(that); .appendTo(that);
} }
if (self.options.label) {
self.$label = Ox.Label({
overlap: 'right',
textAlign: 'right',
title: self.options.label,
width: self.options.labelWidth
})
.css({float: 'left'})
.appendTo(that);
}
self.$button = Ox.Button({ self.$button = Ox.Button({
disabled: self.options.disabled, disabled: self.options.disabled,
id: self.options.id + 'Button', id: self.options.id + 'Button',

View file

@ -24,6 +24,8 @@ Ox.Input <f:Ox.Element> Input Element
height <n> px (for type='textarea' and type='range' with orientation='horizontal') height <n> px (for type='textarea' and type='range' with orientation='horizontal')
id <s> element id id <s> element id
key <s> to be passed to autocomplete and autovalidate functions key <s> to be passed to autocomplete and autovalidate functions
label <s|''> Label
labelWidth <n|64> Label width
max <n> max value if type is 'int' or 'float' max <n> max value if type is 'int' or 'float'
min <n> min value if type is 'int' or 'float' min <n> min value if type is 'int' or 'float'
name <s> will be displayed by autovalidate function ('invalid ' + name) name <s> will be displayed by autovalidate function ('invalid ' + name)
@ -31,7 +33,7 @@ Ox.Input <f:Ox.Element> Input Element
picker <o> picker object picker <o> picker object
rangeOptions <o> range options rangeOptions <o> range options
arrows <b>boolean, if true, display arrows arrows <b>boolean, if true, display arrows
//arrowStep <n> number, step when clicking arrows //arrowStep <n> number, step when clicking arrows
//arrowSymbols <a> array of two strings //arrowSymbols <a> array of two strings
max <n> number, maximum value max <n> number, maximum value
min <n> number, minimum value min <n> number, minimum value

View file

@ -8,6 +8,8 @@ Ox.Select <f:Ox.Element> Select Object
options <o> Options object options <o> Options object
id <s> element id id <s> element id
items <a|[]> items items <a|[]> items
label <s|''> Label
labelWidth <n|64> Label width
max <n|1> minimum number of selected items max <n|1> minimum number of selected items
min <n|1> maximum number of selected items min <n|1> maximum number of selected items
overlap <s|'none'> can be none, left or right overlap <s|'none'> can be none, left or right
@ -32,6 +34,8 @@ Ox.Select = function(options, self) {
.defaults({ .defaults({
id: '', id: '',
items: [], items: [],
label: '',
labelWidth: 64,
max: 1, max: 1,
min: 1, min: 1,
overlap: 'none', // can be none, left or right overlap: 'none', // can be none, left or right
@ -46,9 +50,10 @@ Ox.Select = function(options, self) {
// or allow for extra action items below options // or allow for extra action items below options
.options(options) .options(options)
.addClass( .addClass(
'OxSelect Ox' + Ox.toTitleCase(self.options.size) + 'OxSelect Ox' + Ox.toTitleCase(self.options.size) + (
(self.options.overlap == 'none' ? '' : ' OxOverlap' + self.options.overlap == 'none'
Ox.toTitleCase(self.options.overlap)) ? '' : ' OxOverlap' + Ox.toTitleCase(self.options.overlap)
) + (self.options.label ? ' OxLabelSelect' : '')
) )
.css(self.options.width == 'auto' ? {} : { .css(self.options.width == 'auto' ? {} : {
width: self.options.width - 2 + 'px' width: self.options.width - 2 + 'px'

View file

@ -297,6 +297,19 @@ Forms
background: rgb(240, 240, 240); background: rgb(240, 240, 240);
} }
.OxThemeClassic .OxLabelSelect > .OxTitle {
border-color: rgb(176, 176, 176);
background: -moz-linear-gradient(top, rgb(224, 224, 224), rgb(192, 192, 192));
background: -o-linear-gradient(top, rgb(224, 224, 224), rgb(192, 192, 192));
background: -webkit-linear-gradient(top, rgb(224, 224, 224), rgb(192, 192, 192));
}
.OxThemeClassic .OxLabelSelect.OxSelected > .OxTitle {
background: -moz-linear-gradient(top, rgb(160, 160, 160), rgb(192, 192, 192));
background: -o-linear-gradient(top, rgb(160, 160, 160), rgb(192, 192, 192));
background: -webkit-linear-gradient(top, rgb(160, 160, 160), rgb(192, 192, 192));
}
/* /*
================================================================================ ================================================================================
Images Images

View file

@ -193,6 +193,7 @@ Forms
.OxThemeModern .OxSelect > .OxTitle { .OxThemeModern .OxSelect > .OxTitle {
color: rgb(192, 192, 192); color: rgb(192, 192, 192);
} }
.OxThemeModern .OxInputLabel { .OxThemeModern .OxInputLabel {
color: rgb(192, 192, 192); color: rgb(192, 192, 192);
} }
@ -280,6 +281,21 @@ Forms
background: rgb(16, 16, 16); background: rgb(16, 16, 16);
} }
.OxThemeModern .OxLabelSelect > .OxTitle {
border-color: rgb(48, 48, 48);
background: -moz-linear-gradient(top, rgb(96, 96, 96), rgb(64, 64, 64));
background: -o-linear-gradient(top, rgb(96, 96, 96), rgb(64, 64, 64));
background: -webkit-linear-gradient(top, rgb(96, 96, 96), rgb(64, 64, 64));
}
.OxThemeModern .OxLabelSelect.OxSelected > .OxTitle {
background: -moz-linear-gradient(top, rgb(0, 0, 0), rgb(32, 32, 32) 10%, rgb(64, 64, 64));
background: -o-linear-gradient(top, rgb(0, 0, 0), rgb(32, 32, 32) 10%, rgb(64, 64, 64));
background: -webkit-linear-gradient(top, rgb(0, 0, 0), rgb(32, 32, 32) 10%, rgb(64, 64, 64));
}
/* /*
================================================================================ ================================================================================
Images Images