mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-24 17:31:52 +00:00
[ACA-99] Viewer actions (#203)
* "toggle favorite" action * copy and move actions * move actions to the "more" menu
This commit is contained in:
@@ -57,6 +57,14 @@ export class ContentManagementService {
|
|||||||
return this.nodeHasPermission(node, 'delete');
|
return this.nodeHasPermission(node, 'delete');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
canMoveNode(node: Node): boolean {
|
||||||
|
return this.nodeHasPermission(node, 'delete');
|
||||||
|
}
|
||||||
|
|
||||||
|
canCopyNode(node: Node): boolean {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
async deleteNode(node: Node) {
|
async deleteNode(node: Node) {
|
||||||
if (this.canDeleteNode(node)) {
|
if (this.canDeleteNode(node)) {
|
||||||
try {
|
try {
|
||||||
|
@@ -9,15 +9,42 @@
|
|||||||
(navigateBefore)="onNavigateBefore()"
|
(navigateBefore)="onNavigateBefore()"
|
||||||
(navigateNext)="onNavigateNext()">
|
(navigateNext)="onNavigateNext()">
|
||||||
|
|
||||||
<adf-viewer-toolbar-actions>
|
<adf-viewer-more-actions>
|
||||||
|
|
||||||
<button mat-icon-button
|
<button
|
||||||
[disabled]="!canDeleteFile()"
|
mat-menu-item
|
||||||
(click)="deleteFile()"
|
#selection="adfFavorite"
|
||||||
title="{{ 'APP.ACTIONS.DELETE' | translate }}">
|
[adf-node-favorite]="selectedEntities">
|
||||||
<mat-icon>delete</mat-icon>
|
<mat-icon [ngClass]="{ 'icon-highlight': selection.hasFavorites() }">
|
||||||
|
{{ selection.hasFavorites() ? 'star' :'star_border' }}
|
||||||
|
</mat-icon>
|
||||||
|
<span>{{ 'APP.ACTIONS.FAVORITE' | translate }}</span>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
</adf-viewer-toolbar-actions>
|
<button
|
||||||
|
mat-menu-item
|
||||||
|
*ngIf="canCopyFile()"
|
||||||
|
[app-copy-node]="selectedEntities">
|
||||||
|
<mat-icon>content_copy</mat-icon>
|
||||||
|
<span>{{ 'APP.ACTIONS.COPY' | translate }}</span>
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<button
|
||||||
|
mat-menu-item
|
||||||
|
*ngIf="canMoveFile()"
|
||||||
|
[app-move-node]="selectedEntities">
|
||||||
|
<mat-icon>library_books</mat-icon>
|
||||||
|
<span>{{ 'APP.ACTIONS.MOVE' | translate }}</span>
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<button
|
||||||
|
mat-menu-item
|
||||||
|
*ngIf="canDeleteFile()"
|
||||||
|
(click)="deleteFile()">
|
||||||
|
<mat-icon>delete</mat-icon>
|
||||||
|
<span>{{ 'APP.ACTIONS.DELETE' | translate }}</span>
|
||||||
|
</button>
|
||||||
|
|
||||||
|
</adf-viewer-more-actions>
|
||||||
</adf-viewer>
|
</adf-viewer>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
@@ -29,7 +29,7 @@ import { RouterTestingModule } from '@angular/router/testing';
|
|||||||
import { TestBed, async, ComponentFixture } from '@angular/core/testing';
|
import { TestBed, async, ComponentFixture } from '@angular/core/testing';
|
||||||
import {
|
import {
|
||||||
AlfrescoApiService, UserPreferencesService, TranslationService, TranslationMock,
|
AlfrescoApiService, UserPreferencesService, TranslationService, TranslationMock,
|
||||||
AppConfigService, StorageService, CookieService, NotificationService
|
AppConfigService, StorageService, CookieService, NotificationService, NodeFavoriteDirective
|
||||||
} from '@alfresco/adf-core';
|
} from '@alfresco/adf-core';
|
||||||
import { TranslateModule } from '@ngx-translate/core';
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
import { HttpClientModule } from '@angular/common/http';
|
import { HttpClientModule } from '@angular/common/http';
|
||||||
@@ -67,7 +67,8 @@ describe('PreviewComponent', () => {
|
|||||||
ContentManagementService
|
ContentManagementService
|
||||||
],
|
],
|
||||||
declarations: [
|
declarations: [
|
||||||
PreviewComponent
|
PreviewComponent,
|
||||||
|
NodeFavoriteDirective
|
||||||
],
|
],
|
||||||
schemas: [ NO_ERRORS_SCHEMA ]
|
schemas: [ NO_ERRORS_SCHEMA ]
|
||||||
})
|
})
|
||||||
|
@@ -26,7 +26,7 @@
|
|||||||
import { Component, OnInit, ViewEncapsulation } from '@angular/core';
|
import { Component, OnInit, ViewEncapsulation } from '@angular/core';
|
||||||
import { ActivatedRoute, Router } from '@angular/router';
|
import { ActivatedRoute, Router } from '@angular/router';
|
||||||
import { AlfrescoApiService, UserPreferencesService, ObjectUtils } from '@alfresco/adf-core';
|
import { AlfrescoApiService, UserPreferencesService, ObjectUtils } from '@alfresco/adf-core';
|
||||||
import { MinimalNodeEntryEntity } from 'alfresco-js-api';
|
import { Node, MinimalNodeEntity } from 'alfresco-js-api';
|
||||||
import { ContentManagementService } from '../../common/services/content-management.service';
|
import { ContentManagementService } from '../../common/services/content-management.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@@ -39,7 +39,7 @@ import { ContentManagementService } from '../../common/services/content-manageme
|
|||||||
})
|
})
|
||||||
export class PreviewComponent implements OnInit {
|
export class PreviewComponent implements OnInit {
|
||||||
|
|
||||||
node: MinimalNodeEntryEntity;
|
node: Node;
|
||||||
previewLocation: string = null;
|
previewLocation: string = null;
|
||||||
routesSkipNavigation = [ 'shared', 'recent-files', 'favorites' ];
|
routesSkipNavigation = [ 'shared', 'recent-files', 'favorites' ];
|
||||||
navigateSource: string = null;
|
navigateSource: string = null;
|
||||||
@@ -51,6 +51,8 @@ export class PreviewComponent implements OnInit {
|
|||||||
nextNodeId: string;
|
nextNodeId: string;
|
||||||
navigateMultiple = false;
|
navigateMultiple = false;
|
||||||
|
|
||||||
|
selectedEntities: MinimalNodeEntity[] = [];
|
||||||
|
|
||||||
constructor(private router: Router,
|
constructor(private router: Router,
|
||||||
private route: ActivatedRoute,
|
private route: ActivatedRoute,
|
||||||
private apiService: AlfrescoApiService,
|
private apiService: AlfrescoApiService,
|
||||||
@@ -93,8 +95,10 @@ export class PreviewComponent implements OnInit {
|
|||||||
if (id) {
|
if (id) {
|
||||||
try {
|
try {
|
||||||
this.node = await this.apiService.nodesApi.getNodeInfo(id, {
|
this.node = await this.apiService.nodesApi.getNodeInfo(id, {
|
||||||
include: [ 'allowableOperations']
|
include: ['allowableOperations']
|
||||||
});
|
});
|
||||||
|
this.selectedEntities = [{ entry: this.node }];
|
||||||
|
|
||||||
if (this.node && this.node.isFile) {
|
if (this.node && this.node.isFile) {
|
||||||
const nearest = await this.getNearestNodes(this.node.id, this.node.parentId);
|
const nearest = await this.getNearestNodes(this.node.id, this.node.parentId);
|
||||||
|
|
||||||
@@ -331,4 +335,12 @@ export class PreviewComponent implements OnInit {
|
|||||||
} catch {
|
} catch {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
canMoveFile(): boolean {
|
||||||
|
return this.content.canMoveNode(this.node);
|
||||||
|
}
|
||||||
|
|
||||||
|
canCopyFile(): boolean {
|
||||||
|
return this.content.canCopyNode(this.node);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -54,10 +54,6 @@ adf-document-list {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.adf-no-content-container {
|
|
||||||
border: none !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.adf-datatable-header:first-of-type, .adf-datatable-header.adf-data-table-cell--image,
|
.adf-datatable-header:first-of-type, .adf-datatable-header.adf-data-table-cell--image,
|
||||||
.adf-data-table-cell:first-of-type, .adf-data-table-cell.adf-data-table-cell--image {
|
.adf-data-table-cell:first-of-type, .adf-data-table-cell.adf-data-table-cell--image {
|
||||||
padding-left: 24px;
|
padding-left: 24px;
|
||||||
|
Reference in New Issue
Block a user