Skip to content

Commit

Permalink
favicon search results line, and etc.
Browse files Browse the repository at this point in the history
Former-commit-id: bc127bce96d71d5ab39f0582d7c2c10b2781fd6d
  • Loading branch information
Daniel Sherson committed May 13, 2011
1 parent f6a0b86 commit a2edda9
Show file tree
Hide file tree
Showing 10 changed files with 227 additions and 163 deletions.
86 changes: 86 additions & 0 deletions app/helpers/classifiers_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
module ClassifiersHelper
def classifiers
{
:sass => [
['spot on face', classifier_image('SASS.spot_on_face')],
['square shape', classifier_image('SASS.square_shape')],
['square frame edge', classifier_image('SASS.square_frame_edge')],
['square container', classifier_image('SASS.square_container')],
['thick', classifier_image('SASS.thick')],
['rake or claw', classifier_image('SASS.rake_or_claw')],
['thin round length (e.g. stick, cane)', classifier_image('SASS.thin_round_length')],
['thick round length (e.g. pole)', classifier_image('SASS.thick_round_length')],
['very thick and round (e.g. trunk, pillar)', classifier_image('SASS.very_thick_round')]
],
:texture_consistency => [
['sandy', classifier_image('texture_consistency_quality.tactile.sandy')],
['sticky', classifier_image('texture_consistency_quality.tactile.sticky')],
['wet', classifier_image('texture_consistency_quality.tactile.wet')],
['bright', classifier_image('texture_consistency_quality.visual.bright')],
['twinkly', classifier_image('texture_consistency_quality.visual.twinkly')],
['sunshine', classifier_image('texture_consistency_quality.visual.sunshine')]
],
:entity => [
['vehicle', [
['into garage', classifier_image('entity.vehicle.into_garage')],
['nose-to-tail collision', classifier_image('entity.vehicle.nose_to_tail_collision')],
['reversing', classifier_image('entity.vehicle.reversing')]
]],
['person', [
['approach', classifier_image('entity.person.approach')],
['meet', classifier_image('entity.persons.meet')],
['turn and walk away', classifier_image('entity.person.turn_and_walk_away')]
]],
['two legged', [
['fall', classifier_image('entity.legs.fall')],
['jump', classifier_image('entity.legs.jump')],
['stand up', classifier_image('entity.legs.stand_up')]
]],
['plane', [
['plane fly', classifier_image('entity.plane.plane_fly')],
['plane take-off', classifier_image('entity.plane.plane_take_off')]
]]
],
:body_parts => [
['flap wings', classifier_image('body_parts.wings.flap')],
['whiplash', classifier_image('body_parts.neck_and_head.whiplash')],
['Claw', classifier_image('body_parts.claw')],
['open/shut beak (e.g. duck, goose)', classifier_image('body_parts.wide_beak_open_shut')]
],
:mass_or_quantity => [
['pile of stuff', classifier_image('mass_or_quantity.stuff.heap_pile')],
['line of people', classifier_image('mass_or_quantity.persons.line')],
['heavy traffic', classifier_image('mass_or_quantity.vehicles.heavy_traffic')]
],
:handling_or_instrumental => [
['computer-mouse', classifier_image('handling_or_instrumental.computer_mouse')],
['game-remote', classifier_image('handling_or_instrumental.game_remote')],
['bat', classifier_image('handling_or_instrumental.bat')],
['holding cricket-ball', classifier_image('handling_or_instrumental.holding_objects.cricket_ball')],
['holding softball', classifier_image('handling_or_instrumental.holding_objects.softball')],
['holding basketball', classifier_image('handling_or_instrumental.holding_objects.basketball')]
],
:element => [
['Fire', [
['candle-flame', classifier_image('element.fire.candle_flame')],
['small-fire', classifier_image('element.fire.small_fire')],
['bonfire', classifier_image('element.fire.bonfire')]
]],
['Water', [
['water-drip', classifier_image('element.water.water_drip')],
['flowing-water', classifier_image('element.water.flowing_water')],
['water-flooding', classifier_image('element.water.water_flooding')],
['water-overflowing', classifier_image('element.water.water_overflowing')]
]],
['Air', [
['gentle breeze', classifier_image('element.air.gentle_breeze')],
['strong wind', classifier_image('element.air.strong_wind')],
]]
]
}
end
private
def classifier_image(partial_image_identifier)
return "/images/classifiers/90/Classifiers.#{partial_image_identifier}.png"
end
end
82 changes: 82 additions & 0 deletions app/helpers/numbers_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
module NumbersHelper
def numbers
{:cardinal => signs_from_array(cardinal_array),
:ordinal => signs_from_array(ordinal_array),
:fractions => signs_from_array(fractions_array),
:clock => signs_from_array(clock_array),
:calendar => signs_from_array(calendar_array),
:age => signs_from_array(age_array),
:money => signs_from_array(money_array)
}
end
private
def cardinal_array
[[0, 4056],
[1, 5607],
[2, 5617],
[3, 5619],
[4, 5620],
[5, 5621],
[6, 5622],
[7, 5623],
[9, 5696],
[10, 4065],
[11, 5608],
[12, 5609],
[13, 5610],
[14, 5611],
[15, 5612],
[16, 5613],
[18, 5615],
[19, 5701],
[20, 5618],
[21, 5703],
[22, 5704],
[24, 5715],
[25, nil ],
[30, nil ],
[40, 5707],
[50, 5708],
[60, 5711],
[70, 5712],
[80, 5713],
[90, nil ],
[100, 386],
[100, 5709],
[1000, 2290],
[1000000, 1109],
[1000000000, 4086]]
end

