mirror of https://github.com/Squidex/squidex.git
Browse Source
* Provide user role in context context. * Also provide user for backwards compatibility. * Show current users on resource. * Fix tests. * Started with backend work. * UI and backend improvements.pull/778/head
committed by
GitHub
36 changed files with 670 additions and 84 deletions
@ -0,0 +1,20 @@ |
|||||
|
// ==========================================================================
|
||||
|
// Squidex Headless CMS
|
||||
|
// ==========================================================================
|
||||
|
// Copyright (c) Squidex UG (haftungsbeschraenkt)
|
||||
|
// All rights reserved. Licensed under the MIT license.
|
||||
|
// ==========================================================================
|
||||
|
|
||||
|
using Squidex.Infrastructure.Validation; |
||||
|
|
||||
|
namespace Squidex.Areas.Api.Controllers |
||||
|
{ |
||||
|
public sealed class RenameTagDto |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// The new name for the tag.
|
||||
|
/// </summary>
|
||||
|
[LocalizedRequired] |
||||
|
public string TagName { get; set; } |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,29 @@ |
|||||
|
<form [formGroup]="editForm.form" (ngSubmit)="renameAssetTag()"> |
||||
|
<sqx-modal-dialog (close)="emitComplete()"> |
||||
|
<ng-container title> |
||||
|
{{ 'common.renameTag' | sqxTranslate }} |
||||
|
</ng-container> |
||||
|
|
||||
|
<ng-container content> |
||||
|
<sqx-form-error [error]="editForm.error | async"></sqx-form-error> |
||||
|
|
||||
|
<div class="form-group"> |
||||
|
<label for="tagName">{{ 'common.name' | sqxTranslate }} <small class="hint">({{ 'common.requiredHint' | sqxTranslate }})</small></label> |
||||
|
|
||||
|
<sqx-control-errors for="tagName"></sqx-control-errors> |
||||
|
|
||||
|
<input type="text" class="form-control" id="tagName" formControlName="tagName" autocomplete="off" sqxFocusOnInit> |
||||
|
</div> |
||||
|
</ng-container> |
||||
|
|
||||
|
<ng-container footer> |
||||
|
<button type="button" class="btn btn-text-secondary" (click)="emitComplete()"> |
||||
|
{{ 'common.cancel' | sqxTranslate }} |
||||
|
</button> |
||||
|
|
||||
|
<button type="submit" class="btn btn-success"> |
||||
|
{{ 'common.rename' | sqxTranslate }} |
||||
|
</button> |
||||
|
</ng-container> |
||||
|
</sqx-modal-dialog> |
||||
|
</form> |
||||
@ -0,0 +1,61 @@ |
|||||
|
/* |
||||
|
* Squidex Headless CMS |
||||
|
* |
||||
|
* @license |
||||
|
* Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved. |
||||
|
*/ |
||||
|
|
||||
|
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'; |
||||
|
import { FormBuilder } from '@angular/forms'; |
||||
|
import { AssetsState, RenameAssetTagForm } from '@app/shared/internal'; |
||||
|
|
||||
|
@Component({ |
||||
|
selector: 'sqx-asset-tag-dialog[tagName]', |
||||
|
styleUrls: ['./asset-tag-dialog.component.scss'], |
||||
|
templateUrl: './asset-tag-dialog.component.html', |
||||
|
}) |
||||
|
export class AssetTagDialogComponent implements OnInit { |
||||
|
@Output() |
||||
|
public complete = new EventEmitter(); |
||||
|
|
||||
|
@Input() |
||||
|
public tagName: string; |
||||
|
|
||||
|
public editForm = new RenameAssetTagForm(this.formBuilder); |
||||
|
|
||||
|
constructor( |
||||
|
private readonly assetsState: AssetsState, |
||||
|
private readonly formBuilder: FormBuilder, |
||||
|
) { |
||||
|
} |
||||
|
|
||||
|
public ngOnInit() { |
||||
|
this.editForm.load({ tagName: this.tagName }); |
||||
|
} |
||||
|
|
||||
|
public emitComplete() { |
||||
|
this.complete.emit(); |
||||
|
} |
||||
|
|
||||
|
public renameAssetTag() { |
||||
|
const value = this.editForm.submit(); |
||||
|
|
||||
|
if (!value) { |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
if (value.tagName === this.tagName) { |
||||
|
this.emitComplete(); |
||||
|
} |
||||
|
|
||||
|
this.assetsState.renameTag(this.tagName, value?.tagName) |
||||
|
.subscribe({ |
||||
|
next: () => { |
||||
|
this.emitComplete(); |
||||
|
}, |
||||
|
error: error => { |
||||
|
this.editForm.submitFailed(error); |
||||
|
}, |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
Loading…
Reference in new issue