dbnschools / moodle-theme_fordson

Theme for Moodle 3.3+
43 stars 40 forks source link

possible blockslider alterations #95

Closed mnods closed 4 years ago

mnods commented 4 years ago

Not really issues exactly but thought i'd share what we're proposing to alter locally:

when scrolled down a course page, blockslider clicked, we altered to scroll to top of page so it isn't "hidden":

added $(window).scrollTop(0);

added a heading to the block slider (in template) to better indicate that it's a panel - some people seemed to get confused and this was a way to indicate what this panel is.

we often have many blocks that shove the bottom of the slider down the page, so the close button is not obvious, so we removed the close button at the bottom and added some lines to the js to switch the text on the button to "close" to hopefully better indicate that it can/should be closed.

added if (blockslideropen == 1) { localStorage.setItem('blockslideropen', 0); $('.blockbtntext').text("EXTRA RESOURCES"); } else { localStorage.setItem('blockslideropen', 1);
$('.blockbtntext').text("CLOSE");
}

blockslider open on a course, navigate to another page eg dashboard and then return to the course, the blockslider is open. This confused people, so we added to the top of the js:

$(document).ready(function() { $('#blockslider').removeClass('show'); localStorage.setItem('blockslideropen', 0); });

i'm sure there's a better way to do all this but these are things we've observed as people use the theme as we've set it up.

Cheers

dbnschools commented 4 years ago

This is interesting. I will need to take a look at this functionality. I am assuming you added this to the blockslider.js? Can you copy a completed js file?

In trying this out I have an issue when adding new blocks - the drawer closes each page refresh which means you have to open it up each time and scroll down to add a new block.

mnods commented 4 years ago

hi, yes, added to blockslider.js, didn't add anything but what i mentioned above.


$(document).ready(function() { $('#blockslider').removeClass('show'); localStorage.setItem('blockslideropen', 0); }); $('.blockpanelbutton').click(function(){ var blockslideropen = localStorage.getItem('blockslideropen'); $(window).scrollTop(0);
if (blockslideropen == 1) { localStorage.setItem('blockslideropen', 0); $('.blockbtntext').text("EXTRA RESOURCES"); } else { localStorage.setItem('blockslideropen', 1); $('.blockbtntext').text("CLOSE");
}

});

if (localStorage.getItem('blockslideropen') == 1) { $('#blockslider').addClass('show'); }


yes that is true, would be better in that scenario to not fire close, but we thought generally better for non-editing users. It's also not that great if you click the button before the page loads, so would be better with a more robust solution, if it makes sense to change.