aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobin Appelman <icewind1991@gmail.com>2011-07-28 04:29:04 +0200
committerRobin Appelman <icewind1991@gmail.com>2011-07-28 04:29:04 +0200
commitece6bd663cc2a03e339019c29d1ea9170d11c24e (patch)
tree339440b6a0a93a35c6530140d2cf43f80982bb5b
parent74249c65da5b21c4b191f9792b510268c4b83454 (diff)
downloadnextcloud-server-ece6bd663cc2a03e339019c29d1ea9170d11c24e.tar.gz
nextcloud-server-ece6bd663cc2a03e339019c29d1ea9170d11c24e.zip
show icons instead of text for file actions
-rw-r--r--apps/files_imageviewer/js/lightbox.js2
-rw-r--r--apps/media/js/files.js8
-rw-r--r--files/css/files.css3
-rw-r--r--files/js/fileactions.js45
-rw-r--r--files/js/filelist.js4
-rw-r--r--files/templates/part.list.php2
6 files changed, 38 insertions, 26 deletions
diff --git a/apps/files_imageviewer/js/lightbox.js b/apps/files_imageviewer/js/lightbox.js
index 6e45547ebb4..318c764458e 100644
--- a/apps/files_imageviewer/js/lightbox.js
+++ b/apps/files_imageviewer/js/lightbox.js
@@ -7,7 +7,7 @@ $(document).ready(function() {
$( 'body' ).append(overlay);
var container=$('<div id="lightbox"/>');
$( 'body' ).append(container);
- FileActions.register('image','View',function(filename){
+ FileActions.register('image','View','',function(filename){
var location='ajax/download.php?files='+filename+'&dir='+$('#dir').val();
overlay.show();
if(!images[location]){
diff --git a/apps/media/js/files.js b/apps/media/js/files.js
index d699a96db7e..307c6012a26 100644
--- a/apps/media/js/files.js
+++ b/apps/media/js/files.js
@@ -40,11 +40,11 @@ function loadPlayer(type,ready){
$(document).ready(function() {
loadPlayer.done=false
- FileActions.register('audio','Add to playlist',addAudio);
- FileActions.register('application/ogg','Add to playlist',addAudio);
+// FileActions.register('audio','Add to playlist','',addAudio);
+// FileActions.register('application/ogg','Add to playlist','',addAudio);
- FileActions.register('audio','Play',playAudio);
- FileActions.register('application/ogg','Play',playAudio);
+ FileActions.register('audio','Play','',playAudio);
+ FileActions.register('application/ogg','','Play',playAudio);
FileActions.setDefault('audio','Play');
FileActions.setDefault('application/ogg','Play');
}); \ No newline at end of file
diff --git a/files/css/files.css b/files/css/files.css
index e956f8c03af..31f041884fd 100644
--- a/files/css/files.css
+++ b/files/css/files.css
@@ -26,7 +26,7 @@ table th, table td { border-bottom:1px solid #ddd; text-align:left; font-weight:
table td { border-bottom:1px solid #eee; font-style:normal; }
table th#headerSize, table td.filesize, table th#headerDate, table td.date { width:5em; padding:0 1em; text-align:right; cursor:help; }
table td.selection, table th.selection, table td.fileaction { width:2em; text-align:center; }
-table td.filename a { display:block; background-image:url('../img/file.png'); text-decoration:none; }
+table td.filename a.name { display:block; background-image:url('../img/file.png'); text-decoration:none; }
table td.filename a, table td.login, table td.logout, table td.download, table td.upload, table td.create, table td.delete { padding:.5em .5em .5em 3em; background-position:1em center; background-repeat:no-repeat; }
table td.filename a:hover, table td.filename a:focus { outline:0; }
table td.filename a:active { outline:0; }
@@ -53,6 +53,7 @@ table td.delete { background-image:url('../img/delete.png'); }
#selectedActions { float:right; display:none; }
#selectedActions a { margin:0 .5em; }
#uploadsize-message { display:none; }
+a.file_action { float:right; display:inline; padding:3px !important }
/* add breadcrumb divider to the File item in navigation panel */
#plugins li:first-child { background-position:15.7em 0px; background-repeat:no-repeat; background-image:url("/owncloud/core/img/breadcrumb-divider-start.png"); width:15.7em; padding-right:11px; }
diff --git a/files/js/fileactions.js b/files/js/fileactions.js
index 8c8296894a9..32029c94daa 100644
--- a/files/js/fileactions.js
+++ b/files/js/fileactions.js
@@ -1,11 +1,14 @@
FileActions={
actions:{},
defaults:{},
- register:function(mime,name,action){
+ icons:{},
+ currentFile:null,
+ register:function(mime,name,icon,action){
if(!FileActions.actions[mime]){
FileActions.actions[mime]={};
}
FileActions.actions[mime][name]=action;
+ FileActions.icons[name]=icon;
},
setDefault:function(mime,name){
FileActions.defaults[mime]=name;
@@ -49,14 +52,17 @@ FileActions={
return actions[name];
},
display:function(parent){
- $('#file_menu').empty();
- parent.append($('#file_menu'));
+ FileActions.currentFile=parent;
var actions=FileActions.get(FileActions.getCurrentMimeType(),FileActions.getCurrentType());
var defaultAction=FileActions.getDefault(FileActions.getCurrentMimeType(),FileActions.getCurrentType());
for(name in actions){
if(actions[name]!=defaultAction && name!='Delete'){
- var html='<a href="#" alt="'+name+'">'+name+'</a>';
+ var img=FileActions.icons[name];
+ var html='<a href="#" title="'+name+'" class="file_action"/>';
var element=$(html);
+ if(img){
+ element.append($('<img src="'+img+'"/>'));
+ }
element.data('action',name);
element.click(function(event){
event.stopPropagation();
@@ -66,12 +72,16 @@ FileActions={
FileActions.hide();
action(currentFile);
});
- $('#file_menu').append(element);
+ parent.children('a.name').append(element);
}
}
if(actions['Delete']){
- var html='<a href="#" alt="Delete" id="action_delete">Delete</a>';
+ var img=FileActions.icons['Delete'];
+ var html='<a href="#" title="Delete" class="file_action"/>';
var element=$(html);
+ if(img){
+ element.append($('<img src="'+img+'"/>'));
+ }
element.data('action','Delete');
element.click(function(event){
event.stopPropagation();
@@ -83,31 +93,27 @@ FileActions={
});
parent.parent().children().last().append(element);
}
- $('#file_menu').show();
return false;
},
hide:function(){
- $('#file_menu').hide();
- $('#file_menu').empty();
- $('#action_delete').remove();
- $('body').append($('#file_menu'));
+ $('.file_action').remove();
},
getCurrentFile:function(){
- return $('#file_menu').parent().parent().attr('data-file');
+ return FileActions.currentFile.parent().attr('data-file');
},
getCurrentMimeType:function(){
- return $('#file_menu').parent().parent().attr('data-mime');
+ return FileActions.currentFile.parent().attr('data-mime');
},
getCurrentType:function(){
- return $('#file_menu').parent().parent().attr('data-type');
+ return FileActions.currentFile.parent().attr('data-type');
}
}
-FileActions.register('all','Download',function(filename){
+FileActions.register('all','Download',OC.imagePath('core','actions/download'),function(filename){
window.location='ajax/download.php?files='+filename+'&dir='+$('#dir').val();
});
-FileActions.register('all','Delete',function(filename){
+FileActions.register('all','Delete',OC.imagePath('core','actions/delete'),function(filename){
$.ajax({
url: 'ajax/delete.php',
data: "dir="+encodeURIComponent($('#dir').val())+"&file="+encodeURIComponent(filename),
@@ -119,9 +125,14 @@ FileActions.register('all','Delete',function(filename){
});
});
+FileActions.register('all','Rename',OC.imagePath('core','actions/rename'),function(filename){
+ //todo
+ alert('Implement Me!!');
+});
+
FileActions.setDefault('all','Download');
-FileActions.register('dir','Open',function(filename){
+FileActions.register('dir','Open','',function(filename){
window.location='index.php?dir='+$('#dir').val()+'/'+filename;
});
diff --git a/files/js/filelist.js b/files/js/filelist.js
index 973fda23e1e..e84a9acb535 100644
--- a/files/js/filelist.js
+++ b/files/js/filelist.js
@@ -5,7 +5,7 @@ FileList={
addFile:function(name,size,lastModified,loading){
var img=(loading)?'img/loading.gif':'img/file.png';
var html='<tr data-file="'+name+'" data-type="file">';
- html+='<td class="filename"><input type="checkbox" /><a style="background-image:url('+img+')" href="download.php?file='+$('#dir').val()+'/'+name+'">'+name+'</a></td>';
+ html+='<td class="filename"><input type="checkbox" /><a class="name" style="background-image:url('+img+')" href="download.php?file='+$('#dir').val()+'/'+name+'">'+name+'</a></td>';
html+='<td class="filesize">'+size+'</td>';
html+='<td class="date">'+lastModified+'</td>';
html+='</tr>';
@@ -18,7 +18,7 @@ FileList={
},
addDir:function(name,size,lastModified){
var html='<tr data-file="'+name+'" data-type="dir">';
- html+='<td class="filename"><input type="checkbox" /><a style="background-image:url(img/folder.png)" href="index.php?dir='+$('#dir').val()+'/'+name+'"><strong>'+name+'</strong></a></td>';
+ html+='<td class="filename"><input type="checkbox" /><a class="name" style="background-image:url(img/folder.png)" href="index.php?dir='+$('#dir').val()+'/'+name+'"><strong>'+name+'</strong></a></td>';
html+='<td class="filesize">'+size+'</td>';
html+='<td class="date">'+lastModified+'</td>';
html+='</tr>';
diff --git a/files/templates/part.list.php b/files/templates/part.list.php
index 1468f485c23..cce0080b4db 100644
--- a/files/templates/part.list.php
+++ b/files/templates/part.list.php
@@ -4,7 +4,7 @@
<tr data-file="<?php echo $file['name'];?>" data-type="<?php echo ($file['type'] == 'dir')?'dir':'file'?>" data-mime="<?php echo $file['mime']?>" data-size='<?php echo $file['size'];?>'>
<td class="filename">
<input type="checkbox" />
- <a style="background-image:url(<?php if($file['type'] == 'dir') echo mimetype_icon('dir'); else echo mimetype_icon($file['mime']); ?>)" href="<?php if($file['type'] == 'dir') echo link_to('files', 'index.php?dir='.$file['directory'].'/'.$file['name']); else echo link_to('files', 'download.php?file='.$file['directory'].'/'.$file['name']); ?>" title="">
+ <a class="name" style="background-image:url(<?php if($file['type'] == 'dir') echo mimetype_icon('dir'); else echo mimetype_icon($file['mime']); ?>)" href="<?php if($file['type'] == 'dir') echo link_to('files', 'index.php?dir='.$file['directory'].'/'.$file['name']); else echo link_to('files', 'download.php?file='.$file['directory'].'/'.$file['name']); ?>" title="">
<?php if($file['type'] == 'dir'):?>
<strong><?php echo htmlspecialchars($file['name']);?></strong>
<?php else:?>