drhenner/ror_ecommerce

View on GitHub
app/views/admin/config/countries/index.html.erb

Summary

Maintainability
Test Coverage
<% content_for :bottom do -%>
  <%= javascript_include_tag 'admin/countries' %>
<% end %>

<h1> Countries </h1>
<p>
  Select other countries below to activate them:
  <%= select_tag "countries_select", options_from_collection_for_select(@countries, "id", "name"), {prompt: 'Select to activate'} %>
  <%= link_to "Activate", [:activate, :admin, :config, @countries.first], method: :put, id: "activate-link", style: "display:none;" %>
</p>
<div id="admin_country_grid_wrapper" class='pretty_table'>
  <table class='hover'>
    <tr class='odd'>
        <th  class='column1_header'><%= sortable 'name', 'Name' %></th>
        <th>Abbreviation</th>
        <th>Shipping Zone</th>
        <th>Active</th>
        <th></th>
    </tr>
    <tbody>
    <% for country in @active_countries %>
      <tr  class='<%= cycle("odd", "")%>'>
          <td><%= link_to country.name, [:edit, :admin, :config, country] %></td>
          <td><%= country.abbreviation %></td>
          <td><%= country.shipping_zone.try(:name) %></td>
          <td><%= link_to "InActivate", [:admin, :config, country], :data => { :confirm => 'Are you sure?' }, :method => :delete %></td>
      </tr>
    <% end %>
    </tbody>
  </table>
</div>

<%= will_paginate @active_countries %>