diff options
author | Jan-Christoph Borchardt <hey@jancborchardt.net> | 2012-10-28 17:10:31 +0100 |
---|---|---|
committer | Jan-Christoph Borchardt <hey@jancborchardt.net> | 2012-10-28 17:10:31 +0100 |
commit | d7abd44dea9eb37312615e7d737acecf945a38fe (patch) | |
tree | b254ea8e226a9089d08d58132a5b365b6e9ee753 /apps | |
parent | 99ba05e766defb746284d6e93829fa81eebd530c (diff) | |
parent | 7af8c6c3cbf00444b81a6d3d0c4cede983ff8edc (diff) | |
download | nextcloud-server-d7abd44dea9eb37312615e7d737acecf945a38fe.tar.gz nextcloud-server-d7abd44dea9eb37312615e7d737acecf945a38fe.zip |
merge breadcrumb root into navigation
Diffstat (limited to 'apps')
-rw-r--r-- | apps/files/appinfo/app.php | 2 | ||||
-rw-r--r-- | apps/files/css/files.css | 6 | ||||
-rw-r--r-- | apps/files/js/fileactions.js | 208 | ||||
-rw-r--r-- | apps/files/js/files.js | 8 | ||||
-rw-r--r-- | apps/files/templates/part.breadcrumb.php | 11 |
5 files changed, 114 insertions, 121 deletions
diff --git a/apps/files/appinfo/app.php b/apps/files/appinfo/app.php index b431ddfec02..3f437679e05 100644 --- a/apps/files/appinfo/app.php +++ b/apps/files/appinfo/app.php @@ -3,6 +3,6 @@ $l=OC_L10N::get('files'); OCP\App::registerAdmin('files', 'admin'); -OCP\App::addNavigationEntry( array( "id" => "files_index", "order" => 0, "href" => OCP\Util::linkTo( "files", "index.php" ), "icon" => OCP\Util::imagePath( "core", "places/home.svg" ), "name" => $l->t("Files") )); +OCP\App::addNavigationEntry( array( "id" => "files_index", "order" => 0, "href" => OCP\Util::linkTo( "files", "index.php" ), "icon" => OCP\Util::imagePath( "core", "places/files.svg" ), "name" => $l->t("Files") )); OC_Search::registerProvider('OC_Search_Provider_File'); diff --git a/apps/files/css/files.css b/apps/files/css/files.css index 48051a9a921..69cdb48e567 100644 --- a/apps/files/css/files.css +++ b/apps/files/css/files.css @@ -12,7 +12,7 @@ .file_upload_wrapper, #file_newfolder_name { background-repeat:no-repeat; background-position:.5em .5em; padding-left:2em; } .file_upload_wrapper { font-weight:bold; display:-moz-inline-box; /* fallback for older firefox versions*/ display:block; float:left; padding-left:0; overflow:hidden; position:relative; margin:0; margin-left:2px; } .file_upload_wrapper .file_upload_button_wrapper { position:absolute; top:0; left:0; width:100%; height:100%; cursor:pointer; z-index:1000; } -#new { background-color:#5bb75b; float:left; margin:0 0 0 1em; border-right:none; z-index:1010; height:1.3em; } +#new { background-color:#5bb75b; float:left; margin:0; border-right:none; z-index:1010; height:1.3em; } #new:hover, a.file_upload_button_wrapper:hover + button.file_upload_filename { background-color:#4b964b; } #new.active { border-bottom-left-radius:0; border-bottom-right-radius:0; border-bottom:none; } #new>a { padding:.5em 1.2em .3em; color:#fff; text-shadow:0 1px 0 #51a351; } @@ -81,10 +81,6 @@ a.action>img { max-height:16px; max-width:16px; vertical-align:text-bottom; } .selectedActions a { display:inline; margin:-.5em 0; padding:.5em !important; } .selectedActions a img { position:relative; top:.3em; } -/* add breadcrumb divider to the File item in navigation panel */ -#navigation>ul>li:first-child { background:url('%webroot%/core/img/breadcrumb-start.svg') no-repeat 64px 0; width:64px; padding-right:1em; position:fixed; } -#navigation>ul>li:first-child+li { padding-top:68px; } #scanning-message{ top:40%; left:40%; position:absolute; display:none; } -div.crumb a{ padding: 0.9em 0 0.7em 0; } diff --git a/apps/files/js/fileactions.js b/apps/files/js/fileactions.js index 1cf80352bef..24c8e85656c 100644 --- a/apps/files/js/fileactions.js +++ b/apps/files/js/fileactions.js @@ -1,191 +1,189 @@ -var FileActions={ - actions:{}, - defaults:{}, - icons:{}, - currentFile:null, - register:function(mime,name,permissions,icon,action){ - if(!FileActions.actions[mime]){ - FileActions.actions[mime]={}; +var FileActions = { + actions: {}, + defaults: {}, + icons: {}, + currentFile: null, + register: function (mime, name, permissions, icon, action) { + if (!FileActions.actions[mime]) { + FileActions.actions[mime] = {}; } if (!FileActions.actions[mime][name]) { FileActions.actions[mime][name] = {}; } FileActions.actions[mime][name]['action'] = action; FileActions.actions[mime][name]['permissions'] = permissions; - FileActions.icons[name]=icon; + FileActions.icons[name] = icon; }, - setDefault:function(mime,name){ - FileActions.defaults[mime]=name; + setDefault: function (mime, name) { + FileActions.defaults[mime] = name; }, - get:function(mime,type,permissions){ - var actions={}; - if(FileActions.actions.all){ - actions=$.extend( actions, FileActions.actions.all ); + get: function (mime, type, permissions) { + var actions = {}; + if (FileActions.actions.all) { + actions = $.extend(actions, FileActions.actions.all); } - if(mime){ - if(FileActions.actions[mime]){ - actions=$.extend( actions, FileActions.actions[mime] ); + if (mime) { + if (FileActions.actions[mime]) { + actions = $.extend(actions, FileActions.actions[mime]); } - var mimePart=mime.substr(0,mime.indexOf('/')); - if(FileActions.actions[mimePart]){ - actions=$.extend( actions, FileActions.actions[mimePart] ); + var mimePart = mime.substr(0, mime.indexOf('/')); + if (FileActions.actions[mimePart]) { + actions = $.extend(actions, FileActions.actions[mimePart]); } } - if(type){//type is 'dir' or 'file' - if(FileActions.actions[type]){ - actions=$.extend( actions, FileActions.actions[type] ); + if (type) {//type is 'dir' or 'file' + if (FileActions.actions[type]) { + actions = $.extend(actions, FileActions.actions[type]); } } var filteredActions = {}; - $.each(actions, function(name, action) { + $.each(actions, function (name, action) { if (action.permissions & permissions) { filteredActions[name] = action.action; } }); return filteredActions; }, - getDefault:function(mime,type,permissions){ - if(mime){ - var mimePart=mime.substr(0,mime.indexOf('/')); + getDefault: function (mime, type, permissions) { + if (mime) { + var mimePart = mime.substr(0, mime.indexOf('/')); } - var name=false; - if(mime && FileActions.defaults[mime]){ - name=FileActions.defaults[mime]; - }else if(mime && FileActions.defaults[mimePart]){ - name=FileActions.defaults[mimePart]; - }else if(type && FileActions.defaults[type]){ - name=FileActions.defaults[type]; - }else{ - name=FileActions.defaults.all; + var name = false; + if (mime && FileActions.defaults[mime]) { + name = FileActions.defaults[mime]; + } else if (mime && FileActions.defaults[mimePart]) { + name = FileActions.defaults[mimePart]; + } else if (type && FileActions.defaults[type]) { + name = FileActions.defaults[type]; + } else { + name = FileActions.defaults.all; } - var actions=this.get(mime,type,permissions); + var actions = this.get(mime, type, permissions); return actions[name]; }, - display:function(parent){ - FileActions.currentFile=parent; - $('#fileList span.fileactions, #fileList td.date a.action').remove(); - var actions=FileActions.get(FileActions.getCurrentMimeType(),FileActions.getCurrentType(), FileActions.getCurrentPermissions()); - var file=FileActions.getCurrentFile(); - if($('tr').filterAttr('data-file',file).data('renaming')){ + display: function (parent) { + FileActions.currentFile = parent; + var actions = FileActions.get(FileActions.getCurrentMimeType(), FileActions.getCurrentType(), FileActions.getCurrentPermissions()); + var file = FileActions.getCurrentFile(); + if ($('tr').filterAttr('data-file', file).data('renaming')) { return; } parent.children('a.name').append('<span class="fileactions" />'); - var defaultAction=FileActions.getDefault(FileActions.getCurrentMimeType(),FileActions.getCurrentType(), FileActions.getCurrentPermissions()); - for(name in actions){ + var defaultAction = FileActions.getDefault(FileActions.getCurrentMimeType(), FileActions.getCurrentType(), FileActions.getCurrentPermissions()); + for (name in actions) { // NOTE: Temporary fix to prevent rename action in root of Shared directory - if (name == 'Rename' && $('#dir').val() == '/Shared') { + if (name === 'Rename' && $('#dir').val() === '/Shared') { continue; } - if((name=='Download' || actions[name]!=defaultAction) && name!='Delete'){ - var img=FileActions.icons[name]; - if(img.call){ - img=img(file); + if ((name === 'Download' || actions[name] !== defaultAction) && name !== 'Delete') { + var img = FileActions.icons[name]; + if (img.call) { + img = img(file); } - var html='<a href="#" class="action" style="display:none">'; - if(img) { html+='<img src="'+img+'"/> '; } - html += t('files', name) +'</a>'; - var element=$(html); - element.data('action',name); - element.click(function(event){ + var html = '<a href="#" class="action">'; + if (img) { + html += '<img src="' + img + '"/> '; + } + html += t('files', name) + '</a>'; + var element = $(html); + element.data('action', name); + element.click(function (event) { + FileActions.currentFile = $(this).parent().parent().parent(); event.stopPropagation(); event.preventDefault(); - var action=actions[$(this).data('action')]; - var currentFile=FileActions.getCurrentFile(); - FileActions.hide(); + var action = actions[$(this).data('action')]; + var currentFile = FileActions.getCurrentFile(); action(currentFile); }); - element.hide(); parent.find('a.name>span.fileactions').append(element); } } - if(actions['Delete']){ - var img=FileActions.icons['Delete']; - if(img.call){ - img=img(file); + if (actions['Delete']) { + var img = FileActions.icons['Delete']; + if (img.call) { + img = img(file); } // NOTE: Temporary fix to allow unsharing of files in root of Shared folder if ($('#dir').val() == '/Shared') { - var html = '<a href="#" original-title="' + t('files', 'Unshare') + '" class="action delete" style="display:none" />'; + var html = '<a href="#" original-title="' + t('files', 'Unshare') + '" class="action delete" />'; } else { - var html='<a href="#" original-title="' + t('files', 'Delete') + '" class="action delete" style="display:none" />'; + var html = '<a href="#" original-title="' + t('files', 'Delete') + '" class="action delete" />'; } - var element=$(html); - if(img){ - element.append($('<img src="'+img+'"/>')); + var element = $(html); + if (img) { + element.append($('<img src="' + img + '"/>')); } - element.data('action','Delete'); - element.click(function(event){ + element.data('action', 'Delete'); + element.click(function (event) { event.stopPropagation(); event.preventDefault(); - var action=actions[$(this).data('action')]; - var currentFile=FileActions.getCurrentFile(); - FileActions.hide(); + var action = actions[$(this).data('action')]; + var currentFile = FileActions.getCurrentFile(); action(currentFile); }); - element.hide(); parent.parent().children().last().append(element); } - $('#fileList .action').css('-o-transition-property','none');//temporarly disable - $('#fileList .action').fadeIn(200,function(){ - $('#fileList .action').css('-o-transition-property','opacity'); - }); - return false; - }, - hide:function(){ - $('#fileList span.fileactions, #fileList td.date a.action').fadeOut(200,function(){ - $(this).remove(); - }); }, - getCurrentFile:function(){ + getCurrentFile: function () { return FileActions.currentFile.parent().attr('data-file'); }, - getCurrentMimeType:function(){ + getCurrentMimeType: function () { return FileActions.currentFile.parent().attr('data-mime'); }, - getCurrentType:function(){ + getCurrentType: function () { return FileActions.currentFile.parent().attr('data-type'); }, - getCurrentPermissions:function() { + getCurrentPermissions: function () { return FileActions.currentFile.parent().data('permissions'); } }; -$(document).ready(function(){ - if($('#allowZipDownload').val() == 1){ +$(document).ready(function () { + if ($('#allowZipDownload').val() == 1) { var downloadScope = 'all'; } else { var downloadScope = 'file'; } - FileActions.register(downloadScope,'Download', OC.PERMISSION_READ, function(){return OC.imagePath('core','actions/download');},function(filename){ - window.location=OC.filePath('files', 'ajax', 'download.php') + '?files='+encodeURIComponent(filename)+'&dir='+encodeURIComponent($('#dir').val()); + FileActions.register(downloadScope, 'Download', OC.PERMISSION_READ, function () { + return OC.imagePath('core', 'actions/download'); + }, function (filename) { + window.location = OC.filePath('files', 'ajax', 'download.php') + '?files=' + encodeURIComponent(filename) + '&dir=' + encodeURIComponent($('#dir').val()); + }); + + $('#fileList tr').each(function(){ + FileActions.display($(this).children('td.filename')); }); }); -FileActions.register('all','Delete', OC.PERMISSION_DELETE, function(){return OC.imagePath('core','actions/delete');},function(filename){ - if(Files.cancelUpload(filename)) { - if(filename.substr){ - filename=[filename]; +FileActions.register('all', 'Delete', OC.PERMISSION_DELETE, function () { + return OC.imagePath('core', 'actions/delete'); +}, function (filename) { + if (Files.cancelUpload(filename)) { + if (filename.substr) { + filename = [filename]; } - $.each(filename,function(index,file){ - var filename = $('tr').filterAttr('data-file',file); + $.each(filename, function (index, file) { + var filename = $('tr').filterAttr('data-file', file); filename.hide(); filename.find('input[type="checkbox"]').removeAttr('checked'); filename.removeClass('selected'); }); procesSelection(); - }else{ + } else { FileList.do_delete(filename); } $('.tipsy').remove(); }); // t('files', 'Rename') -FileActions.register('all','Rename', OC.PERMISSION_UPDATE, function(){return OC.imagePath('core','actions/rename');},function(filename){ +FileActions.register('all', 'Rename', OC.PERMISSION_UPDATE, function () { + return OC.imagePath('core', 'actions/rename'); +}, function (filename) { FileList.rename(filename); }); -FileActions.register('dir','Open', OC.PERMISSION_READ, '', function(filename){ - window.location=OC.linkTo('files', 'index.php') + '?dir='+encodeURIComponent($('#dir').val()).replace(/%2F/g, '/')+'/'+encodeURIComponent(filename); +FileActions.register('dir', 'Open', OC.PERMISSION_READ, '', function (filename) { + window.location = OC.linkTo('files', 'index.php') + '?dir=' + encodeURIComponent($('#dir').val()).replace(/%2F/g, '/') + '/' + encodeURIComponent(filename); }); -FileActions.setDefault('dir','Open'); +FileActions.setDefault('dir', 'Open'); diff --git a/apps/files/js/files.js b/apps/files/js/files.js index 549204e8572..2d9ccba424a 100644 --- a/apps/files/js/files.js +++ b/apps/files/js/files.js @@ -62,14 +62,6 @@ $(document).ready(function() { return false; }); - // Sets the file-action buttons behaviour : - $('tr').live('mouseenter',function(event) { - FileActions.display($(this).children('td.filename')); - }); - $('tr').live('mouseleave',function(event) { - FileActions.hide(); - }); - var lastChecked; // Sets the file link behaviour : diff --git a/apps/files/templates/part.breadcrumb.php b/apps/files/templates/part.breadcrumb.php index 71b695f65f8..37b6b63eabd 100644 --- a/apps/files/templates/part.breadcrumb.php +++ b/apps/files/templates/part.breadcrumb.php @@ -1,6 +1,13 @@ + <?php if(count($_["breadcrumb"])):?> + <div class="crumb"> + <a href="<?php echo $_['baseURL'].urlencode($crumb['dir']); ?>"> + <img src="<?php echo OCP\image_path('core','places/home.svg');?>" /> + </a> + </div> + <?php endif;?> <?php for($i=0; $i<count($_["breadcrumb"]); $i++): $crumb = $_["breadcrumb"][$i]; ?> - <div class="crumb <?php if($i == count($_["breadcrumb"])-1) echo 'last';?> svg" data-dir='<?php echo urlencode($crumb["dir"]);?>' style='background-image:url("<?php echo OCP\image_path('core','breadcrumb.png');?>")'> - <a href="<?php echo $_['baseURL'].urlencode($crumb["dir"]); ?>"><?php echo OCP\Util::sanitizeHTML($crumb["name"]); ?></a> + <div class="crumb <?php if($i == count($_["breadcrumb"])-1) echo 'last';?> svg" data-dir='<?php echo urlencode($crumb["dir"]);?>'> + <a href="<?php echo $_['baseURL'].urlencode($crumb['dir']); ?>"><?php echo OCP\Util::sanitizeHTML($crumb["name"]); ?></a> </div> <?php endfor;?> |