This commit is contained in:
Martin Schröder 2015-04-23 16:41:56 +02:00 committed by Martin Schröder
parent ce3b5d9ebe
commit 17a72c630f
20 changed files with 3326 additions and 151 deletions

View file

@ -159,27 +159,21 @@ angular.module("luci").controller("BodyCtrl", function ($scope, $templateCache,
}];
$config.mode = $localStorage.getItem("mode") || "basic";
$config.theme = $localStorage.getItem("theme") || "vodaphone"; // TODO: change to default inteno
$config.theme = $localStorage.getItem("theme") || $config.theme || "default";
$scope.theme_index = "themes/"+$config.theme+"/index.html";
/*setTimeout(function(){
$("#guiMode").selectpicker('val', $config.mode || "basic");
}, 100); */
/*$("#guiMode").on("change", function(){
var selected = $(this).find("option:selected").val();
console.log(selected);
if(selected == "logout") {
$session.logout().always(function(){
$window.location.href="/";
});
} else {
$config.mode = selected;
$state.reload();
}
localStorage.setItem("mode", selected);
}); */
if($config.theme in $config.themes){
var th = $config.themes[$config.theme];
$scope.theme_index = th+"/index.html";
var theme = $('<link href="'+th+'/css/theme.css" rel="stylesheet" />');
theme.appendTo('head');
} else {
alert("Could not load theme "+$config.theme+"!");
var th = $config.themes["default"];
$scope.theme_index = th+"/index.html";
var theme = $('<link href="'+th+'/css/theme.css" rel="stylesheet" />');
theme.appendTo('head');
}
});

View file

@ -87,27 +87,6 @@ angular.module("luci")
if(!item.path) return;
item = this.insertLeaf(item.path, item);
// now also register with the routing service
//if(item.page){
/* (function(item){
var lazyPromise = null;
$stateProvider.state(item.path.replace(".", "_"), {
url: "/"+item.path,
views: {
"content": {
templateUrl: item.page || "/pages/default.html"
}
},
onEnter: function($window){
// TODO: all these redirects seem to load page multiple times.
if(item.redirect) $window.location.href = "#!"+item.redirect;
},
luci_config: item
});
})(item); */
//}
//alert(JSON.stringify(data));
return data;
};
this.$get = function() {

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1 @@
// bootstrap example page

View file

@ -17,6 +17,9 @@
},
"login": {
"view": "pages/login"
},
"bootstrap": {
"view": "pages/bootstrap"
}
}
}

View file

@ -4,9 +4,13 @@
<span ng-repeat="lang in languages">
<a style="text-decoration: {{isActiveLanguage(lang)?'underline':'none'}}; color: inherit;" href="" ng-click="setLanguage(lang)">{{lang.title}}</a>{{$last ? '' : ' | '}}
</span>
| Theme: <a href="" data-theme="default" class="theme-link">Default</a>
<a href="" data-theme="vodaphone" class="theme-link">Vodaphone</a>
<a href="" data-theme="red" class="theme-link">Inteno</a>
</div>
<div id="info">
WAN IP Address: {{wanip}} | Firmware version: {{firmwareVersion}}
</div>
</div>
</div>

View file

@ -32,7 +32,7 @@ $juci.module("core")
controller: "luciFooterController"
};
})
.controller("luciFooterController", function($scope, $rpc, $languages, gettextCatalog){
.controller("luciFooterController", function($scope, $rpc, $config, $languages, gettextCatalog){
// TODO: move this into a higher level controller maybe?
$scope.languages = $languages.getLanguages();
$scope.isActiveLanguage = function(lang){
@ -50,4 +50,23 @@ $juci.module("core")
$scope.$apply();
});
});
// TODO: remove the theme switches when done developing
$(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");
window.location.reload();
});
});
});

View file

@ -1,6 +1,6 @@
<luci-top-bar></luci-top-bar>
<div>
<div class="container" role="main" style="min-height: 1000px;">
<div class="luci-content container" role="main" style="min-height: 1000px;">
<div class="row">
<luci-navbar></luci-navbar>
</div>
@ -13,7 +13,6 @@
<ng-transclude></ng-transclude>
</div>
</div>
</div>
<div class="container">
<div class="row">

View file

@ -22,8 +22,21 @@
$juci.module("core")
.directive("luciNavbar", function(){
.directive("luciNavbar", function($location, $rootScope){
var plugin_root = $juci.module("core").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",
@ -32,13 +45,13 @@ $juci.module("core")
})
.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";
@ -55,21 +68,4 @@ $juci.module("core")
theme.attr('href',themeurl+"/css/theme.css");
});
});
function activate(){
var path = $location.path().replace(/^\/+|\/+$/g, '');
var subtree = path.split(".")[0];
$scope.tree = $navigation.tree();
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();
});
activate();
});

