Advertisement
Guest User

Untitled

a guest
Apr 17th, 2014
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. class DynamicPagesController < ApplicationController
  2. def map
  3. @fields = ['Software Engineering',
  4. 'Mechanical Engineering',
  5. 'Electrical Engineering',
  6. 'Aerospace Engineering',
  7. 'Civil Engineering',
  8. 'Chemical Engineering',
  9. 'Architectural Engineering']
  10. end
  11. end
  12.  
  13. <%= select(:primary_field, :id, @fields) %>
  14. <%= button_to "Filter", map_path, :method => :get, class: "btn btn-primary" %>
  15.  
  16. ...
  17.  
  18. for (var i = 0; i < companies.length; i++){
  19. markers.addLayer(new L.Marker([companies[i].latitude, companies[i].longitude]).bindPopup(companies[i].popup, { maxHeight:150 }).openPopup());
  20. }
  21.  
  22. if params[:filter].present?
  23. # This will apply the filter
  24. Model.where(attribute: params[:filter])
  25. else
  26. # This will return all records
  27. Model.all
  28. end
  29.  
  30. select(:primary_field, :id, @fields, allow_blank: true)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement