Skip to content

Commit

Permalink
made extension-label-customization backwards compatible (eclipse-arch…
Browse files Browse the repository at this point in the history
…ived#2676)

Signed-off-by: Aoun Bukhari <[email protected]>
  • Loading branch information
aounhaider1 authored and kaikreuzer committed Dec 19, 2016
1 parent 22d4bd6 commit 0491fa0
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
angular.module('PaperUI', [ 'PaperUI.controllers', 'PaperUI.controllers.control', 'PaperUI.controllers.setup', 'PaperUI.controllers.configuration', 'PaperUI.controllers.extension', 'PaperUI.controllers.rules', 'PaperUI.services', 'PaperUI.services.rest', 'PaperUI.services.repositories', 'PaperUI.extensions', 'ngRoute', 'ngResource', 'ngMaterial', 'ngMessages', 'ngSanitize', 'ui.sortable' ]).config([ '$routeProvider', '$httpProvider', 'globalConfig', '$mdDateLocaleProvider', 'moduleLabels', function($routeProvider, httpProvider, globalConfig, $mdDateLocaleProvider, moduleLabels) {
angular.module('PaperUI', [ 'PaperUI.controllers', 'PaperUI.controllers.control', 'PaperUI.controllers.setup', 'PaperUI.controllers.configuration', 'PaperUI.controllers.extension', 'PaperUI.controllers.rules', 'PaperUI.services', 'PaperUI.services.rest', 'PaperUI.services.repositories', 'PaperUI.extensions', 'ngRoute', 'ngResource', 'ngMaterial', 'ngMessages', 'ngSanitize', 'ui.sortable' ]).config([ '$routeProvider', '$httpProvider', 'globalConfig', '$mdDateLocaleProvider', 'moduleConfig', function($routeProvider, httpProvider, globalConfig, $mdDateLocaleProvider, moduleConfig) {
$routeProvider.when('/control', {
templateUrl : 'partials/control.html',
controller : 'ControlPageController',
Expand Down Expand Up @@ -70,7 +70,7 @@ angular.module('PaperUI', [ 'PaperUI.controllers', 'PaperUI.controllers.control'
}).when('/extensions', {
templateUrl : 'partials/extensions.html',
controller : 'ExtensionPageController',
title : moduleLabels.extensions
title : moduleConfig.extensions && moduleConfig.extensions.hasOwnProperty('label') && moduleConfig.extensions['label'] ? moduleConfig.extensions['label'] : 'Extensions'
}).when('/rules', {
templateUrl : 'partials/rules.html',
controller : 'RulesPageController',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@ angular.module('PaperUI.constants', []).constant('globalConfig', {
'configuration' : true,
'setup' : true,
'configuration' : true,
'extensions' : true,
'extensions' : {
'label' : 'Extensions',
'visible' : true
},
'rules' : true,
'preferences' : true,
'groups' : true
}).constant('moduleLabels', {
'extensions' : 'Extensions'
});
Original file line number Diff line number Diff line change
Expand Up @@ -193,11 +193,10 @@ angular.module('PaperUI.controllers', [ 'PaperUI.constants' ]).controller('BodyC
$scope.getSelected = function(property) {
return $('select#' + property + ' option:selected').val();
}
}).controller('NavController', function($scope, $location, $http, restConfig, moduleConfig, moduleLabels) {
}).controller('NavController', function($scope, $location, $http, restConfig, moduleConfig) {
$scope.opened = null;
$scope.extensionEnabled;
$scope.ruleEnabled;
$scope.moduleLabels = moduleLabels;
$scope.open = function(viewLocation) {
$scope.opened = viewLocation;
}
Expand All @@ -210,7 +209,14 @@ angular.module('PaperUI.controllers', [ 'PaperUI.constants' ]).controller('BodyC
return active;
}
$scope.isHidden = function(module) {
return moduleConfig[module] === false;
return (moduleConfig[module].hasOwnProperty('visible') ? moduleConfig[module].visible : moduleConfig[module]) === false;
}
$scope.getLabel = function(property) {
var object = moduleConfig && moduleConfig[property] ? moduleConfig[property] : '';
if (object && object.hasOwnProperty('label') && object['label']) {
return object['label'];
}
return 'Extensions';
}
$scope.$on('$routeChangeSuccess', function() {
$('body').removeClass('sml-open');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ <h1 class="title">SmartHome</h1>
<li ng-show="extensionEnabled" ng-class="{active: isActive('extensions'), hidden: isHidden('extensions')}">
<a href="#extensions">
<span class="icon material-icons">extension</span>
<span class="side-menu">{{moduleLabels.extensions}}</span>
<span class="side-menu">{{getLabel('extensions')}}</span>
</a>
</li>
<li ng-show="ruleEnabled" ng-class="{active: isActive('rules'), hidden: isHidden('rules')}">
Expand Down

0 comments on commit 0491fa0

Please sign in to comment.