Skip to content

Commit

Permalink
#6214 add show_publication UIOptionsWidget
Browse files Browse the repository at this point in the history
  • Loading branch information
piorek committed Feb 6, 2018
1 parent dd90c0a commit dfb3be8
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions js/notebook/src/tree/JVMOptions/UIOptionsWidget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,15 @@
import * as $ from "jquery";
import { Widget } from "@phosphor/widgets";
import { IUIOptions } from "../BeakerXApi";
import {MessageLoop} from "@phosphor/messaging";
import {Messages} from "./Messages";
import { MessageLoop } from "@phosphor/messaging";
import { Messages } from "./Messages";

export class UIOptionsWidget extends Widget {

public readonly AUTO_CLOSE_SELECTOR = '#auto_close';
public readonly WIDE_CELLS_SELECTOR = '#wide_cells';
public readonly IMPROVE_FONTS_SELECTOR = '#improve_fonts';
public readonly SHOW_PUBLICATION_SELECTOR = '#show_publication';

public readonly HTML_ELEMENT_TEMPLATE = `
<fieldset id="ui_options">
Expand All @@ -42,6 +43,10 @@ export class UIOptionsWidget extends Widget {
<input class="form-check-input" id="improve_fonts" name="improve_fonts" type="checkbox">
<label class="form-check-label" for="improve_fonts">Improve fonts</label>
</div>
<div class="form-check">
<input class="form-check-input" id="show_publication" name="show_publication" type="checkbox">
<label class="form-check-label" for="show_publication">Show publication</label>
</div>
</div>
</fieldset>
`;
Expand All @@ -56,7 +61,7 @@ export class UIOptionsWidget extends Widget {
$(this.HTML_ELEMENT_TEMPLATE).appendTo(this.node);

this.$node
.find(`${ this.AUTO_CLOSE_SELECTOR },${ this.IMPROVE_FONTS_SELECTOR },${ this.WIDE_CELLS_SELECTOR }`)
.find(`${ this.AUTO_CLOSE_SELECTOR },${ this.IMPROVE_FONTS_SELECTOR },${ this.WIDE_CELLS_SELECTOR },${ this.SHOW_PUBLICATION_SELECTOR }`)
.on('change', this.optionsChangedHandler.bind(this));
}

Expand All @@ -66,6 +71,7 @@ export class UIOptionsWidget extends Widget {
this.setWideCells(options.wide_cells);
this.setAutoClose(options.auto_close);
this.setImproveFonts(options.improve_fonts);
this.setShowPublication(options.show_publication);
}

private optionsChangedHandler(evt): void {
Expand Down Expand Up @@ -95,6 +101,13 @@ export class UIOptionsWidget extends Widget {
.prop('checked', checked);
}

private setShowPublication(checked: boolean) {
this.$node
.find(this.SHOW_PUBLICATION_SELECTOR)
.prop('checked', checked);

}

private _options: IUIOptions;
}

Expand Down

0 comments on commit dfb3be8

Please sign in to comment.