2219 Añadir menu wikipedia

This commit is contained in:
Javi Gallego 2020-04-06 12:40:21 +02:00
parent aca687bafc
commit d835dd60ed
3 changed files with 32 additions and 10 deletions

View File

@ -1,10 +1,11 @@
<ul class="vn-list" ng-if="::$ctrl.items.length > 0">
<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"
ng-class="{active: item.active && !item.childs, expanded: item.active}"
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-item-section>
<vn-item-section translate>
@ -14,6 +15,16 @@
<vn-icon icon="keyboard_arrow_down" ng-if="::item.childs.length > 0"></vn-icon>
</vn-item-section>
</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">
<li ng-repeat="child in ::item.childs">
<a ui-sref="{{::child.state}}"

View File

@ -36,23 +36,28 @@ export default class LeftMenu {
let addItem = (items, item) => {
let state = states[item.state];
if (!state) return;
if (state) {
state = state.self;
let acl = state.data.acl;
state = state.self;
let acl = state.data.acl;
if (acl && !this.aclService.hasAny(acl))
if (acl && !this.aclService.hasAny(acl))
return;
} else if (!item.external) {
console.warn('wrong left-menu definition');
return;
}
items.push({
icon: item.icon,
description: state.description,
state: item.state
description: item.description || state.description,
state: item.state,
external: item.external,
url: item.url
});
};
for (let item of menu) {
if (item.state)
if (item.state || item.external)
addItem(items, item);
else {
let childs = [];

View File

@ -14,6 +14,12 @@
{"state": "worker.card.calendar", "icon": "icon-calendar"},
{"state": "worker.card.timeControl", "icon": "access_time"},
{"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"}
]
},