Skip to content

Commit

Permalink
Merge pull request #248 from azelma/changing-tables
Browse files Browse the repository at this point in the history
Changing tables
  • Loading branch information
tkwidmer committed Oct 26, 2015
2 parents 2bc5071 + e4a660a commit 449962c
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 7 deletions.
15 changes: 10 additions & 5 deletions app/assets/javascripts/views/restrooms/restrooms.js.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,20 @@
# You can use CoffeeScript in this file: http://coffeescript.org/

$ ->
$('#ada_filter').click ->
$('#ada_filter').click ->
if $(this).hasClass("active")
$('.listItem.not_accessible').show()
else
else
$('.listItem.not_accessible').hide()
$('#unisex_filter').click ->

$('#unisex_filter').click ->
if $(this).hasClass("active")
$('.listItem.not_unisex').show()
else
else
$('.listItem.not_unisex').hide()

$('#changing_table_filter').click ->
if $(this).hasClass("active")
$('.listItem.no_changing_table').show()
else
$('.listItem.no_changing_table').hide()
1 change: 1 addition & 0 deletions app/views/restrooms/_formsubmit.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
= f.hidden_field :longitude
= f.input :accessible, :collection => [[t('restroom.accessible'), true], [t('restroom.not_accessible'), false]], :include_blank => false
= f.input :unisex, :collection => [[t('restroom.type.unisex'), true], [t('restroom.type.single_stall'), false]], :include_blank => false
= f.input :changing_table, :collection => [[t('restroom.changing_table'), true], [t('restroom.no_changing_table'), false]], :include_blank => false
= f.input :directions, :placeholder => t('restroom.directions_hint'), :as => :text, :required => false, :input_html => { :class => "span6" }
= f.input :comment, :placeholder => t('restroom.comments_hint'), :as => :text, :required => false, :input_html => { :class => "span6" }
= f.button :submit, t('restroom.restsubmit'), :class => "linkbutton"
10 changes: 9 additions & 1 deletion app/views/restrooms/_restroom.html.haml
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
%div{:class => "listItem #{restroom.unisex? ? '' : 'not_unisex'} #{restroom.accessible? ? '' : 'not_accessible'}", "data-id" => restroom.id}
- unisex_class = restroom.unisex? ? '' : 'not_unisex'
- accessible_class = restroom.accessible? ? '' : 'not_accessible'
- changing_table_class = restroom.accessible? ? '' : 'no_changing_table'

%div{ class: "listItem #{unisex_class} #{accessible_class} #{changing_table_class}",
data: { id: restroom.id} }
.listItemImage
/ image tag goes here
.itemInfo
Expand Down Expand Up @@ -26,3 +31,6 @@
- if restroom.accessible?
.ADARestroom
%i.fa.fa-wheelchair.fa-3x
- if restroom.changing_table?
.changingTable
%i.fa.fa-child.fa-3x
3 changes: 3 additions & 0 deletions app/views/restrooms/index.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
%label#unisex_filter.filter.btn-light-purple.btn.linkbutton
%input{:type => "checkbox"}
%i.fa.fa-transgender-alt
%label#changing_table_filter.filter.btn-light-purple.btn.linkbutton
%input{:type => "checkbox"}
%i.fa.fa-child

.map-toggle-btn.mapToggle.filter.linkbutton.btn-light-purple
Map View
Expand Down
2 changes: 2 additions & 0 deletions config/locales/restroom.en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ en:
comments: 'Comments'
accessible: 'Accessible'
not_accessible: 'Not accessible'
changing_table: 'Changing table'
no_changing_table: 'No changing table'
type:
unisex: 'Unisex / Gender neutral'
single_stall: 'Gendered single stall or safe place'
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class AddChangingTableFlagToRestrooms < ActiveRecord::Migration
def change
add_column :restrooms, :changing_table, :boolean, default: false
end
end
3 changes: 2 additions & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 20140423031801) do
ActiveRecord::Schema.define(version: 20151018191859) do

# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
Expand Down Expand Up @@ -66,6 +66,7 @@
t.integer "downvote", default: 0
t.integer "upvote", default: 0
t.string "country"
t.boolean "changing_table", default: false
end

end
5 changes: 5 additions & 0 deletions spec/models/restroom_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@
it { expect(Restroom.new(accessible: true).accessible?).to be true }
end

describe '#changing_table?' do
it { expect(Restroom.new.changing_table?).to be false }
it { expect(Restroom.new(changing_table: true).changing_table?).to be true }
end

describe '#topcities' do
it 'should return the top five cities with the most restroom data' do
city_with_more_data = "City1"
Expand Down

0 comments on commit 449962c

Please sign in to comment.