##// END OF EJS Templates
adding a tooltip in IPython buttons
Sylvain Corlay -
Show More
@@ -12,7 +12,7 b' define(['
12 // Called when view is rendered.
12 // Called when view is rendered.
13 this.setElement($("<button />")
13 this.setElement($("<button />")
14 .addClass('btn btn-default'));
14 .addClass('btn btn-default'));
15
15 this.$el.attr("data-toggle", "tooltip");
16 this.model.on('change:button_style', function(model, value) {
16 this.model.on('change:button_style', function(model, value) {
17 this.update_button_style();
17 this.update_button_style();
18 }, this);
18 }, this);
@@ -27,6 +27,7 b' define(['
27 // Called when the model is changed. The model may have been
27 // Called when the model is changed. The model may have been
28 // changed by another view or by a state update from the back-end.
28 // changed by another view or by a state update from the back-end.
29 var description = this.model.get('description');
29 var description = this.model.get('description');
30 this.$el.attr("title", this.model.get("tooltip"));
30 if (description.length === 0) {
31 if (description.length === 0) {
31 this.$el.html("&nbsp;"); // Preserve button height
32 this.$el.html("&nbsp;"); // Preserve button height
32 } else {
33 } else {
@@ -29,7 +29,8 b' class Button(DOMWidget):'
29 _view_name = Unicode('ButtonView', sync=True)
29 _view_name = Unicode('ButtonView', sync=True)
30
30
31 # Keys
31 # Keys
32 description = Unicode('', help="Description of the button (label).", sync=True)
32 description = Unicode('', help="Button label.", sync=True)
33 tooltip = Unicode(help="Tooltip caption of the button.", sync=True)
33 disabled = Bool(False, help="Enable or disable user changes.", sync=True)
34 disabled = Bool(False, help="Enable or disable user changes.", sync=True)
34
35
35 button_style = CaselessStrEnum(
36 button_style = CaselessStrEnum(
General Comments 0
You need to be logged in to leave comments. Login now