From e173115753e55a4258567d5c0205207bcc1d59d0 Mon Sep 17 00:00:00 2001 From: Gregory L'Azou Date: Wed, 23 Jul 2014 16:09:40 -0700 Subject: [PATCH] V1.0.2 - Fix issue preventing theme colors to be customized --- package.json | 2 +- .../storymaps/tpl/core/WebApplicationData.js | 18 +++++++++++++++++- src/index.html | 2 +- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index bd850e23..9a50b714 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "Storymaps-MapJournal", - "version": "1.0.1", + "version": "1.0.2", "devDependencies": { "grunt": "~0.4.1", "grunt-contrib-clean": "~0.4.0", diff --git a/src/app/storymaps/tpl/core/WebApplicationData.js b/src/app/storymaps/tpl/core/WebApplicationData.js index ed5fe04c..41d88a74 100644 --- a/src/app/storymaps/tpl/core/WebApplicationData.js +++ b/src/app/storymaps/tpl/core/WebApplicationData.js @@ -246,7 +246,23 @@ define(["dojo/_base/lang"], }, getColors: function() { - return this.getTheme().colors || this.getLayoutProperties().themes[0]; + var cfgColors = this.getTheme().colors; + + // If colors are defined, check if that theme is present in the config file + // If present reuse the values from config, else use the values from the item + // This allow an user to override his theme from the config file as well as administrator update + if ( cfgColors && cfgColors.name ) { + var matchedTheme = $.grep(this.getLayoutProperties().themes, function(theme) { + return theme.name == cfgColors.name; + }); + + if ( matchedTheme && matchedTheme.length ) + return matchedTheme[0]; + else + return cfgColors; + } + else + return this.getLayoutProperties().themes[0]; }, /* diff --git a/src/index.html b/src/index.html index 4d9984b0..1a9a738d 100644 --- a/src/index.html +++ b/src/index.html @@ -52,7 +52,7 @@