Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
A reference implementation of Popolo as a Rails engine
CSS Ruby HTML
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
app
bin
config
lib
spec
.gitignore
.rspec
.travis.yml
.yardopts
Gemfile
Guardfile
LICENSE
README.md
Rakefile
popolo.gemspec

README.md

Popolo Rails Engine

If you are looking for the GitHub repository for the data specification, head over to the popolo-spec repository.

Gem Version Build Status Dependency Status Coverage Status Code Climate

Popolo's goal is to make it easier for civic developers to create government transparency, monitoring and engagement websites.

Popolo is a Ruby on Rails engine that provides additional functionality to a Ruby on Rails application, so that developers can focus on what's special about the governments they want to monitor, instead of re-implementing features commonly found in open government websites. The core Popolo engine provides basic models, controllers and views for the objects found in all open government websites – people, organizations and the relationships between the two. Other engines provide additional functionality.

In addition to being a Rails engine, Popolo is also a data specification. This engine is up-to-date with its 2014-12-21 version, except for the updates:

  • 2014-12-14: Add a video property to the Speech class.
  • 2014-11-23: Add a Speech class.
  • 2014-05-09: Add a member property to the Membership class, to relate organizations to organizations.

Getting Started

Popolo uses Mongoid to connect to MongoDB.

First, create your Rails application:

rails new myapp --skip-active-record

Add the popolo gem to your Gemfile and bundle your dependencies:

gem 'popolo'
bundle

If you didn't run rails new with the --skip-active-record option, follow Mongoid's installation instructions. Otherwise:

rails generate mongoid:config

Finally, run the popolo generator and create the MongoDB indexes:

rails generate popolo
bundle exec rake db:mongoid:create_indexes

If you would like to use the free Lumen Bootstrap theme, add the following line to your application's application.css file:

*= require popolo

Internationalization

If you are using Popolo's default views, you can translate your contact detail types and organization classifications by creating a locale file, e.g. config/locales/en.yml:

en:
  popolo:
    contact_details:
      types:
        cell: Mobile number
    organizations:
      classifications:
        party:
          one: Political party
          other: Political parties

You may translate model names like:

en:
  mongoid:
    models:
      popolo/membership:
        one: Membership
        other: Memberships

The sources property reuses the Link model. To translate this word:

en:
  popolo:
    popolo/source:
      one: Source
      other: Sources

Deployment

A Popolo app is easy to deploy on Heroku using either the MongoLab or MongoHQ add-ons.

  1. Sign up for Heroku if you don't already have an account, and install the Heroku Toolbelt.

  2. Create a new Cedar app on Heroku with either MongoLab or MongoHQ:

    heroku apps:create -s cedar --addons mongolab:starter
    # OR
    heroku apps:create -s cedar --addons mongohq:sandbox
  3. If this is your first time using Heroku, read its guide, Getting Started with Rails 3.x on Heroku, for next steps.

We highly recommend using the Unicorn Rack HTTP server. This blog post has great instructions. You can remove the before_fork and after_fork blocks from your config/unicorn.rb because Mongoid will automatically reconnect after forks.

Copyright (c) 2015 James McKinney, released under the MIT license

Something went wrong with that request. Please try again.