the little things

I’m trying to really polish off the edges and provide a slick interface in our Blacklight implementation, to contrast with the very hacky legacy OPAC.

Applied to the display of your items out with due dates… In a display of due dates, the user has to do some arithmatic to figure out how far away a given date is. What they really care about is, is this tomorrow? In a week? In a month?

So why not display it to them?  There’s a nice Rails helper to calculate human readable time deltas, although I customized it just a bit to handle the fact that some of our due dates have specific times attached (like for reserves; I use a ruby Time object), and others are just dates with no time, before close of business (I use ruby Date object). The built-in method alone works with Dates, but doesn’t always do the most sensible thing with them for this case.

 # handle both Date's without a time, and Time's with hour/minute/second
 # appropriately. 
 def relative_due_date(date_or_time)
    if date_or_time.kind_of?(Time)
       distance_of_time_in_words( Time.now, date_or_time)
    elsif date_or_time == Date.today
       "today"
    elsif (date_or_time == (Date.today + 1))
       "tomorrow"
    else
       distance_of_time_in_words( Date.today, date_or_time)
    end
 end

A screenshot.

There are other corners that it wasn’t really feasible to polish off based on the functionality and business rules of the underlying ILS.   Like if the item isn’t renewable, I’d rather now show a renew button at all, instead showing the reason it’s not renewable. But the underlying ILS doesn’t really support that, you have to click ‘renew’ first, and then (maybe, sometimes) get a reason if it wasn’t renewable. So I polished off what I could within reasonable constraints — like at least in this interface if you choose ‘renew all’, it specifically marks which items were renewed and which weren’t, instead of the legacy OPAC that just let you look at the new due dates without telling you if they were actually new or the same old ones due to not being renewable. Oh well.

About these ads
This entry was posted in General. Bookmark the permalink.

One Response to the little things

  1. Liz Mengel says:

    Wow, really cool Jonathan

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s