Use svg by default. Closes #31
This commit is contained in:
parent
d870247133
commit
efe0d7c869
@ -38,7 +38,8 @@ class DocumentController extends Controller{
|
|||||||
$documents = Storage::getDocuments();
|
$documents = Storage::getDocuments();
|
||||||
|
|
||||||
$fileIds = array();
|
$fileIds = array();
|
||||||
foreach ($documents as $document) {
|
foreach ($documents as $key=>$document) {
|
||||||
|
$documents[$key]['icon'] = preg_replace('/\.png$/', '.svg', \OC_Helper::mimetypeIcon($document['mimetype']));
|
||||||
$fileIds[] = $document['fileid'];
|
$fileIds[] = $document['fileid'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,3 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
OCP\JSON::success(array('path' => OC_Helper::mimetypeIcon($_GET['mime'])));
|
|
@ -218,10 +218,8 @@ var documentsMain = {
|
|||||||
var a = docElem.find('a');
|
var a = docElem.find('a');
|
||||||
a.attr('href', OC.Router.generate('download',{file:document.path}));
|
a.attr('href', OC.Router.generate('download',{file:document.path}));
|
||||||
a.find('label').text(document.name);
|
a.find('label').text(document.name);
|
||||||
|
a.css('background-image', 'url("'+document.icon+'")');
|
||||||
|
|
||||||
getMimeIcon(document.mimetype).then(function(path){
|
|
||||||
a.css('background-image', 'url("'+path+'")');
|
|
||||||
});
|
|
||||||
$('.documentslist').append(docElem);
|
$('.documentslist').append(docElem);
|
||||||
docElem.show();
|
docElem.show();
|
||||||
});
|
});
|
||||||
@ -241,30 +239,6 @@ var documentsMain = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* TODO copy from files, move from files to core? load files.js?
|
|
||||||
* @param {type} mime
|
|
||||||
* @returns {getMimeIcon}
|
|
||||||
*/
|
|
||||||
function getMimeIcon(mime){
|
|
||||||
var def = new $.Deferred();
|
|
||||||
if(getMimeIcon.cache[mime]){
|
|
||||||
def.resolve(getMimeIcon.cache[mime]);
|
|
||||||
}else{
|
|
||||||
jQuery.getJSON( OC.filePath('documents','ajax','mimeicon.php'), {mime: mime})
|
|
||||||
.done(function(data){
|
|
||||||
getMimeIcon.cache[mime]=data.path;
|
|
||||||
def.resolve(getMimeIcon.cache[mime]);
|
|
||||||
})
|
|
||||||
.error(function(jqXHR, textStatus, errorThrown){
|
|
||||||
console.log(textStatus + ': ' + errorThrown);
|
|
||||||
console.log(jqXHR);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return def;
|
|
||||||
}
|
|
||||||
getMimeIcon.cache={};
|
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
@ -330,4 +304,4 @@ $(document).ready(function() {
|
|||||||
//TODO when ending a session as the last user close session?
|
//TODO when ending a session as the last user close session?
|
||||||
|
|
||||||
OC.addScript('documents', 'webodf_bootstrap', documentsMain.onStartup);
|
OC.addScript('documents', 'webodf_bootstrap', documentsMain.onStartup);
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user