Picture of aaron quinn
adapt-contrib-drawerPageNavigation
by aaron quinn - Friday, 24 February 2017, 5:26 PM
 

first off, this plugin is great (thanks for making and sharing it). having a table of contents is pretty important for the projects i work on. but i have a couple of improvements for anyone using it.

 

to prevent an item from appearing in the drawer if it is unavailable, modify the template:

{{#each resources}}
    {{#if _isAvailable}}

        //drawer item stuff here

    {{/if}}
{{/each}}

 

to prevent disappearing items and a flicker when selecting an item, modify the drawerPageNavigationView.js in the function onContentObjectMenuClicked::

//to prevent any "flicker" and drawer content disappearing before drawer is closed
//put navigate code inside the "once"

Adapt.once('drawer:closed', function() {

    Backbone.history.navigate('#/id/' + $(event.currentTarget).data("href"), {trigger: true});

});
Adapt.trigger('drawer:closeDrawer');

 

also, i notice the Authoring Tool reorders the contentObjects.json when using submenus, resulting in the items being out-of-sequence when displayed in the drawer. this can be remedied by manually reordering the contentObjects.json using some sort of code editor after you download the course.

Picture of Matt Leathes
Re: adapt-contrib-drawerPageNavigation
by Matt Leathes - Friday, 24 February 2017, 6:23 PM
 

Very useful info - worth doing a PR of these changes to the repository to see if the repo owner (the Open Data Institute) will pull those changes in for the benefit of all.

Plus then you'll have contributed to a plugin that's used by an organisation headed up by the mighty Sir Tim Berners-Lee... All hail Sir Tim!

Picture of aaron quinn
Re: adapt-contrib-drawerPageNavigation
by aaron quinn - Friday, 24 February 2017, 6:51 PM
 

thanks. i'd be happy to add a pull request once i understand how to do it. i clicked on the pull request button on the repo and then froze like a deer in headlights. lol.

however, i did add the code snippets to the issues page earlier today - but since most people probably won't read those, i decided to put the code here, too :)

Picture of Matt Leathes
Re: adapt-contrib-drawerPageNavigation
by Matt Leathes - Friday, 24 February 2017, 9:13 PM
 

Because you're only making small amends you should be able to do it all through the Github interface. You'll just need to set up a Github account first.

Once you've done that you actually want to get your own copy of the adapt-contrib-drawerPageNavigation repository. Your copy is known as a 'fork'. Click the fork button in the top-right of the repository to fork it to your account.

Once you've done that, Github will take you to your copy of the repository.

At this point, you can either edit the files within Github or, if you already have copies of the files with the modifications you want in place, you can just upload via drag and drop.

If you want to edit via Github, just browse to the file, click on it to open it, then click the edit icon in the top right.

When you're done editing, scroll to the bottom, enter a comment explaining what you've done and, if your change relates to a specific issue, put the issue number in in this style: "fixes issue #10" - the word 'fixes' should trigger the issue to be closed automatically when the PR is accepted & merged.

Then click 'commit changes' (it's fine to commit to the master branch here since it's your own copy).

Now change any other files you need to change.

Once you're happy with your changes, go back to the repository's main screen and click New Pull Request.

This should automatically figure out that you want to send your changes back to the original repository and will show you what changes you have made.

Enter a good summary and description of what you've done - see the link I posted earlier for some tips on this.

When you're done, submit your pull request.

If you need to make any further changes just edit your copy of the files, the PR will automatically get updated.

If you get stuck, don't worry - jump on the Gitter chat next week and we'll help you out.

Picture of aaron quinn
Re: adapt-contrib-drawerPageNavigation
by aaron quinn - Friday, 24 February 2017, 9:58 PM
 

thanks a lot, matt. these are very helpful instructions.

+100

Picture of aaron quinn
Re: adapt-contrib-drawerPageNavigation
by aaron quinn - Tuesday, 28 February 2017, 6:59 AM
 

pull request submitted :)