mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
Add ContentService dep to viewer comp in search bar
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<alfresco-search-control *ngIf="isLoggedIn()" [searchTerm]="searchTerm" [autocomplete]="false"
|
||||
(searchChange)="searchTermChange($event);"(preview)="onFileClicked($event)"></alfresco-search-control>
|
||||
|
||||
<alfresco-viewer [(showViewer)]="fileShowed" [urlFile]="urlFile" [overlayMode]="true">
|
||||
<alfresco-viewer [(showViewer)]="fileShowed" [urlFile]="urlFile" [mimeType]="mimeType" [overlayMode]="true">
|
||||
<div class="mdl-spinner mdl-js-spinner is-active"></div>
|
||||
</alfresco-viewer>
|
||||
|
@@ -21,7 +21,7 @@ import { ALFRESCO_SEARCH_DIRECTIVES } from 'ng2-alfresco-search/dist/ng2-alfresc
|
||||
import { VIEWERCOMPONENT } from 'ng2-alfresco-viewer/dist/ng2-alfresco-viewer';
|
||||
import {
|
||||
AlfrescoAuthenticationService,
|
||||
AlfrescoSettingsService
|
||||
AlfrescoContentService
|
||||
} from 'ng2-alfresco-core/dist/ng2-alfresco-core';
|
||||
|
||||
declare let __moduleName: string;
|
||||
@@ -37,12 +37,14 @@ declare let __moduleName: string;
|
||||
export class SearchBarComponent {
|
||||
|
||||
urlFile: string;
|
||||
mimeType: string;
|
||||
fileShowed: boolean = false;
|
||||
|
||||
constructor(
|
||||
public router: Router,
|
||||
public auth: AlfrescoAuthenticationService,
|
||||
public settings: AlfrescoSettingsService
|
||||
public contentService: AlfrescoContentService
|
||||
|
||||
) {
|
||||
}
|
||||
|
||||
@@ -63,9 +65,8 @@ export class SearchBarComponent {
|
||||
|
||||
onFileClicked(event) {
|
||||
if (event.value.entry.isFile) {
|
||||
let workSpace = 'workspace/SpacesStore/' + event.value.entry.id;
|
||||
let nameFile = event.value.entry.name;
|
||||
this.urlFile = this.settings.host + '/alfresco/s/slingshot/node/content/' + workSpace + '/' + nameFile;
|
||||
this.mimeType = event.value.entry.content.mimeType;
|
||||
this.urlFile = this.contentService.getContentUrl(event.value);
|
||||
this.fileShowed = true;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user