mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2026-01-28 01:47:19 +01:00
Added proper overriding using decorator pattern
This commit is contained in:
parent
4938681ca4
commit
2cf8bde6b9
32 changed files with 73 additions and 515 deletions
|
|
@ -91,9 +91,13 @@ angular.module("luci")
|
|||
$juci.controller = $controllerProvider.register;
|
||||
$juci.directive = $compileProvider.directive;
|
||||
$juci.state = $stateProvider.state;
|
||||
$juci.decorator = function(name, func){
|
||||
return $provide.decorator(name, func);
|
||||
}
|
||||
$juci.config = angular.module("luci").config;
|
||||
$juci.$stateProvider = $stateProvider;
|
||||
|
||||
|
||||
/*$provide.decorator("luciFooterDirective", function($delegate){
|
||||
console.log(JSON.stringify($delegate[0]));
|
||||
return $delegate;
|
||||
|
|
@ -171,13 +175,15 @@ angular.module("luci")
|
|||
//$state.go("login");
|
||||
});
|
||||
})
|
||||
.directive("luciFooter", function(){
|
||||
var plugin_root = $juci.module("core").plugin_root;
|
||||
|
||||
return {
|
||||
restrict: "E"
|
||||
};
|
||||
})
|
||||
|
||||
.directive("luciFooter", function(){ return {} })
|
||||
.directive("luciLayoutNaked", function(){ return {} })
|
||||
.directive("luciLayoutSingleColumn", function(){ return {} })
|
||||
.directive("luciLayoutWithSidebar", function(){ return {} })
|
||||
.directive("luciNav", function(){ return {} })
|
||||
.directive("luciNavbar", function(){ return {} })
|
||||
.directive("luciTopBar", function(){ return {} })
|
||||
|
||||
angular.module("luci")
|
||||
.factory("$hosts", function($rpc, $uci){
|
||||
var hosts = {};
|
||||
|
|
|
|||
|
|
@ -20,24 +20,6 @@ angular.module("luci")
|
|||
// TODO: use rpc
|
||||
next();
|
||||
},
|
||||
function(next){
|
||||
// TODO: this will be moved somewhere else. What we want to do is
|
||||
// pick both a theme and plugins based on the router model.
|
||||
console.log("Detected hardware model: "+$config.system.hardware);
|
||||
var themes = {
|
||||
"CG300A": "inteno-red"
|
||||
};
|
||||
$config.mode = $localStorage.getItem("mode") || "basic";
|
||||
$config.theme = $localStorage.getItem("theme") || themes[$config.system.hardware] || "inteno-red";
|
||||
|
||||
//$config.theme = "default";
|
||||
|
||||
$theme.changeTheme($config.theme).done(function(){
|
||||
next();
|
||||
}).fail(function(){
|
||||
next();
|
||||
});
|
||||
},
|
||||
function(next){
|
||||
progress("Loading plugins..", 8);
|
||||
var count = 0;
|
||||
|
|
@ -47,6 +29,7 @@ angular.module("luci")
|
|||
var plugin_root = "plugins/"+id;
|
||||
$http.get(plugin_root + "/plugin.json")
|
||||
.success(function(data){
|
||||
console.log("found plugin "+id);
|
||||
$juci.module(id, plugin_root, data);
|
||||
if(data && data.scripts){
|
||||
data.scripts.map(function(x){scripts.push(plugin_root + "/" + x); });
|
||||
|
|
@ -97,6 +80,24 @@ angular.module("luci")
|
|||
next();
|
||||
});
|
||||
},
|
||||
function(next){
|
||||
// TODO: this will be moved somewhere else. What we want to do is
|
||||
// pick both a theme and plugins based on the router model.
|
||||
console.log("Detected hardware model: "+$config.system.hardware);
|
||||
var themes = {
|
||||
"CG300A": "inteno-red"
|
||||
};
|
||||
$config.mode = $localStorage.getItem("mode") || "basic";
|
||||
$config.theme = $localStorage.getItem("theme") || themes[$config.system.hardware] || "inteno-red";
|
||||
|
||||
//$config.theme = "default";
|
||||
|
||||
$theme.changeTheme($config.theme).done(function(){
|
||||
next();
|
||||
}).fail(function(){
|
||||
next();
|
||||
});
|
||||
},
|
||||
function(next){
|
||||
async.each(scripts, function(script, next){
|
||||
//console.log("...."+script);
|
||||
|
|
|
|||
|
|
@ -5,6 +5,13 @@
|
|||
"widgets/luci.progress",
|
||||
"widgets/luci.table",
|
||||
"widgets/luci.config",
|
||||
"widgets/luci.layout.naked",
|
||||
"widgets/luci.layout.single_column",
|
||||
"widgets/luci.layout.with_sidebar",
|
||||
"widgets/luci.footer",
|
||||
"widgets/luci.nav",
|
||||
"widgets/luci.navbar",
|
||||
"widgets/luci.top_bar",
|
||||
"widgets/uci.firewall.nat.rule.edit",
|
||||
"widgets/core.modal",
|
||||
"widgets/luci.input.port"
|
||||
|
|
|
|||
|
|
@ -20,9 +20,9 @@
|
|||
* 02110-1301 USA
|
||||
*/
|
||||
|
||||
$juci.module("vodaphone")
|
||||
$juci.module("core")
|
||||
.directive("luciFooter", function(){
|
||||
var plugin_root = $juci.module("vodaphone").plugin_root;
|
||||
var plugin_root = $juci.module("core").plugin_root;
|
||||
|
||||
return {
|
||||
templateUrl: plugin_root+"/widgets/luci.footer.html",
|
||||
|
|
@ -20,9 +20,9 @@
|
|||
* 02110-1301 USA
|
||||
*/
|
||||
|
||||
$juci.module("vodaphone")
|
||||
$juci.module("core")
|
||||
.directive("luciLayoutNaked", function(){
|
||||
var plugin_root = $juci.module("vodaphone").plugin_root;
|
||||
var plugin_root = $juci.module("core").plugin_root;
|
||||
return {
|
||||
templateUrl: plugin_root+"/widgets/luci.layout.naked.html",
|
||||
transclude: true,
|
||||
|
|
@ -20,9 +20,9 @@
|
|||
* 02110-1301 USA
|
||||
*/
|
||||
|
||||
$juci.module("vodaphone")
|
||||
$juci.module("core")
|
||||
.directive("luciLayoutSingleColumn", function(){
|
||||
var plugin_root = $juci.module("vodaphone").plugin_root;
|
||||
var plugin_root = $juci.module("core").plugin_root;
|
||||
return {
|
||||
// accepted parameters for this tag
|
||||
scope: {
|
||||
|
|
@ -20,9 +20,9 @@
|
|||
* 02110-1301 USA
|
||||
*/
|
||||
|
||||
$juci.module("vodaphone")
|
||||
$juci.module("core")
|
||||
.directive("luciLayoutWithSidebar", function(){
|
||||
var plugin_root = $juci.module("vodaphone").plugin_root;
|
||||
var plugin_root = $juci.module("core").plugin_root;
|
||||
|
||||
return {
|
||||
// accepted parameters for this tag
|
||||
|
|
@ -20,9 +20,9 @@
|
|||
* 02110-1301 USA
|
||||
*/
|
||||
|
||||
$juci.module("vodaphone")
|
||||
$juci.module("core")
|
||||
.directive("luciNav", function(){
|
||||
var plugin_root = $juci.module("vodaphone").plugin_root;
|
||||
var plugin_root = $juci.module("core").plugin_root;
|
||||
return {
|
||||
// accepted parameters for this tag
|
||||
scope: {
|
||||
|
|
@ -21,9 +21,9 @@
|
|||
*/
|
||||
|
||||
|
||||
$juci.module("vodaphone")
|
||||
$juci.module("core")
|
||||
.directive("luciNavbar", function($location, $rootScope){
|
||||
var plugin_root = $juci.module("vodaphone").plugin_root;
|
||||
var plugin_root = $juci.module("core").plugin_root;
|
||||
function activate(){
|
||||
var path = $location.path().replace(/^\/+|\/+$/g, '');
|
||||
var subtree = path.split(".")[0];
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
$juci.module("vodaphone")
|
||||
$juci.module("core")
|
||||
.directive("luciTopBar", function($compile){
|
||||
var plugin_root = $juci.module("vodaphone").plugin_root;
|
||||
var plugin_root = $juci.module("core").plugin_root;
|
||||
return {
|
||||
templateUrl: plugin_root+"/widgets/luci.top_bar.html",
|
||||
controller: "luciTopBarController",
|
||||
|
|
@ -31,3 +31,4 @@ $juci.module("router")
|
|||
}); */
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -5,12 +5,5 @@
|
|||
"css/bootstrap.min.css"
|
||||
],
|
||||
"scripts": [
|
||||
"widgets/luci.layout.naked",
|
||||
"widgets/luci.layout.single_column",
|
||||
"widgets/luci.layout.with_sidebar",
|
||||
"widgets/luci.footer",
|
||||
"widgets/luci.nav",
|
||||
"widgets/luci.navbar",
|
||||
"widgets/luci.top_bar"
|
||||
]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,50 +0,0 @@
|
|||
/*
|
||||
* juci - javascript universal client interface
|
||||
*
|
||||
* Project Author: Martin K. Schröder <mkschreder.uk@gmail.com>
|
||||
*
|
||||
* Copyright (C) 2012-2013 Inteno Broadband Technology AB. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* version 2 as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA
|
||||
*/
|
||||
|
||||
$juci.module("inteno-red")
|
||||
.directive("luciFooter", function(){
|
||||
var plugin_root = $juci.module("inteno-red").plugin_root;
|
||||
|
||||
return {
|
||||
templateUrl: plugin_root+"/widgets/luci.footer.html",
|
||||
controller: "luciFooterController"
|
||||
};
|
||||
})
|
||||
.controller("luciFooterController", function($scope, $rpc, $config, $languages, gettextCatalog, gettext, $tr, $status){
|
||||
// TODO: move this into a higher level controller maybe?
|
||||
$scope.languages = $languages.getLanguages();
|
||||
$scope.isActiveLanguage = function(lang){
|
||||
return gettextCatalog.currentLanguage == lang.short_code;
|
||||
}
|
||||
$scope.setLanguage = function(lang){
|
||||
$languages.setLanguage(lang.short_code);
|
||||
};
|
||||
$scope.config = $config;
|
||||
setInterval(function(){
|
||||
try{
|
||||
$scope.wanip = $status.ubus.network.interface.wan.status["ipv4-address"][0].ipaddr;
|
||||
} catch(e) {
|
||||
$scope.wanip = $tr(gettext("Not connected"));
|
||||
}
|
||||
try{ $scope.firmware = $status.ubus.router.info.system.firmware; } catch(e) {}
|
||||
}, 1000);
|
||||
});
|
||||
|
|
@ -1,35 +0,0 @@
|
|||
/*
|
||||
* juci - javascript universal client interface
|
||||
*
|
||||
* Project Author: Martin K. Schröder <mkschreder.uk@gmail.com>
|
||||
*
|
||||
* Copyright (C) 2012-2013 Inteno Broadband Technology AB. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* version 2 as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA
|
||||
*/
|
||||
|
||||
$juci.module("inteno-red")
|
||||
.directive("luciLayoutNaked", function(){
|
||||
var plugin_root = $juci.module("inteno-red").plugin_root;
|
||||
return {
|
||||
templateUrl: plugin_root+"/widgets/luci.layout.naked.html",
|
||||
transclude: true,
|
||||
controller: "luciLayoutNakedController",
|
||||
controllerAs: "ctrl"
|
||||
};
|
||||
})
|
||||
.controller("luciLayoutNakedController", function($scope, $session){
|
||||
|
||||
});
|
||||
|
|
@ -1,38 +0,0 @@
|
|||
/*
|
||||
* juci - javascript universal client interface
|
||||
*
|
||||
* Project Author: Martin K. Schröder <mkschreder.uk@gmail.com>
|
||||
*
|
||||
* Copyright (C) 2012-2013 Inteno Broadband Technology AB. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* version 2 as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA
|
||||
*/
|
||||
|
||||
$juci.module("inteno-red")
|
||||
.directive("luciLayoutSingleColumn", function(){
|
||||
var plugin_root = $juci.module("inteno-red").plugin_root;
|
||||
return {
|
||||
// accepted parameters for this tag
|
||||
scope: {
|
||||
},
|
||||
templateUrl: plugin_root+"/widgets/luci.layout.single_column.html",
|
||||
transclude: true,
|
||||
controller: "luciLayoutSingleColumnController",
|
||||
controllerAs: "ctrl"
|
||||
};
|
||||
})
|
||||
.controller("luciLayoutSingleColumnController", function($scope, $session){
|
||||
|
||||
});
|
||||
|
|
@ -1,39 +0,0 @@
|
|||
/*
|
||||
* juci - javascript universal client interface
|
||||
*
|
||||
* Project Author: Martin K. Schröder <mkschreder.uk@gmail.com>
|
||||
*
|
||||
* Copyright (C) 2012-2013 Inteno Broadband Technology AB. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* version 2 as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA
|
||||
*/
|
||||
|
||||
$juci.module("inteno-red")
|
||||
.directive("luciLayoutWithSidebar", function(){
|
||||
var plugin_root = $juci.module("inteno-red").plugin_root;
|
||||
|
||||
return {
|
||||
// accepted parameters for this tag
|
||||
scope: {
|
||||
},
|
||||
templateUrl: plugin_root+"/widgets/luci.layout.with_sidebar.html",
|
||||
transclude: true,
|
||||
controller: "luciLayoutWithSidebarController",
|
||||
controllerAs: "ctrl"
|
||||
};
|
||||
})
|
||||
.controller("luciLayoutWithSidebarController", function($scope, $session){
|
||||
|
||||
});
|
||||
|
|
@ -1,78 +0,0 @@
|
|||
/*
|
||||
* juci - javascript universal client interface
|
||||
*
|
||||
* Project Author: Martin K. Schröder <mkschreder.uk@gmail.com>
|
||||
*
|
||||
* Copyright (C) 2012-2013 Inteno Broadband Technology AB. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* version 2 as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA
|
||||
*/
|
||||
|
||||
$juci.module("inteno-red")
|
||||
.directive("luciNav", function(){
|
||||
var plugin_root = $juci.module("inteno-red").plugin_root;
|
||||
return {
|
||||
// accepted parameters for this tag
|
||||
scope: {
|
||||
},
|
||||
templateUrl: plugin_root+"/widgets/luci.nav.html",
|
||||
replace: true,
|
||||
controller: "NavCtrl",
|
||||
controllerAs: "ctrl"
|
||||
};
|
||||
})
|
||||
.controller("NavCtrl", function($scope, $navigation, $location, $state, $rootScope, $config){
|
||||
var path = $location.path().replace(/^\/+|\/+$/g, '');
|
||||
var subtree = path.split(".")[0];
|
||||
|
||||
$scope.tree = $navigation.tree(subtree);
|
||||
|
||||
$scope.hasChildren = function(menu){
|
||||
return Object.keys(menu.children) > 0;
|
||||
}
|
||||
$scope.isActive = function (viewLocation) {
|
||||
return viewLocation === $location.path();
|
||||
};
|
||||
|
||||
$scope.itemVisible = function(item){
|
||||
if(!item.modes.length) return true;
|
||||
else if(item.modes && item.modes.indexOf($config.mode) == -1) {
|
||||
return false;
|
||||
}
|
||||
else return true;
|
||||
}
|
||||
|
||||
function activate(){
|
||||
var path = $location.path().replace(/^\/+|\/+$/g, '');
|
||||
var subtree = path.split(".")[0];
|
||||
$scope.tree = $navigation.tree(subtree);
|
||||
|
||||
setTimeout(function(){
|
||||
$("nav ul a").removeClass("open");
|
||||
$("nav ul a[href='#!"+path+"']").parent().addClass("open");
|
||||
}, 0);
|
||||
};
|
||||
$rootScope.$on('$stateChangeSuccess', function(event, toState, toParams, fromState, fromParams){
|
||||
activate();
|
||||
});
|
||||
activate();
|
||||
|
||||
/*$scope.$on('$locationChangeSuccess', function () {
|
||||
var path = $location.path().replace(/^\/+|\/+$/g, '');
|
||||
var subtree = path.split(".")[0];
|
||||
$scope.tree = $navigation.tree(subtree);
|
||||
$("nav ul a[href='#!"+path+"']").parent().addClass("open");
|
||||
}); */
|
||||
});
|
||||
|
|
@ -1,71 +0,0 @@
|
|||
/*
|
||||
* juci - javascript universal client interface
|
||||
*
|
||||
* Project Author: Martin K. Schröder <mkschreder.uk@gmail.com>
|
||||
*
|
||||
* Copyright (C) 2012-2013 Inteno Broadband Technology AB. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* version 2 as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA
|
||||
*/
|
||||
|
||||
|
||||
$juci.module("inteno-red")
|
||||
.directive("luciNavbar", function($location, $rootScope){
|
||||
var plugin_root = $juci.module("inteno-red").plugin_root;
|
||||
function activate(){
|
||||
var path = $location.path().replace(/^\/+|\/+$/g, '');
|
||||
var subtree = path.split(".")[0];
|
||||
|
||||
setTimeout(function(){
|
||||
$("ul.nav li a").parent().removeClass("open");
|
||||
$("ul.nav li a[href='#!"+subtree+"']").addClass("open");
|
||||
$("ul.nav li a[href='#!"+subtree+"']").parent().addClass("open");
|
||||
}, 0);
|
||||
};
|
||||
$rootScope.$on('$stateChangeSuccess', function(event, toState, toParams, fromState, fromParams){
|
||||
activate();
|
||||
});
|
||||
return {
|
||||
restrict: 'E',
|
||||
templateUrl: plugin_root+"/widgets/luci.navbar.html",
|
||||
replace: true
|
||||
};
|
||||
})
|
||||
.controller("NavigationCtrl", function($scope, $location, $navigation, $rootScope, $config, $rpc){
|
||||
$scope.tree = $navigation.tree();
|
||||
$scope.hasChildren = function(menu){
|
||||
return menu.children_list > 0;
|
||||
}
|
||||
$scope.isActive = function (viewLocation) {
|
||||
return viewLocation === $location.path();
|
||||
};
|
||||
/*
|
||||
$(function(){
|
||||
var themes = $config.themes;
|
||||
$config.theme = localStorage.getItem("theme") || "default";
|
||||
//var bootstrap = $('<link href="'+themes[$config.theme]+'/css/bootstrap.min.css" rel="stylesheet" />');
|
||||
var theme = $('<link href="'+themes[$config.theme]+'/css/theme.css" rel="stylesheet" />');
|
||||
//bootstrap.appendTo('head');
|
||||
theme.appendTo('head');
|
||||
$('.theme-link').click(function(){
|
||||
var themename = $(this).attr('data-theme');
|
||||
var themeurl = themes[themename];
|
||||
$config.theme = themename;
|
||||
localStorage.setItem("theme", themename);
|
||||
//bootstrap.attr('href',themeurl+"/css/bootstrap.min.css");
|
||||
theme.attr('href',themeurl+"/css/theme.css");
|
||||
});
|
||||
});*/
|
||||
});
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
$juci.module("inteno-red")
|
||||
.directive("luciTopBar", function($compile){
|
||||
var plugin_root = $juci.module("inteno-red").plugin_root;
|
||||
return {
|
||||
templateUrl: plugin_root+"/widgets/luci.top_bar.html",
|
||||
controller: "luciTopBarController",
|
||||
replace: true
|
||||
};
|
||||
})
|
||||
.controller("luciTopBarController", function($scope, $config, $session, $window, $localStorage, $state, gettext){
|
||||
$scope.model = ($config.system.name || "") + " " + ($config.system.hardware || "");
|
||||
|
||||
$scope.guiModes = [
|
||||
{id: "basic", label: gettext("Basic Mode")},
|
||||
{id: "expert", label: gettext("Expert Mode")},
|
||||
{id: "logout", label: gettext("Log out")}
|
||||
];
|
||||
Object.keys($scope.guiModes).map(function(k){
|
||||
var m = $scope.guiModes[k];
|
||||
if(m.id == $config.mode) $scope.selectedMode = m;
|
||||
});
|
||||
$scope.onChangeMode = function(item){
|
||||
var selected = item.id;
|
||||
if(selected == "logout") {
|
||||
$session.logout().always(function(){
|
||||
$window.location.href="/";
|
||||
});
|
||||
} else {
|
||||
$localStorage.setItem("mode", selected);
|
||||
$config.mode = selected;
|
||||
$state.reload();
|
||||
}
|
||||
};
|
||||
});
|
||||
|
|
@ -6,12 +6,6 @@
|
|||
"css/theme.css"
|
||||
],
|
||||
"scripts": [
|
||||
"widgets/luci.layout.naked",
|
||||
"widgets/luci.layout.single_column",
|
||||
"widgets/luci.layout.with_sidebar",
|
||||
"widgets/luci.footer",
|
||||
"widgets/luci.nav",
|
||||
"widgets/luci.navbar",
|
||||
"widgets/luci.top_bar"
|
||||
"vodaphone"
|
||||
]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1 +1,18 @@
|
|||
|
||||
(function(){
|
||||
var overrides = {
|
||||
"luciFooterDirective": "/widgets/luci.footer.html",
|
||||
"luciLayoutNakedDirective": "/widgets/luci.layout.naked.html",
|
||||
"luciLayoutSingleColumnDirective": "/widgets/luci.layout.single_column.html",
|
||||
"luciLayoutWithSidebarDirective": "/widgets/luci.layout.with_sidebar.html",
|
||||
"luciNavDirective": "/widgets/luci.nav.html",
|
||||
"luciNavbarDirective": "/widgets/luci.navbar.html",
|
||||
"luciTopBarDirective": "/widgets/luci.top_bar.html"
|
||||
};
|
||||
Object.keys(overrides).map(function(k){
|
||||
$juci.decorator(k, function($delegate){
|
||||
var plugin_root = $juci.module("vodaphone").plugin_root;
|
||||
$delegate[1].templateUrl = plugin_root + overrides[k];
|
||||
return $delegate;
|
||||
});
|
||||
});
|
||||
})();
|
||||
|
|
|
|||
|
|
@ -1,22 +0,0 @@
|
|||
<luci-top-bar></luci-top-bar>
|
||||
<div>
|
||||
<div class="container" role="main" style="min-height: 1000px;">
|
||||
<luci-main>
|
||||
<div class="row">
|
||||
<luci-navbar></luci-navbar>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<ng-transclude></ng-transclude>
|
||||
</div>
|
||||
</div>
|
||||
</luci-main>
|
||||
</div>
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<luci-footer></luci-footer>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -1,46 +0,0 @@
|
|||
<luci-top-bar></luci-top-bar>
|
||||
<div>
|
||||
<div class="luci-content container" role="main" style="min-height: 1000px;">
|
||||
<div class="row">
|
||||
<div class="col-xs-1"></div>
|
||||
<div class="col-xs-10">
|
||||
<div id="rhombus-wrap">
|
||||
<div id="logo"> </div>
|
||||
<div id="rhombus"> </div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<luci-navbar></luci-navbar>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-3">
|
||||
<luci-nav></luci-nav>
|
||||
</div>
|
||||
<div class="col-md-9">
|
||||
<ng-transclude></ng-transclude>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-1"></div>
|
||||
</div>
|
||||
<!--
|
||||
<div class="row">
|
||||
<luci-navbar></luci-navbar>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-3">
|
||||
<luci-nav></luci-nav>
|
||||
</div>
|
||||
<div class="col-md-9">
|
||||
<ng-transclude></ng-transclude>
|
||||
</div>
|
||||
</div>-->
|
||||
</div>
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<luci-footer></luci-footer>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -1,48 +0,0 @@
|
|||
|
||||
$juci.config(function($provide){
|
||||
$provide.decorator("luciFooterDirective", function($delegate){
|
||||
console.log(JSON.stringify($delegate[0]));
|
||||
return $delegate;
|
||||
})
|
||||
});
|
||||
|
||||
$juci.module("vodaphone")
|
||||
.directive("luciLayoutWithSidebar", function($http, $compile, $templateCache, $config, $provide){
|
||||
/*function deleteDirective(name){
|
||||
for(var i = 0; i < angular._invokeQueue.length; i++){
|
||||
var item = angular._invokeQueue[i];
|
||||
if(item[1] == "directive" && item.Arguments[0] == name){
|
||||
angular._invokeQueue.splice(i, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
deleteDirective("luciLayoutWithSidebar");
|
||||
var plugin_root = $juci.module("vodaphone").plugin_root;
|
||||
|
||||
return {
|
||||
templateUrl: plugin_root + "/widgets/vodaphone.layout.with_sidebar.html",
|
||||
transclude: true,
|
||||
controller: "luciLayoutWithSidebarController"
|
||||
};
|
||||
*/
|
||||
var plugin_root = $juci.module("vodaphone").plugin_root;
|
||||
var target_tpl = "plugins/core/widgets/luci.layout.with_sidebar.html";
|
||||
return {
|
||||
priority: 100, // give it higher priority than built-in ng-click
|
||||
//templateUrl: plugin_root+"/widgets/vodaphone.navbar.html",
|
||||
template: '<div ng-include="templateUrl" ng-transclude></div>',
|
||||
replace: true,
|
||||
transclude: true,
|
||||
link: function(scope, element, attrs){
|
||||
scope.templateUrl = plugin_root + "/widgets/vodaphone.layout.with_sidebar.html";
|
||||
|
||||
if($config.theme == "vodaphone" && !$templateCache.get(plugin_root + "/widgets/vodaphone.layout.with_sidebar.html")){
|
||||
var promise = $http.get(plugin_root + "/widgets/vodaphone.layout.with_sidebar.html", {cache: $templateCache}).success(function(html) {
|
||||
$templateCache.put(target_tpl, html);
|
||||
}).then(function (response) {
|
||||
//element.replaceWith($compile($templateCache.get(target_tpl))(scope));
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
});
|
||||
Loading…
Add table
Reference in a new issue