Browse Source

Hide date buttons based on settings. (#421)

pull/425/head
Sebastian Stehle 7 years ago
committed by GitHub
parent
commit
c03bd72d4e
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      src/Squidex/Areas/Api/Controllers/UI/MyUIOptions.cs
  2. 4
      src/Squidex/app/framework/angular/forms/date-time-editor.component.html
  3. 12
      src/Squidex/app/framework/angular/forms/date-time-editor.component.ts
  4. 2
      src/Squidex/app/theme/_mixins.scss
  5. 4
      src/Squidex/appsettings.json

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

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

4
src/Squidex/app/framework/angular/forms/date-time-editor.component.html

@ -13,12 +13,12 @@
<i class="icon-close"></i>
</button>
</div>
<div class="form-group" *ngIf="showTime">
<div class="form-group" *ngIf="showTime && !hideDateButtons">
<button type="button" class="btn btn-text-secondary" [disabled]="snapshot.isDisabled" (click)="writeNow()" title="Use Now (UTC)">
Now
</button>
</div>
<div class="form-group" *ngIf="!showTime">
<div class="form-group" *ngIf="!showTime && !hideDateButtons">
<button type="button" class="btn btn-text-secondary" [disabled]="snapshot.isDisabled" (click)="writeNow()" title="Use Today (UTC)">
Today
</button>

12
src/Squidex/app/framework/angular/forms/date-time-editor.component.ts

@ -9,7 +9,11 @@ import { AfterViewInit, ChangeDetectionStrategy, ChangeDetectorRef, Component, E
import { FormControl, NG_VALUE_ACCESSOR } from '@angular/forms';
import * as moment from 'moment';
import { StatefulControlComponent, Types } from '@app/framework/internal';
import {
StatefulControlComponent,
Types,
UIOptions
} from '@app/framework/internal';
declare module 'pikaday/pikaday';
@ -49,6 +53,8 @@ export class DateTimeEditorComponent extends StatefulControlComponent<{}, string
public timeControl = new FormControl();
public dateControl = new FormControl();
public hideDateButtons: boolean;
public get showTime() {
return this.mode === 'DateTime';
}
@ -57,8 +63,10 @@ export class DateTimeEditorComponent extends StatefulControlComponent<{}, string
return !!this.dateValue;
}
constructor(changeDetector: ChangeDetectorRef) {
constructor(changeDetector: ChangeDetectorRef, uiOptions: UIOptions) {
super(changeDetector, {});
this.hideDateButtons = !!uiOptions.get('hideDateButtons');
}
public ngOnInit() {

2
src/Squidex/app/theme/_mixins.scss

@ -36,7 +36,7 @@
&:active,
&:hover {
color: darken($color, 8%);
color: darken($color, 15%);
}
}

4
src/Squidex/appsettings.json

@ -93,6 +93,10 @@
* Hide all onboarding tooltips and dialogs.
*/
"hideOnboarding": false,
/*
* Hide the today and now button.
*/
"hideDateButtons": false,
/*
* Show the exposed values as information on the apps overview page.
*/

Loading…
Cancel
Save