View file

@ -1,26 +1,21 @@
<div id="top-bar">
<div id="top-bar-content">
<div class="rel">
<a href="#">
<div id="logo">
{{ model }} <!--<img src="themes/vodaphone/img/logo/easybox-804-reskin.png" alt="">-->
</div>
</a>
<div id="top-info" class="clearfix">
<div id="top-info-mode" class="rel">
<ui-select ng-model="selectedMode"
theme="bootstrap"
search-enabled="false"
on-select="onChangeMode($item, $model)"
style="width: 150px;"
>
<ui-select-match placeholder="Basic">{{$select.selected.label}}</ui-select-match>
<ui-select-choices repeat="mode in guiModes"
refresh-delay="0">
<div >{{mode.label}}</div>
</ui-select-choices>
</ui-select>
</div>
<div class="top-bar">
<div class="container">
<div class="row">
<div class="col-md-5" style="font-size: 28px; padding-top: 10px;">{{ model }}</div>
<div style="float: right; margin-top: 10px; ">
<ui-select ng-model="selectedMode"
theme="bootstrap"
search-enabled="false"
on-select="onChangeMode($item, $model)"
style="width: 150px;"
>
<ui-select-match placeholder="Basic">{{$select.selected.label}}</ui-select-match>
<ui-select-choices repeat="mode in guiModes"
refresh-delay="0">
<div >{{mode.label}}</div>
</ui-select-choices>
</ui-select>
</div>
</div>
</div>

View file

@ -29,11 +29,11 @@
</div>
<div class="panel-body">
<div class="row" ng-repeat="(k, v) in values">
<div class="col-md-4">
<div class="col-md-6">
{{k}}
</div>
<div class="col-md-6">
<input type="text" ng-model="values[k]"/>
<input type="text" class="form-control" ng-model="values[k]"/>
</div>
</div>
</div>

View file

@ -1,5 +1,6 @@
{
"scripts": [
"widgets/vodaphone.navbar"
"widgets/vodaphone.navbar",
"widgets/vodaphone.top_bar"
]
}

View file

