Use svg by default. Closes #31

pull/1/head
Victor Dubiniuk 11 years ago
parent a6ea161534
commit 6c05c370a6

@ -38,7 +38,8 @@ class DocumentController extends Controller{
$documents = Storage::getDocuments();
$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'];
}

@ -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');
a.attr('href', OC.Router.generate('download',{file:document.path}));
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);
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() {
"use strict";
@ -330,4 +304,4 @@ $(document).ready(function() {
//TODO when ending a session as the last user close session?
OC.addScript('documents', 'webodf_bootstrap', documentsMain.onStartup);
});
});

Loading…
Cancel
Save