mattvanhorn/BJJLife

View on GitHub
app/views/academies/index.html.haml

Summary

Maintainability
Test Coverage
#academies.grid
  = standard_header

  .main
    .row
      - if flash[:notice]
        .notice= flash[:notice]

    .row
      = simple_form_for AcademySearch.new, :method => :get do |form|
        = form.input :location, :hint => 'Address, City/State or ZIP code'
        = form.button :submit

    - if academies.nearest.any?
      .row
        - academies.nearest.each do |group|
          = group.render(self)

    .row
      - cache(academies.by_state) do
        - academies.by_state.each do |group|
          = group.render(self, 'us_state')

      - cache(academies.by_country) do
        - academies.by_country.each do |group|
          = group.render(self, 'country')

  .sidebar
    = link_to t('.add_academy_link'), new_academy_path, :class => 'btn'
    %p= t('academies.jump_to_state')
    %ul
      %li= link_to 'Nearest', "#nearest" if academies.nearest.any?

      - academies.by_state.each do |group|
        = group.render_as_link(self)

      %li <br/>

      - academies.by_country.each do |group|
        = group.render_as_link(self)