Skip to content

Commit

Permalink
[#2648] Add SITE_ROOT and SITE_LOCALE constants to ckan
Browse files Browse the repository at this point in the history
  • Loading branch information
aron committed Jul 16, 2012
1 parent 373b056 commit 2d32a39
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions ckan/public/base/javascript/main.js
@@ -1,13 +1,23 @@
// Global ckan namespace
this.ckan = this.ckan || {};

this.ckan.initialize = function () {
this.module.initialize();
};

this.jQuery(function () {
ckan.initialize();
});
(function (ckan, jQuery) {
ckan.initialize = function () {
var body = jQuery('body');
var trailingSlash = /\/$/;
var location = window.location;
var root = location.protocol + location.host;

this.SITE_ROOT = (body.data('siteRoot') || root).replace(trailingSlash, '');
this.LOCALE_ROOT = (body.data('localeRoot') || root).replace(trailingSlash, '');

this.module.initialize();
};

jQuery(function () {
ckan.initialize();
});
})(this.ckan, this.jQuery);

// Temporary banner to let users on IE7 know that it may not display as
// expected.
Expand Down

0 comments on commit 2d32a39

Please sign in to comment.