From 45804b5bef932ba86ff5a28a40f1a7ebcb7c5290 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Thu, 18 Oct 2018 15:47:18 +0200 Subject: [PATCH] Add icon to file sidebar tabs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- apps/comments/js/commentstabview.js | 4 ++++ apps/files/js/detailsview.js | 3 ++- apps/files/js/detailtabview.js | 9 +++++++++ apps/files/js/templates.js | 12 ++++++++++-- apps/files/js/templates/detailsview.handlebars | 1 + apps/files_sharing/js/sharetabview.js | 4 ++++ core/css/apps.scss | 10 ++++++++++ 7 files changed, 40 insertions(+), 3 deletions(-) diff --git a/apps/comments/js/commentstabview.js b/apps/comments/js/commentstabview.js index 35e73d3f4a..8ea4dbc2ff 100644 --- a/apps/comments/js/commentstabview.js +++ b/apps/comments/js/commentstabview.js @@ -89,6 +89,10 @@ return t('comments', 'Comments'); }, + getIcon: function() { + return 'icon-comment'; + }, + setFileInfo: function(fileInfo) { if (fileInfo) { this.model = fileInfo; diff --git a/apps/files/js/detailsview.js b/apps/files/js/detailsview.js index 2a5d589a73..ad5c999352 100644 --- a/apps/files/js/detailsview.js +++ b/apps/files/js/detailsview.js @@ -122,7 +122,8 @@ templateVars.tabHeaders = _.map(this._tabViews, function(tabView, i) { return { tabId: tabView.id, - label: tabView.getLabel() + label: tabView.getLabel(), + tabIcon: tabView.getIcon() }; }); diff --git a/apps/files/js/detailtabview.js b/apps/files/js/detailtabview.js index 0bd34a8818..a66cedbc15 100644 --- a/apps/files/js/detailtabview.js +++ b/apps/files/js/detailtabview.js @@ -49,6 +49,15 @@ return 'Tab ' + this.id; }, + /** + * Returns the tab label + * + * @return {String}|{null} icon class + */ + getIcon: function() { + return null + }, + /** * returns the jQuery object for HTML output * diff --git a/apps/files/js/templates.js b/apps/files/js/templates.js index 0511873c8f..a2bdae5b3c 100644 --- a/apps/files/js/templates.js +++ b/apps/files/js/templates.js @@ -7,13 +7,21 @@ templates['detailsview'] = template({"1":function(container,depth0,helpers,parti + ((stack1 = helpers.each.call(depth0 != null ? depth0 : (container.nullContext || {}),(depth0 != null ? depth0.tabHeaders : depth0),{"name":"each","hash":{},"fn":container.program(2, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + "\n"; },"2":function(container,depth0,helpers,partials,data) { - var helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=helpers.helperMissing, alias3="function", alias4=container.escapeExpression; + var stack1, helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=helpers.helperMissing, alias3="function", alias4=container.escapeExpression; return "
  • \n " + + "\" tabindex=\"0\">\n " + + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.tabIcon : depth0),{"name":"if","hash":{},"fn":container.program(3, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + + "\n " + alias4(((helper = (helper = helpers.label || (depth0 != null ? depth0.label : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"label","hash":{},"data":data}) : helper))) + "\n
  • \n"; +},"3":function(container,depth0,helpers,partials,data) { + var helper; + + return ""; },"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) { var stack1, helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}); diff --git a/apps/files/js/templates/detailsview.handlebars b/apps/files/js/templates/detailsview.handlebars index 841a8fe25f..4d489e4fa0 100644 --- a/apps/files/js/templates/detailsview.handlebars +++ b/apps/files/js/templates/detailsview.handlebars @@ -3,6 +3,7 @@