Browse Source

Status buttons changed.

pull/428/head
Sebastian Stehle 6 years ago
parent
commit
dd175a37fd
  1. 2
      src/Squidex.Domain.Apps.Entities/Contents/ContentGrain.cs
  2. 9
      src/Squidex/app/features/content/pages/contents/contents-page.component.html
  3. 4
      src/Squidex/app/features/content/pages/contents/contents-page.component.scss
  4. 13
      src/Squidex/app/features/content/pages/contents/contents-page.component.ts
  5. 4
      src/Squidex/app/features/content/shared/content-status.component.html
  6. 4
      src/Squidex/app/features/content/shared/content-status.component.scss
  7. 3
      src/Squidex/app/features/content/shared/content-status.component.ts
  8. 9
      src/Squidex/app/features/content/shared/content.component.html

2
src/Squidex.Domain.Apps.Entities/Contents/ContentGrain.cs

@ -100,7 +100,7 @@ namespace Squidex.Domain.Apps.Entities.Contents
Operation = "Published", Operation = "Published",
Data = c.Data, Data = c.Data,
Status = Status.Published, Status = Status.Published,
StatusOld = status StatusOld = default
}); });
} }

9
src/Squidex/app/features/content/pages/contents/contents-page.component.html

@ -77,8 +77,13 @@
<div class="selection" *ngIf="selectionCount > 0"> <div class="selection" *ngIf="selectionCount > 0">
{{selectionCount}} items selected&nbsp;&nbsp; {{selectionCount}} items selected&nbsp;&nbsp;
<button type="button" class="btn btn-secondary mr-1" *ngFor="let status of nextStatuses" (click)="changeSelectedStatus(status)"> <button type="button" class="btn btn-outline-secondary btn-status mr-1" *ngFor="let status of nextStatuses | sqxKeys" (click)="changeSelectedStatus(status)">
Status to {{status}} <sqx-content-status
[status]="status"
[statusColor]="nextStatuses[status]"
showLabel="true"
small="true">
</sqx-content-status>
</button> </button>
<button type="button" class="btn btn-danger" *ngIf="selectionCanDelete" <button type="button" class="btn btn-danger" *ngIf="selectionCanDelete"

4
src/Squidex/app/features/content/pages/contents/contents-page.component.scss

@ -28,6 +28,10 @@
font-size: .8rem; font-size: .8rem;
} }
.btn-status {
background: $color-dark-foreground;
}
.selection { .selection {
background: $color-table-footer; background: $color-table-footer;
border-bottom: 2px solid $color-border; border-bottom: 2px solid $color-border;

13
src/Squidex/app/features/content/pages/contents/contents-page.component.ts

@ -41,7 +41,7 @@ export class ContentsPageComponent extends ResourceOwner implements OnInit {
public selectionCount = 0; public selectionCount = 0;
public selectionCanDelete = false; public selectionCanDelete = false;
public nextStatuses: ReadonlyArray<string> = []; public nextStatuses: { [name: string]: string } = {};
public language: AppLanguageDto; public language: AppLanguageDto;
public languageMaster: AppLanguageDto; public languageMaster: AppLanguageDto;
@ -197,12 +197,11 @@ export class ContentsPageComponent extends ResourceOwner implements OnInit {
this.selectedAll = this.contentsState.snapshot.contents.length > 0; this.selectedAll = this.contentsState.snapshot.contents.length > 0;
this.selectionCount = 0; this.selectionCount = 0;
this.selectionCanDelete = true; this.selectionCanDelete = true;
this.nextStatuses = {};
const allActions = {};
for (let content of this.contentsState.snapshot.contents) { for (let content of this.contentsState.snapshot.contents) {
for (const info of content.statusUpdates) { for (const info of content.statusUpdates) {
allActions[info.status] = info.color; this.nextStatuses[info.status] = info.color;
} }
} }
@ -210,9 +209,9 @@ export class ContentsPageComponent extends ResourceOwner implements OnInit {
if (this.selectedItems[content.id]) { if (this.selectedItems[content.id]) {
this.selectionCount++; this.selectionCount++;
for (const action in allActions) { for (const action in this.nextStatuses) {
if (!content.statusUpdates) { if (!content.statusUpdates) {
delete allActions[action]; delete this.nextStatuses[action];
} }
} }
@ -223,8 +222,6 @@ export class ContentsPageComponent extends ResourceOwner implements OnInit {
this.selectedAll = false; this.selectedAll = false;
} }
} }
this.nextStatuses = Object.keys(allActions);
} }
private updateQueries() { private updateQueries() {

4
src/Squidex/app/features/content/shared/content-status.component.html

@ -1,12 +1,12 @@
<ng-container *ngIf="scheduledTo; else noSchedule"> <ng-container *ngIf="scheduledTo; else noSchedule">
<span class="content-status pending mr-1"title="{{tooltipText}}" titlePosition="top"> <span class="content-status pending mr-1"title="{{tooltipText}}" titlePosition="top">
<i class="icon-clock"></i> <i class="icon-clock" [class.icon-sm]="small"></i>
</span> </span>
</ng-container> </ng-container>
<ng-template #noSchedule> <ng-template #noSchedule>
<span class="content-status default mr-1" [style.color]="statusColor" title="{{tooltipText}}" titlePosition="top"> <span class="content-status default mr-1" [style.color]="statusColor" title="{{tooltipText}}" titlePosition="top">
<i class="icon-circle"></i> <i class="icon-circle" [class.icon-sm]="small"></i>
</span> </span>
</ng-template> </ng-template>

4
src/Squidex/app/features/content/shared/content-status.component.scss

@ -2,10 +2,6 @@
@import '_mixins'; @import '_mixins';
.content-status { .content-status {
& {
vertical-align: middle;
}
&.default { &.default {
color: $color-text-decent; color: $color-text-decent;
} }

3
src/Squidex/app/features/content/shared/content-status.component.ts

@ -34,6 +34,9 @@ export class ContentStatusComponent {
@Input() @Input()
public showLabel = false; public showLabel = false;
@Input()
public small = false;
public get tooltipText() { public get tooltipText() {
if (this.scheduledAt) { if (this.scheduledAt) {
return `Will be set to '${this.scheduledTo}' at ${this.scheduledAt.toStringFormat('LLLL')}`; return `Will be set to '${this.scheduledTo}' at ${this.scheduledAt.toStringFormat('LLLL')}`;

9
src/Squidex/app/features/content/shared/content.component.html

@ -14,7 +14,14 @@
<ng-container *sqxModal="dropdown;closeAlways:true"> <ng-container *sqxModal="dropdown;closeAlways:true">
<div class="dropdown-menu" [sqxAnchoredTo]="buttonOptions" position="bottom-left" @fade> <div class="dropdown-menu" [sqxAnchoredTo]="buttonOptions" position="bottom-left" @fade>
<a class="dropdown-item" *ngFor="let info of content.statusUpdates" (click)="emitChangeStatus(info.status)"> <a class="dropdown-item" *ngFor="let info of content.statusUpdates" (click)="emitChangeStatus(info.status)">
Change to <i class="icon-circle icon-sm" [style.color]="info.color"></i> {{info.status}} Change to
<sqx-content-status
[status]="info.status"
[statusColor]="info.color"
showLabel="true"
small="true">
</sqx-content-status>
</a> </a>
<a class="dropdown-item" (click)="emitClone(); dropdown.hide()" *ngIf="canClone"> <a class="dropdown-item" (click)="emitClone(); dropdown.hide()" *ngIf="canClone">
Clone Clone

Loading…
Cancel
Save