Refactor in preparation for Bootstrap 2.0

This commit is contained in:
Erik Michaels-Ober 2012-01-14 14:31:01 -08:00
parent 7dc7e2a4a3
commit 0d45efac05
28 changed files with 396 additions and 342 deletions

View File

@ -11,11 +11,6 @@ gem 'rails_admin', :git => 'git://github.com/sferik/rails_admin.git'
gem 'rack-contrib' gem 'rack-contrib'
gem 'validates_formatting_of' gem 'validates_formatting_of'
platforms :jruby do
gem 'jruby-openssl'
gem 'therubyrhino'
end
platforms :ruby_18 do platforms :ruby_18 do
gem 'fastercsv' gem 'fastercsv'
end end

View File

@ -48,10 +48,8 @@ GEM
arel (3.0.0) arel (3.0.0)
bbenezech-nested_form (0.0.2) bbenezech-nested_form (0.0.2)
bcrypt-ruby (3.0.1) bcrypt-ruby (3.0.1)
bcrypt-ruby (3.0.1-java)
bootstrap-sass (1.4.3) bootstrap-sass (1.4.3)
sass-rails (~> 3.1) sass-rails (~> 3.1)
bouncy-castle-java (1.5.0146.1)
builder (3.0.0) builder (3.0.0)
coffee-rails (3.2.1) coffee-rails (3.2.1)
coffee-script (>= 2.2.0) coffee-script (>= 2.2.0)
@ -68,7 +66,6 @@ GEM
warden (~> 1.1) warden (~> 1.1)
erubis (2.7.0) erubis (2.7.0)
eventmachine (0.12.10) eventmachine (0.12.10)
eventmachine (0.12.10-java)
execjs (1.2.13) execjs (1.2.13)
multi_json (~> 1.0) multi_json (~> 1.0)
fastercsv (1.5.4) fastercsv (1.5.4)
@ -76,16 +73,12 @@ GEM
haml (3.2.0.alpha.10) haml (3.2.0.alpha.10)
hike (1.2.1) hike (1.2.1)
hpricot (0.8.5) hpricot (0.8.5)
hpricot (0.8.5-java)
i18n (0.6.0) i18n (0.6.0)
journey (1.0.0) journey (1.0.0)
jquery-rails (2.0.0) jquery-rails (2.0.0)
railties (>= 3.2.0.beta, < 5.0) railties (>= 3.2.0.beta, < 5.0)
thor (~> 0.14) thor (~> 0.14)
jruby-openssl (0.7.4)
bouncy-castle-java
json (1.6.5) json (1.6.5)
json (1.6.5-java)
kaminari (0.13.0) kaminari (0.13.0)
actionpack (>= 3.0.0) actionpack (>= 3.0.0)
activesupport (>= 3.0.0) activesupport (>= 3.0.0)
@ -144,7 +137,6 @@ GEM
rack (~> 1.0) rack (~> 1.0)
tilt (~> 1.1, != 1.3.0) tilt (~> 1.1, != 1.3.0)
sqlite3 (1.3.5) sqlite3 (1.3.5)
therubyrhino (1.73.0)
thin (1.3.1) thin (1.3.1)
daemons (>= 1.0.9) daemons (>= 1.0.9)
eventmachine (>= 0.12.6) eventmachine (>= 0.12.6)
@ -167,7 +159,6 @@ GEM
crack (>= 0.1.7) crack (>= 0.1.7)
PLATFORMS PLATFORMS
java
ruby ruby
DEPENDENCIES DEPENDENCIES
@ -176,14 +167,12 @@ DEPENDENCIES
fastercsv fastercsv
geokit geokit
haml (~> 3.2.0.alpha) haml (~> 3.2.0.alpha)
jruby-openssl
pg pg
rack-contrib rack-contrib
rails (~> 3.2.0.rc2) rails (~> 3.2.0.rc2)
rails_admin! rails_admin!
simplecov simplecov
sqlite3 sqlite3
therubyrhino
thin thin
uglifier uglifier
validates_formatting_of validates_formatting_of

View File

