v0.5
Billtrack is a small web application for a reporter (or team) to publish brief updates on changes made to bills in a legislative session. The app consists of:
- A Wordpress plugin (
ipm-billtrack
) that creates a custom hierarchical post type, 'billupdates' - A pair of Wordpress template files (
page-billtrack.php
andpage-bills.php
), usable with any theme, which outputs the bill updates as a Javascript object and the bills as<option>
elements for navigational purposes - A CMS-independent widget (
billtrack-app
) which uses listjs to present the bill updates as a web interactive. The user can browse updates to bills (or sets of bills) by topic or by using the search field.
To get started, first install and activate the WP plugin (ipm-billtrack
/ 'BillTrack backend'). On activation, the custom post type 'billupdates' will be generated. If the post type already exists as a flat post type, it will be converted to a hierarchical post type. Start by creating a new bill post with a title, description in the post body, and two custom fields ('bill_number' and 'bill_topic').
Then, create a few child posts of the bill post to create updates, with a title, description, and tags.
Next, add the files page-billtrack.php
and page-bills.php
to your WP theme, and create two Pages, one called 'Billtrack' and the other called 'Bills'. Wordpress with automatically use the proper page templates if you use matching page-*.php
filenames and page names.
Note that by default, the WP loop is limited to 500 bills and 500 updates for performance reasons. I suggest using a caching mechanism in conjunction with Billtrack.
If everything is working correctly so far and you've published at least one billupdate parent post (a bill) and one billupdate child post (a bill update), you should be able to visit yourWPsiteurl.example/billtrack/ and see a snippet of JS (no, this is not where the interactive itself lives), beginning with a global variable called BillUpdateList, a jQuery handler, and an object with the following data fields:
id
(the WP post ID; not used)bill
(the WP post title)billnum
(the value of the 'bill_number' meta field)topic
(the tags of the WP post)headline
(the title of the WP post)date
(the WP post date)body
(the WP post body)
You should also be able to go to /bills/ and see a simple list of <option>
HTML tags to populate the bill select menu.
The last major step is to upload the billtrack-app folder to a web server with PHP. To hook this part up, edit $billtrackpath
and $billspath
in config.php
to point to your published billtrack WP page's URL and the bills WP page URL, respectively.
Finally, you will also want to change the topics array (also in config.php
) to correspond with what you've filled in the bill_topic meta field of the billupdate parent posts in WP.
A live demo can be found here:
http://indianapublicmedia.org/static/testing/billtrack/
Here's a screenshot of the web interactive.
- rewrite select menu cascade function to not rely on old jquery version for
filter()
- test as an embedded iframe
- implement pagination if necessary/desirable
- perhaps make bill topics select menu manageable from WP?
- a friendlier tab-based interface to select a bill topic?
- Lauren E Chapman, for proof-of-concept and UI improvements
- Claire McInerny & Peter Balonon-Rosen, IPBS News reporters
- Sarah Neal-Estes, Managing editor for IPBS News