Convert views to haml

This commit is contained in:
Erik Michaels-Ober 2011-05-08 01:29:21 -07:00
parent 1528fde5bd
commit bb02f26d3e
33 changed files with 155 additions and 161 deletions

View File

@ -4,6 +4,7 @@ gem 'rails', '3.1.0.beta1'
gem 'coffee-script' gem 'coffee-script'
gem 'devise' gem 'devise'
gem 'geokit' gem 'geokit'
gem 'haml'
gem 'pg' gem 'pg'
gem 'sass' gem 'sass'

View File

@ -49,6 +49,7 @@ GEM
execjs (0.3.3) execjs (0.3.3)
multi_json (~> 1.0) multi_json (~> 1.0)
geokit (1.5.0) geokit (1.5.0)
haml (3.1.1)
hike (1.0.0) hike (1.0.0)
i18n (0.6.0beta1) i18n (0.6.0beta1)
jruby-openssl (0.7.4) jruby-openssl (0.7.4)
@ -110,6 +111,7 @@ DEPENDENCIES
coffee-script coffee-script
devise devise
geokit geokit
haml
jruby-openssl (~> 0.7) jruby-openssl (~> 0.7)
pg pg
rails (= 3.1.0.beta1) rails (= 3.1.0.beta1)

View File

@ -1,6 +1,4 @@
class UsersController < Devise::RegistrationsController class UsersController < Devise::RegistrationsController
respond_to :json, :only => [:create]
def edit def edit
render("edit", :layout => "info_window") render("edit", :layout => "info_window")
end end
@ -18,12 +16,8 @@ class UsersController < Devise::RegistrationsController
def create def create
build_resource build_resource
if resource.save if resource.save
if resource.active? sign_in(resource_name, resource)
sign_in(resource_name, resource) render(:json => resource)
else
expire_session_data_after_sign_in!
end
respond_with resource
else else
clean_up_passwords(resource) clean_up_passwords(resource)
render(:json => {"errors" => resource.errors}) render(:json => {"errors" => resource.errors})

View File

@ -1,6 +0,0 @@
<%= form_for(@hydrant, :html => {:id => "abandon_form"}) do |f| %>
<%= f.hidden_field "id" %>
<%= f.hidden_field "user_id", :value => "" %>
<%= f.hidden_field "name", :value => "" %>
<%= f.submit "Abandon this hydrant" %>
<% end %>

View File

@ -0,0 +1,5 @@
= form_for @hydrant, :html => {:id => "abandon_form"} do |f|
= f.hidden_field "id"
= f.hidden_field "user_id", :value => ""
= f.hidden_field "name", :value => ""
= f.submit "Abandon this hydrant"

View File

@ -1,4 +0,0 @@
<%= form_for(:hydrant, :url => '/hydrant', :html => {:id => "back_form", :method => "get"}) do |f| %>
<%= f.hidden_field "id" %>
<%= f.submit "Back" %>
<% end %>

View File

@ -0,0 +1,3 @@
= form_for :hydrant, :url => '/hydrant', :html => {:id => "back_form", :method => "get"} do |f|
= f.hidden_field "id"
= f.submit "Back"

View File

@ -1,6 +0,0 @@
<%= form_for(@hydrant, :html => {:id => "steal_form"}) do |f| %>
<%= f.hidden_field "id" %>
<%= f.hidden_field "user_id", :value => "" %>
<%= f.hidden_field "name", :value => "" %>
<%= f.submit "Steal this hydrant" %>
<% end %>

View File

@ -0,0 +1,5 @@
= form_for @hydrant, :html => {:id => "steal_form"} do |f|
= f.hidden_field "id"
= f.hidden_field "user_id", :value => ""
= f.hidden_field "name", :value => ""
= f.submit "Steal this hydrant"

View File

@ -1,11 +0,0 @@
<%= form_for(@hydrant, :html => {:id => "adoption_form"}) do |f| %>
<h2>Adopt this Hydrant</h2>
<%= f.hidden_field "id" %>
<%= f.hidden_field "user_id", :value => current_user.id %>
<%= f.label "name", "Give this hydrant a name", :id => "hydrant_name_label" %>
<%= f.text_field "name", :tabindex => 1 %>
<%= f.submit "Adopt!", :tabindex => 2 %>
<p>By adopting this hydrant, you agree to the <%= link_to "Terms of Service", "#", :tabindex => 3 %>.</p>
<% end %>
<%= render(:partial => 'users/edit_profile') %>
<%= render(:partial => 'sessions/sign_out') %>

View File

