Thumbnails for files

This commit is contained in:
Denys Vuika 2016-04-08 14:51:03 +01:00
parent 626d54560f
commit d771b175cd
2 changed files with 11 additions and 3 deletions

View File

@ -167,7 +167,7 @@
<img class="folder" src="img/folder.svg"> <img class="folder" src="img/folder.svg">
</template> </template>
<template is="dom-if" if="{{!item.isFolder}}"> <template is="dom-if" if="{{!item.isFolder}}">
<img class="file" src="{{thumbBaseUrl()}}{{item.contentUrl}}"> <img class="file" src="{{getThumbnailUrl(item)}}">
</template> </template>
</div> </div>
<div class="text"> <div class="text">
@ -258,7 +258,7 @@
var xhr = new XMLHttpRequest(); var xhr = new XMLHttpRequest();
xhr.addEventListener("load", (XMLHttpRequestProgressEvent)=>{ xhr.addEventListener("load", (XMLHttpRequestProgressEvent)=>{
this.data =JSON.parse(XMLHttpRequestProgressEvent.currentTarget.response).items; this.data =JSON.parse(XMLHttpRequestProgressEvent.currentTarget.response).items;
}); });
xhr.addEventListener("error", error); xhr.addEventListener("error", error);
@ -271,6 +271,10 @@
thumbBaseUrl: function () { thumbBaseUrl: function () {
return this.host + '/alfresco/service/'; return this.host + '/alfresco/service/';
},
getThumbnailUrl: function(item) {
return this.host + '/alfresco/service/api/node/' + item.nodeRef.replace('://', '/') + '/content/thumbnails/doclib?c=queue&amp;ph=true&amp;lastModified=1';
} }
}); });
}); });

View File

@ -167,7 +167,7 @@
<img class="folder" src="img/folder.svg"> <img class="folder" src="img/folder.svg">
</template> </template>
<template is="dom-if" if="{{!item.isFolder}}"> <template is="dom-if" if="{{!item.isFolder}}">
<img class="file" src="{{thumbBaseUrl()}}{{item.contentUrl}}"> <img class="file" src="{{getThumbnailUrl(item)}}">
</template> </template>
</div> </div>
<div class="text"> <div class="text">
@ -269,6 +269,10 @@
xhr.send(); xhr.send();
}, },
getThumbnailUrl: function(item) {
return this.host + '/alfresco/service/api/node/' + item.nodeRef.replace('://', '/') + '/content/thumbnails/doclib?c=queue&amp;ph=true&amp;lastModified=1';
},
thumbBaseUrl: function () { thumbBaseUrl: function () {
return this.host + '/alfresco/service/'; return this.host + '/alfresco/service/';
} }