@ -21,33 +21,21 @@
*/
$juci.module("vodaphone")
.directive("luciNavbar", function($http, $compile, $templateCache){
.directive("luciNavbar", function($http, $compile, $templateCache, $config){
var plugin_root = $juci.module("vodaphone").plugin_root;
var target_tpl = "plugins/core/widgets/luci.navbar.html";
return {
priority: 100, // give it higher priority than built-in ng-click
//templateUrl: plugin_root+"/widgets/vodaphone.navbar.html",
replace: true,
/*compile: function(tElement, tAtrrs) {
templateLoader = $http.get(plugin_root + "/widgets/vodaphone.navbar.html", {cache: $templateCache})
.success(function(html) {
$templateCache.put("plugins/core/widgets/luci.navbar.html", html);
tElement.html(html);
});
return function (scope, element, attrs) {
templateLoader.then(function (templateText) {
//alert(tElement.html());
element.html($compile(tElement.html())(scope));
});
};
}, */
link: function(scope, element, attrs){
var promise = $http.get(plugin_root + "/widgets/vodaphone.navbar.html", {cache: $templateCache}).success(function(html) {
$templateCache.put("plugins/core/widgets/luci.navbar.html", html);
element.html(html);
}).then(function (response) {
element.replaceWith($compile(element.html())(scope));
});
if($config.theme == "vodaphone" && !$templateCache.get(plugin_root + "/widgets/vodaphone.navbar.html")){
var promise = $http.get(plugin_root + "/widgets/vodaphone.navbar.html", {cache: $templateCache}).success(function(html) {
$templateCache.put(target_tpl, html);
}).then(function (response) {
element.replaceWith($compile($templateCache.get(target_tpl))(scope));
});
}
}
};
});

View file

@ -0,0 +1,27 @@
<div id="top-bar" ng-controller="luciTopBarController">
<div id="top-bar-content">
<div class="rel">
<a href="#">
<div id="logo">
{{ model }} <!--<img src="themes/vodaphone/img/logo/easybox-804-reskin.png" alt="">-->
</div>
</a>
<div id="top-info" class="clearfix">
<div id="top-info-mode" class="rel">
<ui-select ng-model="selectedMode"
theme="bootstrap"
search-enabled="false"
on-select="onChangeMode($item, $model)"
style="width: 150px;"
>
<ui-select-match placeholder="Basic">{{$select.selected.label}}</ui-select-match>
<ui-select-choices repeat="mode in guiModes"
refresh-delay="0">
<div >{{mode.label}}</div>
</ui-select-choices>
</ui-select>
</div>
</div>
</div>
</div>
</div>

View file

@ -0,0 +1,41 @@
/*
* 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("vodaphone")
.directive("luciTopBar", function($http, $compile, $templateCache, $config){
var plugin_root = $juci.module("vodaphone").plugin_root;
var target_tpl = "plugins/core/widgets/luci.top_bar.html";
return {
priority: 100, // give it higher priority than built-in ng-click
//templateUrl: plugin_root+"/widgets/vodaphone.navbar.html",
replace: true,
link: function(scope, element, attrs){
if($config.theme == "vodaphone" && !$templateCache.get(plugin_root + "/widgets/vodaphone.top_bar.html")){
var promise = $http.get(plugin_root + "/widgets/vodaphone.top_bar.html", {cache: $templateCache}).success(function(html) {
$templateCache.put(target_tpl, html);
}).then(function (response) {
element.replaceWith($compile($templateCache.get(target_tpl))(scope));
});
}
}
};
});

View file

@ -10,11 +10,38 @@ div.logo {
margin-left: 20px;
}
.top-bar {
margin-bottom: 20px;
background-color: #EBEBEB;
border-bottom: 1px solid #ccc;
padding-bottom: 10px;
/* ==========================================================================
Header
========================================================================== */
#logo {
float: left;
}
#top-bar {
background-color: #ebebeb;
border-bottom: 1px solid #bbb;
height: 50px;
margin-bottom: 20px;
position: relative;
font-size: 14px;
line-height: 50px;
}
#top-bar-content {
width: 950px;
margin: 0 auto;
padding-left: 80px;
}
#top-info-mode {
float: right;
}
#top-info-logged-user {
float: right;
margin-right: 15px;
}
#top-info-mode .chosen-container {
background-color: #fff;
display: block;
margin-top: 5px;
}
.navbar-default {

View file

@ -1,27 +1,2 @@
<div class="top-bar">
<div class="container">
<div class="row">
<div class="col-md-5" style="font-size: 28px; padding-top: 10px;">{{ config.model }}</div>
<div style="float: right; margin-top: 10px; ">
<ui-select ng-model="selectedMode"
theme="bootstrap"
search-enabled="false"
on-select="onChangeMode($item, $model)"
style="width: 150px;"
>
<ui-select-match placeholder="Basic">{{$select.selected.label}}</ui-select-match>
<ui-select-choices repeat="mode in guiModes"
refresh-delay="0">
<div >{{mode.label}}</div>
</ui-select-choices>
</ui-select>
<!--<select id="guiMode" class="selectpicker" >
<option value="basic">Basic Mode</option>
<option value="expert">Expert Mode</option>
<option value="logout">Logout</option>
</select>-->
</div>
</div>
</div>
</div>
<div ui-view="content" style="min-height: 1000px;"></div>

View file

@ -18,3 +18,34 @@ div.logo {
.navbar-default {
box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.6);
}
.luci-nav a {
color: #444;
}
.nav > li.open > a {
color: #ee0000 !important;
}
.navbar .nav > li.open > a {
color: #fff !important;
}
.animate-show {
line-height: 20px;
opacity: 1;
padding: 10px;
border: 1px solid black;
background: white;
}
.animate-show.ng-hide-add.ng-hide-add-active,
.animate-show.ng-hide-remove.ng-hide-remove-active {
-webkit-transition: all linear 0.5s;
transition: all linear 0.5s;
}
.animate-show.ng-hide {
line-height: 0;
opacity: 0;
padding: 0 10px;
}

View file

@ -0,0 +1 @@
<div ui-view="content" style="min-height: 1000px;"></div>

View file

@ -1,3 +1,4 @@
html {
box-sizing: border-box;
}
@ -43,6 +44,9 @@ a {
color: inherit;
}
.luci-content {
}
/* ==========================================================================
Font
========================================================================== */
@ -475,6 +479,12 @@ body {
width: 100%;
margin: 0;
}
/*
Please make selectors specific, otherwise you override them everywhere.
This is important because for instance bootstrap panel is also using
h3 tags and they look messed up if global h3 tag is overridden here!
*/
/*
h1 {
color: #e60000;
font-family: "VodafoneRgRegular";
@ -533,8 +543,8 @@ h3.margin-top {
}
.row {
/*font-weight: bold;*/
display: table-row;
line-height: 24px;
width: 100%;
@ -543,15 +553,6 @@ h3.margin-top {
padding-top: 20px;
padding-bottom: 20px;
}
/*.row:not(.description) .left {
width: 70%;
}
.row:not(.description) .leftHasRight {
width: 22%;
}
.row:not(.description) .left + .right {
width: 30%;
}*/
.h3-content .row + .row > div,
.h3-wrapper-content .row + .row > div {
border-top: solid 1px #e6e6e6;
@ -657,7 +658,7 @@ input.max2-network {
text-align: center;
padding: 7px 0px !important;
}
*/
/*
Text box input error
*/