Skip to content

Commit

Permalink
Include more info on fields (#178)
Browse files Browse the repository at this point in the history
  • Loading branch information
kows authored and patrickdemooij9 committed Jun 1, 2023
1 parent fe4b469 commit aa88f17
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@
var vm = this;

vm.availableItems = $scope.model.availableItems;
vm.groupedItems = $scope.model.availableItems.reduce((grp, item) => {
let { group } = item;
grp[group] = grp[group] ?? [];
grp[group].push(item);
return grp;
}, {});
vm.model = {
selection: []
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,19 @@
hide-description="true">
</umb-editor-header>
<umb-editor-container>
<umb-box>
<umb-box ng-repeat="group in vm.groupedItems">
<umb-box-content>
<div class="umb-tree">
<h4>
{{group[0].group}}
</h4>
<ul>
<li class="umb-tree-item" ng-repeat="item in vm.availableItems">
<li class="umb-tree-item" ng-repeat="item in group">
<div class="umb-tree-item__inner">
<umb-icon icon="icon-check" class="umb-tree-icon" ng-show="vm.model.selection.includes(item)"></umb-icon>
<umb-icon icon="icon-autofill" class="umb-tree-icon" ng-show="!vm.model.selection.includes(item)"></umb-icon>
<a class="umb-tree-item__label" ng-click="vm.selectItem(item)">
{{item.name}}
{{item.name}} {{item.source == 1 ? '(' + item.value + ')' : ''}}
</a>
</div>
</li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@
name: field.name,
value: field.value,
onlyShowIfInherited: field.onlyShowIfInherited,
source: 2
source: 2,
group: 'SEO Toolkit'
});
});
fields.forEach(function (d) {
Expand Down Expand Up @@ -107,11 +108,11 @@

function getAllContentFields(fields) {
return editorState.getCurrent().groups.flatMap(function (g) {
return g.properties;
return g.properties.map(prop => {return { group: g, prop};});
}).filter(function (g) {
return fields.includes(g.editor);
return fields.includes(g.prop.editor);
}).map(function (g) {
return { name: g.label, value: g.alias, source: 1 };
return { name: g.prop.label, value: g.prop.alias, source: 1, group: g.group.name };
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<div class="umb-nested-content__heading">
<umb-icon icon="icon-autofill" class="icon"></umb-icon>
<div class="umb-nested-content__item-name --has-icon">
{{field.name}}
{{field.name}} {{field.source == 1 ? '(' + field.value + ')' : ''}}
</div>
</div>
<div class="umb-nested-content__icons">
Expand Down

0 comments on commit aa88f17

Please sign in to comment.