Skip to content

Commit

Permalink
Merge pull request #1105 from openstax/turn-off-resources-tabs-for-po…
Browse files Browse the repository at this point in the history
…lish-page

Turn off resources tabs for Polish
  • Loading branch information
mwvolo authored May 2, 2018
2 parents 8f3d307 + bbc1b35 commit f837988
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 13 deletions.
25 changes: 17 additions & 8 deletions src/app/pages/details/details.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,15 @@ export default class Details extends CMSPageController {
document.body.classList.remove('page-loading');
document.body.classList.add('page-loaded');
document.title = `${this.pageData.title} - OpenStax`;
const tabLabels = ['Book details', 'Instructor resources', 'Student resources'];
const tabLabels = ['Book details'];
let selectedTab = tabLabels[0];
const detailsTabData = () => {
/* eslint complexity: 0 */
const model = {
bookInfo: this.pageData,
comingSoon: this.pageData.coming_soon ? ' coming-soon' : '',
description: this.pageData.description,
errataBlurb: this.pageData.errata_content.content.content,
errataBlurb: this.pageData.errata_content.content && this.pageData.errata_content.content.content,
formattedPublishDate: this.pageData.publish_date && formatDate(this.pageData.publish_date),
slug: this.slug,
title: this.pageData.title
Expand Down Expand Up @@ -132,8 +132,11 @@ export default class Details extends CMSPageController {
);

const contents = {
'Book details': new DetailsTab(detailsTabData()),
'Instructor resources': new InstructorResourceTab(
'Book details': new DetailsTab(detailsTabData())
};

if (this.pageData.free_stuff_instructor.content) {
contents['Instructor resources'] = new InstructorResourceTab(
{
resources: this.pageData.book_faculty_resources,
allies: shuffle(this.pageData.book_allies),
Expand Down Expand Up @@ -162,16 +165,22 @@ export default class Details extends CMSPageController {
}
},
compCopyDialogProps
),
'Student resources': new StudentResourceTab({
);
tabLabels.push('Instructor resources');
}

if (this.pageData.free_stuff_student.content) {
contents['Student resources'] = new StudentResourceTab({
freeStuff: {
heading: this.pageData.free_stuff_student.content.heading,
blurb: this.pageData.free_stuff_student.content.content
},
resources: this.pageData.book_student_resources,
userStatusPromise: this.userStatusPromise
})
};
});
tabLabels.push('Student resources');
}

const contentGroup = new ContentGroup(() => ({
selectedTab,
contents
Expand Down
7 changes: 2 additions & 5 deletions src/app/pages/details/phone-view/phone-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,18 +56,14 @@ export default class PhoneView extends Controller {
title: 'Report errata',
contentComponent: new ErrataPane({
title: this.props.bookTitle,
errataBlurb: this.props.errataContent.content.content
errataBlurb: this.props.errataContent.content && this.props.errataContent.content.content
})
}
];

if (this.props.tableOfContents) {
accordionItems.splice(1, 0, {
title: 'Table of contents',
// contentComponent: new Contents(
// this.props.tableOfContents,
// {tag: 'ol', classes: ['table-of-contents']}
// )
contentComponent: new TocPane({
webviewLink: this.props.webviewLink,
contentPane: new Contents(
Expand All @@ -77,6 +73,7 @@ export default class PhoneView extends Controller {
})
});
}

this.regions.accordion.append(new AccordionGroup(() => ({
items: accordionItems
})));
Expand Down

0 comments on commit f837988

Please sign in to comment.