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

New: Introduce Menus as Pages #366

Closed
wants to merge 4 commits into from
Closed

New: Introduce Menus as Pages #366

wants to merge 4 commits into from

Conversation

oliverfoster
Copy link
Member

@oliverfoster oliverfoster commented Apr 30, 2023

fixes #365

With config.json:_isPageMenu = true, menus may have articles, blocks and components, menus are rendered as pages. Use ComponentMenuView and ComponentMenuModel as the basis for menu components, which will inherit the children and therefore completion from the nearest contentobject and render the contentobject's children by default.

New

  • Added ComponentMenuView to render child views by default
  • Added ComponentMenuModel to inherit the children and therefore completion, from its immediate contentobject ancestor
  • Added config.json:_isPageMenu to register PageView for course and menu _type.
  • Restricted AdaptView so that a default page doesn't render child contentobject types
  • Updated getAllDescendantModels to take a filter argument as part of an options object

Testing

  • Install https://github.com/cgkineo/adapt-contrib-menuBox
  • Remove default menu
  • Add config.json:_isPageMenu = true
  • Add course.json:_pageLevelProgress._showAtCourseLevel = true
  • Add an article with a _parentId = "course", along with a block and a component, which should have _component = "menuBox"
  • Add any other articles, blocks and components to the course page

Or use the following zip, extract and run npm install then build as usual:
test.zip

Todo

pagemenus

@StuartNicholls
Copy link
Contributor

I have actually started work on a page header / hero plug-in, will add some layouts we've mapped out on the issue #2703

@oliverfoster oliverfoster force-pushed the issue/365 branch 2 times, most recently from ae17c2c to 461aeb5 Compare May 4, 2023 16:25
@kirsty-hames
Copy link
Contributor

kirsty-hames commented May 9, 2023

This works great thanks @oliverfoster. I have some queries/issues if you could take a look please...

  1. When _isPageMenu = true, the PLP drawer only displays contentObject items, none of the standard components show as items. Is this expected? For page views, both contentObjects and components display as items in the drawer.

  2. When using the menuBox component as a sub menu, you get a duplicate PLP entry: a child item of course and a child item of the parent contentObject (See screenshot: Page test topic is displaying as a course child in the PLP but this should only be available via Question components topic).

duplicate_plp_entry

@oliverfoster
Copy link
Member Author

oliverfoster commented May 9, 2023

This works great thanks @oliverfoster. I have some queries/issues if you could take a look please...

  1. When _isPageMenu = true, the PLP drawer only displays contentObject items, none of the standard components show as items. Is this expected? For page views, both contentObjects and components display as items in the drawer.
  2. [...]

Verified, need to tweak plp to get it to work properly.

@oliverfoster
Copy link
Member Author

Aria-levels are off by one for components and group sub items.

@oliverfoster
Copy link
Member Author

oliverfoster commented Jun 12, 2023

The confusing part about this is that the children of the Page Menu don't run in render order.

Ideally:

Parent Name Child name
Page Menu Article 1
SubPage 1
Article 2
SubPage 2
Article 3
SubPage 3

Whereas because articles live in article.json and pages live in contentObjects.json and the Page Menu can live in course.json, we have the children of the Page Menu children split over two separate files and their order isn't reflective of the render order.

course.json contentObject.json articles.json
Page Menu SubPage 1 Article 1
SubPage 2 Article 2
SubPage 3 Article 3

Currently:

Parent Name Child name Block Component Content Object
Page Menu Article 1 Block 1 Component 1 n/a
Article 2 Block 2 Component 2 Sub Page 1
Article 2 Block 2 Component 2 Sub Page 2
Article 2 Block 2 Component 2 Sub Page 3
Article 3 Block 3 Component 3 n/a

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow articles blocks and components on menus
3 participants