mirror of https://github.com/Squidex/squidex.git
7 changed files with 228 additions and 0 deletions
@ -0,0 +1,18 @@ |
|||||
|
// ==========================================================================
|
||||
|
// ContentPublished.cs
|
||||
|
// Squidex Headless CMS
|
||||
|
// ==========================================================================
|
||||
|
// Copyright (c) Squidex Group
|
||||
|
// All rights reserved.
|
||||
|
// ==========================================================================
|
||||
|
|
||||
|
using Squidex.Infrastructure; |
||||
|
using Squidex.Infrastructure.CQRS.Events; |
||||
|
|
||||
|
namespace Squidex.Events.Contents |
||||
|
{ |
||||
|
[TypeName("ContentPublishedEvent")] |
||||
|
public class ContentPublished : IEvent |
||||
|
{ |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,18 @@ |
|||||
|
// ==========================================================================
|
||||
|
// ContentUnpublished.cs
|
||||
|
// Squidex Headless CMS
|
||||
|
// ==========================================================================
|
||||
|
// Copyright (c) Squidex Group
|
||||
|
// All rights reserved.
|
||||
|
// ==========================================================================
|
||||
|
|
||||
|
using Squidex.Infrastructure; |
||||
|
using Squidex.Infrastructure.CQRS.Events; |
||||
|
|
||||
|
namespace Squidex.Events.Contents |
||||
|
{ |
||||
|
[TypeName("ContentUnpublishedEvent")] |
||||
|
public class ContentUnpublished : IEvent |
||||
|
{ |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,14 @@ |
|||||
|
// ==========================================================================
|
||||
|
// PublishContent.cs
|
||||
|
// Squidex Headless CMS
|
||||
|
// ==========================================================================
|
||||
|
// Copyright (c) Squidex Group
|
||||
|
// All rights reserved.
|
||||
|
// ==========================================================================
|
||||
|
|
||||
|
namespace Squidex.Write.Contents.Commands |
||||
|
{ |
||||
|
public class PublishContent : SchemaCommand |
||||
|
{ |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,14 @@ |
|||||
|
// ==========================================================================
|
||||
|
// UnpublishContent.cs
|
||||
|
// Squidex Headless CMS
|
||||
|
// ==========================================================================
|
||||
|
// Copyright (c) Squidex Group
|
||||
|
// All rights reserved.
|
||||
|
// ==========================================================================
|
||||
|
|
||||
|
namespace Squidex.Write.Contents.Commands |
||||
|
{ |
||||
|
public class UnpublishContent : SchemaCommand |
||||
|
{ |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,30 @@ |
|||||
|
<td *ngFor="let field of fields"> |
||||
|
<span class="field"> |
||||
|
{{getValue(field)}} |
||||
|
</span> |
||||
|
</td> |
||||
|
<td> |
||||
|
<span class="content-published" [class.unpublished]="!content.isPublished"></span> |
||||
|
<span class="content-modified">{{content.lastModified | fromNow}}</span> |
||||
|
</td> |
||||
|
<td> |
||||
|
<img class="user-picture" [attr.title]="userName(content.lastModifiedBy) | async" [attr.src]="userPicture(content.lastModifiedBy, true) | async" /> |
||||
|
</td> |
||||
|
<td> |
||||
|
<div class="dropdown" *ngIf="content"> |
||||
|
<button type="button" class="btn btn-simple" (click)="dropdown.toggle(); $event.stopPropagation()" [class.active]="dropdown.isOpen | async"> |
||||
|
<i class="icon-dots"></i> |
||||
|
</button> |
||||
|
<div class="dropdown-menu" *sqxModalView="dropdown" closeAlways="true" [@fade]> |
||||
|
<a class="dropdown-item" (click)="published.emit(); $event.stopPropagation()" *ngIf="!content.isPublished"> |
||||
|
Publish |
||||
|
</a> |
||||
|
<a class="dropdown-item" (click)="unpublished.emit(); $event.stopPropagation()" *ngIf="content.isPublished"> |
||||
|
Unpublish |
||||
|
</a> |
||||
|
<a class="dropdown-item" (click)="deleted.emit(); $event.stopPropagation()"> |
||||
|
Delete |
||||
|
</a> |
||||
|
</div> |
||||
|
</div> |
||||
|
</td> |
||||
@ -0,0 +1,61 @@ |
|||||
|
@import '_vars'; |
||||
|
@import '_mixins'; |
||||
|
|
||||
|
.field { |
||||
|
@include truncate; |
||||
|
} |
||||
|
|
||||
|
.dropdown { |
||||
|
& { |
||||
|
display: inline-block; |
||||
|
} |
||||
|
|
||||
|
&-menu { |
||||
|
@include absolute(100%, 0, auto, auto); |
||||
|
} |
||||
|
|
||||
|
&-item { |
||||
|
cursor: pointer; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
.btn-simple { |
||||
|
& { |
||||
|
color: $color-border-dark; |
||||
|
} |
||||
|
|
||||
|
&:hover, |
||||
|
&.active { |
||||
|
color: $color-text; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
.user-picture { |
||||
|
& { |
||||
|
@include circle(2.2rem); |
||||
|
} |
||||
|
|
||||
|
&:not([src]) { |
||||
|
@include opacity(0); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
.content { |
||||
|
& { |
||||
|
cursor: pointer; |
||||
|
} |
||||
|
|
||||
|
&-published { |
||||
|
& { |
||||
|
@include circle(.5rem); |
||||
|
display: inline-block; |
||||
|
border: 0; |
||||
|
background: $color-theme-green; |
||||
|
margin-left: .4rem; |
||||
|
} |
||||
|
|
||||
|
&.unpublished { |
||||
|
background: $color-theme-error; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,73 @@ |
|||||
|
/* |
||||
|
* Squidex Headless CMS |
||||
|
* |
||||
|
* @license |
||||
|
* Copyright (c) Sebastian Stehle. All rights reserved |
||||
|
*/ |
||||
|
|
||||
|
import { Component, EventEmitter, Input, Output } from '@angular/core'; |
||||
|
|
||||
|
import { |
||||
|
AppComponentBase, |
||||
|
AppLanguageDto, |
||||
|
AppsStoreService, |
||||
|
ContentDto, |
||||
|
fadeAnimation, |
||||
|
FieldDto, |
||||
|
ModalView, |
||||
|
NotificationService, |
||||
|
SchemaDto, |
||||
|
UsersProviderService |
||||
|
} from 'shared'; |
||||
|
|
||||
|
@Component({ |
||||
|
selector: '[sqxContent]', |
||||
|
styleUrls: ['./content-item.component.scss'], |
||||
|
templateUrl: './content-item.component.html', |
||||
|
animations: [ |
||||
|
fadeAnimation |
||||
|
] |
||||
|
}) |
||||
|
export class ContentItemComponent extends AppComponentBase { |
||||
|
public dropdown = new ModalView(false, true); |
||||
|
|
||||
|
@Output() |
||||
|
public published = new EventEmitter<ContentDto>(); |
||||
|
|
||||
|
@Output() |
||||
|
public unpublished = new EventEmitter<ContentDto>(); |
||||
|
|
||||
|
@Output() |
||||
|
public deleted = new EventEmitter<ContentDto>(); |
||||
|
|
||||
|
@Input() |
||||
|
public fields: FieldDto[]; |
||||
|
|
||||
|
@Input() |
||||
|
public language: AppLanguageDto; |
||||
|
|
||||
|
@Input() |
||||
|
public schema: SchemaDto; |
||||
|
|
||||
|
@Input('sqxContent') |
||||
|
public content: ContentDto; |
||||
|
|
||||
|
constructor(apps: AppsStoreService, notifications: NotificationService, users: UsersProviderService) { |
||||
|
super(apps, notifications, users); |
||||
|
} |
||||
|
|
||||
|
public getValue(field: FieldDto): any { |
||||
|
const contentField = this.content.data[field.name]; |
||||
|
|
||||
|
if (!contentField) { |
||||
|
return ''; |
||||
|
} |
||||
|
|
||||
|
if (field.properties.isLocalizable) { |
||||
|
return contentField[this.language.iso2Code]; |
||||
|
} else { |
||||
|
return contentField['iv']; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
Loading…
Reference in new issue