Converted erb properties views to haml and added lazy lookups for translations

This commit is contained in:
luisramos0
2019-11-08 17:31:43 +00:00
parent f8b0ad29df
commit 2d240f23a8
9 changed files with 83 additions and 88 deletions

View File

@@ -1,16 +0,0 @@
<div data-hook="admin_property_form" class="align-center row">
<div class="alpha eight columns">
<%= f.field_container :name do %>
<%= f.label :name, Spree.t(:name) %> <span class="required">*</span><br />
<%= f.text_field :name, :class => 'fullwidth' %>
<%= f.error_message_on :name %>
<% end %>
</div>
<div class="eight columns omega">
<%= f.field_container :presentation do %>
<%= f.label :presentation, Spree.t(:presentation) %> <span class="required">*</span><br />
<%= f.text_field :presentation, :class => 'fullwidth' %>
<%= f.error_message_on :presentation %>
<% end %>
</div>
</div>

View File

@@ -0,0 +1,15 @@
.align-center.row
.alpha.eight.columns
= f.field_container :name do
= f.label :name, t('.name')
%span.required *
%br/
= f.text_field :name, class: 'fullwidth'
= f.error_message_on :name
.eight.columns.omega
= f.field_container :presentation do
= f.label :presentation, t('.presentation')
%span.required *
%br/
= f.text_field :presentation, class: 'fullwidth'
= f.error_message_on :presentation

View File

@@ -1,18 +0,0 @@
<%= render :partial => 'spree/admin/shared/product_sub_menu' %>
<% content_for :page_title do %>
<%= Spree.t(:editing_property) %>
<% end %>
<% content_for :page_actions do %>
<li><%= button_link_to Spree.t(:back_to_properties_list), admin_properties_url, :icon => 'icon-arrow-left'%></li>
<% end %>
<%= render :partial => 'spree/shared/error_messages', :locals => { :target => @property } %>
<%= form_for [:admin, @property] do |f| %>
<fieldset class="no-border-top">
<%= render :partial => 'form', :locals => { :f => f } %>
<%= render :partial => 'spree/admin/shared/edit_resource_links' %>
</fieldset>
<% end %>

View File

@@ -0,0 +1,14 @@
= render partial: 'spree/admin/shared/product_sub_menu'
- content_for :page_title do
= t('.editing_property')
- content_for :page_actions do
%li= button_link_to t('.back_to_properties_list'), admin_properties_url, icon: 'icon-arrow-left'
= render partial: 'spree/shared/error_messages', locals: { target: @property }
= form_for [:admin, @property] do |f|
%fieldset.no-border-top
= render partial: 'form', locals: { f: f }
= render partial: 'spree/admin/shared/edit_resource_links'

View File

@@ -1,41 +0,0 @@
<% content_for :page_title do %>
<%= Spree.t(:properties) %>
<% end %>
<% content_for :page_actions do %>
<li id="new_property_link">
<%= button_link_to Spree.t(:new_property), new_admin_property_url, { :remote => true, :icon => 'icon-plus', 'data-update' => 'new_property', :id => 'new_property_link' } %>
</li>
<% end %>
<%= render :partial => 'spree/admin/shared/product_sub_menu' %>
<div id="new_property"></div>
<table class="index" id='listing_properties' data-hook>
<colgroup>
<col style="width: 45%">
<col style="width: 45%">
<col style="width: 10%">
</colgroup>
<thead>
<tr data-hook="listing_properties_header">
<th><%= Spree.t(:name) %></th>
<th><%= Spree.t(:presentation) %></th>
<th class="actions"></th>
</tr>
</thead>
<tbody>
<% @properties.each do |property| %>
<tr id="<%= spree_dom_id property %>" data-hook="listing_properties_row" class="<%= cycle('odd', 'even')%>">
<td><%= property.name %></td>
<td><%= property.presentation %></td>
<td class="actions">
<%= link_to_edit(property, :no_text => true) %>
<%= link_to_delete(property, :no_text => true) %>
</td>
</tr>
<% end %>
</tbody>
</table>

View File

@@ -0,0 +1,30 @@
- content_for :page_title do
= t('.properties')
- content_for :page_actions do
%li#new_property_link
= button_link_to t('.new_property'), new_admin_property_url, { remote: true, icon: 'icon-plus', 'data-update' => 'new_property', id: 'new_property_link' }
= render partial: 'spree/admin/shared/product_sub_menu'
#new_property
%table#listing_properties.index
%colgroup
%col{style: "width: 45%"}/
%col{style: "width: 45%"}/
%col{style: "width: 10%"}/
%thead
%tr
%th= t('.name')
%th= t('.presentation')
%th.actions
%tbody
- @properties.each do |property|
- tr_class = cycle('odd', 'even')
- tr_id = spree_dom_id(property)
%tr{class: tr_class, id: tr_id}
%td= property.name
%td= property.presentation
%td.actions
= link_to_edit(property, no_text: true)
= link_to_delete(property, no_text: true)

View File

@@ -1,13 +0,0 @@
<%= render :partial => 'spree/admin/shared/product_sub_menu' %>
<%= render :partial => 'spree/shared/error_messages', :locals => { :target => @property } %>
<%= form_for [:admin, @property] do |f| %>
<fieldset data-hook="new_property">
<legend align="center"><%= Spree.t(:new_property) %></legend>
<%= render :partial => 'form', :locals => { :f => f } %>
<div class="filter-actions">
<%= render :partial => 'spree/admin/shared/new_resource_links' %>
</div>
</fieldset>
<% end %>

View File

@@ -0,0 +1,10 @@
= render partial: 'spree/admin/shared/product_sub_menu'
= render partial: 'spree/shared/error_messages', locals: { target: @property }
= form_for [:admin, @property] do |f|
%fieldset
%legend{align: "center"}= t('.new_property')
= render partial: 'form', locals: { f: f }
.filter-actions
= render partial: 'spree/admin/shared/new_resource_links'

View File

@@ -2993,6 +2993,20 @@ See the %{link} to find out more about %{sitename}'s features and to start using
inherits_properties_checkbox_hint: "Inherit properties from %{supplier}? (unless overridden above)"
add_product_properties: "Add Product Properties"
select_from_prototype: "Select From Prototype"
properties:
index:
properties: "Properties"
new_property: "New Property"
name: "Name"
presentation: "Presentation"
new:
new_property: "New Property"
edit:
editing_property: "Editing Property"
back_to_properties_list: "Back To Properties List"
form:
name: "Name"
presentation: "Presentation"
orders:
index:
listing_orders: "Listing Orders"