2219 Añadir menu wikipedia
This commit is contained in:
parent
aca687bafc
commit
d835dd60ed
|
@ -1,10 +1,11 @@
|
||||||
<ul class="vn-list" ng-if="::$ctrl.items.length > 0">
|
<ul class="vn-list" ng-if="::$ctrl.items.length > 0">
|
||||||
<li ng-repeat="item in ::$ctrl.items" name="{{::item.description}}">
|
<li ng-repeat="item in ::$ctrl.items" name="{{::item.description}}">
|
||||||
<a ui-sref="{{::item.state}}"
|
<a ng-if="!item.external"
|
||||||
|
ui-sref="{{::item.state}}"
|
||||||
class="vn-item"
|
class="vn-item"
|
||||||
ng-class="{active: item.active && !item.childs, expanded: item.active}"
|
ng-class="{active: item.active && !item.childs, expanded: item.active}"
|
||||||
ng-click="$ctrl.setActive(item)">
|
ng-click="$ctrl.setActive(item)">
|
||||||
<vn-item-section avatar>
|
<vn-item-section avatar>
|
||||||
<vn-icon icon="{{::item.icon}}" ng-if="::item.icon"></vn-icon>
|
<vn-icon icon="{{::item.icon}}" ng-if="::item.icon"></vn-icon>
|
||||||
</vn-item-section>
|
</vn-item-section>
|
||||||
<vn-item-section translate>
|
<vn-item-section translate>
|
||||||
|
@ -14,6 +15,16 @@
|
||||||
<vn-icon icon="keyboard_arrow_down" ng-if="::item.childs.length > 0"></vn-icon>
|
<vn-icon icon="keyboard_arrow_down" ng-if="::item.childs.length > 0"></vn-icon>
|
||||||
</vn-item-section>
|
</vn-item-section>
|
||||||
</a>
|
</a>
|
||||||
|
<a ng-if="item.external"
|
||||||
|
href="{{::item.url}}"
|
||||||
|
class="vn-item">
|
||||||
|
<vn-item-section avatar>
|
||||||
|
<vn-icon icon="{{::item.icon}}" ng-if="::item.icon"></vn-icon>
|
||||||
|
</vn-item-section>
|
||||||
|
<vn-item-section translate>
|
||||||
|
{{::item.description}}
|
||||||
|
</vn-item-section>
|
||||||
|
</a>
|
||||||
<ul class="vn-list" ng-show="item.childs.length > 0 && item.active">
|
<ul class="vn-list" ng-show="item.childs.length > 0 && item.active">
|
||||||
<li ng-repeat="child in ::item.childs">
|
<li ng-repeat="child in ::item.childs">
|
||||||
<a ui-sref="{{::child.state}}"
|
<a ui-sref="{{::child.state}}"
|
||||||
|
|
|
@ -36,23 +36,28 @@ export default class LeftMenu {
|
||||||
|
|
||||||
let addItem = (items, item) => {
|
let addItem = (items, item) => {
|
||||||
let state = states[item.state];
|
let state = states[item.state];
|
||||||
if (!state) return;
|
if (state) {
|
||||||
|
state = state.self;
|
||||||
|
let acl = state.data.acl;
|
||||||
|
|
||||||
state = state.self;
|
if (acl && !this.aclService.hasAny(acl))
|
||||||
let acl = state.data.acl;
|
return;
|
||||||
|
} else if (!item.external) {
|
||||||
if (acl && !this.aclService.hasAny(acl))
|
console.warn('wrong left-menu definition');
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
items.push({
|
items.push({
|
||||||
icon: item.icon,
|
icon: item.icon,
|
||||||
description: state.description,
|
description: item.description || state.description,
|
||||||
state: item.state
|
state: item.state,
|
||||||
|
external: item.external,
|
||||||
|
url: item.url
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
for (let item of menu) {
|
for (let item of menu) {
|
||||||
if (item.state)
|
if (item.state || item.external)
|
||||||
addItem(items, item);
|
addItem(items, item);
|
||||||
else {
|
else {
|
||||||
let childs = [];
|
let childs = [];
|
||||||
|
|
|
@ -14,6 +14,12 @@
|
||||||
{"state": "worker.card.calendar", "icon": "icon-calendar"},
|
{"state": "worker.card.calendar", "icon": "icon-calendar"},
|
||||||
{"state": "worker.card.timeControl", "icon": "access_time"},
|
{"state": "worker.card.timeControl", "icon": "access_time"},
|
||||||
{"state": "worker.card.dms.index", "icon": "cloud_upload"},
|
{"state": "worker.card.dms.index", "icon": "cloud_upload"},
|
||||||
|
{
|
||||||
|
"icon": "icon-wiki",
|
||||||
|
"external":true,
|
||||||
|
"url": "http://wiki.verdnatura.es",
|
||||||
|
"description": "Wikipedia"
|
||||||
|
},
|
||||||
{"state": "worker.card.workerLog", "icon": "history"}
|
{"state": "worker.card.workerLog", "icon": "history"}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue