From e9dc530655b68c8eb7ae2c2a4be3ef6930804fdd Mon Sep 17 00:00:00 2001 From: Martin Cech Date: Mon, 13 Jan 2014 12:26:30 -0500 Subject: [PATCH] =?UTF-8?q?disable=20visualization=20and=20workflows=20men?= =?UTF-8?q?u=20items=20for=20anonymous=20users=20that=20can=E2=80=99t=20us?= =?UTF-8?q?e=20them,=20show=20notification=20of=20clicked,=20also=20add=20?= =?UTF-8?q?possibility=20to=20use=20titles=20in=20menu=20(shown=20by=20def?= =?UTF-8?q?ault=20on=20hoover)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- static/scripts/galaxy.masthead.js | 21 ++++++++-- static/scripts/galaxy.menu.js | 53 +++++++++++++++++------- static/scripts/packed/galaxy.masthead.js | 2 +- static/scripts/packed/galaxy.menu.js | 2 +- static/style/blue/base.css | 4 +- static/style/src/less/toastr.less | 6 +-- 6 files changed, 61 insertions(+), 27 deletions(-) diff --git a/static/scripts/galaxy.masthead.js b/static/scripts/galaxy.masthead.js index 2bf3b42b1e9..9ed389fa263 100644 --- a/static/scripts/galaxy.masthead.js +++ b/static/scripts/galaxy.masthead.js @@ -3,7 +3,7 @@ */ // dependencies -define(["utils/galaxy.utils"], function(mod_utils) { +define(["utils/galaxy.utils", "libs/toastr"], function(mod_utils, mod_toastr) { // masthead var GalaxyMasthead = Backbone.View.extend( @@ -259,7 +259,9 @@ var GalaxyMastheadTab = Backbone.View.extend( type : 'url', scratchbook : false, on_unload : null, - visible : true + visible : true, + disabled : false, + title_attribute : '' }, // location @@ -288,6 +290,12 @@ var GalaxyMastheadTab = Backbone.View.extend( // add template for tab this.setElement($(this._template(this.options))); + // disable menu items that are not available to anonymous user + // also show title to explain why they are disabled + if (this.options.disabled){ + $(this.el).find('.root').addClass('disabled'); + } + // visiblity if (!this.options.visible) this.hide(); @@ -371,9 +379,14 @@ var GalaxyMastheadTab = Backbone.View.extend( // prevent default e.preventDefault(); + if (this.options.disabled){ + mod_toastr.info('Please register to use this feature'); + return + } + // check for menu options if (!this.$menu) { - Galaxy.frame.add(this.options); + Galaxy.frame.add(this.options); } }, @@ -400,7 +413,7 @@ var GalaxyMastheadTab = Backbone.View.extend( // start template var tmpl = '