Browse Source

Setting to disable the due time dialog.

pull/502/head
Sebastian 6 years ago
parent
commit
fee448bd7e
  1. 2
      backend/src/Squidex/Areas/Api/Controllers/UI/MyUIOptions.cs
  2. 4
      backend/src/Squidex/appsettings.json
  3. 21
      frontend/app/features/content/shared/due-time-selector.component.ts

2
backend/src/Squidex/Areas/Api/Controllers/UI/MyUIOptions.cs

@ -27,6 +27,8 @@ namespace Squidex.Areas.Api.Controllers.UI
public bool HideDateButtons { get; set; } public bool HideDateButtons { get; set; }
public bool DisableScheduledChanges { get; set; }
public bool RedirectToLogin { get; set; } public bool RedirectToLogin { get; set; }
public bool OnlyAdminsCanCreateApps { get; set; } public bool OnlyAdminsCanCreateApps { get; set; }

4
backend/src/Squidex/appsettings.json

@ -107,6 +107,10 @@
* Hide the today and now button. * Hide the today and now button.
*/ */
"hideDateButtons": false, "hideDateButtons": false,
/*
* True to disable scheduled content status changed, for example when you have your own scheduling system.
*/
"disableScheduledChanges": false,
/* /*
* Show the exposed values as information on the apps overview page. * Show the exposed values as information on the apps overview page.
*/ */

21
frontend/app/features/content/shared/due-time-selector.component.ts

@ -6,9 +6,11 @@
*/ */
import { Component } from '@angular/core'; import { Component } from '@angular/core';
import { Observable, Subject } from 'rxjs'; import { Observable, of, Subject } from 'rxjs';
import { DialogModel } from '@app/shared'; import { DialogModel, UIOptions } from '@app/shared';
const OPTION_IMMEDIATELY = 'Immediately';
@Component({ @Component({
selector: 'sqx-due-time-selector', selector: 'sqx-due-time-selector',
@ -16,14 +18,23 @@ import { DialogModel } from '@app/shared';
templateUrl: './due-time-selector.component.html' templateUrl: './due-time-selector.component.html'
}) })
export class DueTimeSelectorComponent { export class DueTimeSelectorComponent {
private disabled: boolean;
private dueTimeResult: Subject<string | null>; private dueTimeResult: Subject<string | null>;
public dueTimeDialog = new DialogModel(); public dueTimeDialog = new DialogModel();
public dueTime: string | null = ''; public dueTime: string | null = '';
public dueTimeAction: string | null = ''; public dueTimeAction: string | null = '';
public dueTimeMode = 'Immediately'; public dueTimeMode = OPTION_IMMEDIATELY;
constructor(uiOptions: UIOptions) {
this.disabled = uiOptions.get('disableScheduledChanges') === true;
}
public selectDueTime(action: string): Observable<string | null> { public selectDueTime(action: string): Observable<string | null> {
if (this.disabled) {
return of(null);
}
this.dueTimeAction = action; this.dueTimeAction = action;
this.dueTimeResult = new Subject<string | null>(); this.dueTimeResult = new Subject<string | null>();
this.dueTimeDialog.show(); this.dueTimeDialog.show();
@ -32,7 +43,7 @@ export class DueTimeSelectorComponent {
} }
public confirmStatusChange() { public confirmStatusChange() {
const result = this.dueTimeMode === 'Immediately' ? null : this.dueTime; const result = this.dueTimeMode === OPTION_IMMEDIATELY ? null : this.dueTime;
this.dueTimeResult.next(result); this.dueTimeResult.next(result);
this.dueTimeResult.complete(); this.dueTimeResult.complete();
@ -41,7 +52,7 @@ export class DueTimeSelectorComponent {
} }
public cancelStatusChange() { public cancelStatusChange() {
this.dueTimeMode = 'Immediately'; this.dueTimeMode = OPTION_IMMEDIATELY;
this.dueTimeDialog.hide(); this.dueTimeDialog.hide();
this.dueTimeResult = null!; this.dueTimeResult = null!;
this.dueTime = null; this.dueTime = null;

Loading…
Cancel
Save