1
0
Fork 0
forked from 0x2620/oxjs

update Ox.URL, add Ox.Event

This commit is contained in:
rlx 2011-09-23 10:43:57 +00:00
commit f2c8644001
6 changed files with 166 additions and 33 deletions

View file

@ -1,12 +1,12 @@
// vim: et:ts=4:sw=4:sts=4:ft=javascript
/*@
Ox.Filter <f:Ox.Element> Filter Element
() -> <f> Filter Element
(options) -> <f> Filter Element
(options, self) -> <f> Filter Element
Ox.Filter <o> Filter Object
() -> <f> Filter Object
(options) -> <f> Filter Object
(options, self) -> <f> Filter Object
options <o> Options object
findKeys <a|[]> keys
findKeys <[]|[]> keys
list <o> list object
sort <s> List sort
view <s> List view
@ -69,8 +69,8 @@ Ox.Filter = function(options, self) {
{id: '!<', title: 'is not less than'},
{id: '>', title: 'is greater than'},
{id: '!>', title: 'is not greater than'},
{id: '-', title: 'is between'},
{id: '!-', title: 'is not between'}/*,
{id: '=:', title: 'is between'},
{id: '!=:', title: 'is not between'}/*,
{id: '^', title: 'starts with'},
{id: '!^', title: 'does not start with'},
{id: '$', title: 'ends with'},
@ -318,13 +318,15 @@ Ox.Filter = function(options, self) {
var condition = subpos == -1
? self.options.query.conditions[pos]
: self.options.query.conditions[pos].conditions[subpos],
isBetween = operator.indexOf('-') > -1,
oldOperator = condition.operator,
wasBetween = oldOperator.indexOf('-') > -1,
wasUselessCondition = isUselessCondition(pos, subpos);
condition.operator = operator;
if (oldOperator.indexOf('-') == -1 && operator.indexOf('-') > -1) {
if (isBetween && !wasBetween) {
condition.value = [condition.value, condition.value]
renderConditions();
} else if (oldOperator.indexOf('-') > -1 && operator.indexOf('-') == -1) {
} else if (!isBetween && wasBetween) {
condition.value = condition.value[0]
renderConditions();
}

View file

@ -23,6 +23,7 @@ Ox.Select <f:Ox.Element> Select Object
Ox.Select = function(options, self) {
// fixme: make selected a separate option
// fixme: selected item needs attribute "checked", not "selected" ... that's strange
self = self || {};
var that = Ox.Element({
@ -176,7 +177,7 @@ Ox.Select = function(options, self) {
};
/*@
selectItem <f> select item in group
selected <f> gets selected item
() -> <o> returns object of selected items with id, title
@*/
that.selected = function() {