diff options
Diffstat (limited to 'module/web/static/js/views/input/inputView.js')
-rw-r--r-- | module/web/static/js/views/input/inputView.js | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/module/web/static/js/views/input/inputView.js b/module/web/static/js/views/input/inputView.js index 15dc71aad..56087c516 100644 --- a/module/web/static/js/views/input/inputView.js +++ b/module/web/static/js/views/input/inputView.js @@ -10,6 +10,9 @@ define(['jquery', 'backbone', 'underscore'], function($, Backbone, _) { default_value: null, description: null, + // enables tooltips + tooltip: true, + initialize: function(model, value, default_value, description) { this.model = model; this.value = value; @@ -18,9 +21,36 @@ define(['jquery', 'backbone', 'underscore'], function($, Backbone, _) { }, render: function() { + this.renderInput(); + + // data for tooltips + if (this.description && this.tooltip) { + this.$el.data('content', this.description); +// this.$el.data('title', "TODO: title"); + this.$el.popover({ + placement: 'right', + trigger: 'hover', + delay: { show: 500, hide: 100 } + }); + } + return this; }, + renderInput: function() { + // Overwrite this + }, + + showTooltip: function() { + if (this.description && this.tooltip) + this.$el.popover('show'); + }, + + hideTooltip: function() { + if (this.description && this.tooltip) + this.$el.popover('hide'); + }, + destroy: function() { this.undelegateEvents(); this.unbind(); |