Created
February 16, 2011 19:55
-
-
Save brandon-beacher/830048 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- content_for(:end) do | |
:javascript | |
var subdivisions_by_district = {}; | |
subdivisions_by_district['all'] = #{MlsListing.on_market.distinct_subdivisions.collect { |s| s.subdivision }.to_json }; | |
- District.all.each do |district| | |
:javascript | |
subdivisions_by_district['#{district.id}'] = #{MlsListing.on_market.district_id(district.id).distinct_subdivisions.collect { |s| s.subdivision }.to_json }; | |
:javascript | |
$('#search_subdivision').autocomplete({ | |
source: subdivisions_by_district['all'] | |
}); | |
$('#search_district_id').change(function () { | |
var district_id = $("#search_district_id").val(); | |
if (!district_id) { district_id = 'all' }; | |
$('#search_subdivision').autocomplete('option', { source: subdivisions_by_district[district_id] }); | |
} ); | |
$("input#search_query").placeholder({message: "Enter a single MLS#"}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment