Bootstrap

This commit is contained in:
Erik Michaels-Ober 2011-12-24 23:23:19 -08:00
parent 593ce81aef
commit 23ec5c99eb
75 changed files with 2916 additions and 414 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View File

@ -4,11 +4,13 @@ $(function() {
var mapOptions = {
center: center,
mapTypeControl: false,
zoomControl: false,
mapTypeId: google.maps.MapTypeId.ROADMAP,
panControl: false,
scrollwheel: false,
zoom: zoomLevel
};
var map = new google.maps.Map(document.getElementById("map_canvas"), mapOptions);
var map = new google.maps.Map(document.getElementById("map"), mapOptions);
var activeThingId;
var activeMarker;
var activeInfoWindow;
@ -37,7 +39,7 @@ $(function() {
activeInfoWindow.close();
}
var infoWindow = new google.maps.InfoWindow({
maxWidth: 350
maxWidth: 230
});
google.maps.event.addListener(infoWindow, 'closeclick', function() {
isWindowOpen = false;
@ -68,7 +70,6 @@ $(function() {
type: 'GET',
url: '/things.json',
data: {
'commit': $('#address_form input[type="submit"]').val(),
'utf8': '✓',
'authenticity_token': $('#address_form input[name="authenticity_token"]').val(),
'lat': lat,
@ -115,7 +116,7 @@ $(function() {
center = map.getCenter();
addMarkersAround(center.lat(), center.lng());
});
$('#address_form').submit(function() {
$('#address_form').live('submit', function() {
var submitButton = $("#address_form input[type='submit']");
$(submitButton).attr("disabled", true);
var submitButtonText = $(submitButton).attr("value");
@ -131,7 +132,6 @@ $(function() {
type: 'GET',
url: '/address.json',
data: {
'commit': submitButton.val(),
'utf8': '✓',
'authenticity_token': $('#address_form input[name="authenticity_token"]').val(),
'city_state': $('#city_state').val(),
@ -152,33 +152,48 @@ $(function() {
}
return false;
});
$('#combo_form input[type="radio"]').live('click', function() {
// Focus on the first non-empty text input or password field
function setComboFormFocus() {
$('#combo-form input[type="text"]:visible, #combo-form input[type="password"]:visible, #combo-form input[type="submit"]:visible, #combo-form button:visible').each(function(index) {
if($(this).val() === "" || $(this).attr('type') === 'submit' || this.tagName.toLowerCase() === 'button') {
$(this).focus();
return false;
}
});
}
$('#combo-form input[type="radio"]').live('click', function() {
var self = $(this);
if('new' == self.val()) {
$('#combo-form').data('state', 'user_sign_up');
$('#user_forgot_password_fields').slideUp();
$('#user_sign_in_fields').slideUp();
$('#user_sign_up_fields').slideDown();
$('#combo_form').data('state', 'user_sign_up');
$('#user_sign_up_fields').slideDown(function() {
setComboFormFocus();
});
} else if('existing' == self.val()) {
$('#user_sign_up_fields').slideUp();
$('#user_sign_in_fields').slideDown(function() {
$('#combo_form').data('state', 'user_sign_in');
$('#combo-form').data('state', 'user_sign_in');
setComboFormFocus();
$('#user_forgot_password_link').click(function() {
$('#combo-form').data('state', 'user_forgot_password');
$('#user_sign_in_fields').slideUp();
$('#user_forgot_password_fields').slideDown(function() {
setComboFormFocus();
$('#user_remembered_password_link').click(function() {
$('#combo-form').data('state', 'user_sign_in');
$('#user_forgot_password_fields').slideUp();
$('#user_sign_in_fields').slideDown();
$('#combo_form').data('state', 'user_sign_in');
$('#user_sign_in_fields').slideDown(function() {
setComboFormFocus();
});
});
});
$('#combo_form').data('state', 'user_forgot_password');
});
});
}
});
$('#combo_form').live('submit', function() {
var submitButton = $("#combo_form input[type='submit']");
$('#combo-form').live('submit', function() {
var submitButton = $("#combo-form input[type='submit']");
$(submitButton).attr("disabled", true);
var errors = []
if(!/[\w\.%\+\]+@[\w\]+\.+[\w]{2,}/.test($('#user_email').val())) {
@ -214,9 +229,8 @@ $(function() {
type: 'POST',
url: '/users.json',
data: {
'commit': submitButton.val(),
'utf8': '✓',
'authenticity_token': $('#combo_form input[name="authenticity_token"]').val(),
'authenticity_token': $('#combo-form input[name="authenticity_token"]').val(),
'user': {
'email': $('#user_email').val(),
'name': $('#user_name').val(),
@ -227,14 +241,8 @@ $(function() {
'password_confirmation': $('#user_password_confirmation').val()
}
},
beforeSend: function() {
$('#info_window').hide();
$('#loader').show();
},
error: function(jqXHR) {
data = $.parseJSON(jqXHR.responseText);
$('#loader').hide();
$('#info_window').show();
$(submitButton).attr("disabled", false);
if(data.errors.email) {
errors.push($('#user_email'));
@ -271,15 +279,14 @@ $(function() {
success: function(data) {
$.ajax({
type: 'GET',
url: '/info_window',
url: '/sidebar/search',
data: {
'thing_id': activeThingId,
'flash': {
'notice': "<%= I18n.t("notices.signed_up") %>"
}
},
success: function(data) {
activeInfoWindow.setContent(data);
$('#content').html(data);
}
});
}
@ -302,22 +309,15 @@ $(function() {
type: 'POST',
url: '/users/sign_in.json',
data: {
'commit': submitButton.val(),
'utf8': '✓',
'authenticity_token': $('#combo_form input[name="authenticity_token"]').val(),
'authenticity_token': $('#combo-form input[name="authenticity_token"]').val(),
'user': {
'email': $('#user_email').val(),
'password': $('#user_password').val(),
'remember_me': $('#user_remember_me').val()
}
},
beforeSend: function() {
$('#info_window').hide();
$('#loader').show();
},
error: function(jqXHR) {
$('#loader').hide();
$('#info_window').show();
$(submitButton).attr("disabled", false);
$('#user_password_label').addClass('error', 500);
$('#user_password').addClass('error', 500);
@ -326,15 +326,14 @@ $(function() {
success: function(data) {
$.ajax({
type: 'GET',
url: '/info_window',
url: '/sidebar/search',
data: {
'thing_id': activeThingId,
'flash': {
'notice': "<%= I18n.t("notices.signed_in") %>"
}
},
success: function(data) {
activeInfoWindow.setContent(data);
$('#content').html(data);
}
});
}
@ -349,42 +348,22 @@ $(function() {
type: 'POST',
url: '/users/password.json',
data: {
'commit': submitButton.val(),
'utf8': '✓',
'authenticity_token': $('#combo_form input[name="authenticity_token"]').val(),
'authenticity_token': $('#combo-form input[name="authenticity_token"]').val(),
'user': {
'email': $('#user_email').val()
}
},
beforeSend: function() {
$('#info_window').hide();
$('#loader').show();
},
error: function(jqXHR) {
$('#loader').hide();
$('#info_window').show();
$(submitButton).attr("disabled", false);
$('#user_email_label').addClass('error', 500);
$('#user_email').addClass('error', 500);
$('#user_email').focus();
},
success: function() {
$.ajax({
type: 'GET',
url: '/users/sign_in',
data: {
'user': {
'email': $('#user_email').val()
},
'flash': {
'notice': "<%= I18n.t("notices.password_reset") %>"
}
},
success: function(data) {
activeInfoWindow.setContent(data);
$('#user_existing').click();
}
});
$(submitButton).attr("disabled", false);
$('#user_remembered_password_link').click();
$('#user_password').focus();
}
});
}
@ -399,7 +378,6 @@ $(function() {
url: '/things.json',
data: {
'id': $('#thing_id').val(),
'commit': submitButton.val(),
'utf8': '✓',
'authenticity_token': $('#adoption_form input[name="authenticity_token"]').val(),
'_method': 'put',
@ -452,7 +430,6 @@ $(function() {
url: '/things.json',
data: {
'id': $('#thing_id').val(),
'commit': submitButton.val(),
'utf8': '✓',
'authenticity_token': $('#abandon_form input[name="authenticity_token"]').val(),
'_method': 'put',
@ -477,7 +454,7 @@ $(function() {
data: {
'thing_id': activeThingId,
'flash': {
'notice': "<%= I18n.t("notices.abandoned", :thing => I18n.t("defaults.thing").capitalize) %>"
'warning': "<%= I18n.t("notices.abandoned", :thing => I18n.t("defaults.thing").capitalize) %>"
}
},
success: function(data) {
@ -503,21 +480,14 @@ $(function() {
type: 'GET',
url: '/users/edit',
data: {
'commit': submitButton.val(),
'utf8': '✓',
'authenticity_token': $('#edit_profile_form input[name="authenticity_token"]').val()
},
beforeSend: function() {
$('#info_window').hide();
$('#loader').show();
},
error: function(jqXHR) {
$('#loader').hide();
$('#info_window').show();
$(submitButton).attr("disabled", false);
},
success: function(data) {
activeInfoWindow.setContent(data);
$('#content').html(data);
}
});
return false;
@ -568,7 +538,6 @@ $(function() {
data: {
'id': $('#id').val(),
'thing_id': activeThingId,
'commit': submitButton.val(),
'utf8': '✓',
'authenticity_token': $('#edit_form input[name="authenticity_token"]').val(),
'_method': 'put',
@ -583,14 +552,8 @@ $(function() {
'current_password': $('#user_current_password').val()
}
},
beforeSend: function() {
$('#info_window').hide();
$('#loader').show();
},
error: function(jqXHR) {
data = $.parseJSON(jqXHR.responseText);
$('#loader').hide();
$('#info_window').show();
$(submitButton).attr("disabled", false);
if(data.errors.email) {
errors.push($('#user_email'));
@ -630,7 +593,7 @@ $(function() {
errors[0].focus();
},
success: function(data) {
activeInfoWindow.setContent(data);
$('#content').html(data);
}
});
}
@ -643,31 +606,23 @@ $(function() {
type: 'GET',
url: '/users/sign_out.json',
data: {
'commit': submitButton.val(),
'utf8': '✓',
'authenticity_token': $('#sign_out_form input[name="authenticity_token"]').val()
},
beforeSend: function() {
$('#info_window').hide();
$('#loader').show();
},
error: function(jqXHR) {
$('#loader').hide();
$('#info_window').show();
$(submitButton).attr("disabled", false);
},
success: function(data) {
$.ajax({
type: 'GET',
url: '/info_window',
url: '/sidebar/combo_form',
data: {
'thing_id': activeThingId,
'flash': {
'notice': "<%= I18n.t("notices.signed_out") %>"
'warning': "<%= I18n.t("notices.signed_out") %>"
}
},
success: function(data) {
activeInfoWindow.setContent(data);
$('#content').html(data);
}
});
}
@ -681,7 +636,6 @@ $(function() {
type: 'GET',
url: '/users/sign_in',
data: {
'commit': submitButton.val(),
'utf8': '✓',
'authenticity_token': $('#sign_in_form input[name="authenticity_token"]').val(),
},
@ -705,24 +659,12 @@ $(function() {
$(submitButton).attr("disabled", true);
$.ajax({
type: 'GET',
url: '/info_window',
data: {
'commit': submitButton.val(),
'utf8': '✓',
'authenticity_token': $('#back_form input[name="authenticity_token"]').val(),
'thing_id': activeThingId
},
beforeSend: function() {
$('#info_window').hide();
$('#loader').show();
},
url: '/sidebar/search',
error: function(jqXHR) {
$('#loader').hide();
$('#info_window').show();
$(submitButton).attr("disabled", false);
},
success: function(data) {
activeInfoWindow.setContent(data);
$('#content').html(data);
}
});
return false;
@ -734,9 +676,8 @@ $(function() {
type: 'POST',
url: '/reminders.json',
data: {
'commit': submitButton.val(),
'utf8': '✓',
'authenticity_token': $('#sign_out_form input[name="authenticity_token"]').val(),
'authenticity_token': $('#reminder_form input[name="authenticity_token"]').val(),
'reminder': {
'from_user_id': $('#reminder_from_user_id').val(),
'to_user_id': $('#reminder_to_user_id').val(),

2467
app/assets/stylesheets/bootstrap.css vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@ -3,61 +3,134 @@ html {
}
body {
font-family: 'Palatino Linotype', 'Book Antiqua', Palatino, FreeSerif, serif;
height: 100%;
margin: 0px;
padding: 0px;
}
h1, h2, h3, h4, h5, h6 {
font-family: Helvetica, Arial, sans-serif;
margin: 0;
}
h1, h2 {
text-align: center;
}
#map_canvas {
float: left;
h2 {
font-size: 22px;
margin-bottom: 10px;
}
form.form-stacked {
padding-left: 10px;
margin-bottom: 0;
}
label, input {
white-space: nowrap;
text-align: left;
}
input {
width: 200px;
}
input, select, option, button, input[type="submit"] {
display: block;
margin-bottom: 10px;
}
input[type="radio"], input[type="checkbox"] {
display: inline;
width: auto;
margin: 0 10px 10px 0;
}
input#user_new {
margin-bottom: 0;
}
button.btn, input[type="submit"].btn {
display: block;
text-align: center;
width: 210px;
}
form label.error {
color: #b94a48;
}
form input.error, form textarea.error {
border-color: #ee5f5b;
}
form input.error:focus, form textarea.error:focus {
border-color: #e9322d;
-webkit-box-shadow: 0 0 6px #f8b9b7;
-moz-box-shadow: 0 0 6px #f8b9b7;
box-shadow: 0 0 6px #f8b9b7;
}
.table {
display: table;
height: 100%;
width: 75%;
}
#sidebar {
float: left;
height: 100%;
width: 25%;
overflow: hidden;
}
form {
width: 90%;
margin: auto;
}
#sidebar #tagline {
text-align: center;
padding: 10px;
background: #c33;
color: #fff;
}
#sidebar #logos {
text-align: center;
}
#sidebar #logos img {
padding: 10px 5px 0 5px;
}
#sidebar #feedback {
text-align: center;
}
#sidebar img#hydrant-in-snow {
width: 100%;
}
.table-row {
display: table-row;
}
.table-cell {
display: table-cell;
height: 100%;
}
.alert-message {
-webkit-border-radius: 0;
-moz-border-radius: 0;
border-radius: 0;
text-align: center;
margin-bottom: 10px;
}
.sidebar {
padding-top: 20px;
width: 250px;
text-align: center;
}
.sidebar form.form-stacked {
padding-left: 20px;
}
.sidebar p {
width: 210px;
}
.sidebar p#tagline {
color: #ffffff;
padding: 10px 20px;
background-color: #c43c35;
background-repeat: repeat-x;
background-image: -khtml-gradient(linear, left top, left bottom, from(#ee5f5b), to(#c43c35));
background-image: -moz-linear-gradient(top, #ee5f5b, #c43c35);
background-image: -ms-linear-gradient(top, #ee5f5b, #c43c35);
background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #ee5f5b), color-stop(100%, #c43c35));
background-image: -webkit-linear-gradient(top, #ee5f5b, #c43c35);
background-image: -o-linear-gradient(top, #ee5f5b, #c43c35);
background-image: linear-gradient(top, #ee5f5b, #c43c35);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ee5f5b', endColorstr='#c43c35', GradientType=0);
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
border-color: #c43c35 #c43c35 #882a25;
border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
text-align: center;
}
.sidebar #logos img {
margin: 10px 5px;
}
#map {
margin-top: 40px;
width: auto;
}
#error, #notice, #warning {
margin: auto;
padding: 5px 10px;
@ -78,37 +151,6 @@ form {
border: 1px solid #c0bb73;
}
label, input {
white-space: nowrap;
text-align: left;
}
input, select, option, button, input[type="submit"] {
display: block;
margin-bottom: 10px;
font-size: 1.0em;
width: 100%;
}
input[type="radio"], input[type="checkbox"] {
display: inline;
width: auto;
margin-right: 10px;
}
button, input[type="submit"] {
width: 100%;
text-align: center;
}
label.error {
color: #c33;
}
input.error {
background-color: #ffc;
}
.upcase {
text-transform: uppercase;
}

View File

@ -11,7 +11,7 @@ class InfoWindowController < ApplicationController
if user_signed_in?
render("things/adopt")
else
render("sessions/new")
render("users/sign_in")
end
end
end

View File

@ -1,6 +1,6 @@
class SessionsController < Devise::SessionsController
def new
render("new", :layout => "info_window")
redirect_to root_path
end
def create

View File

@ -0,0 +1,2 @@
class SidebarController < ApplicationController
end

View File

@ -1,13 +1,13 @@
class UsersController < Devise::RegistrationsController
def edit
render("edit", :layout => "info_window")
render("sidebar/edit_profile", :layout => "sidebar")
end
def update
if resource.update_with_password(params[resource_name])
sign_in(resource_name, resource, :bypass => true)
flash[:notice] = "Profile updated!"
redirect_to(:controller => "info_window", :action => "index", :thing_id => params[:thing_id])
redirect_to(:controller => "sidebar", :action => "search")
else
clean_up_passwords(resource)
render(:json => {"errors" => resource.errors}, :status => 500)

View File

@ -241,5 +241,3 @@
The section titles in this Agreement are for convenience only and have no legal or contractual effect.
%p
Last updated August 10, 2011.
= render :partial => 'things/back'

View File

@ -3,11 +3,12 @@
%head
%title
= t("titles.main", :thing => t("defaults.thing").titleize)
= stylesheet_link_tag "application"
= stylesheet_link_tag "bootstrap"
= stylesheet_link_tag "screen"
= 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 "application"
= javascript_include_tag "main"
= csrf_meta_tag
%meta{:name => "viewport", :content => "initial-scale=1.0, user-scalable=no"}
%script{:type => "text/javascript"}

View File

@ -1,7 +1,16 @@
#loader{:style => "display: none;"}
= image_tag "ajax-loader.gif"
#info_window
- flash.each do |key, message|
%div{:id => key}
= message
- if flash[:notice]
.alert-message.success
%p
= flash[:notice]
- if flash[:warning]
.alert-message.warning
%p
= flash[:warning]
- if flash[:error]
.alert-message.error
%p
= flash[:error]
= yield

View File

@ -0,0 +1,13 @@
- if flash[:notice]
.alert-message.success
%p
= flash[:notice]
- if flash[:warning]
.alert-message.warning
%p
= flash[:warning]
- if flash[:error]
.alert-message.error
%p
= flash[:error]
= yield

View File

@ -1,20 +1,22 @@
#sidebar
.table
.table-row
.table-cell.sidebar
%h1
= image_tag "logos/adopt-a-hydrant.png", :alt => t("titles.main", :thing => t("defaults.thing").titleize), :title => t("titles.main", :thing => t("defaults.thing").titleize)
%p#tagline
%p.alert-message#tagline
= t("defaults.tagline")
= form_for :address, :html => {:id => "address_form"} do |f|
= label_tag "city_state", t("labels.city_state"), :id => "city_state_label"
= select_tag "city_state", "<option value=\"#{t("defaults.city")}\" selected=\"selected\">#{t("defaults.city")}</option>".html_safe
= label_tag "address", t("labels.address"), :id => "address_label"
= text_field_tag "address", params[:address]
= hidden_field_tag "limit", params[:limit] || 40
= submit_tag t("buttons.find", :thing => t("defaults.thing").pluralize)
#content
- if signed_in?
= render :partial => "sidebar/search"
- else
= render :partial => "sidebar/combo_form"
#logos
%a{:href => "http://codeforamerica.org/"}
= image_tag "logos/cfa.png", :alt => t("sponsors.cfa"), :title => t("sponsors.cfa")
%a{:href => "http://bostonbuilt.org/"}
= image_tag "logos/boston.png", :alt => t("sponsors.city"), :title => t("sponsors.city")
#feedback
%a{:href => "mailto:adoptahydrant@cityofboston.gov?subject=#{t("titles.main", :thing => t("defaults.thing").titleize)} #{t("links.feedback").titleize}"}
%a{:href => URI.escape("mailto:adoptahydrant@cityofboston.gov?subject=#{t("titles.main", :thing => t("defaults.thing").titleize)} #{t("links.feedback").titleize}")}
= t("links.feedback")
= image_tag "hydrant-in-snow.jpg", :id => "hydrant-in-snow"
#map_canvas
.table-cell#map
&nbsp;

View File

@ -0,0 +1,19 @@
.table
.table-row
.table-cell.sidebar
%h1
= image_tag "logos/adopt-a-hydrant.png", :alt => t("titles.main", :thing => t("defaults.thing").titleize), :title => t("titles.main", :thing => t("defaults.thing").titleize)
%p.alert-message#tagline
= t("defaults.tagline")
#content
= render :partial => "sidebar/combo_form"
#logos
%a{:href => "http://codeforamerica.org/"}
= image_tag "logos/cfa.png", :alt => t("sponsors.cfa"), :title => t("sponsors.cfa")
%a{:href => "http://bostonbuilt.org/"}
= image_tag "logos/boston.png", :alt => t("sponsors.city"), :title => t("sponsors.city")
#feedback
%a{:href => URI.escape("mailto:adoptahydrant@cityofboston.gov?subject=#{t("titles.main", :thing => t("defaults.thing").titleize)} #{t("links.feedback").titleize}")}
= t("links.feedback")
.table-cell#map
&nbsp;

View File

@ -1,7 +1,7 @@
= form_for resource, :as => resource_name, :url => password_path(resource_name), :html => {:id => "edit_form", :method => :put} do |f|
= form_for resource, :as => resource_name, :url => password_path(resource_name), :html => {:id => "edit_form", :class => "form-stacked", :method => :put} do |f|
%h2
= t("titles.edit_profile")
= f.hidden_field "reset_password_token"
= f.label "password", t("labels.password_new"), :id => "user_password_label"
= f.password_field "password"
= f.submit t("buttons.change_password")
= f.submit t("buttons.change_password"), :class => "btn"

View File

@ -1,2 +0,0 @@
= form_for :sign_in, :html => {:id => "sign_in_form"} do |f|
= f.submit t("buttons.sign_in")

View File

@ -1,2 +0,0 @@
= form_for :sign_out, :html => {:id => "sign_out_form"} do |f|
= f.submit t("buttons.sign_out")

View File

@ -1,47 +0,0 @@
= form_for :user, :html => {:id => "combo_form"} do |f|
%h2
= t("titles.adopt", :thing => t("defaults.thing").titleize)
#common_fields
= f.label "email", t("labels.email"), :id => "user_email_label"
%em
= image_tag "lock.svg", :class => "lock", :alt => t("captions.private"), :title => t("captions.private")
= f.text_field "email", :value => params[:user] ? params[:user][:email] : nil
= f.label "new" , radio_button_tag("user", "new", true).html_safe + t("labels.user_new")
= f.label "existing", radio_button_tag("user", "existing").html_safe + t("labels.user_existing")
#user_sign_up_fields
= f.label "name", t("labels.name"), :id => "user_name_label"
%em
= t("captions.public")
= f.text_field "name"
= f.label "organization", t("labels.organization"), :id => "user_organization_label"
%em
= t("captions.public")
= f.text_field "organization"
= f.label "voice_number", t("labels.voice_number"), :id => "user_voice_number_label"
%em
= image_tag "lock.svg", :class => "lock", :alt => t("captions.private"), :title => t("captions.private")
= f.text_field "voice_number"
= f.label "sms_number", t("labels.sms_number"), :id => "user_sms_number_label"
%em
= image_tag "lock.svg", :class => "lock", :alt => t("captions.private"), :title => t("captions.private")
= f.text_field "sms_number"
= f.label "password_confirmation", t("labels.password_choose"), :id => "user_password_confirmation_label"
%em
= image_tag "lock.svg", :class => "lock", :alt => t("captions.private"), :title => t("captions.private")
= f.password_field "password_confirmation"
= f.submit t("buttons.sign_up")
%p
= t("defaults.tos", :tos => link_to(t("titles.tos"), tos_path, :id => "tos_link")).html_safe
#user_sign_in_fields{:style => "display: none;"}
= f.label "password", t("labels.password"), :id => "user_password_label"
%em
= image_tag "lock.svg", :class => "lock", :alt => t("captions.private"), :title => t("captions.private")
= f.password_field "password"
= f.label "remember_me", (f.check_box("remember_me", :checked => true).html_safe + t("labels.remember_me")), :id => "user_remember_me_label"
= f.submit t("buttons.sign_in")
%p
= link_to t("links.forgot_password"), "#", :id => "user_forgot_password_link"
#user_forgot_password_fields{:style => "display: none;"}
= f.submit t("buttons.email_password")
%p
= link_to t("links.remembered_password"), "#", :id => "user_remembered_password_link"

View File

@ -0,0 +1,56 @@
= form_for :user, :html => {:id => "combo-form", :class => "form-stacked"} do |f|
#common_fields
%label{:for => "user_email", :id => "user_email_label"}
= t("labels.email")
%small
= image_tag "lock.svg", :class => "lock", :alt => t("captions.private"), :title => t("captions.private")
= f.text_field "email", :value => params[:user] ? params[:user][:email] : nil
= f.label "new" , radio_button_tag("user", "new", true).html_safe + t("labels.user_new")
= f.label "existing", radio_button_tag("user", "existing").html_safe + t("labels.user_existing")
#user_sign_up_fields
%label{:for => "user_name", :id => "user_name_label"}
= t("labels.name")
%small
= t("captions.public")
= f.text_field "name"
%label{:for => "user_organization", :id => "user_organization_label"}
= t("labels.organization")
%small
= t("captions.public")
= f.text_field "organization"
%label{:for => "user_voice_number", :id => "user_voice_number_label"}
= t("labels.voice_number")
%small
= image_tag "lock.svg", :class => "lock", :alt => t("captions.private"), :title => t("captions.private")
= f.text_field "voice_number"
%label{:for => "user_sms_number", :id => "user_sms_number_label"}
= t("labels.sms_number")
%small
= image_tag "lock.svg", :class => "lock", :alt => t("captions.private"), :title => t("captions.private")
= f.text_field "sms_number"
%label{:for => "user_password_confirmation", :id => "user_password_confirmation_label"}
= t("labels.password_choose")
%small
= image_tag "lock.svg", :class => "lock", :alt => t("captions.private"), :title => t("captions.private")
= f.password_field "password_confirmation"
= f.submit t("buttons.sign_up"), :class => "btn primary"
%p
= t("defaults.tos", :tos => link_to(t("titles.tos"), tos_path, :id => "tos_link")).html_safe
#user_sign_in_fields{:style => "display: none;"}
%label{:for => "user_password", :id => "user_password_label"}
= t("labels.password")
%small
= image_tag "lock.svg", :class => "lock", :alt => t("captions.private"), :title => t("captions.private")
= f.password_field "password"
= f.label "remember_me" , f.check_box("remember_me", :checked => true).html_safe + t("labels.remember_me")
= f.submit t("buttons.sign_in"), :class => "btn primary"
%p
= link_to t("links.forgot_password"), "#", :id => "user_forgot_password_link"
#user_forgot_password_fields{:style => "display: none;"}
= f.submit t("buttons.email_password"), :class => "btn primary"
%p
= link_to t("links.remembered_password"), "#", :id => "user_remembered_password_link"
:javascript
$(function() {
$('#user_email').focus();
});

View File

@ -0,0 +1,15 @@
= form_tag "/address", :method => "get", :id => "address_form", :class => "form-stacked" do
= label_tag "city_state", t("labels.city_state"), :id => "city_state_label"
= select_tag "city_state", "<option value=\"#{t("defaults.city")}\" selected=\"selected\">#{t("defaults.city")}</option>".html_safe
= label_tag "address", t("labels.address"), :id => "address_label"
= text_field_tag "address", params[:address], :placeholder => "1 City Hall Plaza, Downtown"
= hidden_field_tag "limit", params[:limit] || 40
= submit_tag t("buttons.find", :thing => t("defaults.thing").pluralize), :class => "btn primary"
= form_for :user, :url => edit_user_registration_path, :html => {:id => "edit_profile_form", :class => "form-stacked", :method => "get"} do |f|
= f.submit t("buttons.edit_profile"), :class => "btn"
= form_for :sign_out, :html => {:id => "sign_out_form", :class => "form-stacked"} do |f|
= f.submit t("buttons.sign_out"), :class => "btn danger"
:javascript
$(function() {
$('#address').focus();
});

View File

@ -0,0 +1 @@
= render :partial => "combo_form"

View File

@ -0,0 +1,43 @@
= form_for resource, :as => resource_name, :url => registration_path(resource_name), :html => {:id => "edit_form", :class => "form-stacked", :method => :put} do |f|
= f.hidden_field "id"
%label{:for => "user_email", :id => "user_email_label"}
= t("labels.email")
%small
= image_tag "lock.svg", :class => "lock", :alt => t("captions.private"), :title => t("captions.private")
= f.text_field "email"
%label{:for => "user_name", :id => "user_name_label"}
= t("labels.name")
%small
= t("captions.public")
= f.text_field "name"
%label{:for => "user_organization", :id => "user_organization_label"}
= t("labels.organization")
%small
= t("captions.public")
= f.text_field "organization"
%label{:for => "user_voice_number", :id => "user_voice_number_label"}
= t("labels.voice_number")
%small
= image_tag "lock.svg", :class => "lock", :alt => t("captions.private"), :title => t("captions.private")
= f.text_field "voice_number"
%label{:for => "user_sms_number", :id => "user_sms_number_label"}
= t("labels.sms_number")
%small
= image_tag "lock.svg", :class => "lock", :alt => t("captions.private"), :title => t("captions.private")
= f.text_field "sms_number"
%label{:for => "user_password", :id => "user_password_label"}
= t("labels.password_new")
%small
= t("captions.optional")
= f.password_field "password"
%label{:for => "user_current_password", :id => "user_current_password_label"}
= t("labels.current_password")
= f.password_field "current_password"
= f.submit t("buttons.update"), :class => "btn primary"
= form_for :things, :url => root_path, :html => {:id => "back_form", :class => "form-stacked", :method => "get"} do |f|
= f.hidden_field "id"
= f.submit t("buttons.back"), :class => "btn"
:javascript
$(function() {
$('#user_email').focus();
});

View File

@ -0,0 +1 @@
= render :partial => "search"

View File

@ -1,5 +1,5 @@
= form_for :thing, :url => things_path, :method => :put, :html => {:id => "abandon_form"} do |f|
= form_for :thing, :url => things_path, :method => :put, :html => {:id => "abandon_form", :class => "form-stacked"} do |f|
= f.hidden_field "id"
= f.hidden_field "user_id", :value => ""
= f.hidden_field "name", :value => ""
= f.submit t("buttons.abandon", :thing => t("defaults.thing"))
= f.submit t("buttons.abandon", :thing => t("defaults.thing")), :class => "btn danger"

View File

@ -1,3 +0,0 @@
= form_for :things, :url => info_window_path, :html => {:id => "back_form", :method => "get"} do |f|
= f.hidden_field "id"
= f.submit t("buttons.back")

View File

@ -1,10 +1,8 @@
= form_for :thing, :url => things_path, :method => :put, :html => {:id => "adoption_form"} do |f|
= form_for :thing, :url => things_path, :method => :put, :html => {:id => "adoption_form", :class => "form-stacked"} do |f|
%h2
= t("titles.adopt", :thing => t("defaults.thing").titleize)
= f.hidden_field "id"
= f.hidden_field "user_id", :value => current_user.id
= f.label "name", t("labels.name_thing", :thing => t("defaults.thing")), :id => "thing_name_label"
= f.text_field "name"
= f.submit t("buttons.adopt")
= render :partial => 'users/edit_profile'
= render :partial => 'sessions/sign_out'
= f.submit t("buttons.adopt"), :class => "btn primary"

View File

@ -1,2 +0,0 @@
= form_for :user, :url => edit_user_registration_path, :html => {:id => "edit_profile_form", :method => "get"} do |f|
= f.submit t("buttons.edit_profile")

View File

@ -1,5 +1,5 @@
= form_for :reminder, :url => reminders_path, :html => {:id => "reminder_form", :method => "post"} do |f|
= form_for :reminder, :url => reminders_path, :html => {:id => "reminder_form", :class => "form-stacked", :method => "post"} do |f|
= f.hidden_field "from_user_id", :value => current_user.id
= f.hidden_field "to_user_id", :value => @thing.user.id
= f.hidden_field "thing_id", :value => @thing.id
= f.submit t("buttons.send_reminder")
= f.submit t("buttons.send_reminder"), :class => "btn"

View File

@ -1,34 +0,0 @@
= form_for resource, :as => resource_name, :url => registration_path(resource_name), :html => {:id => "edit_form", :method => :put} do |f|
%h2
= t("titles.edit_profile")
= f.hidden_field "id"
= f.label "email", t("labels.email"), :id => "user_email_label"
%em
= image_tag "lock.svg", :class => "lock", :alt => t("captions.private"), :title => t("captions.private")
= f.text_field "email"
= f.label "name", t("labels.name"), :id => "user_name_label"
%em
= t("captions.public")
= f.text_field "name"
= f.label "organization", t("labels.organization"), :id => "user_organization_label"
%em
= t("captions.public")
= f.text_field "organization"
= f.label "voice_number", t("labels.voice_number"), :id => "user_voice_number_label"
%em
= image_tag "lock.svg", :class => "lock", :alt => t("captions.private"), :title => t("captions.private")
= f.text_field "voice_number"
= f.label "sms_number", t("labels.sms_number"), :id => "user_sms_number_label"
%em
= image_tag "lock.svg", :class => "lock", :alt => t("captions.private"), :title => t("captions.private")
= f.text_field "sms_number"
= f.label "password", t("labels.password_new"), :id => "user_password_label"
%em
= t("captions.password")
= f.password_field "password"
= f.label "current_password", t("labels.current_password"), :id => "user_current_password_label"
%em
= t("captions.current_password")
= f.password_field "current_password"
= f.submit t("buttons.update")
= render :partial => 'things/back'

View File

@ -6,7 +6,3 @@
= t("titles.ofline", :organization => @thing.user.organization) unless @thing.user.organization.blank?
- if user_signed_in?
= render :partial => 'users/reminder'
= render :partial => 'users/edit_profile'
= render :partial => 'sessions/sign_out'
- else
= render :partial => 'sessions/sign_in'

View File

@ -0,0 +1,2 @@
%h2
= t("titles.sign_in", :thing => t("defaults.thing").titleize)

View File

@ -1,5 +1,3 @@
%h2
= t("titles.thank_you", :thing => t("defaults.thing"))
= render :partial => 'things/abandon'
= render :partial => 'users/edit_profile'
= render :partial => 'sessions/sign_out'

View File

@ -15,10 +15,9 @@ de:
sign_up: "Registrieren"
update: "Aktualisierung"
captions:
current_password: "(Wir brauchen Ihr aktuelles Passwort, um Ihre Änderungen zu bestätigen)"
password: "(Freilassen, wenn Sie nicht wollen, es zu ändern)"
private: "(Privat)"
public: "(Kann für andere Benutzer sichtbar)"
optional: "(fakultativ)"
private: "(privat)"
public: "(für andere sichtbar)"
defaults:
address: "Adresse"
city: "Boston, MA"
@ -46,7 +45,7 @@ de:
user_new: "Ich habe noch nicht registriert"
voice_number: "Startseite Telefonnummer"
links:
feedback: "Rückkopplung"
feedback: "Feedback senden"
forgot_password: "Passwort vergessen?"
remembered_password: "Das macht nichts. Ich erinnerte mich an mein Passwort vergessen."
notices:
@ -59,12 +58,13 @@ de:
signed_up: "Vielen Dank für Ihre Anmeldung!"
stolen: "%{thing} gestohlen!"
titles:
adopt: "Nehmen Sie dieses %{thing}"
adopt: "Adopt diesem %{thing}"
adopted: "{thing_name} wurde verabschiedet"
byline: "von %{name}"
edit_profile: "Ihr Profil bearbeiten"
main: "Adopt-a-%{thing}"
ofline: "der %{organization}"
sign_in: "Melden Sie sich in diesem %{thing} übernehmen"
thank_you: "Vielen Dank für die Annahme dieser %{thing}!"
tos: "Nutzungsbedingungen"
sponsors:

View File

@ -4,7 +4,6 @@ en:
not_found: "not found"
already_confirmed: "was already confirmed"
not_locked: "was not locked"
devise:
failure:
unauthenticated: 'You need to sign in or sign up before continuing.'

View File

@ -15,10 +15,9 @@ en:
sign_up: "Sign up"
update: "Update"
captions:
current_password: "(we need your current password to confirm your changes)"
password: "(leave blank if you don't want to change it)"
optional: "(optional)"
private: "(private)"
public: "(may be visible to other users)"
public: "(visible to others)"
defaults:
address: "address"
city: "Boston, MA"
@ -46,7 +45,7 @@ en:
user_new: "I haven't signed up yet"
voice_number: "Home phone number"
links:
feedback: "Feedback"
feedback: "Send feedback"
forgot_password: "Forgot your password?"
remembered_password: "Never mind. I remembered my password."
notices:
@ -65,6 +64,7 @@ en:
edit_profile: "Edit your Profile"
main: "Adopt-a-%{thing}"
ofline: "of %{organization}"
sign_in: "Sign in to adopt this %{thing}"
thank_you: "Thank you for adopting this %{thing}!"
tos: "Terms of Service"
sponsors:

View File

@ -15,10 +15,9 @@ es:
sign_up: "Regístrate"
update: "Actualización"
captions:
current_password: "(Necesitamos su contraseña actual para confirmar los cambios)"
password: "(Dejar en blanco si no desea cambiarlo)"
private: "(Privado)"
public: "(Puede ser visible para otros usuarios)"
optional: "(opcional)"
private: "(privado)"
public: "(visible para los demás)"
defaults:
address: "dirección"
city: "Boston, MA"
@ -46,7 +45,7 @@ es:
user_new: "No se ha inscrito"
voice_number: "Número de teléfono"
links:
feedback: "Realimentación"
feedback: "Envíenos sus comentarios"
forgot_password: "¿Olvidaste tu contraseña?"
remembered_password: "No importa. Me acordé de mi contraseña."
notices:
@ -65,6 +64,7 @@ es:
edit_profile: "Edita tu perfil"
main: "Adopt-a-%{thing}"
ofline: "de %{organization}"
sign_in: "Iniciar sesión para adoptar esta %{thing}"
thank_you: "Gracias por la adopción de esta %{thing}!"
tos: "Términos de Servicio"
sponsors:

View File

@ -15,10 +15,9 @@ fr:
sign_up: "S'inscrire"
update: "Mise à jour"
captions:
current_password: "(Nous avons besoin de votre mot de passe actuel pour confirmer vos modifications)"
password: "(Laisser vide si vous ne voulez pas le changer)"
private: "(Privé)"
public: "(Peut être visible aux autres utilisateurs)"
optional: "(optionnelle)"
private: "(privé)"
public: "(visible pour les autres)"
defaults:
address: "Adresse"
city: "Boston, MA"
@ -46,7 +45,7 @@ fr:
user_new: "Je n'ai pas encore inscrits"
voice_number: "Le numéro de téléphone Accueil"
links:
feedback: "Commentaires"
feedback: "Envoyer des commentaires"
forgot_password: "Mot de passe oublié?"
remembered_password: "Jamais l'esprit. J'ai rappelé mon mot de passe."
notices:
@ -65,6 +64,7 @@ fr:
edit_profile: "Modifiez votre profil"
main: "Adopt-a-%{thing}"
ofline: "de %{organization}"
sign_in: "Connectez-vous à adopter cette %{thing}"
thank_you: "Merci pour l'adoption de cette %{thing}!"
tos: "Conditions d'utilisation"
sponsors:

View File

@ -15,10 +15,9 @@ pt:
sign_up: "Inscrever-se"
update: "Atualizar"
captions:
current_password: "(Nós precisamos de sua senha atual para confirmar as alterações)"
password: "(Deixe em branco se você não quer mudá-lo)"
private: "(Privado)"
public: "(Pode ser visível para outros usuários)"
optional: "(opcional)"
private: "(privado)"
public: "(visível para os outros)"
defaults:
address: "endereço"
city: "Boston, MA"
@ -46,7 +45,7 @@ pt:
user_new: "Eu não se inscreveram ainda"
voice_number: "Número de telefone residencial"
links:
feedback: "Comentários"
feedback: "Envie seu comentário"
forgot_password: "Esqueceu sua senha?"
remembered_password: "Não se preocupe. Lembrei-me minha senha."
notices:
@ -65,6 +64,7 @@ pt:
edit_profile: "Editar seu Perfil"
main: "Adotar-um-%{thing}"
ofline: "do %{organization}"
sign_in: "Entrar para adotar essa %{thing}"
thank_you: "Obrigado por adotar este %{thing}!"
tos: "Termos de Serviço"
sponsors:

View File

@ -4,10 +4,18 @@ AdoptAThing::Application.routes.draw do
:registrations => 'users',
:sessions => 'sessions',
}
get 'address' => 'addresses#show', :as => 'address'
get 'info_window' => 'info_window#index', :as => 'info_window'
get 'sitemap' => 'sitemaps#index', :as => 'sitemap'
get 'tos' => 'info_window#tos', :as => 'tos'
scope "sidebar", :controller => :sidebar do
get :search, :as => 'search'
get :combo_form, :as => 'combo_form'
get :edit_profile , :as => 'edit_profile'
end
resource :reminders
resource :things
mount RailsAdmin::Engine => '/admin', :as => 'rails_admin'

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1 +0,0 @@
html{height:100%}body{font-family:'Palatino Linotype', 'Book Antiqua', Palatino, FreeSerif, serif;height:100%;margin:0px;padding:0px}h1,h2,h3,h4,h5,h6{font-family:Helvetica, Arial, sans-serif}h1,h2{text-align:center}#map_canvas{float:left;height:100%;width:75%}#sidebar{float:left;height:100%;width:25%;overflow:hidden}form{width:90%;margin:auto}#sidebar #tagline{text-align:center;padding:10px;background:#c33;color:#fff}#sidebar #logos{text-align:center}#sidebar #logos img{padding:10px 5px 0 5px}#sidebar #feedback{text-align:center}#sidebar img#hydrant-in-snow{width:100%}#error,#notice,#warning{margin:auto;padding:5px 10px}#error{background-color:#ff7373;border:1px solid #c07373}#notice{background-color:#8fe38f;border:1px solid #82b082}#warning{background-color:#fff773;border:1px solid #c0bb73}label,input{white-space:nowrap;text-align:left}input,select,option,button,input[type="submit"]{display:block;margin-bottom:10px;font-size:1.0em;width:100%}input[type="radio"],input[type="checkbox"]{display:inline;width:auto;margin-right:10px}button,input[type="submit"]{width:100%;text-align:center}label.error{color:#c33}input.error{background-color:#ffc}.upcase{text-transform:uppercase}.alpha{list-style-type:lower-alpha}.roman{list-style-type:lower-roman}img.lock{height:9px;width:7px;opacity:0.8;filter:alpha(opacity=80)}

File diff suppressed because one or more lines are too long

Binary file not shown.

File diff suppressed because one or more lines are too long

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View File

@ -4,14 +4,14 @@ hydrant-in-snow.jpg: hydrant-in-snow-37893ae772bc7a50d563ce93ff51e7b4.jpg
lock.svg: lock-4637644daf7162e66f0fc13bd6e09cfe.svg
logos/adopt-a-hydrant.png: logos/adopt-a-hydrant-cc51096facb301fbc47a52e22d548556.png
logos/adopt-a-hydrant_large.png: logos/adopt-a-hydrant_large-bc8c551d4be238ac264a810f7b259101.png
logos/boston.png: logos/boston-ed9439a7ae565fa6132b4aadf2df8d95.png
logos/cfa.png: logos/cfa-e3639eeaca402a55546eafd73b9ed139.png
logos/boston.png: logos/boston-b28b79c935c6a90add1002991469376a.png
logos/cfa.png: logos/cfa-126f65b37b434516568f0e68134381de.png
markers/green.png: markers/green-5583a65ce5266b274e9389fce98ea41a.png
markers/marker.psd: markers/marker-ed6ddafa11280441f4fde86694a5fb5e.psd
markers/red.png: markers/red-8f727186ba094dfb33c72aadd204cd5d.png
markers/shadow.png: markers/shadow-8e05a2a893ca0812e770d88aed15e961.png
application.js: application-879974b2dc732c9ad52461701c6d8221.js
application.css: application-f51fc927e2d61b28a97c412e9ccbf82c.css
application.js: application-1cf60dea943ea122ba3843553cae21f1.js
application.css: application-91caf803854c601630c3e34248437991.css
rails_admin/aristo/images/bg_fallback.png: rails_admin/aristo/images/bg_fallback-da55e947e1aac1e4664adf81539b33f4.png
rails_admin/aristo/images/icon_sprite.png: rails_admin/aristo/images/icon_sprite-c85b36fba1b0dd6067f900f7c8da5aec.png
rails_admin/aristo/images/progress_bar.gif: rails_admin/aristo/images/progress_bar-d62259b73fbfae5fc0dfb0d13b3b05ed.gif
@ -55,7 +55,7 @@ rails_admin/multiselect/ui-icon-circle-triangle-n-light.png: rails_admin/multise
rails_admin/multiselect/ui-icon-circle-triangle-s-dark.png: rails_admin/multiselect/ui-icon-circle-triangle-s-dark-a99905be0af343cac3e336f6c9d656d2.png
rails_admin/multiselect/ui-icon-circle-triangle-s-light.png: rails_admin/multiselect/ui-icon-circle-triangle-s-light-be872b67234f9fbba8ad7b1442ee20fa.png
rails_admin/jquery.colorpicker.js: rails_admin/jquery.colorpicker-3e4bfd61d5898887f4e1f40d114770b0.js
rails_admin/rails_admin.js: rails_admin/rails_admin-47c8211bbe97bd0198612631ceade590.js
rails_admin/rails_admin.js: rails_admin/rails_admin-1868138b8c3bcffc259ee5a1c95a6724.js
rails_admin/base/README: rails_admin/base/README
rails_admin/custom/README: rails_admin/custom/README
rails_admin/jquery.colorpicker.css: rails_admin/jquery.colorpicker-abec8b04315eef26dca1e44d4070c4a1.css

File diff suppressed because one or more lines are too long

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 591 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 495 KiB

After

Width:  |  Height:  |  Size: 279 KiB

View File

@ -16,14 +16,6 @@ class InfoWindowControllerTest < ActionController::TestCase
assert_response :success
assert_template 'users/thank_you'
assert_select 'h2', 'Thank you for adopting this hydrant!'
assert_select 'form#edit_profile_form' do
assert_select '[action=?]', '/users/edit'
assert_select '[method=?]', 'get'
end
assert_select 'input[name="commit"]' do
assert_select '[type=?]', 'submit'
assert_select '[value=?]', 'Edit profile'
end
assert_select 'form#abandon_form' do
assert_select '[action=?]', "/things"
assert_select '[method=?]', 'post'
@ -36,14 +28,6 @@ class InfoWindowControllerTest < ActionController::TestCase
assert_select '[type=?]', 'submit'
assert_select '[value=?]', 'Abandon this hydrant'
end
assert_select 'form#sign_out_form' do
assert_select '[action=?]', '/info_window'
assert_select '[method=?]', 'post'
end
assert_select 'input[name="commit"]' do
assert_select '[type=?]', 'submit'
assert_select '[value=?]', 'Sign out'
end
end
test 'should show the profile if the hydrant is adopted' do
@ -75,37 +59,14 @@ class InfoWindowControllerTest < ActionController::TestCase
assert_select '[type=?]', 'submit'
assert_select '[value=?]', 'Adopt!'
end
assert_select 'form#edit_profile_form' do
assert_select '[action=?]', '/users/edit'
assert_select '[method=?]', 'get'
end
assert_select 'input[name="commit"]' do
assert_select '[type=?]', 'submit'
assert_select '[value=?]', 'Edit profile'
end
assert_select 'form#sign_out_form' do
assert_select '[action=?]', '/info_window'
assert_select '[method=?]', 'post'
end
assert_select 'input[name="commit"]' do
assert_select '[type=?]', 'submit'
assert_select '[value=?]', 'Sign out'
end
end
test 'should show sign-in form if signed out' do
get :index, :thing_id => @thing.id
assert_not_nil assigns :thing
assert_response :success
assert_template 'sessions/new'
assert_select 'form#combo_form' do
assert_select '[action=?]', '/info_window'
assert_select '[method=?]', 'post'
end
assert_select 'h2', 'Adopt this Hydrant'
assert_select 'input', :count => 15
assert_select 'label', :count => 10
assert_select 'input[name="commit"]', :count => 3
assert_template 'users/sign_in'
assert_select 'h2', 'Sign in to adopt this Hydrant'
end
test 'should show terms of service' do

View File

@ -1,11 +1,24 @@
require 'test_helper'
class MainControllerTest < ActionController::TestCase
include Devise::TestHelpers
setup do
request.env["devise.mapping"] = Devise.mappings[:user]
@user = users(:erik)
end
test 'should return the home page' do
get :index
assert_response :success
assert_select 'title', 'Adopt-a-Hydrant'
assert_select 'p#tagline', 'Claim responsibility for shoveling out a fire hydrant after it snows.'
end
test 'should show search form when signed in' do
sign_in @user
get :index
assert_response :success
assert_select 'form' do
assert_select '[action=?]', '/'
assert_select '[method=?]', 'post'
@ -20,6 +33,6 @@ class MainControllerTest < ActionController::TestCase
assert_select '[type=?]', 'submit'
assert_select '[value=?]', 'Find hydrants'
end
assert_select 'div#map_canvas', true
assert_select 'div#map', true
end
end

View File

@ -7,18 +7,9 @@ class SessionsControllerTest < ActionController::TestCase
@user = users(:erik)
end
test 'should render combo form' do
test 'should redirect to root path' do
get :new
assert_response :success
assert_template :new
assert_select 'form#combo_form' do
assert_select '[action=?]', '/users/sign_in'
assert_select '[method=?]', 'post'
end
assert_select 'h2', 'Adopt this Hydrant'
assert_select 'input', :count => 15
assert_select 'label', :count => 10
assert_select 'input[name="commit"]', :count => 3
assert_response :redirect
end
test 'should redirect if user is already authenticated' do

View File

@ -7,16 +7,14 @@ class UsersControllerTest < ActionController::TestCase
@user = users(:erik)
end
test 'should render info window' do
test 'should render edit form' do
sign_in @user
get :edit
assert_response :success
assert_select 'div#info_window', true
assert_select 'form#edit_form' do
assert_select '[action=?]', '/users'
assert_select '[method=?]', 'post'
end
assert_select 'h2', 'Edit your Profile'
assert_select 'input', :count => 14
assert_select 'label', :count => 7
assert_select 'input[name="commit"]' do
@ -24,7 +22,7 @@ class UsersControllerTest < ActionController::TestCase
assert_select '[value=?]', 'Update'
end
assert_select 'form#back_form' do
assert_select '[action=?]', '/info_window'
assert_select '[action=?]', '/'
assert_select '[method=?]', 'get'
end
assert_select 'input[name="commit"]' do
@ -40,7 +38,7 @@ class UsersControllerTest < ActionController::TestCase
@user.reload
assert_equal @user.name, 'New Name'
assert_response :redirect
assert_redirected_to :controller => 'info_window', :action => 'index'
assert_redirected_to :controller => 'sidebar', :action => 'search'
end
test 'should return error if password is incorrect' do