Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#7461 fix EasyForm in tabbed output container #7705

Merged
merged 1 commit into from
Jul 18, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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