@ -0,0 +1,13 @@
= form_for @hydrant, :html => {:id => "adoption_form"} do |f|
%h2
Adopt this Hydrant
= f.hidden_field "id"
= f.hidden_field "user_id", :value => current_user.id
= f.label "name", "Give this hydrant a name", :id => "hydrant_name_label"
= f.text_field "name", :tabindex => 1
= f.submit "Adopt!", :tabindex => 2
%p
By adopting this hydrant, you agree to the
= link_to("Terms of Service", "#", :tabindex => 3) + "."
= render :partial => 'users/edit_profile'
= render :partial => 'sessions/sign_out'

View File

@ -1,18 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>Adopt a Hydrant</title>
<%= stylesheet_link_tag "application" %>
<%= javascript_include_tag "http://maps.google.com/maps/api/js?sensor=false" %>
<%= javascript_include_tag "https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js" %>
<%= javascript_include_tag "https://ajax.googleapis.com/ajax/libs/jqueryui/1/jquery-ui.min.js" %>
<%= javascript_include_tag "https://github.com/scottschiller/Snowstorm/raw/master/snowstorm-min.js" %>
<%= javascript_include_tag "application" %>
<%= javascript_include_tag "analytics" %>
<%= csrf_meta_tag %>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
</head>
<body>
<%= yield -%>
</body>
</html>

View File

@ -0,0 +1,16 @@
!!! 5
%html
%head
%title
Adopt a Hydrant
= stylesheet_link_tag "application"
= javascript_include_tag "http://maps.google.com/maps/api/js?sensor=false"
= javascript_include_tag "https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"
= javascript_include_tag "https://ajax.googleapis.com/ajax/libs/jqueryui/1/jquery-ui.min.js"
= javascript_include_tag "https://github.com/scottschiller/Snowstorm/raw/master/snowstorm-min.js"
= javascript_include_tag "application"
= javascript_include_tag "analytics"
= csrf_meta_tag
%meta{:name => "viewport", :content => "initial-scale=1.0, user-scalable=no"}
%body
= yield

View File

@ -1,6 +0,0 @@
<div id="loader" style="display: none;">
<%= image_tag "ajax-loader.gif" %>
</div>
<div id="info_window">
<%= yield %>
</div>

View File

@ -0,0 +1,4 @@
#loader{:style => "display: none;"}
= image_tag "ajax-loader.gif"
#info_window
= yield

View File

@ -1,20 +0,0 @@
<div id="sidebar">
<h1>Adopt a Hydrant</h1>
<p id="tagline">
Claim responsibility for shoveling out a fire hydrant after it snows.
</p>
<%= form_for :address, :html => {:id => "address_form"} do |f| %>
<%= label_tag "city_state", "City", :id => "city_label" %>
<%= select_tag "city_state", '<option value="Boston, MA" selected="selected">Boston, MA</option>'.html_safe, :tabindex => 10 %>
<%= label_tag "address", "Address", :id => "address_label" %>
<%= text_field_tag "address", params[:address], :tabindex => 11 %>
<%= submit_tag "Find fire hydrants", :tabindex => 12 %>
<% end %>
<div id="logos">
<%= image_tag "logos/cfa.png", :alt => "Code for America", :title => "Code for America" %>
<%= image_tag "logos/boston.png", :alt => "City of Boston", :title => "City of Boston" %>
</div>
<%= image_tag "hydrant-in-snow.jpg", :id => "hydrant-in-snow" %>
</div>
<div id="map_canvas">
</div>

View File

@ -0,0 +1,16 @@
#sidebar
%h1
Adopt a Hydrant
%p#tagline
Claim responsibility for shoveling out a fire hydrant after it snows.
= form_for :address, :html => {:id => "address_form"} do |f|
= label_tag "city_state", "City", :id => "city_label"
= select_tag "city_state", '<option value="Boston, MA" selected="selected">Boston, MA</option>'.html_safe, :tabindex => 10
= label_tag "address", "Address", :id => "address_label"
= text_field_tag "address", params[:address], :tabindex => 11
= submit_tag "Find fire hydrants", :tabindex => 12
#logos
= image_tag "logos/cfa.png", :alt => "Code for America", :title => "Code for America"
= image_tag "logos/boston.png", :alt => "City of Boston", :title => "City of Boston"
= image_tag "hydrant-in-snow.jpg", :id => "hydrant-in-snow"
#map_canvas

View File

@ -1,3 +0,0 @@
<%= form_for(:sign_in, :html => {:id => "sign_in_form"}) do |f| %>
<%= f.submit "Sign in" %>
<% end %>

View File

@ -0,0 +1,2 @@
= form_for :sign_in, :html => {:id => "sign_in_form"} do |f|
= f.submit "Sign in"

View File

@ -1,3 +0,0 @@
<%= form_for(:sign_out, :html => {:id => "sign_out_form"}) do |f| %>
<%= f.submit "Sign out" %>
<% end %>

