now we have a rainbow-gradient range track hidden deep within pandora

This commit is contained in:
rlx 2011-06-02 06:19:44 +00:00
parent 67dd877874
commit 565ff78139

View file

@ -270,7 +270,7 @@ Ox.Filter = function(options, self) {
function getConditionType(type) {
type = Ox.isArray(type) ? type[0] : type;
if (['float', 'integer', 'year'].indexOf(type) > -1) {
if (['float', 'hue', 'integer', 'year'].indexOf(type) > -1) {
type = 'number';
}
return type;
@ -364,7 +364,7 @@ Ox.Filter = function(options, self) {
function renderConditionKey(condition) {
return Ox.Select({
items: $.map(self.options.findKeys, function(key) {
items: self.options.findKeys.map(function(key) {
return {
checked: key.id == condition.key,
id: key.id,
@ -388,10 +388,11 @@ Ox.Filter = function(options, self) {
}
function renderConditionOperator(condition) {
Ox.print('rCO', condition)
return Ox.Select({
items: $.map(self.conditionOperators[getConditionType(
items: self.conditionOperators[getConditionType(
Ox.getObjectById(self.options.findKeys, condition.key).type
)], function(operator) {
)].map(function(operator) {
return {
checked: operator.id == condition.operator, // fixme: should be "selected", not "checked"
id: operator.id,
@ -442,12 +443,30 @@ Ox.Filter = function(options, self) {
var $input,
findKey = Ox.getObjectById(self.options.findKeys, condition.key),
isArray = Ox.isArray(condition.value),
isHue,
type = findKey.type == 'integer' ? 'int' : findKey.type,
formatArgs, formatType, title;
if (findKey.format) {
formatArgs = findKey.format.args
formatType = findKey.format.type;
if (findKey.format.type == 'date') {
if (formatType == 'color') {
isHue = formatArgs[0] == 'hue';
$input = Ox.Range({
max: isHue ? 360 : 1,
min: 0,
size: !isArray ? 288 : 128, // fixme: should be width!
width: !isArray ? 288 : 128, // have to set this too, for formatting when tuple
step: isHue ? 1 : 0.01,
thumbSize: 48,
thumbValue: true,
trackColors: isHue ? [
'rgb(255, 0, 0)', 'rgb(255, 255, 0)',
'rgb(0, 255, 0)', 'rgb(0, 255, 255)',
'rgb(0, 0, 255)', 'rgb(255, 0, 255)',
'rgb(255, 0, 0)'
] : ['rgb(0, 0, 0)', 'rgb(255, 255, 255)']
});
} else if (formatType == 'date') {
$input = Ox.DateInput(!isArray ? {
//value: condition.value,
width: {day: 66, month: 66, year: 140}
@ -526,7 +545,7 @@ Ox.Filter = function(options, self) {
Ox.FormElementGroup({
elements: [
Ox.Select({
items: $.map(self.operators, function(operator) {
items: self.operators.map(function(operator) {
return {
checked: operator.id != self.options.query.operator,
id: operator.id,