Skip to content

Commit

Permalink
#7461 fix EasyForm in tabbed output container
Browse files Browse the repository at this point in the history
  • Loading branch information
Mariusz Jurowicz committed Jul 18, 2018
1 parent b376cbd commit c592806
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 10 deletions.
12 changes: 7 additions & 5 deletions js/notebook/src/EasyForm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import 'flatpickr/dist/flatpickr.css';
import 'jquery-ui/themes/base/all.css';
import 'jquery-ui/ui/widgets/button';
import 'jquery-ui/ui/widgets/autocomplete';
import BeakerXThemeHelper from "./BeakerXThemeHelper";

export class EasyFormModel extends widgets.DOMWidgetModel {
defaults() {
Expand Down Expand Up @@ -60,18 +61,19 @@ export class EasyFormView extends widgets.BoxView {

this.$el
.addClass('beaker-easyform-container')
.addClass('widget-vbox');
.addClass('widget-vbox')
.addClass('beaker-fieldset');

const formTitle = this.model.get('easyFormName');

this.$fieldset = $('<fieldset></fieldset>').addClass('beaker-fieldset');
this.$legend = $('<legend>'+formTitle+'</legend>');

this.displayed.then(() => {
this.$el.wrap(this.$fieldset);
if (BeakerXThemeHelper.isDark) {
this.$legend.css('background-color', '#636363');
}

if (formTitle) {
this.$el.before(this.$legend);
this.$el.prepend(this.$legend);
}
});
}
Expand Down
2 changes: 1 addition & 1 deletion js/notebook/src/Plot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ export class PlotView extends widgets.DOMWidgetView {

handleModellUpdate() {
const newModel = this.model.get('model');
this._currentScope.updateModelData(newModel);
this._currentScope.updateModelData && this._currentScope.updateModelData(newModel);
this._currentScope.updatePlot();
}

Expand Down
18 changes: 14 additions & 4 deletions js/notebook/src/easyForm/css/jupyter-easyform.scss
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,24 @@ $beakerxFont: "Lato", Helvetica, sans-serif;
border: 1px solid #cfcfcf;
padding: 10px;
font-family: $beakerxFont;
overflow: visible;
position: relative;
margin-top: 10px;

legend {
border-bottom: none;
width: auto;
display: inline;
padding: 0 5px;
font-size: 17px;
margin-bottom: 0;
font-size: 17px;
position: absolute;
top: -0.7em;
background: white;
width: auto;
display: inline-block;
padding: 0 4px;
}

.widget-inline-hbox {
align-items: center;
}
}

Expand Down
7 changes: 7 additions & 0 deletions js/notebook/src/plot/plotScope.js
Original file line number Diff line number Diff line change
Expand Up @@ -2086,6 +2086,13 @@ define([
}
};

// update model with partial model data
PlotScope.prototype.updateModelData = function(data) {
if (this.model && this.model.model && data) {
this.model.model = _.extend(this.model.model, data);
}
};

PlotScope.prototype.setElement = function(el) {
this.element = el;
};
Expand Down

0 comments on commit c592806

Please sign in to comment.