-
Notifications
You must be signed in to change notification settings - Fork 3
Hours system
Library hours are imported from an external Google Spreadsheet, and loaded asynchronously on the relevant pages via data attributes and a small Tabletop implementation. This page describes how this system operates.
Dependencies
Google Spreadsheets Those who maintain the library hours information use a Google Spreadsheet. (I'm not sure who needs this URL?)
Harvester Because of latency and caching issues with Google Spreadsheets, we have a separate harvester that pulls the Google Spreadsheet and stores its contents locally on the webserver. That harvester has its own GitHub repository at https://github.com/mitlibraries/libhours-buildjson . This harvester is run as needed after the spreadsheet is updated, and stores its output at /app/libhours-buildjson on the relevant webserver.
Loader The harvested cache is loaded into WordPress via a second external app, which makes use of Tabletop, Moment and Underscore. This loader also has its own GitHub repository, located at https://github.com/szendeh/libhours. This proof-of-concept has been integrated into this WordPress theme, however.
Integration Calling the loader is a matter of issuing the call to Tabletop, in the format of:
Tabletop.init({
// key is generated by Google doc
key: '1hK_4p-jx7dxW3RViRcBDSF_4En2QGgxx-Zy7zXkNIQg',
// location of hard-coded json files (not sure where they'll be stored yet)
proxy: "/app/libhours-buildjson/",
// function to call when the data is retrieved
callback: loadHoursSingle,
simpleSheet: false
});
The callback function then receives the JSON object returned by the loader, and injects it into the relevant portions of each page.
Pages displaying hours information
Hours page http://libraries.mit.edu/hours/
The master grid of hours is the place where all hours-related information is displayed - across all locations, for any date for which hours have been assigned.
Front page http://libraries.mit.edu/
The website front page displays today's library hours for a few key locations such as the Hayden, Barker, and Rotch libraries.
Location pages, e.g. Barker Library http://libraries.mit.edu/barker/
The page for location across the MIT Libraries displays today's hours for that location.
Study spaces http://libraries.mit.edu/study/
Library locations that have study spaces are aggregated on the study spaces page, which displays today's hours for that set of locations.
Non-technical documentation
The information on this page has been written for technical audiences. An overview of the process that is less technical in nature can be found at https://wikis.mit.edu/confluence/display/UXWS/Hours