Update Users tree context menu to include two new items that navigate directly to an Angular Location/Path which loads the Invite or Create User views as needed
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
(function () {
|
||||
"use strict";
|
||||
|
||||
function UsersController($scope, $timeout, $location, usersResource, userGroupsResource, userService, localizationService, contentEditingHelper, usersHelper, formHelper, notificationsService, dateHelper) {
|
||||
function UsersController($scope, $timeout, $location, $routeParams, usersResource, userGroupsResource, userService, localizationService, contentEditingHelper, usersHelper, formHelper, notificationsService, dateHelper) {
|
||||
|
||||
var vm = this;
|
||||
var localizeSaving = localizationService.localize("general_saving");
|
||||
@@ -124,6 +124,13 @@
|
||||
vm.usersOptions.orderBy = "Name";
|
||||
vm.usersOptions.orderDirection = "Ascending";
|
||||
|
||||
if ($routeParams.create) {
|
||||
setUsersViewState("createUser");
|
||||
}
|
||||
else if ($routeParams.invite) {
|
||||
setUsersViewState("inviteUser");
|
||||
}
|
||||
|
||||
// Get users
|
||||
getUsers();
|
||||
|
||||
@@ -168,6 +175,17 @@
|
||||
|
||||
if (state === "createUser") {
|
||||
clearAddUserForm();
|
||||
|
||||
$location.search("create", "true");
|
||||
$location.search("invite", null);
|
||||
}
|
||||
else if (state === "inviteUser") {
|
||||
$location.search("create", null);
|
||||
$location.search("invite", "true");
|
||||
}
|
||||
else if (state === "overview") {
|
||||
$location.search("create", null);
|
||||
$location.search("invite", null);
|
||||
}
|
||||
|
||||
vm.usersViewState = state;
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
using System.Net.Http.Formatting;
|
||||
using umbraco;
|
||||
using umbraco.BusinessLogic.Actions;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Services;
|
||||
using Umbraco.Web.Models.Trees;
|
||||
using Umbraco.Web.Mvc;
|
||||
using Umbraco.Web.WebApi.Filters;
|
||||
@@ -53,6 +56,31 @@ namespace Umbraco.Web.Trees
|
||||
protected override MenuItemCollection GetMenuForNode(string id, FormDataCollection queryStrings)
|
||||
{
|
||||
var menu = new MenuItemCollection();
|
||||
|
||||
if (id == Constants.System.Root.ToInvariantString())
|
||||
{
|
||||
//Create User
|
||||
var createMenuItem = menu.Items.CreateMenuItem<ActionNew>(Services.TextService.Localize("user/createUser"));
|
||||
createMenuItem.Icon = "add";
|
||||
createMenuItem.NavigateToRoute("users/users/overview?subview=users&create=true");
|
||||
menu.Items.Add(createMenuItem);
|
||||
|
||||
//This is the same setting used in the global JS for 'showUserInvite'
|
||||
if (EmailSender.CanSendRequiredEmail)
|
||||
{
|
||||
//Invite User (Action import closest type of action to an invite user)
|
||||
var inviteMenuItem = menu.Items.CreateMenuItem<ActionImport>(Services.TextService.Localize("user/inviteUser"));
|
||||
inviteMenuItem.Icon = "message-unopened";
|
||||
inviteMenuItem.NavigateToRoute("users/users/overview?subview=users&invite=true");
|
||||
|
||||
menu.Items.Add(inviteMenuItem);
|
||||
}
|
||||
|
||||
return menu;
|
||||
}
|
||||
|
||||
//There is no context menu options for editing a specific user
|
||||
//Also we no longer list each user in the tree & in theory never hit this
|
||||
return menu;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user