Closed nuclearsandwich closed 11 years ago
I like this idea, but why don't we take it a step further and add a "Download All" button next to the file header.
That will download a zipped copy of all the problem files and the markdown problem definition.
Here is a quick mock of how I would expect it to look:
If that sounds like a bit more then you signed up for then we can split this off into another ticket and you can just work on the basic feature you described above. Again great idea and thanks for chipping-in :sparkles:
Yeah, I think I can make that happen. :) I might need some help with the HTML templating more than anything else, I'll post back here when I've started and I'll lurk in #rmu on freenode while developing. Again, aiming to do this after Railsbridge Saturday night.
Quick update. I'm actually going to finish two puzzles for an RMU application before I start on this. Still hoping to get to it this weekend but given my other obligations it probably won't happen. I'll post back when I've gotten the application completed and give a new ETA, sorry!
I'm actually going to finish two puzzles for an RMU application before I start on this.
No worries. When you are ready to start working on this just let me know and I will assign it to you. Good luck on your entrance exam!
I had a couple of hours today so I had a go at this. I ended up writing/overwriting a puzzle markdown file to /public/puzzles on each save of the Puzzle model. Posting this in case anyone wants to provide feedback or work on it further. My fork: https://github.com/brentvatne/puzzlenode
Todo:
Problem statement part is done, all that's left now is zipping. Any preference on the route? I was thinking /puzzles/(:id).zip
Also, should I generate a new zip after each change to the puzzle, or dynamically build it on each request?
https://github.com/brentvatne/puzzlenode/tree/download_all_button
Hi @brentvatne thanks for working on this. Send over a pull request and we'll discuss the code over there. Here are some initial answers to your questions:
Yes, /puzzles/(:id).zip
is probably the best route. Ideally the puzzle show
route would use something nicer than the database id, but that is a different problem.
Also, should I generate a new zip after each change to the puzzle, or dynamically build it on each request?
Once puzzles are published we vary rarely make changes, so let's write the zip file after the puzzle is updated and not build it dynamically on each download request.
Once you send over that pull request I'll look through your code and provide feedback there. Thanks again for working on this!
On hold until issue #58 is resolved
It'd be nice to be able to download the problem statement in markdown format along with the other files related to a puzzle.
Why? I like to code on the train a lot, which means I don't always have the internet handy. I presently just save an html copy of the puzzle statement directly in my local repository for the puzzle, but the HTML format doesn't read easily in Vim and I would love to keep the problem at hand for quick look-ups from within my editor.
If this sounds like a good idea, I will be happy to fork and put together a pull request, I probably wouldn't get to it until this weekend though.