View File

@ -0,0 +1,2 @@
= form_for :sign_out, :html => {:id => "sign_out_form"} do |f|
= f.submit "Sign out"

View File

@ -1,34 +0,0 @@
<%= form_for(:user, :html => {:id => "combo_form"}) do |f| %>
<h2>Adopt this Hydrant</h2>
<div id="common_fields">
<%= f.label "email", "Email address", :id => "user_email_label" %>
<%= f.text_field "email", :tabindex => 1 %>
<%= f.label "new" , radio_button_tag("user", "new", true, :tabindex => 2).html_safe + "I haven't signed up yet" %><br />
<%= f.label "existing", radio_button_tag("user", "existing").html_safe + "I've already signed up" %><br />
</div>
<div id="user_sign_up_fields">
<%= f.label "name", "Name", :id => "user_name_label" %>
<%= f.text_field "name", :tabindex => 3 %>
<%= f.label "organization", "Organization", :id => "user_organization_label" %>
<%= f.text_field "organization", :tabindex => 4 %>
<%= f.label "voice_number", "Phone number", :id => "user_voice_number_label" %>
<%= f.text_field "voice_number", :tabindex => 5 %>
<%= f.label "sms_number", "SMS number", :id => "user_sms_number_label" %>
<%= f.text_field "sms_number", :tabindex => 6 %>
<%= f.label "password_confirmation", "Choose a password", :id => "user_password_confirmation_label" %>
<%= f.password_field "password_confirmation", :tabindex => 7 %>
<%= f.submit "Sign up", :tabindex => 8 %>
<p>By signing up, you agree to the <%= link_to "Terms of Service", "#", :tabindex => 9 %>.</p>
</div>
<div id="user_sign_in_fields" style="display: none;">
<%= f.label "password", "Password", :id => "user_password_label" %>
<%= f.password_field "password", :tabindex => 0 %>
<%= f.label "remember_me", (f.check_box("remember_me", :checked => true, :tabindex => 0).html_safe + "Stay signed in"), :id => "user_remember_me_label" %><br />
<%= f.submit "Sign in", :tabindex => 0 %>
<p><%= link_to "Forgot your password?", "#", :id => "user_forgot_password_link", :tabindex => 0 %></p>
</div>
<div id="user_forgot_password_fields" style="display: none;">
<%= f.submit "Email me my password", :tabindex => 0 %>
<p><%= link_to "Never mind. I remembered my password.", "#", :id => "user_remembered_password", :tabindex => 0 %></p>
</div>
<% end %>

View File

@ -0,0 +1,34 @@
= form_for :user, :html => {:id => "combo_form"} do |f|
%h2
Adopt this Hydrant
#common_fields
= f.label "email", "Email address", :id => "user_email_label"
= f.text_field "email", :tabindex => 1
= f.label "new" , radio_button_tag("user", "new", true, :tabindex => 2).html_safe + "I haven't signed up yet"
= f.label "existing", radio_button_tag("user", "existing").html_safe + "I've already signed up"
#user_sign_up_fields
= f.label "name", "Name", :id => "user_name_label"
= f.text_field "name", :tabindex => 3
= f.label "organization", "Organization", :id => "user_organization_label"
= f.text_field "organization", :tabindex => 4
= f.label "voice_number", "Phone number", :id => "user_voice_number_label"
= f.text_field "voice_number", :tabindex => 5
= f.label "sms_number", "SMS number", :id => "user_sms_number_label"
= f.text_field "sms_number", :tabindex => 6
= f.label "password_confirmation", "Choose a password", :id => "user_password_confirmation_label"
= f.password_field "password_confirmation", :tabindex => 7
= f.submit "Sign up", :tabindex => 8
%p
By signing up, you agree to the
= link_to("Terms of Service", "#", :tabindex => 9) + "."
#user_sign_in_fields{:style => "display: none;"}
= f.label "password", "Password", :id => "user_password_label"
= f.password_field "password", :tabindex => 0
= f.label "remember_me", (f.check_box("remember_me", :checked => true, :tabindex => 0).html_safe + "Stay signed in"), :id => "user_remember_me_label"
= f.submit "Sign in", :tabindex => 0
%p
= link_to "Forgot your password?", "#", :id => "user_forgot_password_link", :tabindex => 0
#user_forgot_password_fields{:style => "display: none;"}
= f.submit "Email me my password", :tabindex => 0
%p
= link_to "Never mind. I remembered my password.", "#", :id => "user_remembered_password", :tabindex => 0

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>http://<%= request.env["HTTP_HOST"] %>/</loc>
</url>
</urlset>

View File

