mirror of
https://github.com/jupyter/notebook.git
synced 2024-12-27 04:20:22 +08:00
Merge pull request #6605 from SylvainCorlay/tooltip
Adding a tooltip in IPython buttons
This commit is contained in:
commit
ed43a196b4
@ -12,7 +12,7 @@ define([
|
||||
// Called when view is rendered.
|
||||
this.setElement($("<button />")
|
||||
.addClass('btn btn-default'));
|
||||
|
||||
this.$el.attr("data-toggle", "tooltip");
|
||||
this.model.on('change:button_style', function(model, value) {
|
||||
this.update_button_style();
|
||||
}, this);
|
||||
@ -27,6 +27,7 @@ define([
|
||||
// Called when the model is changed. The model may have been
|
||||
// changed by another view or by a state update from the back-end.
|
||||
var description = this.model.get('description');
|
||||
this.$el.attr("title", this.model.get("tooltip"));
|
||||
if (description.length === 0) {
|
||||
this.$el.html(" "); // Preserve button height
|
||||
} else {
|
||||
|
@ -29,7 +29,8 @@ class Button(DOMWidget):
|
||||
_view_name = Unicode('ButtonView', sync=True)
|
||||
|
||||
# Keys
|
||||
description = Unicode('', help="Description of the button (label).", sync=True)
|
||||
description = Unicode('', help="Button label.", sync=True)
|
||||
tooltip = Unicode(help="Tooltip caption of the button.", sync=True)
|
||||
disabled = Bool(False, help="Enable or disable user changes.", sync=True)
|
||||
|
||||
button_style = CaselessStrEnum(
|
||||
|
Loading…
Reference in New Issue
Block a user