Merge branch 'user-group-permissions' of https://github.com/umbraco/Umbraco-CMS into user-group-permissions
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
replace: true,
|
||||
templateUrl: 'views/components/users/umb-user-preview.html',
|
||||
scope: {
|
||||
avatar: "=?",
|
||||
avatars: "=?",
|
||||
name: "=",
|
||||
allowRemove: "=?",
|
||||
onRemove: "&?"
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
<div class="umb-user-picker-list-item__content">
|
||||
<div class="umb-user-picker-list-item__name">{{ user.name }}</div>
|
||||
<div class="umb-user-picker-list-item__group">
|
||||
<span ng-repeat="(key,value) in user.userGroups">{{ value }}<span ng-if="!$last">, </span></span>
|
||||
<span ng-repeat="userGroup in user.userGroups">{{ userGroup.name }}<span ng-if="!$last">, </span></span>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<div>
|
||||
<img class="umb-avatar umb-avatar--{{size}}" ng-if="imgSrc || imgSrcset" ng-src="{{imgSrc}}" ng-srcset="{{imgSrcset}}" />
|
||||
<div class="umb-avatar umb-avatar--{{size}} umb-avatar--{{color}}" ng-if="!imgSrc && !imgSrcset">
|
||||
<img class="umb-avatar umb-avatar--{{size}}" ng-if="imgSrc" ng-src="{{imgSrc}}" ng-srcset="{{imgSrcset}}" />
|
||||
<div class="umb-avatar umb-avatar--{{size}} umb-avatar--{{color}}" ng-if="!imgSrc">
|
||||
<span ng-if="name">{{ initials }}</span>
|
||||
<span ng-if="!name">?</span>
|
||||
</div>
|
||||
|
||||
@@ -5,7 +5,8 @@
|
||||
size="xs"
|
||||
color="secondary"
|
||||
name="{{name}}"
|
||||
img-src="{{avatar}}">
|
||||
img-src="{{avatars[0]}}"
|
||||
img-srcset="{{avatars[1]}} 2x, {{avatars[2]}} 3x">
|
||||
</umb-avatar>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
vm.openMediaPicker = openMediaPicker;
|
||||
vm.openUserPicker = openUserPicker;
|
||||
vm.removeSelectedItem = removeSelectedItem;
|
||||
vm.clearStartNode = clearStartNode;
|
||||
vm.getUserStateType = getUserStateType;
|
||||
|
||||
function init() {
|
||||
@@ -64,11 +65,11 @@
|
||||
vm.contentPicker = {
|
||||
title: "Select content start node",
|
||||
view: "contentpicker",
|
||||
multiPicker: true,
|
||||
hideSubmitButton: true,
|
||||
show: true,
|
||||
submit: function(model) {
|
||||
if(model.selection) {
|
||||
vm.userGroup.startNodesContent = model.selection;
|
||||
vm.userGroup.startContentId = model.selection[0];
|
||||
}
|
||||
vm.contentPicker.show = false;
|
||||
vm.contentPicker = null;
|
||||
@@ -87,11 +88,11 @@
|
||||
section: "media",
|
||||
treeAlias: "media",
|
||||
entityType: "media",
|
||||
multiPicker: true,
|
||||
hideSubmitButton: true,
|
||||
show: true,
|
||||
submit: function(model) {
|
||||
if(model.selection) {
|
||||
vm.userGroup.startNodesMedia = model.selection;
|
||||
vm.userGroup.startMediaId = model.selection[0];
|
||||
}
|
||||
vm.contentPicker.show = false;
|
||||
vm.contentPicker = null;
|
||||
@@ -126,7 +127,17 @@
|
||||
}
|
||||
|
||||
function removeSelectedItem(index, selection) {
|
||||
selection.splice(index, 1);
|
||||
if(selection && selection.length > 0) {
|
||||
selection.splice(index, 1);
|
||||
}
|
||||
}
|
||||
|
||||
function clearStartNode(type) {
|
||||
if (type === "content") {
|
||||
vm.userGroup.startContentId = null;
|
||||
} else if (type === "media") {
|
||||
vm.userGroup.startMediaId = null;
|
||||
}
|
||||
}
|
||||
|
||||
function getUserStateType(state) {
|
||||
|
||||
@@ -44,17 +44,18 @@
|
||||
</a>
|
||||
</umb-control-group>
|
||||
|
||||
<umb-control-group label="Content start nodes" description="Lorem ipsum dolor sit amet, consectetur adipiscing elit.">
|
||||
<umb-control-group label="Content start node" description="Lorem ipsum dolor sit amet, consectetur adipiscing elit.">
|
||||
<umb-node-preview
|
||||
ng-if="vm.userGroup.startContentId.id"
|
||||
style="max-width: 100%;"
|
||||
ng-repeat="node in vm.userGroup.startNodesContent"
|
||||
icon="node.icon"
|
||||
name="node.name"
|
||||
icon="vm.userGroup.startContentId.icon"
|
||||
name="vm.userGroup.startContentId.name"
|
||||
allow-remove="true"
|
||||
on-remove="vm.removeSelectedItem($index, vm.userGroup.startNodesContent)">
|
||||
on-remove="vm.clearStartNode('content')">
|
||||
</umb-node-preview>
|
||||
|
||||
<a href=""
|
||||
ng-if="!vm.userGroup.startContentId.id"
|
||||
style="max-width: 100%;"
|
||||
class="umb-node-preview-add"
|
||||
ng-click="vm.openContentPicker()"
|
||||
@@ -63,17 +64,18 @@
|
||||
</a>
|
||||
</umb-control-group>
|
||||
|
||||
<umb-control-group label="Media start nodes" description="Donec quis lacinia ligula. Suspendisse ultrices risus ante">
|
||||
<umb-control-group label="Media start node" description="Donec quis lacinia ligula. Suspendisse ultrices risus ante">
|
||||
<umb-node-preview
|
||||
ng-if="vm.userGroup.startMediaId.id"
|
||||
style="max-width: 100%;"
|
||||
ng-repeat="node in vm.userGroup.startNodesMedia"
|
||||
icon="node.icon"
|
||||
name="node.name"
|
||||
icon="vm.userGroup.startMediaId.icon"
|
||||
name="vm.userGroup.startMediaId.name"
|
||||
allow-remove="true"
|
||||
on-remove="vm.removeSelectedItem($index, vm.userGroup.startNodesMedia)">
|
||||
on-remove="vm.clearStartNode('media')">
|
||||
</umb-node-preview>
|
||||
|
||||
<a href=""
|
||||
ng-if="!vm.userGroup.startMediaId.id"
|
||||
style="max-width: 100%;"
|
||||
class="umb-node-preview-add"
|
||||
ng-click="vm.openMediaPicker()"
|
||||
@@ -106,7 +108,7 @@
|
||||
<umb-user-preview
|
||||
ng-repeat="user in vm.userGroup.users"
|
||||
name="user.name"
|
||||
avatar="user.avatar"
|
||||
avatars="user.avatars"
|
||||
allow-remove="true"
|
||||
on-remove="vm.removeSelectedUser($index, vm.userGroup.users)">
|
||||
</umb-user-preview>
|
||||
|
||||
@@ -100,15 +100,21 @@
|
||||
title: "Select content start node",
|
||||
view: "contentpicker",
|
||||
multiPicker: true,
|
||||
selection: vm.user.startContentIds,
|
||||
show: true,
|
||||
submit: function (model) {
|
||||
// select items
|
||||
if (model.selection) {
|
||||
vm.user.startNodesContent = model.selection;
|
||||
angular.forEach(model.selection, function(item){
|
||||
multiSelectItem(item, vm.user.startContentIds);
|
||||
});
|
||||
}
|
||||
// close overlay
|
||||
vm.contentPicker.show = false;
|
||||
vm.contentPicker = null;
|
||||
},
|
||||
close: function (oldModel) {
|
||||
// close overlay
|
||||
vm.contentPicker.show = false;
|
||||
vm.contentPicker = null;
|
||||
}
|
||||
@@ -125,19 +131,40 @@
|
||||
multiPicker: true,
|
||||
show: true,
|
||||
submit: function (model) {
|
||||
// select items
|
||||
if (model.selection) {
|
||||
vm.user.startNodesMedia = model.selection;
|
||||
angular.forEach(model.selection, function(item){
|
||||
multiSelectItem(item, vm.user.startMediaIds);
|
||||
});
|
||||
}
|
||||
// close overlay
|
||||
vm.mediaPicker.show = false;
|
||||
vm.mediaPicker = null;
|
||||
},
|
||||
close: function (oldModel) {
|
||||
// close overlay
|
||||
vm.mediaPicker.show = false;
|
||||
vm.mediaPicker = null;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
function multiSelectItem(item, selection) {
|
||||
var found = false;
|
||||
// check if item is already in the selected list
|
||||
if (selection.length > 0) {
|
||||
angular.forEach(selection, function (selectedItem) {
|
||||
if (selectedItem.udi === item.udi) {
|
||||
found = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
// only add the selected item if it is not already selected
|
||||
if (!found) {
|
||||
selection.push(item);
|
||||
}
|
||||
}
|
||||
|
||||
function removeSelectedItem(index, selection) {
|
||||
selection.splice(index, 1);
|
||||
}
|
||||
|
||||
@@ -126,7 +126,8 @@
|
||||
color="secondary"
|
||||
size="xxl"
|
||||
name="{{vm.user.name}}"
|
||||
img-src="{{vm.user.avatars[4]}}">
|
||||
img-src="{{vm.user.avatars[3]}}"
|
||||
img-srcset="{{vm.user.avatars[4]}} 2x, {{vm.user.avatars[4]}} 3x">
|
||||
</umb-avatar>
|
||||
|
||||
<umb-progress-bar
|
||||
|
||||
@@ -12,19 +12,15 @@
|
||||
vm.clearSelection = clearSelection;
|
||||
vm.selectUserGroup = selectUserGroup;
|
||||
|
||||
function init() {
|
||||
function onInit() {
|
||||
|
||||
vm.loading = true;
|
||||
|
||||
// Get users
|
||||
usersResource.getUserGroups().then(function (userGroups) {
|
||||
vm.userGroups = userGroups;
|
||||
});
|
||||
|
||||
// fake loading
|
||||
$timeout(function () {
|
||||
vm.loading = false;
|
||||
}, 500);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@@ -50,7 +46,7 @@
|
||||
$location.path('users/users/group/' + userGroup.id);
|
||||
}
|
||||
|
||||
init();
|
||||
onInit();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -181,7 +181,8 @@
|
||||
size="l"
|
||||
color="secondary"
|
||||
name="{{user.name}}"
|
||||
img-src="{{user.avatars[2]}}">
|
||||
img-src="{{user.avatars[2]}}"
|
||||
img-srcset="{{user.avatars[3]}} 2x, {{user.avatars[4]}} 3x">
|
||||
</umb-avatar>
|
||||
</div>
|
||||
<div class="umb-user__checkmark" ng-if="user.selected"><umb-checkmark checked="user.selected" size="s"></umb-checkmark></div>
|
||||
@@ -232,7 +233,8 @@
|
||||
size="xs"
|
||||
color="secondary"
|
||||
name="{{user.name}}"
|
||||
img-src="{{user.avatars[0]}}">
|
||||
img-src="{{user.avatars[0]}}"
|
||||
img-srcset="{{user.avatars[1]}} 2x, {{user.avatars[2]}} 3x">
|
||||
</umb-avatar>
|
||||
</td>
|
||||
<td class="bold"><a href="" ng-click="vm.goToUser(user)">{{user.name}}</a></td>
|
||||
|
||||
Reference in New Issue
Block a user