assemblymade/coderwall

View on GitHub
app/views/teams/_locations.html.haml

Summary

Maintainability
Test Coverage
%section.location#locations{:class => section_enabled_class(@team.has_locations?)}
  - if !@team.has_locations?
    - inactive_box('#locations', "Office Locations") do
      = nil

  - if can_edit?
    - panel_form_for_section('#locations', 'Where do you have offices?') do |f|
      %aside
        - admin_hint do
          Specify points of interest (e.g. restaurants, bars, public transportation) and other amenities and highlights for each office location
      .form-inputs
        %fieldset
          .add-map-location= link_to_add_fields('Add new location', f, :locations)
          -if @team.has_locations?
            .location-list
              = f.fields_for :locations do |fields|
                .item
                  %fieldset
                    = fields.label :name, 'Location Name'
                    = fields.text_field :name
                  %fieldset
                    = fields.label :description, 'Highlights for this office location'
                    = fields.text_area :description
                  %fieldset
                    = fields.label :address, 'Full street address of this office location'
                    = fields.text_field :address
                  %fieldset.remove-location
                    = fields.label :_destroy, "Remove Location"
                    = fields.check_box :_destroy

  #location-map
  .location-details
    .selected
      %h3= @team.primary_address_name
      %p.address= @team.primary_address
      %p.description= @team.primary_address_description
      %ul.poi
        - @team.primary_points_of_interest.each do |point|
          %li= point
    -if @team.locations.size > 1
      %ul.locations.cf
        - @team.locations.each do |location|
          %li.team_location
            %a.mapLocation{:href => '#position'}
              .name= location.name
              .address.hide= location.address || location.name
              .description.hide= location.description
              %ul.poi
                - location.points_of_interest.each do |point|
                  %li= point