Ox.URL: correctly handle number spans
This commit is contained in:
parent
0989a41c8e
commit
4f9192f140
1 changed files with 13 additions and 13 deletions
|
@ -40,10 +40,10 @@ Ox.URL <f> URL controller
|
||||||
typeA <o> Span types for this type
|
typeA <o> Span types for this type
|
||||||
list <o> Span types for list views for this type
|
list <o> Span types for list views for this type
|
||||||
viewA <s> Span type for this view
|
viewA <s> Span type for this view
|
||||||
Can be "date", "duration" or "location"
|
Can be "date", "duration", "location" or "number"
|
||||||
item <o> Span types for item views for this type
|
item <o> Span types for item views for this type
|
||||||
viewA <s> Span type for this view
|
viewA <s> Span type for this view
|
||||||
Can be "date", "duration" or "location"
|
Can be "date", "duration", "location" or "number"
|
||||||
types <[s]> List of types
|
types <[s]> List of types
|
||||||
views <o> List and item views for all types
|
views <o> List and item views for all types
|
||||||
typeA <o> Views for type "typeA"
|
typeA <o> Views for type "typeA"
|
||||||
|
@ -504,8 +504,8 @@ Ox.URL = function(options) {
|
||||||
return Ox.isNumber(point) ? (
|
return Ox.isNumber(point) ? (
|
||||||
spanType == 'date' ? constructDate(point)
|
spanType == 'date' ? constructDate(point)
|
||||||
: spanType == 'duration' ? constructDuration(point)
|
: spanType == 'duration' ? constructDuration(point)
|
||||||
: spanType == 'number' ? point
|
: spanType == 'location' ? constructLocation(point)
|
||||||
: constructLocation(point)
|
: point
|
||||||
) : point;
|
) : point;
|
||||||
}).join(',');
|
}).join(',');
|
||||||
}
|
}
|
||||||
|
@ -586,8 +586,8 @@ Ox.URL = function(options) {
|
||||||
: canBeDuration ? 'duration'
|
: canBeDuration ? 'duration'
|
||||||
: canBeDate && !/\./.test(str) ? 'date'
|
: canBeDate && !/\./.test(str) ? 'date'
|
||||||
: canBeLocation && length == 2 ? 'location'
|
: canBeLocation && length == 2 ? 'location'
|
||||||
: canBeNumber && /\d-/.test(str) ? 'number'
|
: canBeNumber && /^\d+$/.test(str) ? 'number'
|
||||||
: ':'
|
: '';
|
||||||
}
|
}
|
||||||
|
|
||||||
function parseCondition(str) {
|
function parseCondition(str) {
|
||||||
|
@ -647,10 +647,6 @@ Ox.URL = function(options) {
|
||||||
return Ox.parseDuration(str);
|
return Ox.parseDuration(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
function parseNumber(str) {
|
|
||||||
return parseFloat(str);
|
|
||||||
}
|
|
||||||
|
|
||||||
function parseFind(str) {
|
function parseFind(str) {
|
||||||
str = (str || '').replace(/%7C/g, '|');
|
str = (str || '').replace(/%7C/g, '|');
|
||||||
var conditions, counter = 0,
|
var conditions, counter = 0,
|
||||||
|
@ -716,6 +712,10 @@ Ox.URL = function(options) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function parseNumber(str) {
|
||||||
|
return parseInt(str);
|
||||||
|
}
|
||||||
|
|
||||||
function parseSort(str, state) {
|
function parseSort(str, state) {
|
||||||
return str.split(',').map(function(str) {
|
return str.split(',').map(function(str) {
|
||||||
var hasOperator = /^[\+-]/.test(str);
|
var hasOperator = /^[\+-]/.test(str);
|
||||||
|
@ -738,8 +738,8 @@ Ox.URL = function(options) {
|
||||||
return split.map(
|
return split.map(
|
||||||
type == 'date' ? parseDate
|
type == 'date' ? parseDate
|
||||||
: type == 'duration' ? parseDuration
|
: type == 'duration' ? parseDuration
|
||||||
: type == 'number' ? parseNumber
|
: type == 'location' ? parseLocation
|
||||||
: parseLocation
|
: parseNumber
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -813,7 +813,7 @@ Ox.URL = function(options) {
|
||||||
spanType = state.view
|
spanType = state.view
|
||||||
? spanTypes[state.view]
|
? spanTypes[state.view]
|
||||||
: getSpanType(parts[0], Ox.unique(Ox.values(spanTypes)));
|
: getSpanType(parts[0], Ox.unique(Ox.values(spanTypes)));
|
||||||
Ox.Log('Core', 'SPAN TYPE', spanType)
|
Ox.Log('URL', 'SPAN TYPE', spanType)
|
||||||
if (spanType) {
|
if (spanType) {
|
||||||
span = parseSpan(parts[0], spanType);
|
span = parseSpan(parts[0], spanType);
|
||||||
if (span) {
|
if (span) {
|
||||||
|
|
Loading…
Reference in a new issue