Move admin enterprises index to haml

This commit is contained in:
Rob H
2014-06-18 11:08:00 +10:00
parent 0611947306
commit 2e749ef1f3
2 changed files with 64 additions and 76 deletions

View File

@@ -1,76 +0,0 @@
<% content_for :page_title do %>
Enterprises
<% end %>
<% content_for :page_actions do %>
<li id="new_product_link">
<%= button_link_to "New Enterprise", main_app.new_admin_enterprise_path, :icon => 'add', :id => 'admin_new_enterprise_link' %>
</li>
<% end %>
<%= render 'admin/shared/enterprises_sub_menu' %>
<%= form_for @enterprise_set, :url => main_app.bulk_update_admin_enterprises_path do |f| %>
<table class="index" id="listing_enterprises">
<colgroup>
<col style="width: 20%;">
<col style="width: 10%;">
<col style="width: 5%;">
<col>
<col style="width: 20%;">
</colgroup>
<thead>
<tr data-hook="enterprises_header">
<th>Name</th>
<th>Role</th>
<th>Visible?</th>
<th>Description</th>
<th></th>
</tr>
</thead>
<tbody>
<%= f.fields_for :collection do |enterprise_form| %>
<% enterprise = enterprise_form.object %>
<tr class="enterprise-<%= enterprise.id %>">
<td><%= link_to enterprise.name, main_app.admin_enterprise_path(enterprise) %></td>
<td><% if enterprise.is_primary_producer && enterprise.is_distributor %> Producer &amp; Distributor
<% elsif enterprise.is_distributor %> Distributor
<% elsif enterprise.is_primary_producer %> Producer
<% else %>
<h1 class = "icon-exclamation-sign with-tip" style = "text-align: center;color: #DA5354" data-powertip = "This enterprise does not have any roles"></h1>
<% end %>
</td>
<td><%= enterprise.visible ? 'Visible' : 'Invisible' %></td>
<td><%= enterprise.description %></td>
<td data-hook="admin_users_index_row_actions">
<%= link_to_with_icon('icon-edit', 'Edit Profile', main_app.edit_admin_enterprise_path(enterprise), class: 'edit') %><br />
<%= link_to_delete_enterprise enterprise %><br />
<% if enterprise.is_distributor %>
<%= link_to_with_icon 'icon-chevron-right', 'Payment Methods', spree.admin_payment_methods_path(enterprise_id: enterprise.id) %> (<%= enterprise.payment_methods.count %>)
<% if enterprise.payment_methods.count == 0 %>
<span class = "icon-exclamation-sign with-tip" style = "font-size: 16px;color: #DA5354" data-powertip = "This enterprise has no payment methods"></span>
<% end %><br />
<%= link_to_with_icon 'icon-plane', 'Shipping Methods', spree.admin_shipping_methods_path(enterprise_id: enterprise.id) %> (<%= enterprise.shipping_methods.count %>)
<% if enterprise.shipping_methods.count == 0 %>
<span class = "icon-exclamation-sign with-tip" style = "font-size: 16px;color: #DA5354" data-powertip = "This enterprise has shipping methods"></span>
<% end %><br />
<% end %>
<%= link_to_with_icon 'icon-money', 'Enterprise Fees', main_app.admin_enterprise_fees_path(enterprise_id: enterprise.id) %> (<%= enterprise.enterprise_fees.count %>)
<% if enterprise.enterprise_fees.count == 0 %>
<span class = "icon-warning-sign with-tip" style = "font-size: 16px;color: orange" data-powertip = "This enterprise has no fees"></span>
<% end %>
</td>
</tr>
<% end %>
<% if @enterprises.empty? %>
<tr><td colspan="4"><%= t(:none) %></td></tr>
<% end %>
</tbody>
</table>
<%= f.submit 'Update' %>
<% end %>

View File

@@ -0,0 +1,64 @@
- content_for :page_title do
Enterprises
- content_for :page_actions do
%li#new_product_link
= button_link_to "New Enterprise", main_app.new_admin_enterprise_path, :icon => 'add', :id => 'admin_new_enterprise_link'
= render 'admin/shared/enterprises_sub_menu'
= form_for @enterprise_set, :url => main_app.bulk_update_admin_enterprises_path do |f|
%table#listing_enterprises.index
%colgroup
%col{style: "width: 20%;"}/
%col{style: "width: 10%;"}/
%col{style: "width: 5%;"}/
%col/
%col{style: "width: 20%;"}/
%thead
%tr{"data-hook" => "enterprises_header"}
%th Name
%th Role
%th Visible?
%th Description
%th
%tbody
= f.fields_for :collection do |enterprise_form|
- enterprise = enterprise_form.object
%tr{class: "enterprise-#{enterprise.id}"}
%td= link_to enterprise.name, main_app.admin_enterprise_path(enterprise)
%td
- if enterprise.is_primary_producer && enterprise.is_distributor
Producer & Distributor
- elsif enterprise.is_distributor
Distributor
- elsif enterprise.is_primary_producer
Producer
- else
%h1.icon-exclamation-sign.with-tip{"data-powertip" => "This enterprise does not have any roles", style: "text-align: center;color: #DA5354"}
%td= enterprise.visible ? 'Visible' : 'Invisible'
%td= enterprise.description
%td{"data-hook" => "admin_users_index_row_actions"}
= link_to_with_icon('icon-edit', 'Edit Profile', main_app.edit_admin_enterprise_path(enterprise), class: 'edit')
%br/
= link_to_delete_enterprise enterprise
%br/
- if enterprise.is_distributor
= link_to_with_icon 'icon-chevron-right', 'Payment Methods', spree.admin_payment_methods_path(enterprise_id: enterprise.id)
(#{enterprise.payment_methods.count})
- if enterprise.payment_methods.count == 0
%span.icon-exclamation-sign.with-tip{"data-powertip" => "This enterprise has no payment methods", style: "font-size: 16px;color: #DA5354"}
%br/
= link_to_with_icon 'icon-plane', 'Shipping Methods', spree.admin_shipping_methods_path(enterprise_id: enterprise.id)
(#{enterprise.shipping_methods.count})
- if enterprise.shipping_methods.count == 0
%span.icon-exclamation-sign.with-tip{"data-powertip" => "This enterprise has shipping methods", style: "font-size: 16px;color: #DA5354"}
%br/
= link_to_with_icon 'icon-money', 'Enterprise Fees', main_app.admin_enterprise_fees_path(enterprise_id: enterprise.id)
(#{enterprise.enterprise_fees.count})
- if enterprise.enterprise_fees.count == 0
%span.icon-warning-sign.with-tip{"data-powertip" => "This enterprise has no fees", style: "font-size: 16px;color: orange"}
- if @enterprises.empty?
%tr
%td{colspan: "4"}= t(:none)
= f.submit 'Update'