@ -1,30 +1,37 @@
$(function() { $(function() {
var center = new google.maps.LatLng(42.358431, -71.059773); var center = new google.maps.LatLng(42.358431, -71.059773);
var zoomLevel = 15;
var mapOptions = { var mapOptions = {
center: center, center: center,
disableDoubleClickZoom: true,
keyboardShortcuts: false,
mapTypeControl: false, mapTypeControl: false,
mapTypeId: google.maps.MapTypeId.ROADMAP, mapTypeId: google.maps.MapTypeId.ROADMAP,
panControl: false, panControl: false,
rotateControl: false,
scaleControl: false,
scrollwheel: false, scrollwheel: false,
zoom: zoomLevel, streetViewControl: true,
zoom: 15,
zoomControl: false zoomControl: false
}; };
var map = new google.maps.Map(document.getElementById("map"), mapOptions); var map = new google.maps.Map(document.getElementById("map"), mapOptions);
var size = new google.maps.Size(27.0, 37.0);
var origin = new google.maps.Point(0, 0);
var anchor = new google.maps.Point(13.0, 18.0);
var greenMarkerImage = new google.maps.MarkerImage('<%= image_path 'markers/green.png' %>', var greenMarkerImage = new google.maps.MarkerImage('<%= image_path 'markers/green.png' %>',
new google.maps.Size(27.0, 37.0), size,
new google.maps.Point(0, 0), origin,
new google.maps.Point(13.0, 18.0) anchor
); );
var redMarkerImage = new google.maps.MarkerImage('<%= image_path 'markers/red.png' %>', var redMarkerImage = new google.maps.MarkerImage('<%= image_path 'markers/red.png' %>',
new google.maps.Size(27.0, 37.0), size,
new google.maps.Point(0, 0), origin,
new google.maps.Point(13.0, 18.0) anchor
); );
var markerShadowImage = new google.maps.MarkerImage('<%= image_path 'markers/shadow.png' %>', var markerShadowImage = new google.maps.MarkerImage('<%= image_path 'markers/shadow.png' %>',
new google.maps.Size(46.0, 37.0), new google.maps.Size(46.0, 37.0),
new google.maps.Point(0, 0), origin,
new google.maps.Point(13.0, 18.0) anchor
); );
var activeThingId; var activeThingId;
var activeMarker; var activeMarker;
@ -49,7 +56,7 @@ $(function() {
activeInfoWindow.close(); activeInfoWindow.close();
} }
var infoWindow = new google.maps.InfoWindow({ var infoWindow = new google.maps.InfoWindow({
maxWidth: 232 maxWidth: 210
}); });
google.maps.event.addListener(infoWindow, 'closeclick', function() { google.maps.event.addListener(infoWindow, 'closeclick', function() {
isWindowOpen = false; isWindowOpen = false;
@ -93,8 +100,7 @@ $(function() {
success: function(data) { success: function(data) {
$(submitButton).attr("disabled", false); $(submitButton).attr("disabled", false);
if(data.errors) { if(data.errors) {
$('#address_label').addClass('error', 500); $('#address').parent().addClass('error');
$('#address').addClass('error', 500);
$('#address').focus(); $('#address').focus();
} else { } else {
$('#address_label').removeClass('error', 500); $('#address_label').removeClass('error', 500);
@ -117,7 +123,7 @@ $(function() {
addMarker(thing.id, point, color); addMarker(thing.id, point, color);
}, i * 100); }, i * 100);
}); });
map.setZoom(18); map.setZoom(19);
} }
} }
}); });
@ -131,8 +137,7 @@ $(function() {
$(submitButton).attr("disabled", true); $(submitButton).attr("disabled", true);
if($('#address').val() === '') { if($('#address').val() === '') {
$(submitButton).attr("disabled", false); $(submitButton).attr("disabled", false);
$('#address_label').addClass('error', 500); $('#address').parent().addClass('error');
$('#address').addClass('error', 500);
$('#address').focus(); $('#address').focus();
} else { } else {
$.ajax({ $.ajax({
@ -146,15 +151,13 @@ $(function() {
}, },
error: function(jqXHR) { error: function(jqXHR) {
$(submitButton).attr("disabled", false); $(submitButton).attr("disabled", false);
$('#address_label').addClass('error', 500); $('#address').parent().addClass('error');
$('#address').addClass('error', 500);
$('#address').focus(); $('#address').focus();
}, },
success: function(data) { success: function(data) {
$(submitButton).attr("disabled", false); $(submitButton).attr("disabled", false);
if(data.errors) { if(data.errors) {
$('#address_label').addClass('error', 500); $('#address').parent().addClass('error');
$('#address').addClass('error', 500);
$('#address').focus(); $('#address').focus();
} else { } else {
$('#address_label').removeClass('error', 500); $('#address_label').removeClass('error', 500);
@ -214,28 +217,22 @@ $(function() {
var errors = [] var errors = []
if(!/[\w\.%\+\]+@[\w\]+\.+[\w]{2,}/.test($('#user_email').val())) { if(!/[\w\.%\+\]+@[\w\]+\.+[\w]{2,}/.test($('#user_email').val())) {
errors.push($('#user_email')); errors.push($('#user_email'));
$('#user_email_label').addClass('error', 500); $('#user_email').parent().addClass('error');
$('#user_email').addClass('error', 500);
} else { } else {
$('#user_email_label').removeClass('error'); $('#user_email').parent().removeClass('error');
$('#user_email').removeClass('error');
} }
if(!$(this).data('state') || $(this).data('state') === 'user_sign_up') { if(!$(this).data('state') || $(this).data('state') === 'user_sign_up') {
if($('#user_name').val() === '') { if($('#user_name').val() === '') {
errors.push($('#user_name')); errors.push($('#user_name'));
$('#user_name_label').addClass('error', 500); $('#user_name').parent().addClass('error');
$('#user_name').addClass('error', 500);
} else { } else {
$('#user_name_label').removeClass('error'); $('#user_name').parent().removeClass('error');
$('#user_name').removeClass('error');
} }
if($('#user_password_confirmation').val().length < 6 || $('#user_password_confirmation').val().length > 20) { if($('#user_password_confirmation').val().length < 6 || $('#user_password_confirmation').val().length > 20) {
errors.push($('#user_password_confirmation')); errors.push($('#user_password_confirmation'));
$('#user_password_confirmation_label').addClass('error', 500); $('#user_password_confirmation').parent().addClass('error');
$('#user_password_confirmation').addClass('error', 500);
} else { } else {
$('#user_password_confirmation_label').removeClass('error'); $('#user_password_confirmation').parent().removeClass('error');
$('#user_password_confirmation').removeClass('error');
} }
if(errors.length > 0) { if(errors.length > 0) {
$(submitButton).attr("disabled", false); $(submitButton).attr("disabled", false);
@ -262,33 +259,27 @@ $(function() {
$(submitButton).attr("disabled", false); $(submitButton).attr("disabled", false);
if(data.errors.email) { if(data.errors.email) {
errors.push($('#user_email')); errors.push($('#user_email'));
$('#user_email_label').addClass('error', 500); $('#user_email').parent().addClass('error');
$('#user_email').addClass('error', 500);
} }
if(data.errors.name) { if(data.errors.name) {
errors.push($('#user_name')); errors.push($('#user_name'));
$('#user_name_label').addClass('error', 500); $('#user_name').parent().addClass('error');
$('#user_name').addClass('error', 500);
} }
if(data.errors.organization) { if(data.errors.organization) {
errors.push($('#user_organization')); errors.push($('#user_organization'));
$('#user_organization_label').addClass('error', 500); $('#user_organization').parent().addClass('error');
$('#user_organization').addClass('error', 500);
} }
if(data.errors.voice_number) { if(data.errors.voice_number) {
errors.push($('#user_voice_number')); errors.push($('#user_voice_number'));
$('#user_voice_number_label').addClass('error', 500); $('#user_voice_number').parent().addClass('error');
$('#user_voice_number').addClass('error', 500);
} }
if(data.errors.sms_number) { if(data.errors.sms_number) {
errors.push($('#user_sms_number')); errors.push($('#user_sms_number'));
$('#user_sms_number_label').addClass('error', 500); $('#user_sms_number').parent().addClass('error');
$('#user_sms_number').addClass('error', 500);
} }
if(data.errors.password) { if(data.errors.password) {
errors.push($('#user_password_confirmation')); errors.push($('#user_password_confirmation'));
$('#user_password_confirmation_label').addClass('error', 500); $('#user_password_confirmation').parent().addClass('error');
$('#user_password_confirmation').addClass('error', 500);
} }
errors[0].focus(); errors[0].focus();
}, },
@ -311,11 +302,9 @@ $(function() {
} else if($(this).data('state') === 'user_sign_in') { } else if($(this).data('state') === 'user_sign_in') {
if($('#user_password').val().length < 6 || $('#user_password').val().length > 20) { if($('#user_password').val().length < 6 || $('#user_password').val().length > 20) {
errors.push($('#user_password')); errors.push($('#user_password'));
$('#user_password_label').addClass('error', 500); $('#user_password').parent().addClass('error');
$('#user_password').addClass('error', 500);
} else { } else {
$('#user_password_label').removeClass('error'); $('#user_password').parent().removeClass('error');
$('#user_password').removeClass('error');
} }
if(errors.length > 0) { if(errors.length > 0) {
$(submitButton).attr("disabled", false); $(submitButton).attr("disabled", false);
@ -335,8 +324,7 @@ $(function() {
}, },
error: function(jqXHR) { error: function(jqXHR) {
$(submitButton).attr("disabled", false); $(submitButton).attr("disabled", false);
$('#user_password_label').addClass('error', 500); $('#user_password').parent().addClass('error');
$('#user_password').addClass('error', 500);
$('#user_password').focus(); $('#user_password').focus();
}, },
success: function(data) { success: function(data) {
@ -372,8 +360,7 @@ $(function() {
}, },
error: function(jqXHR) { error: function(jqXHR) {
$(submitButton).attr("disabled", false); $(submitButton).attr("disabled", false);
$('#user_email_label').addClass('error', 500); $('#user_email').parent().addClass('error');
$('#user_email').addClass('error', 500);
$('#user_email').focus(); $('#user_email').focus();
}, },
success: function() { success: function() {
@ -402,13 +389,7 @@ $(function() {
'name': $('#thing_name').val() 'name': $('#thing_name').val()
} }
}, },
beforeSend: function() {
$('#info_window').hide();
$('#loader').show();
},
error: function(jqXHR) { error: function(jqXHR) {
$('#loader').hide();
$('#info_window').show();
$(submitButton).attr("disabled", false); $(submitButton).attr("disabled", false);
}, },
success: function(data) { success: function(data) {
@ -422,7 +403,9 @@ $(function() {
} }
}, },
success: function(data) { success: function(data) {
activeInfoWindow.close();
activeInfoWindow.setContent(data); activeInfoWindow.setContent(data);
activeInfoWindow.open(map, activeMarker);
activeMarker.setIcon(greenMarkerImage); activeMarker.setIcon(greenMarkerImage);
activeMarker.setAnimation(google.maps.Animation.BOUNCE); activeMarker.setAnimation(google.maps.Animation.BOUNCE);
} }
@ -449,13 +432,7 @@ $(function() {
'name': $('#thing_name').val() 'name': $('#thing_name').val()
} }
}, },
beforeSend: function() {
$('#info_window').hide();
$('#loader').show();
},
error: function(jqXHR) { error: function(jqXHR) {
$('#loader').hide();
$('#info_window').show();
$(submitButton).attr("disabled", false); $(submitButton).attr("disabled", false);
}, },
success: function(data) { success: function(data) {
@ -469,7 +446,9 @@ $(function() {
} }
}, },
success: function(data) { success: function(data) {
activeInfoWindow.close();
activeInfoWindow.setContent(data); activeInfoWindow.setContent(data);
activeInfoWindow.open(map, activeMarker);
activeMarker.setIcon(redMarkerImage); activeMarker.setIcon(redMarkerImage);
activeMarker.setAnimation(null); activeMarker.setAnimation(null);
} }
@ -479,18 +458,14 @@ $(function() {
} }
return false; return false;
}); });
$('#edit_profile_form').live('submit', function() { $('#edit_profile_link').live('click', function() {
var submitButton = $("#edit_profile_form input[type='submit']"); var link = $(this);
$(submitButton).attr("disabled", true); $(link).addClass('disabled');
$.ajax({ $.ajax({
type: 'GET', type: 'GET',
url: '/users/edit', url: '/users/edit',
data: {
'utf8': '✓',
'authenticity_token': $('#edit_profile_form input[name="authenticity_token"]').val()
},
error: function(jqXHR) { error: function(jqXHR) {
$(submitButton).attr("disabled", false); $(link).removeClass('disabled');
}, },
success: function(data) { success: function(data) {
$('#content').html(data); $('#content').html(data);
@ -504,43 +479,33 @@ $(function() {
var errors = [] var errors = []
if(!/[\w\.%\+\]+@[\w\]+\.+[\w]{2,}/.test($('#user_email').val())) { if(!/[\w\.%\+\]+@[\w\]+\.+[\w]{2,}/.test($('#user_email').val())) {
errors.push($('#user_email')); errors.push($('#user_email'));
$('#user_email_label').addClass('error', 500); $('#user_email').parent().addClass('error');
$('#user_email').addClass('error', 500);
} else { } else {
$('#user_email_label').removeClass('error'); $('#user_email').parent().removeClass('error');
$('#user_email').removeClass('error');
} }
if($('#user_name').val() === '') { if($('#user_name').val() === '') {
errors.push($('#user_name')); errors.push($('#user_name'));
$('#user_name_label').addClass('error', 500); $('#user_name').parent().addClass('error');
$('#user_name').addClass('error', 500);
} else { } else {
$('#user_name_label').removeClass('error'); $('#user_name').parent().removeClass('error');
$('#user_name').removeClass('error');
} }
if($('#user_zip').val() != '' && !/^\d{5}(-\d{4})?$/.test($('#user_zip').val())) { if($('#user_zip').val() != '' && !/^\d{5}(-\d{4})?$/.test($('#user_zip').val())) {
errors.push($('#user_zip')); errors.push($('#user_zip'));
$('#user_zip_label').addClass('error', 500); $('#user_zip').parent().addClass('error');
$('#user_zip').addClass('error', 500);
} else { } else {
$('#user_zip_label').removeClass('error'); $('#user_zip').parent().removeClass('error');
$('#user_zip').removeClass('error');
} }
if($('#user_password').val() && ($('#user_password').val().length < 6 || $('#user_password').val().length > 20)) { if($('#user_password').val() && ($('#user_password').val().length < 6 || $('#user_password').val().length > 20)) {
errors.push($('#user_password')); errors.push($('#user_password'));
$('#user_password_label').addClass('error', 500); $('#user_password').parent().addClass('error');
$('#user_password').addClass('error', 500);
} else { } else {
$('#user_password_label').removeClass('error'); $('#user_password').parent().removeClass('error');
$('#user_password').removeClass('error');
} }
if($('#user_current_password').val().length < 6 || $('#user_current_password').val().length > 20) { if($('#user_current_password').val().length < 6 || $('#user_current_password').val().length > 20) {
errors.push($('#user_current_password')); errors.push($('#user_current_password'));
$('#user_current_password_label').addClass('error', 500); $('#user_current_password').parent().addClass('error');
$('#user_current_password').addClass('error', 500);
} else { } else {
$('#user_current_password_label').removeClass('error'); $('#user_current_password').parent().removeClass('error');
$('#user_current_password').removeClass('error');
} }
if(errors.length > 0) { if(errors.length > 0) {
$(submitButton).attr("disabled", false); $(submitButton).attr("disabled", false);
@ -576,63 +541,51 @@ $(function() {
$(submitButton).attr("disabled", false); $(submitButton).attr("disabled", false);
if(data.errors.email) { if(data.errors.email) {
errors.push($('#user_email')); errors.push($('#user_email'));
$('#user_email_label').addClass('error', 500); $('#user_email').parent().addClass('error');
$('#user_email').addClass('error', 500);
} }
if(data.errors.name) { if(data.errors.name) {
errors.push($('#user_name')); errors.push($('#user_name'));
$('#user_name_label').addClass('error', 500); $('#user_name').parent().addClass('error');
$('#user_name').addClass('error', 500);
} }
if(data.errors.organization) { if(data.errors.organization) {
errors.push($('#user_organization')); errors.push($('#user_organization'));
$('#user_organization_label').addClass('error', 500); $('#user_organization').parent().addClass('error');
$('#user_organization').addClass('error', 500);
} }
if(data.errors.voice_number) { if(data.errors.voice_number) {
errors.push($('#user_voice_number')); errors.push($('#user_voice_number'));
$('#user_voice_number_label').addClass('error', 500); $('#user_voice_number').parent().addClass('error');
$('#user_voice_number').addClass('error', 500);
} }
if(data.errors.sms_number) { if(data.errors.sms_number) {
errors.push($('#user_sms_number')); errors.push($('#user_sms_number'));
$('#user_sms_number_label').addClass('error', 500); $('#user_sms_number').parent().addClass('error');
$('#user_sms_number').addClass('error', 500);
} }
if(data.errors.address_1) { if(data.errors.address_1) {
errors.push($('#user_address_1')); errors.push($('#user_address_1'));
$('#user_address_1_label').addClass('error', 500); $('#user_address_1').parent().addClass('error');
$('#user_address_1').addClass('error', 500);
} }
if(data.errors.address_2) { if(data.errors.address_2) {
errors.push($('#user_address_2')); errors.push($('#user_address_2'));
$('#user_address_2_label').addClass('error', 500); $('#user_address_2').parent().addClass('error');
$('#user_address_2').addClass('error', 500);
} }
if(data.errors.city) { if(data.errors.city) {
errors.push($('#user_city')); errors.push($('#user_city'));
$('#user_city_label').addClass('error', 500); $('#user_city').parent().addClass('error');
$('#user_city').addClass('error', 500);
} }
if(data.errors.state) { if(data.errors.state) {
errors.push($('#user_state')); errors.push($('#user_state'));
$('#user_state_label').addClass('error', 500); $('#user_state').parent().addClass('error');
$('#user_state').addClass('error', 500);
} }
if(data.errors.zip) { if(data.errors.zip) {
errors.push($('#user_zip')); errors.push($('#user_zip'));
$('#user_zip_label').addClass('error', 500); $('#user_zip').parent().addClass('error');
$('#user_zip').addClass('error', 500);
} }
if(data.errors.password) { if(data.errors.password) {
errors.push($('#user_password')); errors.push($('#user_password'));
$('#user_password_label').addClass('error', 500); $('#user_password').parent().addClass('error');
$('#user_password').addClass('error', 500);
} }
if(data.errors.current_password) { if(data.errors.current_password) {
errors.push($('#user_current_password')); errors.push($('#user_current_password'));
$('#user_current_password_label').addClass('error', 500); $('#user_current_password').parent().addClass('error');
$('#user_current_password').addClass('error', 500);
} }
errors[0].focus(); errors[0].focus();
}, },
@ -643,18 +596,14 @@ $(function() {
} }
return false; return false;
}); });
$('#sign_out_form').live('submit', function() { $('#sign_out_link').live('click', function() {
var submitButton = $("#sign_out_form input[type='submit']"); var link = $(this);
$(submitButton).attr("disabled", true); $(link).addClass('disabled');
$.ajax({ $.ajax({
type: 'GET', type: 'GET',
url: '/users/sign_out.json', url: '/users/sign_out.json',
data: {
'utf8': '✓',
'authenticity_token': $('#sign_out_form input[name="authenticity_token"]').val()
},
error: function(jqXHR) { error: function(jqXHR) {
$(submitButton).attr("disabled", false); $(link).removeClass('disabled');
}, },
success: function(data) { success: function(data) {
$.ajax({ $.ajax({
@ -679,33 +628,25 @@ $(function() {
$.ajax({ $.ajax({
type: 'GET', type: 'GET',
url: '/users/sign_in', url: '/users/sign_in',
data: {
'utf8': '✓',
'authenticity_token': $('#sign_in_form input[name="authenticity_token"]').val(),
},
beforeSend: function() {
$('#info_window').hide();
$('#loader').show();
},
error: function(jqXHR) { error: function(jqXHR) {
$('#loader').hide();
$('#info_window').show();
$(submitButton).attr("disabled", false); $(submitButton).attr("disabled", false);
}, },
success: function(data) { success: function(data) {
activeInfoWindow.close();
activeInfoWindow.setContent(data); activeInfoWindow.setContent(data);
activeInfoWindow.open(map, activeMarker);
} }
}); });
return false; return false;
}); });
$('#back_form').live('submit', function() { $('#back_link').live('click', function() {
var submitButton = $("#back_form input[type='submit']"); var link = $(this);
$(submitButton).attr("disabled", true); $(link).addClass('disabled');
$.ajax({ $.ajax({
type: 'GET', type: 'GET',
url: '/sidebar/search', url: '/sidebar/search',
error: function(jqXHR) { error: function(jqXHR) {
$(submitButton).attr("disabled", false); $(link).removeClass('disabled');
}, },
success: function(data) { success: function(data) {
$('#content').html(data); $('#content').html(data);
@ -728,13 +669,7 @@ $(function() {
'thing_id': activeThingId 'thing_id': activeThingId
} }
}, },
beforeSend: function() {
$('#info_window').hide();
$('#loader').show();
},
error: function(jqXHR) { error: function(jqXHR) {
$('#loader').hide();
$('#info_window').show();
$(submitButton).attr("disabled", false); $(submitButton).attr("disabled", false);
}, },
success: function(data) { success: function(data) {
@ -748,7 +683,9 @@ $(function() {
} }
}, },
success: function(data) { success: function(data) {
activeInfoWindow.close();
activeInfoWindow.setContent(data); activeInfoWindow.setContent(data);
activeInfoWindow.open(map, activeMarker);
} }
}); });
} }

View File

@ -19,12 +19,15 @@ h2 {
} }
form.form-stacked { form.form-stacked {
padding-left: 10px; padding-left: 0;
margin-bottom: 0; margin-bottom: 0;
} }
label, input { form.form-stacked fieldset.control-group {
white-space: nowrap; padding: 0;
}
label {
text-align: left; text-align: left;
} }
@ -32,7 +35,7 @@ input {
width: 200px; width: 200px;
} }
input, select, option, button, input[type="submit"] { .sidebar input, .sidebar select, .sidebar option, .sidebar button, .sidebar form.search-form input, .sidebar form.search-form select, .sidebar form.search-form option, .sidebar a.btn {
display: block; display: block;
margin-bottom: 10px; margin-bottom: 10px;
} }
@ -40,34 +43,110 @@ input, select, option, button, input[type="submit"] {
input[type="radio"], input[type="checkbox"] { input[type="radio"], input[type="checkbox"] {
display: inline; display: inline;
width: auto; width: auto;
margin: 0 10px 10px 0; margin-right: 10px;
} }
input#user_new { input#user_new {
margin-bottom: 0; margin-bottom: 0;
} }
button.btn, input[type="submit"].btn { input#user_existing {
display: block; margin-bottom: 10px;
text-align: center; }
form select, button.btn, input[type="submit"].btn {
width: 210px; width: 210px;
} }
form label.error { /* Copied from Bootstrap 2.0-wip
* Modifications:
* width: 180px
*/
form input.search-query {
-moz-border-radius: 14px;
-webkit-border-radius: 14px;
border-radius: 14px;
margin-bottom: 0;
padding-left: 14px;
padding-right: 14px;
width: 180px;
}
p {
padding: 0 10px;
}
a.btn {
width: 180px;
}
/* Copied from Bootstrap 2.0-wip */
.control-group.error > label, .control-group.error .help-block, .control-group.error .help-inline {
color: #b94a48; color: #b94a48;
} }
form input.error, form textarea.error { .control-group.error input, .control-group.error textarea {
color: #b94a48;
border-color: #ee5f5b; border-color: #ee5f5b;
} }
form input.error:focus, form textarea.error:focus { .control-group.error input:focus, .control-group.error textarea:focus {
border-color: #e9322d; border-color: #e9322d;
-webkit-box-shadow: 0 0 6px #f8b9b7; -webkit-box-shadow: 0 0 6px #f8b9b7;
-moz-box-shadow: 0 0 6px #f8b9b7; -moz-box-shadow: 0 0 6px #f8b9b7;
box-shadow: 0 0 6px #f8b9b7; box-shadow: 0 0 6px #f8b9b7;
} }
.control-group.error .input-prepend .add-on, .control-group.error .input-append .add-on {
color: #b94a48;
background-color: #fce6e6;
border-color: #b94a48;
}
.control-group.warning > label, .control-group.warning .help-block, .control-group.warning .help-inline {
color: #c09853;
}
.control-group.warning input, .control-group.warning textarea {
color: #c09853;
border-color: #ccae64;
}
.control-group.warning input:focus, .control-group.warning textarea:focus {
border-color: #be9a3f;
-webkit-box-shadow: 0 0 6px #e5d6b1;
-moz-box-shadow: 0 0 6px #e5d6b1;
box-shadow: 0 0 6px #e5d6b1;
}
.control-group.warning .input-prepend .add-on, .control-group.warning .input-append .add-on {
color: #c09853;
background-color: #d2b877;
border-color: #c09853;
}
.control-group.success > label, .control-group.success .help-block, .control-group.success .help-inline {
color: #468847;
}
.control-group.success input, .control-group.success textarea {
color: #468847;
border-color: #57a957;
}
.control-group.success input:focus, .control-group.success textarea:focus {
border-color: #458845;
-webkit-box-shadow: 0 0 6px #9acc9a;
-moz-box-shadow: 0 0 6px #9acc9a;
box-shadow: 0 0 6px #9acc9a;
}
.control-group.success .input-prepend .add-on, .control-group.success .input-append .add-on {
color: #468847;
background-color: #bcddbc;
border-color: #468847;
}
.table { .table {
display: table; display: table;
height: 100%; height: 100%;
@ -84,32 +163,49 @@ form input.error:focus, form textarea.error:focus {
vertical-align: top; vertical-align: top;
} }
.alert-message { .alert-message.block-message {
padding: 8px 12px 8px;
margin-bottom: 10px;
}
.sidebar .alert-message.block-message {
-webkit-border-radius: 0; -webkit-border-radius: 0;
-moz-border-radius: 0; -moz-border-radius: 0;
border-radius: 0; border-radius: 0;
text-align: left; text-align: left;
margin-bottom: 10px; padding-left: 10px;
padding: 8px 20px; }
fieldset {
margin-bottom: 0;
} }
.sidebar { .sidebar {
width: 252px; width: 250px;
border-right: 1px solid #ccc; border-right: 1px solid #ccc;
text-align: center; text-align: center;
} }
.sidebar form.form-stacked { .sidebar fieldset.control-group {
padding-left: 20px; margin-left: 20px;
} }
.sidebar p { /* Copied from Bootstrap 2.0-wip
width: 210px; * Modifications:
* padding-bottom: 10px
* margin-top: 10px
* margin-bottom: 10px
*/
.sidebar fieldset.form-actions {
padding: 17px 20px 10px;
margin-top: 10px;
margin-bottom: 10px;
background-color: #f5f5f5;
border-top: 1px solid #ddd;
} }
.sidebar p#tagline { .sidebar p#tagline {
color: #ffffff; color: #ffffff;
padding: 10px 20px;
background-color: #c43c35; background-color: #c43c35;
background-repeat: repeat-x; background-repeat: repeat-x;
background-image: -khtml-gradient(linear, left top, left bottom, from(#ee5f5b), to(#c43c35)); background-image: -khtml-gradient(linear, left top, left bottom, from(#ee5f5b), to(#c43c35));
@ -119,11 +215,12 @@ form input.error:focus, form textarea.error:focus {
background-image: -webkit-linear-gradient(top, #ee5f5b, #c43c35); background-image: -webkit-linear-gradient(top, #ee5f5b, #c43c35);
background-image: -o-linear-gradient(top, #ee5f5b, #c43c35); background-image: -o-linear-gradient(top, #ee5f5b, #c43c35);
background-image: 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: #c43c35 #c43c35 #882a25;
border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ee5f5b', endColorstr='#c43c35', GradientType=0);
padding: 10px 20px;
text-align: center; text-align: center;
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
} }
.sidebar #logos img { .sidebar #logos img {

View File

@ -2,7 +2,7 @@ class ThingsController < ApplicationController
respond_to :json respond_to :json
def show def show
@things = Thing.find_closest(params[:lat], params[:lng], params[:limit] || 40) @things = Thing.find_closest(params[:lat], params[:lng], params[:limit] || 10)
unless @things.blank? unless @things.blank?
respond_with @things respond_with @things
else else

View File

@ -4,7 +4,7 @@ class Thing < ActiveRecord::Base
belongs_to :user belongs_to :user
has_many :reminders has_many :reminders
def self.find_closest(lat, lng, limit=40) def self.find_closest(lat, lng, limit=10)
query = <<-SQL query = <<-SQL
SELECT *, (3959 * ACOS(COS(RADIANS(?)) * COS(RADIANS(lat)) * COS(radians(lng) - RADIANS(?)) + SIN(RADIANS(?)) * SIN(RADIANS(lat)))) AS distance SELECT *, (3959 * ACOS(COS(RADIANS(?)) * COS(RADIANS(lat)) * COS(radians(lng) - RADIANS(?)) + SIN(RADIANS(?)) * SIN(RADIANS(lat)))) AS distance
FROM things FROM things

View File

@ -1,18 +1,18 @@
- if flash[:notice] - if flash[:notice]
.alert-message.success{:"data-alert" => true} .alert-message.block-message.info.fade.in{:"data-alert" => true}
%a{:class => "close", :href => "#"} %a{:class => "close", :"data-dismiss" => "alert", :href => "#"}
&times; &times;
%p %p
= flash[:notice] = flash[:notice]
- if flash[:warning] - if flash[:warning]
.alert-message.warning{:"data-alert" => true} .alert-message.block-message.warning.fade.in{:"data-alert" => true}
%a{:class => "close", :href => "#"} %a{:class => "close", :"data-dismiss" => "alert", :href => "#"}
&times; &times;
%p %p
= flash[:warning] = flash[:warning]
- if flash[:error] - if flash[:error]
.alert-message.error{:"data-alert" => true} .alert-message.block-message.error.fade.in{:"data-alert" => true}
%a{:class => "close", :href => "#"} %a{:class => "close", :"data-dismiss" => "alert", :href => "#"}
&times; &times;
%p %p
= flash[:error] = flash[:error]

View File

@ -3,18 +3,21 @@
%head %head
%title %title
= t("titles.main", :thing => t("defaults.thing").titleize) = t("titles.main", :thing => t("defaults.thing").titleize)
= stylesheet_link_tag "http://twitter.github.com/bootstrap/1.4.0/bootstrap.min.css" = csrf_meta_tag
= stylesheet_link_tag "screen" %meta{:name => "viewport", :content => "width=800, user-scalable=no"}
= javascript_include_tag "http://maps.google.com/maps/api/js?sensor=false" / HTML5 shim, for IE6-8 support of HTML5 elements
/[if lt IE 9]
= javascript_include_tag "http://html5shim.googlecode.com/svn/trunk/html5.js"
= javascript_include_tag "http://maps.google.com/maps/api/js?sensor=false&language=#{I18n.locale}"
= javascript_include_tag "http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js" = javascript_include_tag "http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"
= javascript_include_tag "http://ajax.googleapis.com/ajax/libs/jqueryui/1/jquery-ui.min.js" = javascript_include_tag "http://ajax.googleapis.com/ajax/libs/jqueryui/1/jquery-ui.min.js"
= javascript_include_tag "http://twitter.github.com/bootstrap/1.4.0/bootstrap-twipsy.min.js" = javascript_include_tag "http://twitter.github.com/bootstrap/1.4.0/bootstrap-twipsy.min.js"
= javascript_include_tag "http://twitter.github.com/bootstrap/1.4.0/bootstrap-alerts.min.js" = javascript_include_tag "http://twitter.github.com/bootstrap/1.4.0/bootstrap-alerts.min.js"
= javascript_include_tag "http://twitter.github.com/bootstrap/1.4.0/bootstrap-modal.min.js" = javascript_include_tag "http://twitter.github.com/bootstrap/1.4.0/bootstrap-modal.min.js"
= javascript_include_tag "main" = javascript_include_tag "main"
= csrf_meta_tag
%meta{:name => "viewport", :content => "width=800, user-scalable=no"}
%script{:type => "text/javascript"} %script{:type => "text/javascript"}
var _gaq=_gaq||[];_gaq.push(["_setAccount","UA-20825280-2"]),_gaq.push(["_setDomainName",".adoptahydrant.org"]),_gaq.push(["_trackPageview"]),function(){var a=document.createElement("script");a.type="text/javascript",a.async=!0,a.src=("https:"==document.location.protocol?"https://ssl":"http://www")+".google-analytics.com/ga.js";var b=document.getElementsByTagName("script")[0];b.parentNode.insertBefore(a,b)}(); var _gaq=_gaq||[];_gaq.push(["_setAccount","UA-20825280-2"]),_gaq.push(["_setDomainName",".adoptahydrant.org"]),_gaq.push(["_trackPageview"]),function(){var a=document.createElement("script");a.type="text/javascript",a.async=!0,a.src=("https:"==document.location.protocol?"https://ssl":"http://www")+".google-analytics.com/ga.js";var b=document.getElementsByTagName("script")[0];b.parentNode.insertBefore(a,b)}();
= stylesheet_link_tag "http://twitter.github.com/bootstrap/1.4.0/bootstrap.min.css"
= stylesheet_link_tag "screen"
%body %body
= yield = yield

View File

@ -1,5 +1,3 @@
#loader{:style => "display: none;"}
= image_tag "ajax-loader.gif"
#info_window #info_window
= render :partial => "layouts/flash", :locals => {:flash => flash} = render :partial => "layouts/flash", :locals => {:flash => flash}
= yield = yield

View File

@ -3,7 +3,7 @@
.table-cell.sidebar .table-cell.sidebar
%h1 %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) = 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 %p.alert-message.block-message#tagline
= t("defaults.tagline") = t("defaults.tagline")
#content #content
= render :partial => "layouts/flash", :locals => {:flash => flash} = render :partial => "layouts/flash", :locals => {:flash => flash}
@ -17,6 +17,7 @@
%a{:href => "http://bostonbuilt.org/"} %a{:href => "http://bostonbuilt.org/"}
= image_tag "logos/boston.png", :alt => t("sponsors.city"), :title => t("sponsors.city") = image_tag "logos/boston.png", :alt => t("sponsors.city"), :title => t("sponsors.city")
#feedback #feedback
%p
%a{:href => URI.escape("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") = t("links.feedback")
.table-cell.map-container .table-cell.map-container

View File

@ -3,7 +3,7 @@
.table-cell.sidebar .table-cell.sidebar
%h1 %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) = 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 %p.alert-message.block-message#tagline
= t("defaults.tagline") = t("defaults.tagline")
#content #content
= render :partial => "sidebar/combo_form" = render :partial => "sidebar/combo_form"

View File

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

View File

@ -1,52 +1,64 @@
= form_for :user, :html => {:id => "combo-form", :class => "form-stacked"} do |f| = form_for :user, :html => {:id => "combo-form", :class => "form-stacked"} do |f|
#common_fields #common_fields
%fieldset.control-group
%label{:for => "user_email", :id => "user_email_label"} %label{:for => "user_email", :id => "user_email_label"}
= t("labels.email") = t("labels.email")
%small %small
= image_tag "lock.png", :class => "lock", :alt => t("captions.private"), :title => t("captions.private") = image_tag "lock.png", :class => "lock", :alt => t("captions.private"), :title => t("captions.private")
= f.email_field "email", :value => params[:user] ? params[:user][:email] : nil = f.email_field "email", :value => params[:user] ? params[:user][:email] : nil
%fieldset.control-group.radio
= f.label "new" , radio_button_tag("user", "new", true).html_safe + t("labels.user_new") = 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") = f.label "existing", radio_button_tag("user", "existing").html_safe + t("labels.user_existing")
#user_sign_up_fields #user_sign_up_fields
%fieldset.control-group
%label{:for => "user_name", :id => "user_name_label"} %label{:for => "user_name", :id => "user_name_label"}
= t("labels.name") = t("labels.name")
%small %small
= t("captions.public") = t("captions.public")
= f.text_field "name" = f.text_field "name"
%fieldset.control-group
%label{:for => "user_organization", :id => "user_organization_label"} %label{:for => "user_organization", :id => "user_organization_label"}
= t("labels.organization") = t("labels.organization")
%small %small
= t("captions.public") = t("captions.public")
= f.text_field "organization" = f.text_field "organization"
%fieldset.control-group
%label{:for => "user_voice_number", :id => "user_voice_number_label"} %label{:for => "user_voice_number", :id => "user_voice_number_label"}
= t("labels.voice_number") = t("labels.voice_number")
%small %small
= image_tag "lock.png", :class => "lock", :alt => t("captions.private"), :title => t("captions.private") = image_tag "lock.png", :class => "lock", :alt => t("captions.private"), :title => t("captions.private")
= f.telephone_field "voice_number", :placeholder => t("defaults.voice_number") = f.telephone_field "voice_number", :placeholder => t("defaults.voice_number")
%fieldset.control-group
%label{:for => "user_sms_number", :id => "user_sms_number_label"} %label{:for => "user_sms_number", :id => "user_sms_number_label"}
= t("labels.sms_number") = t("labels.sms_number")
%small %small
= image_tag "lock.png", :class => "lock", :alt => t("captions.private"), :title => t("captions.private") = image_tag "lock.png", :class => "lock", :alt => t("captions.private"), :title => t("captions.private")
= f.telephone_field "sms_number", :placeholder => t("defaults.sms_number") = f.telephone_field "sms_number", :placeholder => t("defaults.sms_number")
%fieldset.control-group
%label{:for => "user_password_confirmation", :id => "user_password_confirmation_label"} %label{:for => "user_password_confirmation", :id => "user_password_confirmation_label"}
= t("labels.password_choose") = t("labels.password_choose")
%small %small
= image_tag "lock.png", :class => "lock", :alt => t("captions.private"), :title => t("captions.private") = image_tag "lock.png", :class => "lock", :alt => t("captions.private"), :title => t("captions.private")
= f.password_field "password_confirmation" = f.password_field "password_confirmation"
%fieldset.form-actions
= f.submit t("buttons.sign_up"), :class => "btn primary" = f.submit t("buttons.sign_up"), :class => "btn primary"
%p %p
= t("defaults.tos", :tos => link_to(t("titles.tos"), "#", :id => "tos_link", :"data-controls-modal" => "tos")).html_safe = t("defaults.tos", :tos => link_to(t("titles.tos"), "#", :id => "tos_link", :"data-controls-modal" => "tos")).html_safe
#user_sign_in_fields{:style => "display: none;"} #user_sign_in_fields{:style => "display: none;"}
%fieldset.control-group
%label{:for => "user_password", :id => "user_password_label"} %label{:for => "user_password", :id => "user_password_label"}
= t("labels.password") = t("labels.password")
%small %small
= image_tag "lock.png", :class => "lock", :alt => t("captions.private"), :title => t("captions.private") = image_tag "lock.png", :class => "lock", :alt => t("captions.private"), :title => t("captions.private")
= f.password_field "password" = f.password_field "password"
%fieldset.control-group
= f.label "remember_me" , f.check_box("remember_me", :checked => true).html_safe + t("labels.remember_me") = f.label "remember_me" , f.check_box("remember_me", :checked => true).html_safe + t("labels.remember_me")
%fieldset.form-actions
= f.submit t("buttons.sign_in"), :class => "btn primary" = f.submit t("buttons.sign_in"), :class => "btn primary"
%p %p
= link_to t("links.forgot_password"), "#", :id => "user_forgot_password_link" = link_to t("links.forgot_password"), "#", :id => "user_forgot_password_link"
#user_forgot_password_fields{:style => "display: none;"} #user_forgot_password_fields{:style => "display: none;"}
%fieldset.form-actions
= f.submit t("buttons.email_password"), :class => "btn primary" = f.submit t("buttons.email_password"), :class => "btn primary"
%p %p
= link_to t("links.remembered_password"), "#", :id => "user_remembered_password_link" = link_to t("links.remembered_password"), "#", :id => "user_remembered_password_link"

View File

@ -1,14 +1,17 @@
= form_tag "/address", :method => "get", :id => "address_form", :class => "form-stacked" do = form_tag "/address", :method => "get", :id => "address_form", :class => "search-form form-stacked" do
= hidden_field_tag "limit", params[:limit] || 10
%fieldset.control-group
= label_tag "city_state", t("labels.city_state"), :id => "city_state_label" = label_tag "city_state", t("labels.city_state"), :id => "city_state_label"
= select_tag "city_state", "<option value=\"#{t("defaults.city_state")}\" selected=\"selected\">#{t("defaults.city_state")}</option>".html_safe = select_tag "city_state", "<option value=\"#{t("defaults.city_state")}\" selected=\"selected\">#{t("defaults.city_state")}</option>".html_safe
%fieldset.control-group
= label_tag "address", t("labels.address"), :id => "address_label" = label_tag "address", t("labels.address"), :id => "address_label"
= search_field_tag "address", params[:address], :placeholder => [t("defaults.address_1"), t("defaults.neighborhood")].join(", ") = search_field_tag "address", params[:address], :placeholder => [t("defaults.address_1"), t("defaults.neighborhood")].join(", "), :class => "search-query"
= hidden_field_tag "limit", params[:limit] || 40 %fieldset.form-actions
= submit_tag t("buttons.find", :thing => t("defaults.thing").pluralize), :class => "btn primary" = 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| %a{:href => edit_user_registration_path, :id => "edit_profile_link", :class => "btn"}
= f.submit t("buttons.edit_profile"), :class => "btn" = t("buttons.edit_profile")
= form_for :sign_out, :html => {:id => "sign_out_form", :class => "form-stacked"} do |f| %a{:href => destroy_user_session_path, :id => "sign_out_link", :class => "btn danger"}
= f.submit t("buttons.sign_out"), :class => "btn danger" = t("buttons.sign_out")
:javascript :javascript
$(function() { $(function() {
$('#address').focus(); $('#address').focus();

View File

@ -1,6 +1,6 @@
.modal.hide.fade#tos .modal.hide.fade#tos
.modal-header .modal-header
%a{:class => "close", :href => "#"} %a{:class => "close", :"data-dismiss" => "modal", :href => "#"}
&times; &times;
%h2 %h2
= t("titles.tos") = t("titles.tos")

View File

@ -1,69 +1,81 @@
= form_for resource, :as => resource_name, :url => registration_path(resource_name), :html => {:id => "edit_form", :class => "form-stacked", :method => :put} do |f| = 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" = f.hidden_field "id"
%fieldset.control-group
%label{:for => "user_email", :id => "user_email_label"} %label{:for => "user_email", :id => "user_email_label"}
= t("labels.email") = t("labels.email")
%small %small
= image_tag "lock.png", :class => "lock", :alt => t("captions.private"), :title => t("captions.private") = image_tag "lock.png", :class => "lock", :alt => t("captions.private"), :title => t("captions.private")
= f.email_field "email" = f.email_field "email"
%fieldset.control-group
%label{:for => "user_name", :id => "user_name_label"} %label{:for => "user_name", :id => "user_name_label"}
= t("labels.name") = t("labels.name")
%small %small
= t("captions.public") = t("captions.public")
= f.text_field "name" = f.text_field "name"
%fieldset.control-group
%label{:for => "user_organization", :id => "user_organization_label"} %label{:for => "user_organization", :id => "user_organization_label"}
= t("labels.organization") = t("labels.organization")
%small %small
= t("captions.public") = t("captions.public")
= f.text_field "organization" = f.text_field "organization"
%fieldset.control-group
%label{:for => "user_voice_number", :id => "user_voice_number_label"} %label{:for => "user_voice_number", :id => "user_voice_number_label"}
= t("labels.voice_number") = t("labels.voice_number")
%small %small
= image_tag "lock.png", :class => "lock", :alt => t("captions.private"), :title => t("captions.private") = image_tag "lock.png", :class => "lock", :alt => t("captions.private"), :title => t("captions.private")
= f.telephone_field "voice_number", :placeholder => t("defaults.voice_number"), :value => number_to_phone(f.object.voice_number) = f.telephone_field "voice_number", :placeholder => t("defaults.voice_number"), :value => number_to_phone(f.object.voice_number)
%fieldset.control-group
%label{:for => "user_sms_number", :id => "user_sms_number_label"} %label{:for => "user_sms_number", :id => "user_sms_number_label"}
= t("labels.sms_number") = t("labels.sms_number")
%small %small
= image_tag "lock.png", :class => "lock", :alt => t("captions.private"), :title => t("captions.private") = image_tag "lock.png", :class => "lock", :alt => t("captions.private"), :title => t("captions.private")
= f.telephone_field "sms_number", :placeholder => t("defaults.sms_number"), :value => number_to_phone(f.object.sms_number) = f.telephone_field "sms_number", :placeholder => t("defaults.sms_number"), :value => number_to_phone(f.object.sms_number)
%fieldset.control-group
%label{:for => "user_address_1", :id => "user_address_1_label"} %label{:for => "user_address_1", :id => "user_address_1_label"}
= t("labels.address_1") = t("labels.address_1")
%small %small
= image_tag "lock.png", :class => "lock", :alt => t("captions.private"), :title => t("captions.private") = image_tag "lock.png", :class => "lock", :alt => t("captions.private"), :title => t("captions.private")
= f.text_field "address_1", :placeholder => t("defaults.address_1") = f.text_field "address_1", :placeholder => t("defaults.address_1")
%fieldset.control-group
%label{:for => "user_address_2", :id => "user_address_2_label"} %label{:for => "user_address_2", :id => "user_address_2_label"}
= t("labels.address_2") = t("labels.address_2")
%small %small
= image_tag "lock.png", :class => "lock", :alt => t("captions.private"), :title => t("captions.private") = image_tag "lock.png", :class => "lock", :alt => t("captions.private"), :title => t("captions.private")
= f.text_field "address_2", :placeholder => t("defaults.address_2") = f.text_field "address_2", :placeholder => t("defaults.address_2")
%fieldset.control-group
%label{:for => "user_city", :id => "user_city_label"} %label{:for => "user_city", :id => "user_city_label"}
= t("labels.city") = t("labels.city")
%small %small
= image_tag "lock.png", :class => "lock", :alt => t("captions.private"), :title => t("captions.private") = image_tag "lock.png", :class => "lock", :alt => t("captions.private"), :title => t("captions.private")
= f.text_field "city", :placeholder => t("defaults.city") = f.text_field "city", :placeholder => t("defaults.city")
%fieldset.control-group
%label{:for => "user_state", :id => "user_state_label"} %label{:for => "user_state", :id => "user_state_label"}
= t("labels.state") = t("labels.state")
%small %small
= image_tag "lock.png", :class => "lock", :alt => t("captions.private"), :title => t("captions.private") = image_tag "lock.png", :class => "lock", :alt => t("captions.private"), :title => t("captions.private")
= f.select "state", us_states, :include_blank => true = f.select "state", us_states, :include_blank => true
%fieldset.control-group
%label{:for => "user_zip", :id => "user_zip_label"} %label{:for => "user_zip", :id => "user_zip_label"}
= t("labels.zip") = t("labels.zip")
%small %small
= image_tag "lock.png", :class => "lock", :alt => t("captions.private"), :title => t("captions.private") = image_tag "lock.png", :class => "lock", :alt => t("captions.private"), :title => t("captions.private")
= f.text_field "zip", :placeholder => t("defaults.zip") = f.text_field "zip", :placeholder => t("defaults.zip")
%fieldset.control-group
%label{:for => "user_password", :id => "user_password_label"} %label{:for => "user_password", :id => "user_password_label"}
= t("labels.password_new") = t("labels.password_new")
%small %small
= t("captions.optional") = t("captions.optional")
= f.password_field "password" = f.password_field "password"
%fieldset.control-group
%label{:for => "user_current_password", :id => "user_current_password_label"} %label{:for => "user_current_password", :id => "user_current_password_label"}
= t("labels.current_password") = t("labels.current_password")
%small %small
= t("captions.required") = t("captions.required")
= f.password_field "current_password" = f.password_field "current_password"
%fieldset.form-actions
= f.submit t("buttons.update"), :class => "btn primary" = 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| %a{:href => root_path, :id => "back_link", :class => "btn"}
= f.hidden_field "id" = t("buttons.back")
= f.submit t("buttons.back"), :class => "btn"
:javascript :javascript
$(function() { $(function() {
$('#user_email').focus(); $('#user_email').focus();

View File

@ -2,4 +2,5 @@
= f.hidden_field "id" = f.hidden_field "id"
= f.hidden_field "user_id", :value => "" = f.hidden_field "user_id", :value => ""
= f.hidden_field "name", :value => "" = f.hidden_field "name", :value => ""
%fieldset.form-actions
= f.submit t("buttons.abandon", :thing => t("defaults.thing")), :class => "btn danger" = f.submit t("buttons.abandon", :thing => t("defaults.thing")), :class => "btn danger"

View File

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

View File

@ -2,4 +2,5 @@
= f.hidden_field "from_user_id", :value => current_user.id = f.hidden_field "from_user_id", :value => current_user.id
= f.hidden_field "to_user_id", :value => @thing.user.id = f.hidden_field "to_user_id", :value => @thing.user.id
= f.hidden_field "thing_id", :value => @thing.id = f.hidden_field "thing_id", :value => @thing.id
%fieldset.form-actions
= f.submit t("buttons.send_reminder"), :class => "btn" = f.submit t("buttons.send_reminder"), :class => "btn"

View File

@ -11,3 +11,6 @@ development: &DEVELOPMENT
test: test:
<<: *DEVELOPMENT <<: *DEVELOPMENT
database: adopt_a_thing_test database: adopt_a_thing_test
production:
<<: *DEVELOPMENT

View File

@ -6,6 +6,7 @@ de:
adopt: "Adopt!" adopt: "Adopt!"
back: "Zurück" back: "Zurück"
change_password: "Mein Passwort ändern" change_password: "Mein Passwort ändern"
close: "Schließen"
edit_profile: "Profil bearbeiten" edit_profile: "Profil bearbeiten"
email_password: "Bitte schicken Sie mir mein Passwort" email_password: "Bitte schicken Sie mir mein Passwort"
find: "Finden Sie %{thing}" find: "Finden Sie %{thing}"

View File

@ -6,6 +6,7 @@ en:
adopt: "Adopt!" adopt: "Adopt!"
back: "Back" back: "Back"
change_password: "Change my password" change_password: "Change my password"
close: "Close"
edit_profile: "Edit profile" edit_profile: "Edit profile"
email_password: "Email me my password" email_password: "Email me my password"
find: "Find %{thing}" find: "Find %{thing}"

View File

@ -6,6 +6,7 @@ es:
adopt: "Adoptar!" adopt: "Adoptar!"
back: "De nuevo" back: "De nuevo"
change_password: "Cambiar mi contraseña" change_password: "Cambiar mi contraseña"
close: "Cerca"
edit_profile: "Editar perfil" edit_profile: "Editar perfil"
email_password: "Correo electrónico mi contraseña" email_password: "Correo electrónico mi contraseña"
find: "Encontrar %{thing}" find: "Encontrar %{thing}"

View File

@ -6,6 +6,7 @@ fr:
adopt: "Adopter!" adopt: "Adopter!"
back: "Retour" back: "Retour"
change_password: "Changer mon mot de passe" change_password: "Changer mon mot de passe"
close: "Fermer"
edit_profile: "Modifier le profil" edit_profile: "Modifier le profil"
email_password: "Envoyez-moi mon mot de passe" email_password: "Envoyez-moi mon mot de passe"
find: "Trouver %{thing}" find: "Trouver %{thing}"

View File

@ -6,6 +6,7 @@ pt:
adopt: "Adote!" adopt: "Adote!"
back: "De volta" back: "De volta"
change_password: "Alterar a minha senha" change_password: "Alterar a minha senha"
close: "Fechar"
edit_profile: "Editar perfil" edit_profile: "Editar perfil"
email_password: "E-mail minha senha" email_password: "E-mail minha senha"
find: "Encontrar %{thing}" find: "Encontrar %{thing}"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 276 KiB

After

Width:  |  Height:  |  Size: 219 KiB

View File

@ -20,8 +20,8 @@ class MainControllerTest < ActionController::TestCase
get :index get :index
assert_response :success assert_response :success
assert_select 'form' do assert_select 'form' do
assert_select '[action=?]', '/' assert_select '[action=?]', '/address'
assert_select '[method=?]', 'post' assert_select '[method=?]', 'get'
end end
assert_select 'label#city_state_label', 'City' assert_select 'label#city_state_label', 'City'
assert_select 'select#city_state' do assert_select 'select#city_state' do

View File

@ -15,20 +15,13 @@ class UsersControllerTest < ActionController::TestCase
assert_select '[action=?]', '/users' assert_select '[action=?]', '/users'
assert_select '[method=?]', 'post' assert_select '[method=?]', 'post'
end end
assert_select 'input', :count => 18 assert_select 'input', :count => 15
assert_select 'label', :count => 12 assert_select 'label', :count => 12
assert_select 'input[name="commit"]' do assert_select 'input[name="commit"]' do
assert_select '[type=?]', 'submit' assert_select '[type=?]', 'submit'
assert_select '[value=?]', 'Update' assert_select '[value=?]', 'Update'
end end
assert_select 'form#back_form' do assert_select 'a.btn', 'Back'
assert_select '[action=?]', '/'
assert_select '[method=?]', 'get'
end
assert_select 'input[name="commit"]' do
assert_select '[type=?]', 'submit'
assert_select '[value=?]', 'Back'
end
end end
test 'should update user if password is correct' do test 'should update user if password is correct' do