Update Horizon for Angular 1.4

Wraps deprecated code in relevant versioned blocks.

Implements: blueprint update-dependencies-newton
Change-Id: I4cb71c6306f221c825006be62b30ac8238aa3a78
This commit is contained in:
Rob Cresswell 2016-04-21 11:44:36 +01:00 committed by Timur Sufiev
parent 268e44b349
commit ffceacd349
2 changed files with 12 additions and 6 deletions

View File

@ -38,7 +38,7 @@ horizon.tabs.load_tab = function () {
};
horizon.addInitFunction(horizon.tabs.init = function () {
var data = horizon.cookies.get("tabs") || {};
var data = horizon.cookies.getObject("tabs") || {};
$(".tab-content").find(".js-tab-pane").addClass("tab-pane");
horizon.modals.addModalInitFunction(function (el) {
@ -63,7 +63,7 @@ horizon.addInitFunction(horizon.tabs.init = function () {
}
data[$tab.closest(".nav-tabs").attr("id")] = $tab.attr('data-target');
horizon.cookies.put("tabs", data);
horizon.cookies.putObject("tabs", data);
});
// Initialize stored tab state for tab groups on this page.

View File

@ -119,10 +119,16 @@
horizon.conf.spinner_options = spinnerOptions;
horizon.cookies = angular.extend({}, $cookieStore, {
put: put,
getRaw: getRaw
});
if (angular.version.major === 1 && angular.version.minor < 4) {
horizon.cookies = angular.extend({}, $cookieStore, {
getObject: $cookieStore.get,
put: put,
putObject: put,
getRaw: getRaw
});
} else {
horizon.cookies = $cookies;
}
// rewire the angular-gettext catalog to use django catalog
gettextCatalog.setCurrentLanguage(horizon.languageCode);