-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- replace .hbs templates with .jsx - change view template filenames - create Boxmenu model - condense view background style functions that are dependant on background image
- Loading branch information
1 parent
1fc32a3
commit 68729e0
Showing
11 changed files
with
301 additions
and
196 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import MenuModel from 'core/js/models/menuModel'; | ||
|
||
export default class BoxMenuModel extends MenuModel {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,18 @@ | ||
import components from 'core/js/components'; | ||
import MenuModel from 'core/js/models/menuModel'; | ||
import BoxMenuView from './BoxMenuView'; | ||
import BoxMenuModel from './BoxMenuModel'; | ||
|
||
// Use as default "_type": "course" or "_type": "menu" view. | ||
// Note: This is necessary to maintain legacy behaviour in the AAT where | ||
// only one menu is usable per course and the course / menu is assumed to be | ||
// a core model and use the only installed MenuView. | ||
components.register('course menu', { | ||
view: BoxMenuView | ||
view: BoxMenuView, | ||
model: BoxMenuModel | ||
}); | ||
|
||
// Use for "_component": "boxMenu", or "_view": "boxMenu" and "_model": "boxMenu" | ||
components.register('boxMenu', { | ||
view: BoxMenuView, | ||
model: MenuModel.extend({}) | ||
model: BoxMenuModel | ||
}); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
import React from 'react'; | ||
import Adapt from 'core/js/adapt'; | ||
import { classes, compile } from 'core/js/reactHelpers'; | ||
|
||
export default function BoxMenu (props) { | ||
const { | ||
displayTitle, | ||
subtitle, | ||
body, | ||
pageBody, | ||
instruction | ||
} = props; | ||
|
||
const _graphic = Adapt.course.get('_boxmenu')?._graphic; | ||
|
||
return ( | ||
|
||
<div className="menu__inner boxmenu__inner"> | ||
|
||
{(displayTitle || subtitle || body || instruction) && | ||
<div className="menu__header boxmenu__header"> | ||
<div className="menu__header-inner boxmenu__header-inner"> | ||
|
||
{_graphic?._src && | ||
<div className="menu__image-container boxmenu__image-container"> | ||
<img | ||
className="menu__image boxmenu__image" | ||
src={_graphic?._src} | ||
alt={_graphic?.alt} | ||
aria-hidden={!_graphic?.alt ? true : null} | ||
/> | ||
</div> | ||
} | ||
|
||
<div className="menu__header-content"> | ||
|
||
{displayTitle && | ||
<div className="menu__title boxmenu__title"> | ||
<div className={classes([ | ||
'menu__title-inner', | ||
'boxmenu__title-inner', | ||
'js-heading' | ||
])} /> | ||
</div> | ||
} | ||
|
||
{subtitle && | ||
<div className="menu__subtitle boxmenu__subtitle"> | ||
<div className="menu__subtitle-inner boxmenu__subtitle-inner" dangerouslySetInnerHTML={{ __html: compile(subtitle) }}/> | ||
</div> | ||
} | ||
|
||
{(body || pageBody) && | ||
<div className="menu__body boxmenu__body"> | ||
<div className="menu__body-inner boxmenu__body-inner" dangerouslySetInnerHTML={{ __html: compile(pageBody || body) }} /> | ||
</div> | ||
} | ||
|
||
{instruction && | ||
<div className="menu__instruction boxmenu__instruction"> | ||
<div className="menu__instruction-inner boxmenu__instruction-inner" dangerouslySetInnerHTML={{ __html: compile(instruction) }}/> | ||
</div> | ||
} | ||
|
||
</div> | ||
|
||
</div> | ||
</div> | ||
} | ||
|
||
<div className="menu__item-container boxmenu__item-container"> | ||
<div | ||
className={classes([ | ||
'menu__item-container-inner', | ||
'boxmenu__item-container-inner', | ||
'js-children' | ||
])} | ||
role="list" | ||
> | ||
{/* Menu items render here */} | ||
</div> | ||
</div> | ||
|
||
</div> | ||
); | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.