Docs Decomposer Weekend 2

February 23rd, 2015  |  Published in ruby

Last week I left off with a gnawing sense of unhappiness because the flagging buttons weren’t dynamic: When Rails dropped Prototype.js, it dropped pretty much all the stuff I knew about AJAX and Rails. I could have left well enough alone, but it bothered me; and we’re doing this in the name of (re)learning.

I had fun working on it. Last weekend’s time involved a lot of re-orientation on the basics. This week felt pretty fluid as stuff I’d forgotten came back, and as I got used to a few of the tweaks I added to Emacs last week (including flymake and Projectile).

In the process of rewriting the flagging code into something a little easier to work with, I learned about acts_as_votable, and that encouraged me to just toss the flagging code I’d written altogether. Yay, cargo culting. That didn’t make the dynamic flagging button situation any better, but it did make a few other features fall down much more quickly.

So this weekend I added:

  • Flag status indicators to the page lists. You can tell if you’re the one who flagged the page, and if someone else also flagged it along with
  • A toggle to hide all the unflagged pages
  • A little list of who flagged a page on the page itself, along with next/previous buttons for each page, to make it easier to run through review without going back and forth to the master page list:

Next up, I guess, is commenting. I was hoping to get to it this weekend, but once I had acts_as_votable in place, it was a lot easier to run through a bunch of flag-related things and implement them, and I was ready for some easy stuff once I’d finally managed to make the flagging buttons dynamic.

Once I’ve got commenting in place, it’ll be time to go back through and do a lot of housekeeping. I’ve got view code that probably ought to go into partials, controllers that could probably stand to have some logic moved out into the models, and a lot of code that … well … it’s optimistic is what it is!

After that?

The thing I keep thinking about and sketching out is how being able to flag a given element on a page might work. One of the reasons I decided to just import HTML straight into the app was that it gave me access to the markup. For instance, once you find and checksum an ordered list, it’s pretty easy to wrap it in a div and give it an i.d. At that point, it can be targeted for flagging widgets and such.

Dunno. Bedtime.

Leave a Response

© Michael Hall, licensed under a Creative Commons Attribution-ShareAlike 3.0 United States license.