Skip to content

Commit

Permalink
adding support for passed params (number indexed params in the url ar…
Browse files Browse the repository at this point in the history
…ray generates /param1/param2 instead of /0:param1/1:param2)
  • Loading branch information
dogmatic69 committed Aug 8, 2012
1 parent 3f77073 commit d635c0d
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions Core/Assets/webroot/js/libs/html.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,29 @@
HtmlHelper.url = function(options) {
var opts = $.extend({}, HtmlHelper.url.defaults, options.url);
var returnUrl = [];

returnUrl = [
opts.plugin,
opts.controller,
opts.action
].join('/');

if(opts.prefix) {
returnUrl = opts.prefix + '/' + returnUrl;
}

returnUrl = Infinitas.base + returnUrl;

end = '/';
$.each(options.params, function(key, value){
end += key + ':' + value + '/';
$.each(opts.params, function(key, value) {
if(isNaN(key)) {
end += key + ':' + value + '/';
} else {
end += value + '/';
}

});

return returnUrl + end;
};

Expand Down Expand Up @@ -91,15 +96,15 @@
}
);
};

/**
* @breif submit some POST data to a url
*
*
*/
HtmlHelper.submit = function(metaData, callback) {
//HtmlHelper.loading(metaData.target, true);
var submitUrl = HtmlHelper.url(metaData) + '.json';

$.post(
submitUrl,
metaData.postData,
Expand Down

0 comments on commit d635c0d

Please sign in to comment.