def ordinal_array
[['first', 5663],
['first', 2412],
['second', 2416],
['fourth', 2418],
['fifth', 2419]]
end

def fractions_array
[['1/2', nil ],
['1/3', 6232],
['1/4', nil ]]
end

def clock_array
[['one o\'clock', 5662]]
end

def calendar_array
[]
end
def age_array
[]
end

def money_array
[]
end
def signs_from_array(array)
array.map{|v| [v[0], Sign.find(:id => v[1])]}.reject{|v| v[1].nil? }
end
end
7 changes: 7 additions & 0 deletions app/helpers/search_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,13 @@ def search_term(key)
h @query[key].join(' ') unless @query[key].blank?
end

def display_search_term
p [search_term('s'),
content_tag(:div, [display_handshapes_search_term, display_locations_search_term, display_location_groups_search_term].compact.join(' ').html_safe, :class => 'selected_signs'),
display_usage_tag_search_term,
display_topic_tag_search_term].compact.join(' ').html_safe

end
private
def value_for_sign_attribute number, attribute, main
if attribute == :handshape
Expand Down
145 changes: 1 addition & 144 deletions app/helpers/static_pages_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,152 +4,9 @@ def alphabet_listing
%w(A B_open B_closed C_half C_full D E F G H I J K L M N O P_open P_closed Q R S T U V W X Y Z)
end

def numbers_listing
[[0, 4056],
[1, 5607],
[2, 5617],
[3, 5619],
[4, 5620],
[5, 5621],
[6, 5622],
[7, 5623],
[9, 5696],
[10, 4065],
[11, 5608],
[12, 5609],
[13, 5610],
[14, 5611],
[15, 5612],
[16, 5613],
[18, 5615],
[19, 5701],
[20, 5618],
[21, 5703],
[22, 5704],
[24, 5715],
[25, nil ],
[30, nil ],
[40, 5707],
[50, 5708],
[60, 5711],
[70, 5712],
[80, 5713],
[90, nil ],
[100, 386],
[100, 5709],
[1000, 2290],
[1000000, 1109],
[1000000000, 4086]]
end

def ordinal_numbers_listing
[['first', 5663],
['first', 2412],
['second', 2416],
['fourth', 2418],
['fifth', 2419]]
end

def fractions_listing
[['1/2', nil ],
['1/3', 6232],
['1/4', nil ]]
end

def time_listing
[['one o\'clock', 5662]]
end

