From 2d240f23a89577f784d891911bd30f6a69b3e1a9 Mon Sep 17 00:00:00 2001 From: luisramos0 Date: Fri, 8 Nov 2019 17:31:43 +0000 Subject: [PATCH] Converted erb properties views to haml and added lazy lookups for translations --- .../spree/admin/properties/_form.html.erb | 16 -------- .../spree/admin/properties/_form.html.haml | 15 +++++++ .../spree/admin/properties/edit.html.erb | 18 -------- .../spree/admin/properties/edit.html.haml | 14 +++++++ .../spree/admin/properties/index.html.erb | 41 ------------------- .../spree/admin/properties/index.html.haml | 30 ++++++++++++++ app/views/spree/admin/properties/new.html.erb | 13 ------ .../spree/admin/properties/new.html.haml | 10 +++++ config/locales/en.yml | 14 +++++++ 9 files changed, 83 insertions(+), 88 deletions(-) delete mode 100644 app/views/spree/admin/properties/_form.html.erb create mode 100644 app/views/spree/admin/properties/_form.html.haml delete mode 100644 app/views/spree/admin/properties/edit.html.erb create mode 100644 app/views/spree/admin/properties/edit.html.haml delete mode 100644 app/views/spree/admin/properties/index.html.erb create mode 100644 app/views/spree/admin/properties/index.html.haml delete mode 100644 app/views/spree/admin/properties/new.html.erb create mode 100644 app/views/spree/admin/properties/new.html.haml diff --git a/app/views/spree/admin/properties/_form.html.erb b/app/views/spree/admin/properties/_form.html.erb deleted file mode 100644 index bb86a4e69a..0000000000 --- a/app/views/spree/admin/properties/_form.html.erb +++ /dev/null @@ -1,16 +0,0 @@ -
-
- <%= f.field_container :name do %> - <%= f.label :name, Spree.t(:name) %> *
- <%= f.text_field :name, :class => 'fullwidth' %> - <%= f.error_message_on :name %> - <% end %> -
-
- <%= f.field_container :presentation do %> - <%= f.label :presentation, Spree.t(:presentation) %> *
- <%= f.text_field :presentation, :class => 'fullwidth' %> - <%= f.error_message_on :presentation %> - <% end %> -
-
diff --git a/app/views/spree/admin/properties/_form.html.haml b/app/views/spree/admin/properties/_form.html.haml new file mode 100644 index 0000000000..1e8f402998 --- /dev/null +++ b/app/views/spree/admin/properties/_form.html.haml @@ -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 diff --git a/app/views/spree/admin/properties/edit.html.erb b/app/views/spree/admin/properties/edit.html.erb deleted file mode 100644 index 219c652f32..0000000000 --- a/app/views/spree/admin/properties/edit.html.erb +++ /dev/null @@ -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 %> -
  • <%= button_link_to Spree.t(:back_to_properties_list), admin_properties_url, :icon => 'icon-arrow-left'%>
  • -<% end %> - -<%= render :partial => 'spree/shared/error_messages', :locals => { :target => @property } %> - -<%= form_for [:admin, @property] do |f| %> -
    - <%= render :partial => 'form', :locals => { :f => f } %> - <%= render :partial => 'spree/admin/shared/edit_resource_links' %> -
    -<% end %> diff --git a/app/views/spree/admin/properties/edit.html.haml b/app/views/spree/admin/properties/edit.html.haml new file mode 100644 index 0000000000..18ae81ef52 --- /dev/null +++ b/app/views/spree/admin/properties/edit.html.haml @@ -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' diff --git a/app/views/spree/admin/properties/index.html.erb b/app/views/spree/admin/properties/index.html.erb deleted file mode 100644 index 823cf1b9fd..0000000000 --- a/app/views/spree/admin/properties/index.html.erb +++ /dev/null @@ -1,41 +0,0 @@ -<% content_for :page_title do %> - <%= Spree.t(:properties) %> -<% end %> - -<% content_for :page_actions do %> - -<% end %> - -<%= render :partial => 'spree/admin/shared/product_sub_menu' %> - -
    - - - - - - - - - - - - - - - - <% @properties.each do |property| %> - - - - - - <% end %> - -
    <%= Spree.t(:name) %><%= Spree.t(:presentation) %>
    <%= property.name %><%= property.presentation %> - <%= link_to_edit(property, :no_text => true) %> - <%= link_to_delete(property, :no_text => true) %> -
    - diff --git a/app/views/spree/admin/properties/index.html.haml b/app/views/spree/admin/properties/index.html.haml new file mode 100644 index 0000000000..a712b855bf --- /dev/null +++ b/app/views/spree/admin/properties/index.html.haml @@ -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) diff --git a/app/views/spree/admin/properties/new.html.erb b/app/views/spree/admin/properties/new.html.erb deleted file mode 100644 index 307bb00b17..0000000000 --- a/app/views/spree/admin/properties/new.html.erb +++ /dev/null @@ -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| %> -
    - <%= Spree.t(:new_property) %> - <%= render :partial => 'form', :locals => { :f => f } %> -
    - <%= render :partial => 'spree/admin/shared/new_resource_links' %> -
    -
    -<% end %> diff --git a/app/views/spree/admin/properties/new.html.haml b/app/views/spree/admin/properties/new.html.haml new file mode 100644 index 0000000000..12746d9c5c --- /dev/null +++ b/app/views/spree/admin/properties/new.html.haml @@ -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' diff --git a/config/locales/en.yml b/config/locales/en.yml index d8842c849e..35acc566fb 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -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"