Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Use the state face gem to display the states

  • Loading branch information...
commit 893226a0ad29b96bb77a9d8196aea1f379c647c8 1 parent 090f69e
@ryanatwork ryanatwork authored
View
1  Gemfile
@@ -14,6 +14,7 @@ gem 'prawn'
gem 'prawn-fillform'
gem 'rails_admin', '~> 0.0.5'
gem 'simple_form'
+gem 'stateface-rails'
# Gems used only for assets and not required
# in production environments by default.
View
2  Gemfile.lock
@@ -193,6 +193,7 @@ GEM
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
sqlite3 (1.3.6)
+ stateface-rails (0.0.9)
therubyracer (0.10.1)
libv8 (~> 3.3.10)
thor (0.15.4)
@@ -238,6 +239,7 @@ DEPENDENCIES
simple_form
simplecov
sqlite3
+ stateface-rails
therubyracer
twitter-bootstrap-rails
uglifier (>= 1.0.3)
View
1  app/assets/stylesheets/application.css
@@ -1,3 +1,4 @@
/*
+ *= require propublica/stateface
*= require_tree .
*/
View
55 app/assets/stylesheets/state_face.css.less
@@ -0,0 +1,55 @@
+.propublica-stateface {
+ font-family: StateFace;
+ font-weight: normal;
+ font-style: normal;
+ color: #9C9A9B;
+}
+
+.stateface {
+ margin-right: 5px;
+ text-transform: none;
+}
+
+.stateface_chart {
+ border:0;
+ color: #333;
+ font-size: 9em;
+ margin: 0;
+ padding: 0;
+ text-align: center;
+ text-transform: none;
+}
+
+.stateface_chart a {
+ text-decoration: none;
+}
+
+.state_tile {
+ background:transparent;
+ border: 1px transparent solid;
+ float:left;
+ margin:5px 0px;
+ padding: 10px 5px;
+ width:180px;
+ text-align: center;
+}
+
+.state_tile:hover {
+ background-color: #EDEDED;
+ border: 1px solid #eee;
+ border: 1px solid rgba(0, 0, 0, 0.05);
+ -webkit-border-radius: 4px;
+ -moz-border-radius: 4px;
+ border-radius: 4px;
+ -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05);
+ -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05);
+ box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05);
+ cursor: pointer;
+}
+
+.state_tile p {
+ text-align: center;
+ margin: 0;
+ padding: 0;
+}
+
View
5 app/controllers/register_controller.rb
@@ -1,9 +1,6 @@
class RegisterController < ApplicationController
def index
- unless params[:state].blank?
- redirect_to register_new_path(params[:state])
- end
-
+ @states = Guidelines.select("name, state")
end
def new
View
27 app/views/guidelines/index.html.erb
@@ -3,25 +3,12 @@
</div>
<p>Choose a state below to see specific voter registration guidelines.</p>
<div class="row">
- <div class="span4">
- <ul>
- <% @states[0..16].each do |state| %>
- <li><%= link_to state.name, guideline_path(state.state) %></li>
- <% end %>
- </ul>
- </div>
- <div class="span4">
- <ul>
- <% @states[17..33].each do |state| %>
- <li><%= link_to state.name, guideline_path(state.state) %></li>
- <% end %>
- </ul>
- </div>
- <div class="span4">
- <ul>
- <% @states[34..50].each do |state| %>
- <li><%= link_to state.name, guideline_path(state.state) %></li>
- <% end %>
- </ul>
+ <div class="span12">
+ <% @states.each do |state| %>
+ <div class="state_tile">
+ <h2 class="stateface_chart"><%=link_to stateface_tag(state.state), guideline_path(state.state) %></h2>
+ <p><%= link_to state.name, guideline_path(state.state) %></p>
+ </div>
+ <% end %>
</div>
</div>
View
11 app/views/register/index.html.erb
@@ -2,11 +2,12 @@
<h1>Register to Vote</h1>
</div>
<div class="row">
- <div class="span11">
- <%= form_tag(register_index_path, :method => "GET", :class => "well form-inline") do %>
- <%= label_tag 'Select a state' %>
- <%= select_tag("state", options_for_select(Guidelines.all.collect {|s| [ s.name, s.state ] })) %>
- <%= submit_tag 'Go', :class=> "btn btn-primary" %>
+ <div class="span12">
+ <% @states.each do |state| %>
+ <div class="state_tile">
+ <h2 class="stateface_chart"><%=link_to stateface_tag(state.state), register_new_path(state.state) %></h2>
+ <p><%= link_to state.name, register_new_path(state.state) %></p>
+ </div>
<% end %>
</div>
</div>
View
5 spec/controllers/register_controller_spec.rb
@@ -12,11 +12,6 @@
get 'index'
response.should be_success
end
-
- it "should redirect to registration form for the state" do
- get :index, :state => "CA"
- response.should redirect_to register_new_path("CA")
- end
end
describe "GET 'new'" do
Please sign in to comment.
Something went wrong with that request. Please try again.