Picture of Dean Wilson
Buttons with custom URLs
by Dean Wilson - Thursday, 1 September 2016, 4:54 PM
 

Hi all

Does anyone have an example of creating buttons to work with customised urls that can take the user anywhere in the course? 

Ideally I'd like to have a 'back' button feature at the top of my article page. But anywhere on the page will suffice. 

To see an example or to learn how someone has managed it would be really helpful.

 

Regards

Dean

Picture of Helen Bailey
Re: Buttons with custom URLs
by Helen Bailey - Friday, 2 September 2016, 9:26 AM
 

Hi Dean,

Yes I do!

The way I did it was to create my own button class and define it in my theme, then do the following.

Have a text component and in it go to the source of the text editor and type the following :

<div class="{yourclassname}">
<style="{anystylinghereifneeded}"><a href="#/id/{pageidhere}">Buttontextgoeshere</a></div>
 
To get your page id you need to navigate to the page you want and then copy the ID at the end of the URL thus as in the highlighted picture. You get a button like the one seen in the second image, but your class will determine how it looks.
 
Example for the one attached :
 
<div class="next-button">
<style="text-align:center"><a href="#/id/56a241d6d2aff14813c43196">Where to find support &gt;</a></div>
<p style="text-align:center"><em>The University support network</em></p>
 
Hope that helps! Give me a PM if you need more help.
 
 


Picture of Dean Wilson
Re: Buttons with custom URLs
by Dean Wilson - Friday, 2 September 2016, 12:05 PM
 

Brilliant, thank you Helen!

Picture of Helen Bailey
Re: Buttons with custom URLs
by Helen Bailey - Friday, 2 September 2016, 9:55 AM
 

I also incorporated a back button into my top bar. That was more complex but happy to try and remember if you really want it :)

Picture of Dean Wilson
Re: Buttons with custom URLs
by Dean Wilson - Friday, 2 September 2016, 12:04 PM
 

That actually would be super helpful to know how you did in the top bar.

But what you've provided here is already very helpful. 

Thanks
Dean

Picture of Helen Bailey
Re: Buttons with custom URLs
by Helen Bailey - Friday, 2 September 2016, 3:24 PM
 

OK thinking about it there already is a back button in courses - top left, but it only takes you to the menu. What I implicated was a Home button that takes you to the menu, and the back button now goes back a page rather than to the menu. Hmmmmm

I think what happened is that when I integrated those buttons above into the course, when you click the existing Back Button (<) it doesn't take you to the menu it takes you to where you came from. Does that make sense?

So what you need to do is to decide if that's good enough for you or if you need to incorporate a Menu/Home button too.

 


Picture of Dean Wilson
Re: Buttons with custom URLs
by Dean Wilson - Friday, 2 September 2016, 9:42 PM
 

That's interesting because my course doesn't come with a back button (with the home icon that you showed there). And that actually would suffice. 

I'm using the framework rather than the authoring tool... don't know if that changes anything? 

Picture of Oliver Foster
Re: Buttons with custom URLs
by Oliver Foster - Monday, 5 September 2016, 8:30 AM
 

edit your src/theme/adapt-contrib-vanilla/templates/navigation.hbs and add the following line:

 

<button class="base navigation-home-button icon icon-home" data-event="homeButton" role="button" aria-label="{{_globals._accessibility._ariaLabels.home}}"></button>

 

 

Picture of Helen Bailey
Re: Buttons with custom URLs
by Helen Bailey - Monday, 5 September 2016, 9:23 AM
 

It doesn't change anything no. When you get to your menu and go into a page surely it gives you a back button to go back to the menu?!?!