Skip to content

Commit

Permalink
Merge pull request umbraco#11452 from umbraco/v9/feature/v8_merge_22_…
Browse files Browse the repository at this point in the history
…10_2021

Merge v8 into v9 22/10/2021
  • Loading branch information
bergmania authored Oct 22, 2021
2 parents 884ce98 + 222a40a commit 5ddf6a1
Show file tree
Hide file tree
Showing 32 changed files with 3,902 additions and 2,175 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -673,19 +673,6 @@ protected override void PersistUpdatedItem(IContent entity)
edited = true;
}

// To establish the new value of "edited" we compare all properties publishedValue to editedValue and look
// for differences.
//
// If we SaveAndPublish but the publish fails (e.g. already scheduled for release)
// we have lost the publishedValue on IContent (in memory vs database) so we cannot correctly make that comparison.
//
// This is a slight change to behaviour, historically a publish, followed by change & save, followed by undo change & save
// would change edited back to false.
if (!publishing && editedSnapshot)
{
edited = true;
}

if (entity.ContentType.VariesByCulture())
{
// names also impact 'edited'
Expand Down
235 changes: 159 additions & 76 deletions src/Umbraco.Web.BackOffice/Controllers/ContentTypeControllerBase.cs

Large diffs are not rendered by default.

753 changes: 429 additions & 324 deletions src/Umbraco.Web.BackOffice/Controllers/EntityController.cs

Large diffs are not rendered by default.

27 changes: 15 additions & 12 deletions src/Umbraco.Web.BackOffice/Controllers/MemberGroupController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,20 @@
using Umbraco.Cms.Web.Common.Attributes;
using Umbraco.Cms.Web.Common.Authorization;
using Umbraco.Extensions;
using Constants = Umbraco.Cms.Core.Constants;

namespace Umbraco.Cms.Web.BackOffice.Controllers
{
/// <summary>
/// An API controller used for dealing with member groups
/// An API controller used for dealing with member groups
/// </summary>
[PluginController(Constants.Web.Mvc.BackOfficeApiArea)]
[Authorize(Policy = AuthorizationPolicies.TreeAccessMemberGroups)]
[ParameterSwapControllerActionSelector(nameof(GetById), "id", typeof(int), typeof(Guid), typeof(Udi))]
public class MemberGroupController : UmbracoAuthorizedJsonController
{
private readonly ILocalizedTextService _localizedTextService;
private readonly IMemberGroupService _memberGroupService;
private readonly IUmbracoMapper _umbracoMapper;
private readonly ILocalizedTextService _localizedTextService;

public MemberGroupController(
IMemberGroupService memberGroupService,
Expand All @@ -35,11 +34,12 @@ public MemberGroupController(
{
_memberGroupService = memberGroupService ?? throw new ArgumentNullException(nameof(memberGroupService));
_umbracoMapper = umbracoMapper ?? throw new ArgumentNullException(nameof(umbracoMapper));
_localizedTextService = localizedTextService ?? throw new ArgumentNullException(nameof(localizedTextService));
_localizedTextService =
localizedTextService ?? throw new ArgumentNullException(nameof(localizedTextService));
}

/// <summary>
/// Gets the member group json for the member group id
/// Gets the member group json for the member group id
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
Expand All @@ -56,7 +56,7 @@ public ActionResult<MemberGroupDisplay> GetById(int id)
}

/// <summary>
/// Gets the member group json for the member group guid
/// Gets the member group json for the member group guid
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
Expand All @@ -72,7 +72,7 @@ public ActionResult<MemberGroupDisplay> GetById(Guid id)
}

/// <summary>
/// Gets the member group json for the member group udi
/// Gets the member group json for the member group udi
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
Expand Down Expand Up @@ -100,7 +100,7 @@ public IEnumerable<MemberGroupDisplay> GetByIds([FromQuery] int[] ids)
[HttpPost]
public IActionResult DeleteById(int id)
{
var memberGroup = _memberGroupService.GetById(id);
IMemberGroup memberGroup = _memberGroupService.GetById(id);
if (memberGroup == null)
{
return NotFound();
Expand All @@ -112,7 +112,7 @@ public IActionResult DeleteById(int id)

public IEnumerable<MemberGroupDisplay> GetAllGroups()
=> _memberGroupService.GetAll()
.Select(_umbracoMapper.Map<IMemberGroup, MemberGroupDisplay>);
.Select(_umbracoMapper.Map<IMemberGroup, MemberGroupDisplay>);

public MemberGroupDisplay GetEmpty()
{
Expand All @@ -123,18 +123,21 @@ public MemberGroupDisplay GetEmpty()
public bool IsMemberGroupNameUnique(int id, string oldName, string newName)
{
if (newName == oldName)
{
return true; // name hasn't changed
}

var memberGroup = _memberGroupService.GetByName(newName);
IMemberGroup memberGroup = _memberGroupService.GetByName(newName);
if (memberGroup == null)
{
return true; // no member group found
}

return memberGroup.Id == id;
}

public ActionResult<MemberGroupDisplay> PostSave(MemberGroupSave saveModel)
{

var id = int.Parse(saveModel.Id.ToString(), CultureInfo.InvariantCulture);
IMemberGroup memberGroup = id > 0 ? _memberGroupService.GetById(id) : new MemberGroup();
if (memberGroup == null)
Expand All @@ -157,7 +160,7 @@ public ActionResult<MemberGroupDisplay> PostSave(MemberGroupSave saveModel)
}
else
{
var display = _umbracoMapper.Map<IMemberGroup, MemberGroupDisplay>(memberGroup);
MemberGroupDisplay display = _umbracoMapper.Map<IMemberGroup, MemberGroupDisplay>(memberGroup);
display.AddErrorNotification(
_localizedTextService.Localize("speechBubbles", "memberGroupNameDuplicate"),
string.Empty);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,6 @@
// List of elements that can be focusable within the focus lock
var focusableElementsSelector = '[role="button"], a[href]:not([disabled]):not(.ng-hide), button:not([disabled]):not(.ng-hide), textarea:not([disabled]):not(.ng-hide), input:not([disabled]):not(.ng-hide), select:not([disabled]):not(.ng-hide)';

// Grab the body element so we can add the tabbing class on it when needed
var bodyElement = document.querySelector('body');

function getDomNodes(){
infiniteEditorsWrapper = document.querySelector('.umb-editors');
if(infiniteEditorsWrapper) {
Expand All @@ -47,7 +44,10 @@

function getFocusableElements(targetElm) {
var elm = targetElm ? targetElm : target;
focusableElements = elm.querySelectorAll(focusableElementsSelector);

// Filter out elements that are children of parents with the .ng-hide class
focusableElements = [...elm.querySelectorAll(focusableElementsSelector)].filter(elm => !elm.closest('.ng-hide'));

// Set first and last focusable elements
firstFocusableElement = focusableElements[0];
lastFocusableElement = focusableElements[focusableElements.length - 1];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,18 +118,38 @@ Use this directive to render a ui component for selecting child items to a paren
(function() {
'use strict';

function ChildSelectorDirective() {
function ChildSelectorDirective(overlayService, localizationService) {

function link(scope, el, attr, ctrl) {

var eventBindings = [];
scope.dialogModel = {};
scope.showDialog = false;

scope.removeChild = (selectedChild, $index) => {
if (scope.onRemove) {
scope.onRemove(selectedChild, $index);
}
scope.removeChild = (selectedChild, $index, event) => {
const dialog = {
view: "views/components/overlays/umb-template-remove-confirm.html",
layout: selectedChild,
submitButtonLabelKey: "defaultdialogs_yesRemove",
submitButtonStyle: "danger",
submit: function () {
if(scope.onRemove) {
scope.onRemove(selectedChild, $index);
overlayService.close();
}
},
close: function () {
overlayService.close();
}
};

localizationService.localize("general_delete").then(value => {
dialog.title = value;
overlayService.open(dialog);
});

event.preventDefault();
event.stopPropagation();
};

scope.addChild = $event => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,13 +214,14 @@ When building a custom infinite editor view you can use the same components as a
* Method to tell editors that they are begin blurred.
*/
function blur() {

/* keyboard shortcuts will be overwritten by the new infinite editor
if (isEnabled === true) {
/* keyboard shortcuts will be overwritten by the new infinite editor
so we need to store the shortcuts for the current editor so they can be rebound
when the infinite editor closes
*/
unbindKeyboardShortcuts();
isEnabled = false;
unbindKeyboardShortcuts();
isEnabled = false;
}
}
/**
* @ngdoc method
Expand Down
5 changes: 2 additions & 3 deletions src/Umbraco.Web.UI.Client/src/less/gridview.less
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,6 @@
}

.preview-rows {

display: inline-block;
position: relative;
box-sizing: border-box;
Expand Down Expand Up @@ -675,9 +674,9 @@
}

.preview-rows.columns {
min-height: 18px;
min-height: 16px;
line-height: 11px;
padding: 1px;
padding: 0 1px 1px 1px;

&.prevalues-rows {
min-height: 30px;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<div>

<div ng-if="model.layout" class="umb-alert umb-alert--warning mb2">
<localize key="contentTypeEditor_removeChildNode">You are removing the child node</localize> <strong>{{model.layout.name}}</strong>.
</div>

<p>
<localize key="contentTypeEditor_removeChildNodeWarning">
Removing a child node will limit the editors options to create different content types beneath a node.
</localize>
</p>

<localize key="defaultdialogs_confirmdelete">Are you sure you want to remove</localize>?

</div>
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
<span class="umb-child-selector__child-name">{{selectedChild.name}}</span>
</div>
<div class="umb-child-selector__child-actions">
<button type="button" class="umb-child-selector__child-remove" ng-click="removeChild(selectedChild, $index)">
<umb-icon icon="icon-trash"></umb-icon>
<button type="button" class="umb-node-preview__action umb-node-preview__action--red umb-child-selector__child-remove" ng-click="removeChild(selectedChild, $index, $event)">
<localize key="general_remove">Remove</localize>
</button>
</div>
</div>
Expand Down
112 changes: 58 additions & 54 deletions src/Umbraco.Web.UI.Client/src/views/dataTypes/create.html
Original file line number Diff line number Diff line change
@@ -1,66 +1,70 @@
<div ng-controller="Umbraco.Editors.DataType.CreateController">

<div ng-show="!model.creatingFolder">
<div class="umbracoDialog umb-dialog-body with-footer" ng-cloak>
<div class="umb-pane">
<h5><localize key="create_createUnder">Create an item under</localize> {{currentNode.name}}</h5>
<div ng-show="!model.creatingFolder">
<div class="umbracoDialog umb-dialog-body with-footer" ng-cloak>
<div class="umb-pane">
<h5>
<localize key="create_createUnder">Create an item under</localize>
{{currentNode.name}}
</h5>

<ul class="umb-actions umb-actions-child">
<li data-element="action-data-type" class="umb-action">
<button type="button" class="umb-action-link umb-outline btn-reset" ng-click="createDataType()" umb-auto-focus>
<umb-icon icon="icon-autofill" class="icon large"></umb-icon>
<span class="menu-label">
<ul class="umb-actions umb-actions-child">
<li class="umb-action" data-element="action-data-type">
<button class="umb-action-link umb-outline btn-reset" ng-click="createDataType()" type="button"
umb-auto-focus>
<umb-icon class="icon large" icon="icon-autofill"></umb-icon>
<span class="menu-label">
<localize key="create_newDataType">New data type</localize>
</span>
</button>
</li>
<li data-element="action-folder" class="umb-action">
<button type="button" class="umb-action-link umb-outline btn-reset" ng-click="showCreateFolder()">
<umb-icon icon="icon-folder" class="icon large"></umb-icon>
<span class="menu-label">
</button>
</li>
<li class="umb-action" data-element="action-folder">
<button class="umb-action-link umb-outline btn-reset" ng-click="showCreateFolder()" type="button">
<umb-icon class="icon large" icon="icon-folder"></umb-icon>
<span class="menu-label">
<localize key="create_newFolder">New folder</localize>...
</span>
</button>
</li>
</ul>
</div>

</div>

<div class="umb-dialog-footer btn-toolbar umb-btn-toolbar">
<button type="button" class="btn btn-info" ng-click="close()">
<localize key="buttons_somethingElse">Do something else</localize>
</button>
</div>
</li>
</ul>
</div>

</div>

<div ng-show="model.creatingFolder">
<form novalidate name="createFolderForm"
ng-submit="createContainer()"
val-form-manager>
<div class="umbracoDialog umb-dialog-body with-footer" ng-cloak>
<div class="umb-pane" ng-show="model.creatingFolder">
<umb-control-group label="Enter a folder name" hide-label="false">
<input type="text"
name="folderName"
ng-model="model.folderName"
class="umb-textstring textstring input-block-level"
focus-when="{{model.creatingFolder}}"
required />
</umb-control-group>
</div>
</div>
<div class="umb-dialog-footer btn-toolbar umb-btn-toolbar">
<umb-button type="button"
button-style="link"
action="close()"
label-key="general_close">
</umb-button>
<umb-button type="submit"
button-style="primary"
label-key="general_create">
</umb-button>
</div>
</form>
<div class="umb-dialog-footer btn-toolbar umb-btn-toolbar">
<button class="btn btn-info" ng-click="close()" type="button">
<localize key="buttons_somethingElse">Do something else</localize>
</button>
</div>
</div>

<div ng-show="model.creatingFolder">
<form name="createFolderForm" ng-submit="createContainer()"
novalidate
val-form-manager>
<div class="umbracoDialog umb-dialog-body with-footer" ng-cloak>
<div class="umb-pane" ng-show="model.creatingFolder">
<umb-control-group hide-label="false" label="Enter a folder name">
<input class="umb-textstring textstring input-block-level"
focus-when="{{model.creatingFolder}}"
name="folderName"
ng-model="model.folderName"
required
type="text"/>
</umb-control-group>
</div>
</div>
<div class="umb-dialog-footer btn-toolbar umb-btn-toolbar">
<umb-button action="close()"
button-style="link"
label-key="general_close"
type="button">
</umb-button>
<umb-button button-style="primary"
label-key="general_create"
type="submit">
</umb-button>
</div>
</form>
</div>
</div>
Loading

0 comments on commit 5ddf6a1

Please sign in to comment.