def signs_from_array(array)
array.map{|v| [v[0], Sign.find(:id => v[1])]}.reject{|v| v[1].nil? }
end
def link_sign name, id
return link_to name, sign_path(id) if Sign.find(:id => id)
return name
end
def classifiers
{
:sass => [
['spot on face', classifier_image('SASS.spot_on_face')],
['square shape', classifier_image('SASS.square_shape')],
['square frame edge', classifier_image('SASS.square_frame_edge')],
['square container', classifier_image('SASS.square_container')],
['thick', classifier_image('SASS.thick')],
['rake or claw', classifier_image('SASS.rake_or_claw')],
['thin round length (e.g. stick, cane)', classifier_image('SASS.thin_round_length')],
['thick round length (e.g. pole)', classifier_image('SASS.thick_round_length')],
['very thick and round (e.g. trunk, pillar)', classifier_image('SASS.very_thick_round')]
],
:texture_consistency => [
['sandy', classifier_image('texture_consistency_quality.tactile.sandy')],
['sticky', classifier_image('texture_consistency_quality.tactile.sticky')],
['wet', classifier_image('texture_consistency_quality.tactile.wet')],
['bright', classifier_image('texture_consistency_quality.visual.bright')],
['twinkly', classifier_image('texture_consistency_quality.visual.twinkly')],
['sunshine', classifier_image('texture_consistency_quality.visual.sunshine')]
],
:entity => [
['vehicle', [
['into garage', classifier_image('entity.vehicle.into_garage')],
['nose-to-tail collision', classifier_image('entity.vehicle.nose_to_tail_collision')],
['reversing', classifier_image('entity.vehicle.reversing')]
]],
['person', [
['approach', classifier_image('entity.person.approach')],
['meet', classifier_image('entity.persons.meet')],
['turn and walk away', classifier_image('entity.person.turn_and_walk_away')]
]],
['two legged', [
['fall', classifier_image('entity.legs.fall')],
['jump', classifier_image('entity.legs.jump')],
['stand up', classifier_image('entity.legs.stand_up')]
]],
['plane', [
['plane fly', classifier_image('entity.plane.plane_fly')],
['plane take-off', classifier_image('entity.plane.plane_take_off')]
]]
],
:body_parts => [
['flap wings', classifier_image('body_parts.wings.flap')],
['whiplash', classifier_image('body_parts.neck_and_head.whiplash')],
['Claw', classifier_image('body_parts.claw')],
['open/shut beak (e.g. duck, goose)', classifier_image('body_parts.wide_beak_open_shut')]
],
:mass_or_quantity => [
['pile of stuff', classifier_image('mass_or_quantity.stuff.heap_pile')],
['line of people', classifier_image('mass_or_quantity.persons.line')],
['heavy traffic', classifier_image('mass_or_quantity.vehicles.heavy_traffic')]
],
:handling_or_instrumental => [
['computer-mouse', classifier_image('handling_or_instrumental.computer_mouse')],
['game-remote', classifier_image('handling_or_instrumental.game_remote')],
['bat', classifier_image('handling_or_instrumental.bat')],
['holding cricket-ball', classifier_image('handling_or_instrumental.holding_objects.cricket_ball')],
['holding softball', classifier_image('handling_or_instrumental.holding_objects.softball')],
['holding basketball', classifier_image('handling_or_instrumental.holding_objects.basketball')]
],
:element => [
['Fire', [
['candle-flame', classifier_image('element.fire.candle_flame')],
['small-fire', classifier_image('element.fire.small_fire')],
['bonfire', classifier_image('element.fire.bonfire')]
]],
['Water', [
['water-drip', classifier_image('element.water.water_drip')],
['flowing-water', classifier_image('element.water.flowing_water')],
['water-flooding', classifier_image('element.water.water_flooding')],
['water-overflowing', classifier_image('element.water.water_overflowing')]
]],
['Air', [
['gentle breeze', classifier_image('element.air.gentle_breeze')],
['strong wind', classifier_image('element.air.strong_wind')],
]]
]
}
end

private
def classifier_image(partial_image_identifier)
return "/images/classifiers/90/Classifiers.#{partial_image_identifier}.png"
end

end
10 changes: 1 addition & 9 deletions app/views/signs/search.html.haml
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
%h1.search_results_for
= t('search.results.for')
“
= search_term('s')
.selected_signs
= display_handshapes_search_term
= display_locations_search_term
= display_location_groups_search_term
= display_usage_tag_search_term
= display_topic_tag_search_term
”
“#{display_search_term}”
%em= "#{@results_total} results."
%ol.grid.results.clearfix.rule_after
- @signs.each_with_index do |result, i|
Expand Down
Empty file.
Loading

0 comments on commit a2edda9

Please sign in to comment.