Add ContentService dep to viewer comp in search bar

This commit is contained in:
Will Abson
2016-06-09 19:07:18 +01:00
parent 294cca91de
commit e7967fee35
2 changed files with 7 additions and 6 deletions

View File

@@ -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>

View File

@@ -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;
}
}