allow pages to have additional url parts

This commit is contained in:
j 2015-02-04 15:32:24 +05:30
parent 7b24011ea1
commit 5835cbc38c

View file

@ -21,9 +21,10 @@ Ox.URL <f> URL controller
callback <f> callback function
getPart <f> Tests if a string matches a part (page section)
May modify the state's part property
(state, string, callback) -> <u> undefined
(state, string, parts, callback) -> <u> undefined
state <o> State object
string <s> The string to be tested
parts <[s]> Array of additional parts
callback <f> callback function
getSort <f> Tests if a sort object is valid (for the current item)
May modify the state's sort properties
@ -537,6 +538,9 @@ Ox.URL = function(options) {
parts.push(state.page);
if (state.part) {
parts.push(state.part);
if (state.parts) {
parts = parts.concat(state.parts);
}
}
} else {
if (self.options.types.indexOf(state.type) > 0) {
@ -790,8 +794,8 @@ Ox.URL = function(options) {
state.page = parts[0];
parts.shift();
if (parts.length) {
// may modify state.part
self.options.getPart(state, decodeValue(parts[0]), getHash);
// may modify state.part, state.page
self.options.getPart(state, decodeValue(parts[0]), parts.slice(1), getHash);
} else {
getHash();
}