From 6ee053ab8c517bedf4d1a9943ecf63c89271a85f Mon Sep 17 00:00:00 2001 From: Thomas von Deyen Date: Fri, 1 Dec 2017 14:48:01 +0100 Subject: [PATCH 1/9] Remove unnecessary br tags from store credits form --- backend/app/views/spree/admin/store_credits/_form.html.erb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/app/views/spree/admin/store_credits/_form.html.erb b/backend/app/views/spree/admin/store_credits/_form.html.erb index 527ef5f7fc4..381005e6f2e 100644 --- a/backend/app/views/spree/admin/store_credits/_form.html.erb +++ b/backend/app/views/spree/admin/store_credits/_form.html.erb @@ -1,7 +1,7 @@
<%= f.field_container :amount do %> - <%= f.label :amount, class: 'required' %>
+ <%= f.label :amount, class: 'required' %> <%= render "spree/admin/shared/number_with_currency", f: f, amount_attr: :amount, currency_attr: :currency, required: true %> <%= f.error_message_on :amount %> <%= f.error_message_on :currency %> @@ -9,7 +9,7 @@
<%= f.field_container :category_id do %> - <%= f.label :category_id, class: 'required' %>
+ <%= f.label :category_id, class: 'required' %> <%= f.select :category_id, options_from_collection_for_select(@credit_categories, :id, :name, f.object.category.try(:id)), { include_blank: true }, { class: 'custom-select fullwidth', placeholder: t('spree.admin.store_credits.select_reason') } %> <%= f.error_message_on :category_id %> From 4e78bed6f376a0629c8a123802f8463de867d0c5 Mon Sep 17 00:00:00 2001 From: Thomas von Deyen Date: Fri, 1 Dec 2017 14:48:45 +0100 Subject: [PATCH 2/9] Remove icons from store credit action buttons --- backend/app/views/spree/admin/store_credits/show.html.erb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/app/views/spree/admin/store_credits/show.html.erb b/backend/app/views/spree/admin/store_credits/show.html.erb index 10113a65b5b..c0b7af3eaeb 100644 --- a/backend/app/views/spree/admin/store_credits/show.html.erb +++ b/backend/app/views/spree/admin/store_credits/show.html.erb @@ -8,10 +8,10 @@ <%= render 'spree/admin/users/tabs', current: :store_credits %> <% content_for :page_actions do %> <% if @store_credit.editable? && can?(:edit, @store_credit) %> -
  • <%= link_to_with_icon 'dollar', t('spree.admin.store_credits.change_amount'), edit_amount_admin_user_store_credit_path(@user, @store_credit), class: 'button' %>
  • +
  • <%= link_to t('spree.admin.store_credits.change_amount'), edit_amount_admin_user_store_credit_path(@user, @store_credit), class: 'button' %>
  • <% end %> <% if @store_credit.invalidateable? && can?(:invalidate, @store_credit) %> -
  • <%= link_to_with_icon 'ban', t('spree.invalidate'), edit_validity_admin_user_store_credit_path(@user, @store_credit), class: 'button' %>
  • +
  • <%= link_to t('spree.invalidate'), edit_validity_admin_user_store_credit_path(@user, @store_credit), class: 'button' %>
  • <% end %> <% end %> From 8754a9b4a6646e2b891b4ea5bbf8bbd9cd41367b Mon Sep 17 00:00:00 2001 From: Thomas von Deyen Date: Fri, 1 Dec 2017 14:52:09 +0100 Subject: [PATCH 3/9] Use short time format in store credit events table --- backend/app/views/spree/admin/store_credits/show.html.erb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/backend/app/views/spree/admin/store_credits/show.html.erb b/backend/app/views/spree/admin/store_credits/show.html.erb index c0b7af3eaeb..165997c3d82 100644 --- a/backend/app/views/spree/admin/store_credits/show.html.erb +++ b/backend/app/views/spree/admin/store_credits/show.html.erb @@ -77,12 +77,12 @@ <%= t('spree.admin.store_credits.history') %> - + - + @@ -98,7 +98,7 @@ <% @store_credit_events.each do |event| %> From ace9c3d8a5388b5e68f2b9f7a0dcf0ce51c44697 Mon Sep 17 00:00:00 2001 From: Thomas von Deyen Date: Fri, 1 Dec 2017 14:53:09 +0100 Subject: [PATCH 4/9] Grid layout fixes for store credit edit views --- .../store_credits/_update_reason_field.html.erb | 14 ++++++-------- .../spree/admin/store_credits/edit_amount.html.erb | 12 ++++++++---- .../admin/store_credits/edit_validity.html.erb | 4 +++- 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/backend/app/views/spree/admin/store_credits/_update_reason_field.html.erb b/backend/app/views/spree/admin/store_credits/_update_reason_field.html.erb index 6327c7cd37c..8c219f6298e 100644 --- a/backend/app/views/spree/admin/store_credits/_update_reason_field.html.erb +++ b/backend/app/views/spree/admin/store_credits/_update_reason_field.html.erb @@ -1,8 +1,6 @@ -
    - <%= f.field_container :reason do %> - <%= f.label :reason, t('spree.reason'), class: 'required' %>
    - <%= select_tag :update_reason_id, options_from_collection_for_select(@update_reasons, :id, :name), - { include_blank: true , class: 'custom-select fullwidth', placeholder: t('spree.admin.store_credits.select_amount_update_reason') } %> - <%= f.error_message_on :reason %> - <% end %> -
    +<%= f.field_container :reason do %> + <%= f.label :reason, t('spree.reason'), class: 'required' %> + <%= select_tag :update_reason_id, options_from_collection_for_select(@update_reasons, :id, :name), + { include_blank: true , class: 'custom-select fullwidth', placeholder: t('spree.admin.store_credits.select_amount_update_reason') } %> + <%= f.error_message_on :reason %> +<% end %> diff --git a/backend/app/views/spree/admin/store_credits/edit_amount.html.erb b/backend/app/views/spree/admin/store_credits/edit_amount.html.erb index 2415637f119..b2eb657f334 100644 --- a/backend/app/views/spree/admin/store_credits/edit_amount.html.erb +++ b/backend/app/views/spree/admin/store_credits/edit_amount.html.erb @@ -14,15 +14,19 @@
    <%= t('spree.admin.store_credits.edit_amount') %>
    -
    +
    <%= f.field_container :amount do %> <%= f.label :amount, class: 'required' %>
    - <%= f.number_field :amount, min: 0.00, step: :any %> + <%= render "spree/admin/shared/number_with_currency", f: f, + amount_attr: :amount, currency: @store_credit.currency, required: true %> <%= f.error_message_on :amount %> <% end %>
    - <%= render partial: 'update_reason_field', locals: { f: f } %> +
    + <%= render 'update_reason_field', f: f %> +
    - <%= render partial: 'spree/admin/shared/edit_resource_links', locals: { collection_url: admin_user_store_credits_path(@user, @store_credit) } %> + <%= render 'spree/admin/shared/edit_resource_links', + collection_url: admin_user_store_credits_path(@user, @store_credit) %>
    <% end %> diff --git a/backend/app/views/spree/admin/store_credits/edit_validity.html.erb b/backend/app/views/spree/admin/store_credits/edit_validity.html.erb index f938759ca6c..9393911ea1e 100644 --- a/backend/app/views/spree/admin/store_credits/edit_validity.html.erb +++ b/backend/app/views/spree/admin/store_credits/edit_validity.html.erb @@ -14,7 +14,9 @@
    <%= t('spree.admin.store_credits.invalidate_store_credit') %>
    - <%= render partial: 'update_reason_field', locals: { f: f } %> +
    + <%= render partial: 'update_reason_field', locals: { f: f } %> +
    <%= button t('spree.store_credit.actions.invalidate') %> From 6c68f098e5bb201ab9f611353669b2100d20820c Mon Sep 17 00:00:00 2001 From: Thomas von Deyen Date: Fri, 1 Dec 2017 23:43:23 +0100 Subject: [PATCH 5/9] Add blank message to store credit edit reason select --- .../spree/admin/store_credits/_update_reason_field.html.erb | 3 ++- core/config/locales/en.yml | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/backend/app/views/spree/admin/store_credits/_update_reason_field.html.erb b/backend/app/views/spree/admin/store_credits/_update_reason_field.html.erb index 8c219f6298e..c2784dd5b95 100644 --- a/backend/app/views/spree/admin/store_credits/_update_reason_field.html.erb +++ b/backend/app/views/spree/admin/store_credits/_update_reason_field.html.erb @@ -1,6 +1,7 @@ <%= f.field_container :reason do %> <%= f.label :reason, t('spree.reason'), class: 'required' %> <%= select_tag :update_reason_id, options_from_collection_for_select(@update_reasons, :id, :name), - { include_blank: true , class: 'custom-select fullwidth', placeholder: t('spree.admin.store_credits.select_amount_update_reason') } %> + include_blank: t('spree.choose_reason'), class: 'custom-select fullwidth', + placeholder: t('spree.admin.store_credits.select_amount_update_reason') %> <%= f.error_message_on :reason %> <% end %> diff --git a/core/config/locales/en.yml b/core/config/locales/en.yml index 60c9c3c9481..1a75407b248 100644 --- a/core/config/locales/en.yml +++ b/core/config/locales/en.yml @@ -1089,6 +1089,7 @@ en: choose_location: Choose location choose_promotion_action: Choose action choose_promotion_rule: Choose rule + choose_reason: Choose reason city: City clear_cache: Clear Cache clear_cache_ok: Cache was flushed From e7a21826b1141cc2302f3f3c6f26cb90df72ac4a Mon Sep 17 00:00:00 2001 From: Thomas von Deyen Date: Fri, 1 Dec 2017 14:59:16 +0100 Subject: [PATCH 6/9] Remove the currency name from store credit tables The current balance already indicates the currency of the store credit tables belonging to a currency group. --- backend/app/views/spree/admin/store_credits/index.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/app/views/spree/admin/store_credits/index.html.erb b/backend/app/views/spree/admin/store_credits/index.html.erb index 3da1ebbd18e..f996315da03 100644 --- a/backend/app/views/spree/admin/store_credits/index.html.erb +++ b/backend/app/views/spree/admin/store_credits/index.html.erb @@ -15,7 +15,7 @@ <% @store_credits.group_by(&:currency).each do |currency, credits| %>
    - <%= currency %> <%= t('spree.admin.store_credits.current_balance') %> + <%= t('spree.admin.store_credits.current_balance') %> <% total = credits.sum(&:amount_remaining) %> <%= Spree::Money.new(total, currency: currency) %> From e06343960e6ab12775735734509ed61eb57a1c28 Mon Sep 17 00:00:00 2001 From: Thomas von Deyen Date: Fri, 1 Dec 2017 15:00:37 +0100 Subject: [PATCH 7/9] Say yes or no to invalidated in store credit table Currently it is a untranslated boolean --- backend/app/views/spree/admin/store_credits/index.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/app/views/spree/admin/store_credits/index.html.erb b/backend/app/views/spree/admin/store_credits/index.html.erb index f996315da03..cadb087e998 100644 --- a/backend/app/views/spree/admin/store_credits/index.html.erb +++ b/backend/app/views/spree/admin/store_credits/index.html.erb @@ -53,7 +53,7 @@ <%= l store_credit.created_at.to_date %>
    - <%= pretty_time(event.created_at) %> + <%= pretty_time(event.created_at, :short) %> <%= store_credit_event_admin_action_name(event) %> <%= event.display_amount %> - <%= store_credit.invalidated? %> + <%= t store_credit.invalidated? ? 'spree.say_yes' : 'spree.say_no' %> <% if can?(:show, store_credit) %> From 596e623e43ce23b11ab991e6772974a083158f3d Mon Sep 17 00:00:00 2001 From: Thomas von Deyen Date: Fri, 1 Dec 2017 00:07:35 +0100 Subject: [PATCH 8/9] Remove bottom border of non-form fieldsets We have too many borders in our layout. Whitespace, tables and headers are separating content areas already, no need additional borders. That only distracts the eye. Keeps the bottom border for fieldsets that are holding a form. This makes sense as the form buttons sit on top of the bottom border and visually encloses the form field set. --- .../stylesheets/spree/backend/shared/_forms.scss | 3 +++ backend/app/views/spree/admin/images/index.html.erb | 2 +- .../views/spree/admin/store_credits/index.html.erb | 2 +- .../views/spree/admin/store_credits/show.html.erb | 2 +- backend/app/views/spree/admin/taxons/index.html.erb | 12 ++++++------ .../app/views/spree/admin/users/_sidebar.html.erb | 2 +- backend/app/views/spree/admin/users/items.html.erb | 2 +- backend/app/views/spree/admin/users/orders.html.erb | 2 +- 8 files changed, 15 insertions(+), 12 deletions(-) diff --git a/backend/app/assets/stylesheets/spree/backend/shared/_forms.scss b/backend/app/assets/stylesheets/spree/backend/shared/_forms.scss index 256f5903f0c..cae836b3daa 100644 --- a/backend/app/assets/stylesheets/spree/backend/shared/_forms.scss +++ b/backend/app/assets/stylesheets/spree/backend/shared/_forms.scss @@ -167,6 +167,9 @@ fieldset { &.no-border-bottom { border-bottom: none; + } + + &.no-margin-bottom { margin-bottom: 0; } diff --git a/backend/app/views/spree/admin/images/index.html.erb b/backend/app/views/spree/admin/images/index.html.erb index 4e8d76e5bce..23a9a996053 100644 --- a/backend/app/views/spree/admin/images/index.html.erb +++ b/backend/app/views/spree/admin/images/index.html.erb @@ -13,7 +13,7 @@ <%= render 'new', product: @product, image: Spree::Image.new(viewable: @product) %> -
    +
    <%= t(".upload_images") %>
    diff --git a/backend/app/views/spree/admin/store_credits/index.html.erb b/backend/app/views/spree/admin/store_credits/index.html.erb index cadb087e998..4e7a184cb32 100644 --- a/backend/app/views/spree/admin/store_credits/index.html.erb +++ b/backend/app/views/spree/admin/store_credits/index.html.erb @@ -13,7 +13,7 @@ <% if @store_credits.any? %> <% @store_credits.group_by(&:currency).each do |currency, credits| %> -
    +
    <%= t('spree.admin.store_credits.current_balance') %> <% total = credits.sum(&:amount_remaining) %> diff --git a/backend/app/views/spree/admin/store_credits/show.html.erb b/backend/app/views/spree/admin/store_credits/show.html.erb index 165997c3d82..aaedce547a2 100644 --- a/backend/app/views/spree/admin/store_credits/show.html.erb +++ b/backend/app/views/spree/admin/store_credits/show.html.erb @@ -73,7 +73,7 @@
    -
    +
    <%= t('spree.admin.store_credits.history') %> diff --git a/backend/app/views/spree/admin/taxons/index.html.erb b/backend/app/views/spree/admin/taxons/index.html.erb index 730e1e69583..9e3b87d2492 100644 --- a/backend/app/views/spree/admin/taxons/index.html.erb +++ b/backend/app/views/spree/admin/taxons/index.html.erb @@ -1,16 +1,16 @@ <% admin_breadcrumb(link_to plural_resource_name(Spree::Product), spree.admin_products_path) %> <% admin_breadcrumb(t('spree.admin.taxons.display_order')) %> -<% content_for :table_filter_title do %> - <%= t('spree.choose_a_taxon_to_sort_products_for') %> -<% end %> +
    + + <%= t('spree.choose_a_taxon_to_sort_products_for') %> + -<% content_for :table_filter do %>
    -<% end %> +
    -
    +
    diff --git a/backend/app/views/spree/admin/users/_sidebar.html.erb b/backend/app/views/spree/admin/users/_sidebar.html.erb index 5ef30b2bb0d..29df2b1b3e0 100644 --- a/backend/app/views/spree/admin/users/_sidebar.html.erb +++ b/backend/app/views/spree/admin/users/_sidebar.html.erb @@ -4,7 +4,7 @@ <% content_for :sidebar do %>
    - - - - - - - + + + + + + + diff --git a/backend/app/views/spree/admin/store_credits/show.html.erb b/backend/app/views/spree/admin/store_credits/show.html.erb index aaedce547a2..57d7606a74e 100644 --- a/backend/app/views/spree/admin/store_credits/show.html.erb +++ b/backend/app/views/spree/admin/store_credits/show.html.erb @@ -23,28 +23,28 @@ - - + + diff --git a/core/config/locales/en.yml b/core/config/locales/en.yml index 1a75407b248..9ccbe606ef4 100644 --- a/core/config/locales/en.yml +++ b/core/config/locales/en.yml @@ -868,15 +868,17 @@ en: address: Address store_credits: add: "Add store credit" - amount_authorized: "Amount Authorized" - amount_credited: "Amount Credited" - amount_used: "Amount Used" + amount_authorized: Authorized + amount_credited: Credited + amount_used: Used + created_at: Issued On back_to_edit: "Back to edit" back_to_user_list: "Back to user list" back_to_store_credit_list: "Store credit list" change_amount: "Change amount" created_by: "Created By" - credit_type: "Credit type" + credit_type: Type + memo: Memo current_balance: "Current balance:" edit: "Editing store credit" edit_amount: "Editing store credit amount"
    <%= Spree::StoreCredit.human_attribute_name(:amount_credited) %><%= Spree::StoreCredit.human_attribute_name(:amount_used) %><%= Spree::StoreCredit.human_attribute_name(:amount_authorized) %><%= Spree::StoreCredit.human_attribute_name(:category_id) %><%= Spree::StoreCredit.human_attribute_name(:created_by_id) %><%= Spree::StoreCredit.human_attribute_name(:created_at) %><%= Spree::StoreCredit.human_attribute_name(:invalidated_at) %><%= t('spree.admin.store_credits.amount_credited') %><%= t('spree.admin.store_credits.amount_used') %><%= t('spree.admin.store_credits.amount_authorized') %><%= t('spree.admin.store_credits.credit_type') %><%= t('spree.admin.store_credits.created_by') %><%= t('spree.admin.store_credits.created_at') %><%= t('spree.admin.store_credits.invalidated') %>
    - <%= Spree::StoreCredit.human_attribute_name(:amount) %>: + <%= t('spree.admin.store_credits.amount_credited') %> <%= @store_credit.display_amount.to_html %>
    - <%= Spree::StoreCredit.human_attribute_name(:created_by_id) %>: + <%= t('spree.admin.store_credits.created_by') %> <%= @store_credit.created_by_email %>
    - <%= t('spree.admin.store_credits.credit_type') %>: + <%= t('spree.admin.store_credits.credit_type') %> <%= @store_credit.category_name %>
    - <%= Spree::StoreCredit.human_attribute_name(:memo) %>: + <%= t('spree.admin.store_credits.memo') %> <%= @store_credit.memo %> @@ -57,7 +57,7 @@
    <%= t('spree.date') %> <%= Spree::StoreCreditEvent.human_attribute_name(:action) %><%= Spree::StoreCredit.human_attribute_name(:amount) %><%= Spree::StoreCredit.human_attribute_name(:created_by_id) %><%= t('spree.admin.store_credits.amount_credited') %><%= t('spree.admin.store_credits.created_by') %> <%= Spree::StoreCreditEvent.human_attribute_name(:user_total_amount) %> <%= Spree::StoreCreditUpdateReason.human_attribute_name(:name) %>