Skip to content

Commit

Permalink
Revert get-this-title to use old submenus
Browse files Browse the repository at this point in the history
  • Loading branch information
RoyEJohnson committed Apr 10, 2018
1 parent 450d3d5 commit 7a05fe0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 40 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@openstax/os-webview",
"version": "2.7.0",
"version": "2.8.1",
"description": "OpenStax webview",
"scripts": {
"start": "gulp dev",
Expand Down
45 changes: 6 additions & 39 deletions src/app/components/get-this-title/get-this-title.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ import {on} from '~/helpers/controller/decorators';
import $ from '~/helpers/$';
import userModel from '~/models/usermodel';
import router from '~/router';
import TocDialog from './toc-dialog/toc-dialog';
import OrderPrintCopy from './order-print-copy/order-print-copy';
import shell from '~/components/shell/shell';
import {highSchoolSlugs} from '~/models/book-titles';
import {description as template} from './get-this-title.html';
import {description as polishTemplate} from './get-this-title-polish.html';
Expand All @@ -16,20 +13,14 @@ export default class GetThisTitle extends Controller {
this.template = data.slug.substr(-6) === 'polska' ? polishTemplate : template;
this.css = '/app/components/get-this-title/get-this-title.css';
this.regions = {
submenu: '.submenu',
toc: '.toc-region'
};
this.view = {
classes: ['get-this-title']
submenu: '.submenu'
};

const isHighSchool = highSchoolSlugs.includes(data.slug);
const printLink = [data.amazon_link, data.amazon_coming_soon, data.bookstore_link,
data.bookstore_coming_soon, isHighSchool].find((x) => x);

this.model = {
includeTOC: data.includeTOC,
tableOfContents: data.table_of_contents,
ibookLink: data.ibook_link,
ibookLink2: data.ibook_link_volume_2,
kindleLink: data.kindle_link,
Expand Down Expand Up @@ -60,21 +51,6 @@ export default class GetThisTitle extends Controller {
};
}

onLoaded() {
this.printCopyContent = new OrderPrintCopy({
individualLink: this.model.amazon.link,
amazonPrice: this.model.amazon.price,
bookstoreLink: this.model.bookstore.link,
bulkLink: this.model.isHighSchool ? '/bulk-order?this.model.slug' : null
});
if (this.model.tableOfContents) {
this.tocContent = new TocDialog({
tableOfContents: this.model.tableOfContents,
webviewLink: this.model.webviewLink
});
}
}

@on('click .btn')
blurAfterClick(event) {
event.target.blur();
Expand All @@ -90,12 +66,12 @@ export default class GetThisTitle extends Controller {
}

@on('click .show-print-submenu')
showPrintSubmenu(event) {
showPrintSubment(event) {
event.preventDefault();
shell.showDialog(() => ({
title: 'Order print copy',
content: this.printCopyContent
}));
this.model.submenu = 'print';
this.update();
// Focus on first link
this.el.querySelector('.print-submenu a').focus();
}

@on('click .submenu .remover')
Expand All @@ -121,13 +97,4 @@ export default class GetThisTitle extends Controller {
});
}

@on('click .show-toc')
showToc(event) {
event.preventDefault();
shell.showDialog(() => ({
title: 'Table of contents',
content: this.tocContent
}));
}

}

0 comments on commit 7a05fe0

Please sign in to comment.