juci-core: remove local from config in favour of $localStorage prep for dockumentatio...
authorReidar Cederqvist <reidar.cederqvist@gmail.com>
Wed, 18 Jul 2018 09:10:59 +0000 (11:10 +0200)
committerSukru Senli <sukru.senli@inteno.se>
Sat, 1 Sep 2018 09:23:00 +0000 (11:23 +0200)
juci/src/js/config.js
juci/src/widgets/juci-mode-picker.js
juci/src/widgets/juci-nav.js
juci/src/widgets/juci-navbar.js

index ea14d1d..3b951ee 100644 (file)
@@ -31,9 +31,6 @@
                var deferred = $.Deferred(); 
                var self = this; 
                        
-               // $config.local points to local storage
-               self.local = localStorage; 
-
                async.series([
                        function(next){
                                UBUS.$call("router.system", "info").done(function(info){
index df62985..124376e 100644 (file)
@@ -26,7 +26,7 @@ JUCI.app
                replace: true
         };  
 })
-.controller("juciModePicker", function($scope, $config, $uci, $rpc, $window, $localStorage, $state, $tr, gettext){
+.controller("juciModePicker", function($scope, $uci, $rpc, $window, $localStorage, $state, $tr, gettext){
        $scope.selectedModeValue = $localStorage.getItem("mode") || "basic";
        $scope.guiModes = [
                {label: $tr(gettext("Basic Mode")), value: "basic"},
@@ -37,7 +37,6 @@ JUCI.app
                $scope.selectedModeValue = selected; 
                console.log("selected value", selected);
                $localStorage.setItem("mode", selected);
-               $config.local.mode = selected;
                $state.reload();
        };
 }); 
index 3db735a..6999687 100644 (file)
@@ -30,7 +30,7 @@ JUCI.app
                controllerAs: "ctrl"
        };
 })
-.controller("NavCtrl", function($scope, $navigation, $location, $state, $rootScope, $config){
+.controller("NavCtrl", function($scope, $navigation, $location, $state, $rootScope, $localStorage){
        $scope.showSubMenuItems = false;
        var node = $navigation.findNodeByPage($location.path().replace(/\//g, ""));
        if(node) {
@@ -64,7 +64,7 @@ JUCI.app
 
        $scope.itemVisible = function(item){
                if(!item.modes || !item.modes.length) return true;
-               else if(item.modes && item.modes.indexOf($config.local.mode) == -1) {
+               else if(item.modes && item.modes.indexOf($localStorage.getItem("mode")) == -1) {
                        return false;
                }
                else return true;
index e8482be..847b3f5 100644 (file)
@@ -27,7 +27,7 @@ JUCI.app
                replace: true
        };
 })
-.controller("NavigationCtrl", function($scope, $location, $localStorage, $navigation, $rootScope, $config, $rpc, $events, $rootScope, $wiki){
+.controller("NavigationCtrl", function($scope, $location, $localStorage, $navigation, $rootScope, $localStorage, $rpc, $events, $rootScope, $wiki){
        $scope.tree = $navigation.tree();
        $scope.log_events = [];
        $scope.mode = $localStorage.getItem("mode") || "expert";
@@ -40,7 +40,7 @@ JUCI.app
        }
        $scope.itemVisible = function(item){
                if(!item.modes || !item.modes.length) return true;
-               else if(item.modes && item.modes.indexOf($config.local.mode) == -1) {
+               else if(item.modes && item.modes.indexOf($localStorage.getItem("mode")) == -1) {
                        return false;
                }
                else return true;