Add tipsy config to icon buttons and add tipsy to paramamonster.

This commit is contained in:
Jeremy Goecks
2012-06-27 12:12:43 -04:00
parent 1061f1b281
commit bcd7dbdd66
3 changed files with 26 additions and 12 deletions
+14 -4
View File
@@ -8,10 +8,14 @@
* defines an icon button. Each dictionary must have the following
* elements: icon_class, title, and on_click.
*/
var create_icon_buttons_menu = function(config) {
var create_icon_buttons_menu = function(config, global_config) {
if (!global_config) { global_config = {}; }
// Create and initialize menu.
var buttons = new IconButtonCollection(
_.map(config, function(button_config) { return new IconButton(button_config); })
_.map(config, function(button_config) {
return new IconButton(_.extend(button_config, global_config));
})
);
return new IconButtonMenuView( {collection: buttons} );
@@ -38,7 +42,8 @@ var IconButton = Backbone.Model.extend({
defaults: {
title: "",
icon_class: "",
on_click: null
on_click: null,
tipsy_config: {}
}
});
@@ -60,12 +65,17 @@ var IconButtonMenuView = Backbone.View.extend({
var self = this;
this.collection.each(function(button) {
// Create and add icon button to menu.
$("<a/>").attr('href', 'javascript:void(0)')
var elt =
$('<a/>').attr('href', 'javascript:void(0)')
.attr('title', button.attributes.title)
.addClass('icon-button menu-button')
.addClass(button.attributes.icon_class)
.appendTo(self.$el)
.click(button.attributes.on_click);
if (button.attributes.tipsy_config) {
elt.tipsy(button.attributes.tipsy_config);
}
});
return this;
}
+8 -4
View File
@@ -294,7 +294,8 @@ var ParamaMonsterTrackView = Backbone.View.extend({
icon_class: 'gear track-settings',
on_click: function () {
settings_div.toggle();
}
},
tipsy_config: { gravity: 's' }
}
]);
settings_td.prepend(icon_menu.$el);
@@ -390,7 +391,7 @@ var ToolInputValOrSweepView = Backbone.View.extend({
var self = this,
menu = create_icon_buttons_menu([
{
title: 'Add',
title: 'Add parameter to tree',
icon_class: 'plus-button',
on_click: function () {
input.set('in_ptree', true);
@@ -400,7 +401,7 @@ var ToolInputValOrSweepView = Backbone.View.extend({
},
{
title: 'Remove',
title: 'Remove parameter from tree',
icon_class: 'toggle',
on_click: function() {
// Remove parameter from tree params where name matches clicked paramter.
@@ -409,7 +410,10 @@ var ToolInputValOrSweepView = Backbone.View.extend({
single_input_row.show();
}
}
]);
],
{
tipsy_config: {gravity: 's'}
});
this.$el.prepend(menu.$el);
// Update input's min, max, number of samples as values change.
+4 -4
View File
@@ -177,14 +177,14 @@ ${h.js( "galaxy.base", "galaxy.panels", "json2", "jquery", "jstorage", "jquery.e
{ icon_class: 'cross-circle', title: 'Close', on_click: function() {
window.location = "${h.url_for( controller='visualization', action='list' )}";
} }
]);
],
{
tipsy_config: {gravity: 'n'}
});
menu.$el.attr("style", "float: right");
$("#center .unified-panel-header-inner").append(menu.$el);
// Manual tipsy config because default gravity is S and cannot be changed.
$(".menu-button").tipsy( {gravity: 'n'} );
// Hide bookmarks by default right now.
parent.force_right_panel("hide");