Convert payment_methods/index from ERB to Haml

This commit is contained in:
Hugo Daniel
2019-07-24 14:39:59 +02:00
parent 196a301133
commit 4b6a02cb92
2 changed files with 39 additions and 52 deletions

View File

@@ -1,52 +0,0 @@
<%= render :partial => 'spree/admin/shared/configuration_menu' %>
<% content_for :page_title do %>
<%= Spree.t(:payment_methods) %>
<% end %>
<% content_for :page_actions do %>
<li>
<%= button_link_to Spree.t(:new_payment_method), new_object_url, :icon => 'icon-plus', :id => 'admin_new_payment_methods_link' %>
</li>
<% end %>
<% if @payment_methods.any? %>
<table class="index" id='listing_payment_methods'>
<colgroup>
<col style="width: 15%">
<col style="width: 35%">
<col style="width: 15%">
<col style="width: 10%">
<col style="width: 10%">
<col style="width: 15%">
</colgroup>
<thead>
<tr data-hook="admin_payment_methods_index_headers">
<th><%= Spree.t(:name) %></th>
<th><%= Spree.t(:provider) %></th>
<th><%= Spree.t(:environment) %></th>
<th><%= Spree.t(:display) %></th>
<th><%= Spree.t(:active) %></th>
<th data-hook="admin_payment_methods_index_header_actions" class="actions"></th>
</tr>
</thead>
<tbody>
<% @payment_methods.each do |method|%>
<tr id="<%= spree_dom_id method %>" data-hook="admin_payment_methods_index_rows" class="<%= cycle('odd', 'even')%>">
<td class="align-center"><%= method.name %></td>
<td><%= method.type %></td>
<td class="align-center"><%= method.environment.to_s.titleize %></td>
<td class="align-center"><%= method.display_on.blank? ? Spree.t(:both) : Spree.t(method.display_on) %></td>
<td class="align-center"><%= method.active ? Spree.t(:say_yes) : Spree.t(:say_no) %></td>
<td data-hook="admin_payment_methods_index_row_actions" class="actions">
<%= link_to_edit method, :no_text => true %>
<%= link_to_delete method, :no_text => true %>
</td>
</tr>
<% end %>
</tbody>
</table>
<% else %>
<div class="alpha twelve columns no-objects-found"><%= Spree.t(:no_payment_methods_found) %></div>
<% end %>

View File

@@ -0,0 +1,39 @@
= render partial: 'spree/admin/shared/configuration_menu'
- content_for :page_title do
= Spree.t(:payment_methods)
- content_for :page_actions do
%li
= button_link_to Spree.t(:new_payment_method), new_object_url, icon: 'icon-plus', id: 'admin_new_payment_methods_link'
- if @payment_methods.any?
%table#listing_payment_methods.index
%colgroup
%col{style: "width: 15%"}/
%col{style: "width: 35%"}/
%col{style: "width: 15%"}/
%col{style: "width: 10%"}/
%col{style: "width: 10%"}/
%col{style: "width: 15%"}/
%thead
%tr{"data-hook" => "admin_payment_methods_index_headers"}
%th= Spree.t(:name)
%th= Spree.t(:provider)
%th= Spree.t(:environment)
%th= Spree.t(:display)
%th= Spree.t(:active)
%th.actions{"data-hook" => "admin_payment_methods_index_header_actions"}
%tbody
- @payment_methods.each do |method|
%tr{class: "#{cycle('odd', 'even')}", "data-hook" => "admin_payment_methods_index_rows", id: "#{spree_dom_id method}"}
%td.align-center= method.name
%td= method.type
%td.align-center= method.environment.to_s.titleize
%td.align-center= method.display_on.blank? ? Spree.t(:both) : Spree.t(method.display_on)
%td.align-center= method.active ? Spree.t(:say_yes) : Spree.t(:say_no)
%td.actions{"data-hook" => "admin_payment_methods_index_row_actions"}
= link_to_edit method, no_text: true
= link_to_delete method, no_text: true
- else
.alpha.twelve.columns.no-objects-found= Spree.t(:no_payment_methods_found)