RunestoneInteractive / RunestoneComponents

Packaging of the Runestone tools for publishing educational materials using github pages
http://runestoneinteractive.org
Other
101 stars 225 forks source link

Footer replaced entirely by "user not logged in" when self-hosting book #1190

Closed schellenberg closed 3 years ago

schellenberg commented 3 years ago

Please check the current issues Many bug reports are duplicates, this just creates more work for us. Searching the issues first may give you your answer or a workaround! If not adding new information to an existing report is much more helpful than a new report.

What Course are you in Custom made course

What Page were you on n/a

What is your username n/a

Describe the bug A clear and concise description of what what you were trying to accomplish and what went wrong. Vague statements like X does not work are not helpful. Imagine if one of your students sent you an email that said, "My program doesn't work, whats wrong with it?" Could you help them with only that to go on?

If someone (like me) is using Runestone to build their own custom book (and just hosting the static site on GitHub pages), there isn't any need for students to log in. This used to work just fine, and mostly still does, but with one significant drawback. I had customized the HTML for the footer (in the HTML templates) to allow me to show the Creative Commons license, etc, but if I rebuild the site with an updated version of Runestone Components, the footer is replaced by a "user not logged in" text. I've tracked this down to line 254 from bookfuncs.js, which is:

$(".footer").html("user not logged in");

A suggested solution would be to respect the login_required argument given in the pavement.py file. If login_required is set to false, we shouldn't replace the footer with a "user not logged in" message. I haven't looked into this to see how easy/hard that would be, and my hacky solution right now (just so I can publish an update to my custom book) is to just delete $(".footer").html("user not logged in"); from the compiled version of runestone.js in my build. Although that works, it's a sub-optimal solution.

Traceback If you got here through the Bug Report page and there was a stack trace, please paste it here

Javascript Errors Many many errors can be quickly diagnosed from the Javascript Console error log. On Chrome this is View --> Developer --> Javascript Console, on Safari ⌥⌘i or Develop --> Show Web Inspector on Firefox Tools --> Web Developer --> Toggle Tools

bnmnetp commented 3 years ago

Do you have use_services set to false in your github hosted book?

That would be another possible guard to check eBookConfig.useRunestoneServices. If that is false then do not add the message. Feel free to submit a PR 😄

Thanks for keeping us honest. To be truthful more and more new features that are coming rely on a server. So this is a use case that is less and less top of mind. Thats not to say this use case is not important anymore just that more of what we do is using more data on the server side.

schellenberg commented 3 years ago

Yes, I also have use_services set to false.

I get that this is an edge case. I started using Runestone 4 years ago to create a high school CS1-ish textbook, and one of the requirements by the division was that there could be no login required. While this does have limitations (obviously no saved code from session to session), it also makes it incredibly simple to keep a site going for free via GitHub Pages.

I took a quick peek, and it looks like a one-liner fix (just an if statement confirming that use_services is true before altering the footer). PR submitted.

bnmnetp commented 3 years ago

I totally understand that. You would not believe how many high schools send me 20 page contracts that I am supposed sign as a "Vendor". I'm 100% committed to student privacy but something things they want are just crazy. Assuming I can even wade through the legalese in the first place.

I have a version of each of our books that does not require a login on Runestone Academy, but maybe a version with no-login allowed would be even better.

Thanks for the PR.