@ -0,0 +1,5 @@
!!! XML
%urlset{:xmlns => "http://www.sitemaps.org/schemas/sitemap/0.9"}
%url
%loc
= "http://#{request.env["HTTP_HOST"]}"

View File

@ -1,3 +0,0 @@
<%= form_for(:user, :url => edit_user_registration_path, :html => {:id => "edit_profile_form", :method => "get"}) do |f| %>
<%= f.submit "Edit profile" %>
<% end %>

View File

@ -0,0 +1,2 @@
= form_for :user, :url => edit_user_registration_path, :html => {:id => "edit_profile_form", :method => "get"} do |f|
= f.submit "Edit profile"

View File

@ -1,20 +0,0 @@
<%= form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => {:id => "edit_form", :method => :put}) do |f| %>
<h2>Edit your Profile</h2>
<%= f.hidden_field "id" %>
<%= f.label "email", "Email address", :id => "user_email_label" %>
<%= f.text_field "email", :tabindex => 1 %>
<%= f.label "name", "Name", :id => "user_name_label" %>
<%= f.text_field "name", :tabindex => 2 %>
<%= f.label "organization", "Organization", :id => "user_organization_label" %>
<%= f.text_field "organization", :tabindex => 3 %>
<%= f.label "voice_number", "Phone number", :id => "user_voice_number_label" %>
<%= f.text_field "voice_number", :tabindex => 4 %>
<%= f.label "sms_number", "SMS number", :id => "user_sms_number_label" %>
<%= f.text_field "sms_number", :tabindex => 5 %>
<%= f.label "password", "New password", :id => "user_password_label" %> <em>(leave blank if you don't want to change it)</em>
<%= f.password_field "password", :tabindex => 6 %>
<%= f.label "current_password", "Current password", :id => "user_current_password_label" %> <em>(we need your current password to confirm your changes)</em>
<%= f.password_field "current_password", :tabindex => 7 %>
<%= f.submit "Update", :tabindex => 8 %>
<% end %>
<%= render(:partial => 'hydrants/back') %>

View File

@ -0,0 +1,24 @@
= form_for resource, :as => resource_name, :url => registration_path(resource_name), :html => {:id => "edit_form", :method => :put} do |f|
%h2
Edit your Profile
= f.hidden_field "id"
= f.label "email", "Email address", :id => "user_email_label"
= f.text_field "email", :tabindex => 1
= f.label "name", "Name", :id => "user_name_label"
= f.text_field "name", :tabindex => 2
= f.label "organization", "Organization", :id => "user_organization_label"
= f.text_field "organization", :tabindex => 3
= f.label "voice_number", "Phone number", :id => "user_voice_number_label"
= f.text_field "voice_number", :tabindex => 4
= f.label "sms_number", "SMS number", :id => "user_sms_number_label"
= f.text_field "sms_number", :tabindex => 5
= f.label "password", "New password", :id => "user_password_label"
%em
(leave blank if you don't want to change it)
= f.password_field "password", :tabindex => 6
= f.label "current_password", "Current password", :id => "user_current_password_label"
%em
(we need your current password to confirm your changes)
= f.password_field "current_password", :tabindex => 7
= f.submit "Update", :tabindex => 8
= render :partial => 'hydrants/back'

View File

@ -1,9 +0,0 @@
<h2><%= @hydrant.name ? @hydrant.name.titleize : "This hydrant" %> has been adopted by <%= @hydrant.user.name %></h2>
<%= @hydrant.user.organization.blank? ? nil : "<h3>of #{@hydrant.user.organization}</h3>".html_safe %>
<% if user_signed_in? %>
<%= render(:partial => 'users/edit_profile') %>
<%= render(:partial => 'hydrants/steal') %>
<%= render(:partial => 'sessions/sign_out') %>
<% else %>
<%= render(:partial => 'sessions/sign_in') %>
<% end %>

View File

@ -0,0 +1,14 @@
%h2
= @hydrant.name ? @hydrant.name.titleize : "This hydrant"
has been adopted by
= @hydrant.user.name
- unless @hydrant.user.organization.blank?
%h3
of
= @hydrant.user.organization
- if user_signed_in?
= render :partial => 'users/edit_profile'
= render :partial => 'hydrants/steal'
= render :partial => 'sessions/sign_out'
- else
= render :partial => 'sessions/sign_in'

View File

@ -1,4 +0,0 @@
<h2>Thank you for adopting this hydrant!</h2>
<%= render(:partial => 'users/edit_profile') %>
<%= render(:partial => 'hydrants/abandon') %>
<%= render(:partial => 'sessions/sign_out') %>

View File

@ -0,0 +1,5 @@
%h2
Thank you for adopting this hydrant!
= render :partial => 'users/edit_profile'
= render :partial => 'hydrants/abandon'
= render :partial => 'sessions/sign_out'