Picture of Adam Laird
One page course/component on front page
by Adam Laird - Thursday, 6 March 2014, 1:42 PM
 

I had a try to see if I could make a course with just one page i.e. no menu and the articles are children of course.json but did not work.

Is this possible?

Can you add components to the start page i.e an intro video?

For a few of our case report style learning material a trickle one page module would be ideal missing out the front page as a single article block on the front page looks a bit silly especially when it is left aligned and not centre

Picture of Kev Adsett
Re: One page course/component on front page
by Kev Adsett - Friday, 7 March 2014, 9:57 AM
 

Hi Adam,

What you describe does sound possible but as I understand it, you still need to have a page as the child of course, and append your articles to the page, rather than directly to the course.

Picture of Adam Laird
Re: One page course/component on front page
by Adam Laird - Friday, 7 March 2014, 11:35 AM
 

Thanks Kev,

If you just put a single page in contentObjects it shows as a single block menu so not sure how you mean it is possible?

Picture of Daryl Hedley
Re: One page course/component on front page
by Daryl Hedley - Friday, 7 March 2014, 11:46 AM
 

Hey Adam,

Like Kev said, the structure of the course does rely on having this structure:

course

    => contentObjects

        => articles

            => blocks

                => components

But this is not to say that you can't have a one page course that routes straight there. We don't give access to the router directly (we believe the router has a primary role of routing between pages and menus) but you can route to a one page course by doing the following.

Go into the menu folder and open up your JS file. In here you can tap into Adapt's event system. Remove everything under the variable declaration and put this:

 

Adapt.on('router:menu', function(model) {

    // Listen to when Adapt hits a menu and navigate to a page. Make sure the string here is the page ID you're trying to route too.

    var newRouteId = 'co-05'

    Backbone.history.navigate('#/id/' + newRouteId, true);

});

Adapt.on('router:page', function(model) {

    // Hide the navigation back button. _.defer makes show everything is rendered before hiding.

    _.defer(function() {
        $('.navigation-back-button').addClass('display-none');
    });

});

 

As a vibrant member of the community - would you mind creating a new menu plugin and registering it in the community registry? It's a great way to contribute back to the community. Instructions on how to do this are here:

https://github.com/adaptlearning/adapt_framework/wiki/Developing-plugins

If you need any more help on registering this please contact me.

Thanks and hope this helps,

Daryl

Picture of Chris Jones
Re: One page course/component on front page
by Chris Jones - Friday, 7 March 2014, 12:26 PM
 

This would make an excellent extension.

Then I would probably move the start page value (newRouteId) to configuration.

Creating it as an extension means that it is reuseable and shareable.

Chris

 

 

Picture of Daryl Hedley
Re: One page course/component on front page
by Daryl Hedley - Friday, 7 March 2014, 3:47 PM
 

Hey Chris,

Good idea. We could then remove the Menu completely --- I think! As the Menus work like plugins it would make sense to do this. Only thing you have to remember is to remove the menu - otherwise you will get a collision in callbacks. (As in - who's callback gets called first? If it's the plugins first then the menu will always overwrite it). Makes me think again about using it as a plugin...

Thanks,

Daryl

Picture of Adam Laird
Re: One page course/component on front page
by Adam Laird - Monday, 10 March 2014, 8:21 AM
 

I shall give that a bash early this week

 

Thanks

Picture of Martin Sandberg
Re: One page course/component on front page
by Martin Sandberg - Monday, 10 March 2014, 11:54 AM
 

Thanks for that info....

Was wondering how to do this.  Now I have tested the above code and I get a one-page course.

Will need that for one of my upcoming projects.

 

BR

Martin

 

Picture of Adam Laird
Re: One page course/component on front page
by Adam Laird - Monday, 10 March 2014, 1:03 PM
 

Thanks Daryl

Works as a solution (so far as haven't tested effects on completion and page progress as yet)

had a go at creating https://github.com/adamlaird/adapt-menu-singlePageCourse.git but cant work out how to assign first child _id to the newRouteId.

Best actually learn some javascript ;)