From b9f6cb8800df251670de2286d902bde9632ed13d Mon Sep 17 00:00:00 2001 From: Rob Harrington Date: Sun, 15 May 2016 22:59:07 +1000 Subject: [PATCH] Adding translations for all column names --- .../line_items_controller.js.coffee | 4 +- app/helpers/admin/injection_helper.rb | 5 +- .../_enterprise_user_index.html.haml | 11 +- app/views/admin/enterprises/index.html.haml | 2 +- .../order_cycles/_advanced_settings.html.haml | 2 +- .../variant_overrides/_controls.html.haml | 6 +- .../variant_overrides/_filters.html.haml | 2 +- .../admin/variant_overrides/_header.html.haml | 6 +- .../_hidden_products.html.haml | 4 +- .../variant_overrides/_new_products.html.haml | 10 +- .../_new_products_alert.html.haml | 4 +- .../variant_overrides/_no_results.html.haml | 12 +- .../variant_overrides/_products.html.haml | 14 +- .../_products_variants.html.haml | 2 +- .../admin/orders/bulk_management.html.haml | 60 +++---- .../bulk_edit/_products_head.html.haml | 24 +-- config/locales/en.yml | 151 ++++++++++-------- .../column_preference_defaults.rb | 87 +++++----- .../admin/bulk_product_update_spec.rb | 2 +- spec/features/admin/variant_overrides_spec.rb | 4 +- 20 files changed, 215 insertions(+), 197 deletions(-) diff --git a/app/assets/javascripts/admin/line_items/controllers/line_items_controller.js.coffee b/app/assets/javascripts/admin/line_items/controllers/line_items_controller.js.coffee index f969d82b05..f105ebb0e5 100644 --- a/app/assets/javascripts/admin/line_items/controllers/line_items_controller.js.coffee +++ b/app/assets/javascripts/admin/line_items/controllers/line_items_controller.js.coffee @@ -5,14 +5,14 @@ angular.module("admin.lineItems").controller 'LineItemsCtrl', ($scope, $timeout, $scope.confirmDelete = true $scope.startDate = formatDate daysFromToday -7 $scope.endDate = formatDate daysFromToday 1 - $scope.bulkActions = [ { name: t("bom_actions_delete"), callback: 'deleteLineItems' } ] + $scope.bulkActions = [ { name: t("admin.orders.bulk_management.actions_delete"), callback: 'deleteLineItems' } ] $scope.selectedUnitsProduct = {} $scope.selectedUnitsVariant = {} $scope.sharedResource = false $scope.columns = Columns.columns $scope.confirmRefresh = -> - LineItems.allSaved() || confirm(t "unsaved_changes_warning") + LineItems.allSaved() || confirm(t("unsaved_changes_warning")) $scope.resetSelectFilters = -> $scope.distributorFilter = blankOption().id diff --git a/app/helpers/admin/injection_helper.rb b/app/helpers/admin/injection_helper.rb index ffd2c56c02..079f93d41f 100644 --- a/app/helpers/admin/injection_helper.rb +++ b/app/helpers/admin/injection_helper.rb @@ -47,8 +47,9 @@ module Admin admin_inject_json_ams_array opts[:module], "inventoryItems", @inventory_items, Api::Admin::InventoryItemSerializer end - def admin_inject_column_preferences(opts={module: 'ofn.admin'}) - column_preferences = ColumnPreference.for(spree_current_user, "#{controller_name}_#{action_name}") + def admin_inject_column_preferences(opts={}) + opts.reverse_merge!(module: 'ofn.admin', action: "#{controller_name}_#{action_name}") + column_preferences = ColumnPreference.for(spree_current_user, opts[:action]) admin_inject_json_ams_array opts[:module], "columns", column_preferences, Api::Admin::ColumnPreferenceSerializer end diff --git a/app/views/admin/enterprises/_enterprise_user_index.html.haml b/app/views/admin/enterprises/_enterprise_user_index.html.haml index 1f17f0f82c..75dbf98f17 100644 --- a/app/views/admin/enterprises/_enterprise_user_index.html.haml +++ b/app/views/admin/enterprises/_enterprise_user_index.html.haml @@ -24,12 +24,11 @@ %col.manage{ width: "18%", ng: { show: 'columns.manage.visible' }} %thead %tr{ ng: { controller: "ColumnsCtrl" } } - %th.name{ ng: { show: 'columns.name.visible' } } - Name - %th.producer{ ng: { show: 'columns.producer.visible' } } Producer? - %th.package{ ng: { show: 'columns.package.visible' } } Package - %th.status{ ng: { show: 'columns.status.visible' } } Status - %th.manage{ ng: { show: 'columns.manage.visible' } } Manage + %th.name{ ng: { show: 'columns.name.visible' } }=t('admin.name') + %th.producer{ ng: { show: 'columns.producer.visible' } }=t('.producer?') + %th.package{ ng: { show: 'columns.package.visible' } }=t('.package') + %th.status{ ng: { show: 'columns.status.visible' } }=t('.status') + %th.manage{ ng: { show: 'columns.manage.visible' } }=t('.manage') %tbody{ :id => "e_{{enterprise.id}}", ng: { repeat: "enterprise in filteredEnterprises = ( allEnterprises | filter:{ name: quickSearch } )", controller: 'EnterpriseIndexRowCtrl' } } %tr.enterprise.panel-toggle-row{ object: "enterprise", ng: { class: { even: "'even'", odd: "'odd'"} } } %td.name{ ng: { show: 'columns.name.visible' } } diff --git a/app/views/admin/enterprises/index.html.haml b/app/views/admin/enterprises/index.html.haml index 14bcda7f60..b84659738c 100644 --- a/app/views/admin/enterprises/index.html.haml +++ b/app/views/admin/enterprises/index.html.haml @@ -9,7 +9,7 @@ = button_link_to "New Enterprise", main_app.new_admin_enterprise_path, :icon => 'icon-plus', :id => 'admin_new_enterprise_link' = admin_inject_monthly_bill_description -= admin_inject_column_preferences module: 'admin.enterprises' += admin_inject_column_preferences module: 'admin.enterprises', action: "enterprises_index" = render 'admin/shared/enterprises_sub_menu' diff --git a/app/views/admin/order_cycles/_advanced_settings.html.haml b/app/views/admin/order_cycles/_advanced_settings.html.haml index 27b347880b..f8f71d0b93 100644 --- a/app/views/admin/order_cycles/_advanced_settings.html.haml +++ b/app/views/admin/order_cycles/_advanced_settings.html.haml @@ -5,7 +5,7 @@ = form_for [main_app, :admin, @order_cycle] do |f| .row .six.columns.alpha - = f.label "enterprise_preferred_product_selection_from_coordinator_inventory_only", t('admin.order_cycle.choose_products_from') + = f.label "enterprise_preferred_product_selection_from_coordinator_inventory_only", t('admin.order_cycles.edit.choose_products_from') .with-tip{'data-powertip' => "You can opt to restrict all available products (both incoming and outgoing), to only those in #{@order_cycle.coordinator.name}'s inventory."} %a What's this? .four.columns diff --git a/app/views/admin/variant_overrides/_controls.html.haml b/app/views/admin/variant_overrides/_controls.html.haml index 6757a8c43c..900f46e430 100644 --- a/app/views/admin/variant_overrides/_controls.html.haml +++ b/app/views/admin/variant_overrides/_controls.html.haml @@ -3,9 +3,9 @@ .eight.columns.alpha = render 'admin/shared/bulk_actions_dropdown' = render 'admin/shared/views_dropdown' - %span.text-big.with-tip.icon-question-sign{ ng: { show: 'views.inventory.visible' } , data: { powertip: "#{t('admin.inventory.inventory_powertip')}" } } - %span.text-big.with-tip.icon-question-sign{ ng: { show: 'views.hidden.visible' } , data: { powertip: "#{t('admin.inventory.hidden_powertip')}" } } - %span.text-big.with-tip.icon-question-sign{ ng: { show: 'views.new.visible' } , data: { powertip: "#{t('admin.inventory.new_powertip')}" } } + %span.text-big.with-tip.icon-question-sign{ ng: { show: 'views.inventory.visible' } , data: { powertip: "#{t('admin.variant_overrides.index.inventory_powertip')}" } } + %span.text-big.with-tip.icon-question-sign{ ng: { show: 'views.hidden.visible' } , data: { powertip: "#{t('admin.variant_overrides.index.hidden_powertip')}" } } + %span.text-big.with-tip.icon-question-sign{ ng: { show: 'views.new.visible' } , data: { powertip: "#{t('admin.variant_overrides.index.new_powertip')}" } } .four.columns   .four.columns.omega{ ng: { show: 'views.new.visible' } } %button.fullwidth{ type: 'button', ng: { click: "selectView('inventory')" } } diff --git a/app/views/admin/variant_overrides/_filters.html.haml b/app/views/admin/variant_overrides/_filters.html.haml index c9f3a27b32..a1772ed222 100644 --- a/app/views/admin/variant_overrides/_filters.html.haml +++ b/app/views/admin/variant_overrides/_filters.html.haml @@ -5,7 +5,7 @@ %input.fullwidth{ :type => "text", :id => 'query', ng: { model: 'query', disabled: '!hub_id'} } .two.columns   .filter_select.four.columns - %label{ :for => 'hub_id', ng: { bind: "hub_id ? '#{t('admin.shop')}' : '#{t('admin.inventory.select_a_shop')}'" } } + %label{ :for => 'hub_id', ng: { bind: "hub_id ? '#{t('admin.shop')}' : '#{t('admin.variant_overrides.index.select_a_shop')}'" } } %br %select.select2.fullwidth#hub_id{ 'ng-model' => 'hub_id', name: 'hub_id', ng: { options: 'hub.id as hub.name for (id, hub) in hubs' } } .filter_select.four.columns diff --git a/app/views/admin/variant_overrides/_header.html.haml b/app/views/admin/variant_overrides/_header.html.haml index e4a8e98420..64a6bfb201 100644 --- a/app/views/admin/variant_overrides/_header.html.haml +++ b/app/views/admin/variant_overrides/_header.html.haml @@ -1,8 +1,8 @@ - content_for :html_title do - = t("admin.inventory.title") + = t("admin.variant_overrides.index.title") - content_for :page_title do - %h1.page-title= t("admin.inventory.title") - %a.with-tip{ 'data-powertip' => "#{t("admin.inventory.description")}" }=t('admin.whats_this') + %h1.page-title= t("admin.variant_overrides.index.title") + %a.with-tip{ 'data-powertip' => "#{t("admin.variant_overrides.index.description")}" }=t('admin.whats_this') = render :partial => 'spree/admin/shared/product_sub_menu' diff --git a/app/views/admin/variant_overrides/_hidden_products.html.haml b/app/views/admin/variant_overrides/_hidden_products.html.haml index 9f0d4f2d94..ed3e2555c8 100644 --- a/app/views/admin/variant_overrides/_hidden_products.html.haml +++ b/app/views/admin/variant_overrides/_hidden_products.html.haml @@ -9,7 +9,7 @@ %th.producer=t('admin.producer') %th.product=t('admin.product') %th.variant=t('(admin.variant') - %th.add=t('admin.inventory.add') + %th.add=t('admin.variant_overrides.index.add') %tbody{ ng: { repeat: 'product in filteredProducts | limitTo:productLimit' } } %tr{ id: "v_{{variant.id}}", ng: { repeat: 'variant in product.variants | inventoryVariants:hub_id:views' } } %td.producer{ ng: { bind: '::producersByID[product.producer_id].name'} } @@ -19,4 +19,4 @@ .variant-override-unit{ ng: { bind: '::variant.unit_to_display'} } %td.add %button.fullwidth.icon-plus{ ng: { click: "setVisibility(hub_id,variant.id,true)" } } - = t('admin.inventory.add') + = t('admin.variant_overrides.index.add') diff --git a/app/views/admin/variant_overrides/_new_products.html.haml b/app/views/admin/variant_overrides/_new_products.html.haml index 414fba224d..99827717f5 100644 --- a/app/views/admin/variant_overrides/_new_products.html.haml +++ b/app/views/admin/variant_overrides/_new_products.html.haml @@ -8,9 +8,9 @@ %tr %th.producer=t('admin.producer') %th.product=t('admin.product') - %th.variant=t('(admin.variant') - %th.add=t('admin.inventory.add') - %th.hide=t('admin.inventory.hide') + %th.variant=t('admin.variant') + %th.add=t('admin.variant_overrides.index.add') + %th.hide=t('admin.variant_overrides.index.hide') %tbody{ ng: { repeat: 'product in filteredProducts | limitTo:productLimit' } } %tr{ id: "v_{{variant.id}}", ng: { repeat: 'variant in product.variants | inventoryVariants:hub_id:views' } } %td.producer{ ng: { bind: '::producersByID[product.producer_id].name'} } @@ -20,7 +20,7 @@ .variant-override-unit{ ng: { bind: '::variant.unit_to_display'} } %td.add %button.fullwidth.icon-plus{ ng: { click: "setVisibility(hub_id,variant.id,true)" } } - = t('admin.inventory.add') + = t('admin.variant_overrides.index.add') %td.hide %button.fullwidth.hide.icon-remove{ ng: { click: "setVisibility(hub_id,variant.id,false)" } } - = t('admin.inventory.hide') + = t('admin.variant_overrides.index.hide') diff --git a/app/views/admin/variant_overrides/_new_products_alert.html.haml b/app/views/admin/variant_overrides/_new_products_alert.html.haml index 29ec4c9623..385616d817 100644 --- a/app/views/admin/variant_overrides/_new_products_alert.html.haml +++ b/app/views/admin/variant_overrides/_new_products_alert.html.haml @@ -1,5 +1,5 @@ %div{ ng: { show: '(newProductCount = (products | hubPermissions:hubPermissions:hub_id | newInventoryProducts:hub_id).length) > 0 && !views.new.visible && !alertDismissed' } } %hr.divider.sixteen.columns.alpha.omega - %alert-row{ message: "#{t('admin.inventory.new_products_alert_message', new_product_count: '{{ newProductCount }}')}", + %alert-row{ message: "#{t('admin.variant_overrides.index.new_products_alert_message', new_product_count: '{{ newProductCount }}')}", dismissed: "alertDismissed", - button: { text: "#{t('admin.inventory.review_now')}", action: "selectView('new')" } } + button: { text: "#{t('admin.variant_overrides.index.review_now')}", action: "selectView('new')" } } diff --git a/app/views/admin/variant_overrides/_no_results.html.haml b/app/views/admin/variant_overrides/_no_results.html.haml index cdec6ab8c5..7ec4e68f0e 100644 --- a/app/views/admin/variant_overrides/_no_results.html.haml +++ b/app/views/admin/variant_overrides/_no_results.html.haml @@ -1,7 +1,7 @@ %div.text-big.no-results{ ng: { show: 'hub_id && products.length > 0 && filteredProducts.length == 0' } } - %span{ ng: { show: 'views.inventory.visible && !filtersApplied()' } }=t('admin.inventory.currently_empty') - %span{ ng: { show: 'views.inventory.visible && filtersApplied()' } }=t('admin.inventory.no_matching_products') - %span{ ng: { show: 'views.hidden.visible && !filtersApplied()' } }=t('admin.inventory.no_hidden_products') - %span{ ng: { show: 'views.hidden.visible && filtersApplied()' } }=t('admin.inventory.no_matching_hidden_products') - %span{ ng: { show: 'views.new.visible && !filtersApplied()' } }=t('admin.inventory.no_new_products') - %span{ ng: { show: 'views.new.visible && filtersApplied()' } }=t('admin.inventory.no_matching_new_products') + %span{ ng: { show: 'views.inventory.visible && !filtersApplied()' } }=t('admin.variant_overrides.index.currently_empty') + %span{ ng: { show: 'views.inventory.visible && filtersApplied()' } }=t('admin.variant_overrides.index.no_matching_products') + %span{ ng: { show: 'views.hidden.visible && !filtersApplied()' } }=t('admin.variant_overrides.index.no_hidden_products') + %span{ ng: { show: 'views.hidden.visible && filtersApplied()' } }=t('admin.variant_overrides.index.no_matching_hidden_products') + %span{ ng: { show: 'views.new.visible && !filtersApplied()' } }=t('admin.variant_overrides.index.no_new_products') + %span{ ng: { show: 'views.new.visible && filtersApplied()' } }=t('admin.variant_overrides.index.no_matching_new_products') diff --git a/app/views/admin/variant_overrides/_products.html.haml b/app/views/admin/variant_overrides/_products.html.haml index b54cfeba9a..4330496b3e 100644 --- a/app/views/admin/variant_overrides/_products.html.haml +++ b/app/views/admin/variant_overrides/_products.html.haml @@ -16,13 +16,13 @@ %tr{ ng: { controller: "ColumnsCtrl" } } %th.producer{ ng: { show: 'columns.producer.visible' } }=t('admin.producer') %th.product{ ng: { show: 'columns.product.visible' } }=t('admin.product') - %th.sku{ ng: { show: 'columns.sku.visible' } }=t('admin.inventory.sku') - %th.price{ ng: { show: 'columns.price.visible' } }=t('admin.inventory.price') - %th.on_hand{ ng: { show: 'columns.on_hand.visible' } }=t('admin.inventory.on_hand') - %th.on_demand{ ng: { show: 'columns.on_demand.visible' } }=t('admin.inventory.on_demand') - %th.reset{ colspan: 2, ng: { show: 'columns.reset.visible' } }=t('admin.inventory.enable_reset') - %th.inheritance{ ng: { show: 'columns.inheritance.visible' } }=t('admin.inventory.inherit') - %th.visibility{ ng: { show: 'columns.visibility.visible' } }=t('admin.inventory.hide') + %th.sku{ ng: { show: 'columns.sku.visible' } }=t('admin.sku') + %th.price{ ng: { show: 'columns.price.visible' } }=t('admin.price') + %th.on_hand{ ng: { show: 'columns.on_hand.visible' } }=t('admin.on_hand') + %th.on_demand{ ng: { show: 'columns.on_demand.visible' } }=t('admin.on_demand?') + %th.reset{ colspan: 2, ng: { show: 'columns.reset.visible' } }=t('admin.variant_overrides.index.enable_reset?') + %th.inheritance{ ng: { show: 'columns.inheritance.visible' } }=t('admin.variant_overrides.index.inherit?') + %th.visibility{ ng: { show: 'columns.visibility.visible' } }=t('admin.variant_overrides.index.hide') %tbody{ ng: {repeat: 'product in filteredProducts = (products | hubPermissions:hubPermissions:hub_id | inventoryProducts:hub_id:views | attrFilter:{producer_id:producerFilter} | filter:query) | limitTo:productLimit' } } = render 'admin/variant_overrides/products_product' = render 'admin/variant_overrides/products_variants' diff --git a/app/views/admin/variant_overrides/_products_variants.html.haml b/app/views/admin/variant_overrides/_products_variants.html.haml index a7a94437be..c139bc7ffb 100644 --- a/app/views/admin/variant_overrides/_products_variants.html.haml +++ b/app/views/admin/variant_overrides/_products_variants.html.haml @@ -19,4 +19,4 @@ %input.field{ :type => 'checkbox', name: 'variant-overrides-{{ variant.id }}-inherit', ng: { model: 'inherit' }, 'track-inheritance' => true } %td.visibility{ ng: { show: 'columns.visibility.visible' } } %button.icon-remove.hide.fullwidth{ :type => 'button', ng: { click: "setVisibility(hub_id,variant.id,false)" } } - = t('admin.inventory.hide') + = t('admin.variant_overrides.index.hide') diff --git a/app/views/spree/admin/orders/bulk_management.html.haml b/app/views/spree/admin/orders/bulk_management.html.haml index ce82341e03..520d2376a4 100644 --- a/app/views/spree/admin/orders/bulk_management.html.haml +++ b/app/views/spree/admin/orders/bulk_management.html.haml @@ -3,9 +3,9 @@ - content_for :page_title do %h1.page-title - = t "bom_page_title" + = t("admin.orders.bulk_management.page_title") %a{ 'ofn-with-tip' => t("bom_tip") } - = t "admin.whats_this" + = t("admin.whats_this") = render :partial => 'spree/admin/shared/order_sub_menu' @@ -18,28 +18,28 @@ .filters{ :class => "sixteen columns alpha" } .date_filter{ :class => "two columns alpha" } %label{ :for => 'start_date_filter' } - = t "start_date" + = t("admin.start_date") %br %input{ :class => "two columns alpha", :type => "text", :id => 'start_date_filter', 'ng-model' => 'startDate', 'datepicker' => "startDate", 'confirm-change' => "confirmRefresh()", 'ng-change' => 'refreshData()' } .date_filter{ :class => "two columns" } %label{ :for => 'end_date_filter' } - = t "end_date" + = t("admin.end_date") %br %input{ :class => "two columns alpha", :type => "text", :id => 'end_date_filter', 'ng-model' => 'endDate', 'datepicker' => "endDate", 'confirm-change' => "confirmRefresh()", 'ng-change' => 'refreshData()' } .one.column   .filter_select{ :class => "three columns" } %label{ :for => 'supplier_filter' } - = t "producer" + = t("admin.producer") %br %select{ :class => "three columns alpha", :id => 'supplier_filter', 'select2-min-search' => 5, 'ng-model' => 'supplierFilter', 'ng-options' => 's.id as s.name for s in suppliers' } .filter_select{ :class => "three columns" } %label{ :for => 'distributor_filter' } - = t "bom_hub" + = t("admin.shop") %br %select{ :class => "three columns alpha", :id => 'distributor_filter', 'select2-min-search' => 5, 'ng-model' => 'distributorFilter', 'ng-options' => 'd.id as d.name for d in distributors'} .filter_select{ :class => "three columns" } %label{ :for => 'order_cycle_filter' } - = t "order_cycle" + = t("admin.order_cycle") %br %select{ :class => "three columns alpha", :id => 'order_cycle_filter', 'select2-min-search' => 5, 'ng-model' => 'orderCycleFilter', 'ng-options' => 'oc.id as oc.name for oc in orderCycles', 'confirm-change' => "confirmRefresh()", 'ng-change' => 'refreshData()'} .filter_clear{ :class => "two columns omega" } @@ -53,7 +53,7 @@ %div.shared_resource{ :class => "four columns alpha" } %span{ :class => 'three columns alpha' } %input{ type: 'checkbox', :id => 'shared_resource', 'ng-model' => 'sharedResource'} - = t "bom_shared" + = t("admin.orders.bulk_management.shared") %div{ :class => "eight columns" } %h6{ :class => "eight columns alpha", 'ng-show' => 'sharedResource', style: 'text-align: center;' } {{ selectedUnitsProduct.name + ": ALL" }} %h6{ :class => "eight columns alpha", 'ng-hide' => 'sharedResource', style: 'text-align: center;' } {{ selectedUnitsVariant.full_name }} @@ -65,32 +65,32 @@ .one.column.alpha   .two.columns %span.two.columns - = t "group_buy_unit_size" + = t("admin.orders.bulk_management.group_buy_unit_size") %span.two.columns {{ formattedValueWithUnitName( selectedUnitsProduct.group_buy_unit_size, selectedUnitsProduct, selectedUnitsVariant ) }} .one.column   .two.columns %span.two.columns - = t "total_qtt_ordered" + = t("admin.orders.bulk_management.total_qtt_ordered") %span.two.columns {{ formattedValueWithUnitName( sumUnitValues(), selectedUnitsProduct, selectedUnitsVariant ) }} .one.column   .two.columns %span.two.columns - = t "max_qtt_ordered" + = t("admin.orders.bulk_management.max_qtt_ordered") %span.two.columns {{ formattedValueWithUnitName( sumMaxUnitValues(), selectedUnitsProduct, selectedUnitsVariant ) }} .one.column   .two.columns %span.two.columns - = t "current_fulfilled_units" + = t("admin.orders.bulk_management.current_fulfilled_units") %span.two.columns {{ fulfilled(sumUnitValues()) }} .one.column   .two.columns %span.two.columns - = t "max_fulfilled_units" + = t("admin.orders.bulk_management.max_fulfilled_units") %span.two.columns {{ fulfilled(sumMaxUnitValues()) }} .one.column.omega   %div{ :class => "eight columns alpha", 'ng-hide' => 'allFinalWeightVolumesPresent()' } %span{ :class => "eight columns alpha", style: 'color:red' } - = t "bulk_management_warning" + = t("admin.orders.bulk_management.variants_without_unit_value") %hr.divider.sixteen.columns.alpha.omega @@ -104,11 +104,11 @@ %div.sixteen.columns.alpha#loading{ 'ng-if' => 'RequestMonitor.loading' } %img.spinner{ src: "/assets/spinning-circles.svg" } %h1 - =t "bom_loading" + = t("admin.orders.bulk_management.loading") %div{ :class => "sixteen columns alpha", 'ng-show' => '!RequestMonitor.loading && filteredLineItems.length == 0'} %h1#no_results - = t "bom_no_results" + = t("admin.orders.bulk_management.no_results") .margin-bottom-50{ 'ng-hide' => 'RequestMonitor.loading || filteredLineItems.length == 0' } %form{ name: 'bulk_order_form' } @@ -119,42 +119,42 @@ %input{ :type => "checkbox", :name => 'toggle_bulk', 'ng-click' => 'toggleAllCheckboxes()', 'ng-checked' => "allBoxesChecked()" } %th.order_no{ 'ng-show' => 'columns.order_no.visible' } %a{ :href => '', 'ng-click' => "predicate = 'order.number'; reverse = !reverse" } - = t "order_no" + = t("admin.orders.bulk_management.order_no") %th.full_name{ 'ng-show' => 'columns.full_name.visible' } %a{ :href => '', 'ng-click' => "predicate = 'order.full_name'; reverse = !reverse" } - = t "name" + = t("admin.name") %th.email{ 'ng-show' => 'columns.email.visible' } %a{ :href => '', 'ng-click' => "predicate = 'order.email'; reverse = !reverse" } - = t "email" + = t("admin.email") %th.phone{ 'ng-show' => 'columns.phone.visible' } %a{ :href => '', 'ng-click' => "predicate = 'order.phone'; reverse = !reverse" } - = t "phone" + = t("admin.phone") %th.date{ 'ng-show' => 'columns.order_date.visible' } %a{ :href => '', 'ng-click' => "predicate = 'order.completed_at'; reverse = !reverse" } - =t "bom_date" + = t("admin.orders.bulk_management.order_date") %th.producer{ 'ng-show' => 'columns.producer.visible' } %a{ :href => '', 'ng-click' => "predicate = 'supplier.name'; reverse = !reverse" } - = t "producer" + = t("admin.producer") %th.order_cycle{ 'ng-show' => 'columns.order_cycle.visible' } %a{ :href => '', 'ng-click' => "predicate = 'order.order_cycle.name'; reverse = !reverse" } - = t "bom_cycle" + = t("admin.order_cycle") %th.hub{ 'ng-show' => 'columns.hub.visible' } %a{ :href => '', 'ng-click' => "predicate = 'order.distributor.name'; reverse = !reverse" } - = t "bom_hub" + = t("admin.shop") %th.variant{ 'ng-show' => 'columns.variant.visible' } %a{ :href => '', 'ng-click' => "predicate = 'units_variant.full_name'; reverse = !reverse" } - = t "bom_variant" + = t("admin.orders.bulk_management.product_unit") %th.quantity{ 'ng-show' => 'columns.quantity.visible' } - = t "products_quantity" + = t("admin.quantity") %th.max{ 'ng-show' => 'columns.max.visible' } - = t "shop_variant_quantity_max" + = t("admin.orders.bulk_management.max") %th.final_weight_volume{ 'ng-show' => 'columns.final_weight_volume.visible' } - = t "weight_volume" + = t("admin.orders.bulk_management.weight_volume") %th.price{ 'ng-show' => 'columns.price.visible' } - = t "products_price" + = t("admin.price") %th.actions %th.actions - = t "ask" + = t("admin.orders.bulk_management.ask") %input{ :type => 'checkbox', 'ng-model' => "confirmDelete" } %tr.line_item{ 'ng-repeat' => "line_item in filteredLineItems = ( lineItems | filter:quickSearch | selectFilter:supplierFilter:distributorFilter:orderCycleFilter | variantFilter:selectedUnitsProduct:selectedUnitsVariant:sharedResource | orderBy:predicate:reverse )", 'ng-class-even' => "'even'", 'ng-class-odd' => "'odd'", :id => "li_{{line_item.id}}" } diff --git a/app/views/spree/admin/products/bulk_edit/_products_head.html.haml b/app/views/spree/admin/products/bulk_edit/_products_head.html.haml index 7767b8de89..50789a2f82 100644 --- a/app/views/spree/admin/products/bulk_edit/_products_head.html.haml +++ b/app/views/spree/admin/products/bulk_edit/_products_head.html.haml @@ -21,18 +21,18 @@ %th.left-actions %a{ 'ng-click' => 'toggleShowAllVariants()', :style => 'color: red' } Expand All - %th.producer{ 'ng-show' => 'columns.producer.visible' } Producer - %th.sku{ 'ng-show' => 'columns.sku.visible' } SKU - %th.name{ 'ng-show' => 'columns.name.visible' } Name - %th.unit{ 'ng-show' => 'columns.unit.visible' } Unit / Value - %th.display_as{ 'ng-show' => 'columns.unit.visible' } Display As - %th.price{ 'ng-show' => 'columns.price.visible' } Price - %th.on_hand{ 'ng-show' => 'columns.on_hand.visible' } On Hand - %th.on_demand{ 'ng-show' => 'columns.on_demand.visible' } On Demand - %th.category{ 'ng-show' => 'columns.category.visible' } Category - %th.tax_category{ 'ng-show' => 'columns.tax_category.visible' } Tax Category - %th.inherits_properties{ 'ng-show' => 'columns.inherits_properties.visible' } Inherits Properties? - %th.available_on{ 'ng-show' => 'columns.available_on.visible' } Av. On + %th.producer{ 'ng-show' => 'columns.producer.visible' }=t('admin.producer') + %th.sku{ 'ng-show' => 'columns.sku.visible' }=t('admin.sku') + %th.name{ 'ng-show' => 'columns.name.visible' }=t('admin.name') + %th.unit{ 'ng-show' => 'columns.unit.visible' }=t('admin.products.bulk_edit.unit') + %th.display_as{ 'ng-show' => 'columns.unit.visible' }=t('admin.products.bulk_edit.display_as') + %th.price{ 'ng-show' => 'columns.price.visible' }=t('admin.price') + %th.on_hand{ 'ng-show' => 'columns.on_hand.visible' }=t('admin.on_hand') + %th.on_demand{ 'ng-show' => 'columns.on_demand.visible' }=t('admin.on_demand?') + %th.category{ 'ng-show' => 'columns.category.visible' }=t('admin.products.bulk_edit.category') + %th.tax_category{ 'ng-show' => 'columns.tax_category.visible' }=t('admin.products.bulk_edit.tax_category') + %th.inherits_properties{ 'ng-show' => 'columns.inherits_properties.visible' }=t('admin.products.bulk_edit.inherits_proerties?') + %th.available_on{ 'ng-show' => 'columns.available_on.visible' }=t('admin.products.bulk_edit.av_on') %th.actions %th.actions %th.actions diff --git a/config/locales/en.yml b/config/locales/en.yml index 02d66a5354..3249f00d5a 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -71,13 +71,29 @@ en: admin: + # Common properties / models + date: Date + email: Email + name: Name + on_hand: On Hand + on_demand: On Demand + on_demand?: On Demand? + order_cycle: Order Cycle + phone: Phone + price: Price + producer: Producer + product: Product + quantity: Quantity + shop: Shop + sku: SKU + tags: Tags + variant: Variant + # General form elements quick_search: Quick Search clear_all: Clear All - producer: Producer - shop: Shop - product: Product - variant: Variant + start_date: "Start Date" + end_date: "End Date" columns: Columns actions: Actions @@ -96,38 +112,74 @@ en: customer_placeholder: "customer@example.org" valid_email_error: Please enter a valid email address add_a_new_customer_for: Add a new customer for %{shop_name} - inventory: - title: Inventory - description: Use this page to manage inventories for your enterprises. Any product details set here will override those set on the 'Products' page - sku: SKU - price: Price - on_hand: On Hand - on_demand: On Demand? - enable_reset: Enable Stock Level Reset? - inherit: Inherit? - add: Add - hide: Hide - select_a_shop: Select A Shop - review_now: Review Now - new_products_alert_message: There are %{new_product_count} new products available to add to your inventory. - currently_empty: Your inventory is currently empty - no_matching_products: No matching products found in your inventory - no_hidden_products: No products have been hidden from this inventory - no_matching_hidden_products: No hidden products match your search criteria - no_new_products: No new products are available to add to this inventory - no_matching_new_products: No new products match your search criteria - inventory_powertip: This is your inventory of products. To add products to your inventory, select 'New Products' from the Viewing dropdown. - hidden_powertip: These products have been hidden from your inventory and will not be available to add to your shop. You can click 'Add' to add a product to you inventory. - new_powertip: These products are available to be added to your inventory. Click 'Add' to add a product to your inventory, or 'Hide' to hide it from view. You can always change your mind later! + code: Code + products: + bulk_edit: + unit: Unit + display_as: Display As + category: Category + tax_category: Tax Category + inherits_properties?: Inherits Properties? + available_on: Available On + av_on: "Av. On" - order_cycle: - choose_products_from: "Choose Products From:" + variant_overrides: + index: + title: Inventory + description: Use this page to manage inventories for your enterprises. Any product details set here will override those set on the 'Products' page + enable_reset?: Enable Stock Reset? + inherit?: Inherit? + add: Add + hide: Hide + select_a_shop: Select A Shop + review_now: Review Now + new_products_alert_message: There are %{new_product_count} new products available to add to your inventory. + currently_empty: Your inventory is currently empty + no_matching_products: No matching products found in your inventory + no_hidden_products: No products have been hidden from this inventory + no_matching_hidden_products: No hidden products match your search criteria + no_new_products: No new products are available to add to this inventory + no_matching_new_products: No new products match your search criteria + inventory_powertip: This is your inventory of products. To add products to your inventory, select 'New Products' from the Viewing dropdown. + hidden_powertip: These products have been hidden from your inventory and will not be available to add to your shop. You can click 'Add' to add a product to you inventory. + new_powertip: These products are available to be added to your inventory. Click 'Add' to add a product to your inventory, or 'Hide' to hide it from view. You can always change your mind later! + + orders: + bulk_management: + tip: "Use this page to alter product quantities across multiple orders. Products may also be removed from orders entirely, if required." + shared: "Shared Resource?" + order_no: "Order No." + order_date: "Order Date" + max: "Max" + product_unit: "Product: Unit" + weight_volume: "Weight/Volume" + ask: "Ask?" + page_title: "Bulk Order Management" + actions_delete: "Delete Selected" + loading: "Loading orders" + no_results: "No orders found." + group_buy_unit_size: "Group Buy Unit Size" + total_qtt_ordered: "Total Quantity Ordered" + max_qtt_ordered: "Max Quantity Ordered" + current_fulfilled_units: "Current Fulfilled Units" + max_fulfilled_units: "Max Fulfilled Units" + order_error: "Some errors must be resolved before you can update orders.\nAny fields with red borders contain errors." + variants_without_unit_value: "WARNING: Some variants do not have a unit value" + + order_cycles: + edit: + choose_products_from: "Choose Products From:" enterprise: select_outgoing_oc_products_from: Select outgoing OC products from enterprises: + index: + producer?: Producer? + package: Package + status: Status + manage: Manage form: primary_details: shopfront_requires_login: "Shopfront requires login?" @@ -332,22 +384,6 @@ en: order_payment_paypal_successful: Your payment via PayPal has been processed successfully. order_hub_info: Hub Info - bom_tip: "Use this page to alter product quantities across multiple orders. Products may also be removed from orders entirely, if required." - bom_shared: "Shared Resource?" - bom_page_title: "Bulk Order Management" - bom_no: "Order no." - bom_date: "Order date" - bom_cycle: "Order cycle" - bom_max: "Max" - bom_hub: "Hub" - bom_variant: "Product: Unit" - bom_final_weigth_volume: "Weight/Volume" - bom_quantity: "Quantity" - bom_actions_delete: "Delete Selected" - bom_loading: "Loading orders" - bom_no_results: "No orders found." - bom_order_error: "Some errors must be resolved before you can update orders.\nAny fields with red borders contain errors." - unsaved_changes_warning: "Unsaved changes exist and will be lost if you continue." unsaved_changes_error: "Fields with red borders contain errors." @@ -574,20 +610,9 @@ See the %{link} to find out more about %{sitename}'s features and to start using products_description: Description products_variant: Variant products_quantity: Quantity - products_availabel: Available? + products_available: Available? products_producer: "Producer" products_price: "Price" - products_sku: "SKU" - products_name: "name" - products_unit: "unit" - products_on_hand: "on hand" - products_on_demand: "On demand?" - products_category: "Category" - products_tax_category: "tax category" - products_available_on: "Available On" - products_inherit: "Inherit?" - products_inherits_properties: "Inherits Properties?" - products_stock_level_reset: "Enable Stock Level Reset?" register_title: Register @@ -945,19 +970,7 @@ Please follow the instructions there to make your enterprise visible on the Open manage_products: "Manage products" edit_profile_details: "Edit profile details" edit_profile_details_etc: "Change your profile description, images, etc." - start_date: "Start Date" - end_date: "End Date" order_cycle: "Order Cycle" - group_buy_unit_size: "Group Buy Unit Size" - total_qtt_ordered: "Total Quantity Ordered" - max_qtt_ordered: "Max Quantity Ordered" - current_fulfilled_units: "Current Fulfilled Units" - max_fulfilled_units: "Max Fulfilled Units" - bulk_management_warning: "WARNING: Some variants do not have a unit value" - ask: "Ask?" - no_orders_found: "No orders found." - order_no: "Order No." - weight_volume: "Weight/Volume" remove_tax: "Remove tax" tax_settings: "Tax Settings" products_require_tax_category: "products require tax category" diff --git a/lib/open_food_network/column_preference_defaults.rb b/lib/open_food_network/column_preference_defaults.rb index 126a8a567a..c18ac79550 100644 --- a/lib/open_food_network/column_preference_defaults.rb +++ b/lib/open_food_network/column_preference_defaults.rb @@ -9,68 +9,73 @@ module OpenFoodNetwork # for a given user, action_name and column_name def variant_overrides_index_columns + node = 'admin.variant_overrides.index' { - producer: { name: "Producer", visible: true }, - product: { name: "Product", visible: true }, - sku: { name: "SKU", visible: false }, - price: { name: "Price", visible: true }, - on_hand: { name: "On Hand", visible: true }, - on_demand: { name: "On Demand", visible: false }, - reset: { name: "Reset Stock Level", visible: false }, - inheritance: { name: "Inheritance", visible: false }, - visibility: { name: "Hide", visible: false } + producer: { name: I18n.t("admin.producer"), visible: true }, + product: { name: I18n.t("admin.product"), visible: true }, + sku: { name: I18n.t("admin.sku"), visible: false }, + price: { name: I18n.t("admin.price"), visible: true }, + on_hand: { name: I18n.t("admin.on_hand"), visible: true }, + on_demand: { name: I18n.t("admin.on_demand?"), visible: false }, + reset: { name: I18n.t("#{node}.enable_reset?"), visible: false }, + inheritance: { name: I18n.t("#{node}.inherit?"), visible: false }, + visibility: { name: I18n.t("#{node}.hide"), visible: false } } end def customers_index_columns + node = 'admin.customers.index' { - email: { name: "Email", visible: true }, - code: { name: "Code", visible: true }, - tags: { name: "Tags", visible: true } + email: { name: I18n.t("admin.email"), visible: true }, + code: { name: I18n.t("#{node}.code"), visible: true }, + tags: { name: I18n.t("admin.tags"), visible: true } } end def orders_bulk_management_columns + node = "admin.orders.bulk_management" { - order_no: { name: t("bom_no"), visible: false }, - full_name: { name: t("name"), visible: true }, - email: { name: t("email"), visible: false }, - phone: { name: t("phone"), visible: false }, - order_date: { name: t("bom_date"), visible: true }, - producer: { name: t("producer"), visible: true }, - order_cycle: { name: t("bom_cycle"), visible: false }, - hub: { name: t("bom_hub"), visible: false }, - variant: { name: t("bom_variant"), visible: true }, - quantity: { name: t("bom_quantity"), visible: true }, - max: { name: t("bom_max"), visible: true }, - final_weight_volume: { name: t("bom_final_weigth_volume"), visible: false }, - price: { name: t("price"), visible: false } + order_no: { name: I18n.t("#{node}.order_no"), visible: false }, + full_name: { name: I18n.t("admin.name"), visible: true }, + email: { name: I18n.t("admin.email"), visible: false }, + phone: { name: I18n.t("admin.phone"), visible: false }, + order_date: { name: I18n.t("#{node}.order_date"), visible: true }, + producer: { name: I18n.t("admin.producer"), visible: true }, + order_cycle: { name: I18n.t("admin.order_cycle"), visible: false }, + hub: { name: I18n.t("admin.shop"), visible: false }, + variant: { name: I18n.t("#{node}.product_unit"), visible: true }, + quantity: { name: I18n.t("admin.quantity"), visible: true }, + max: { name: I18n.t("#{node}.max"), visible: true }, + final_weight_volume: { name: I18n.t("#{node}.weight_volume"), visible: false }, + price: { name: I18n.t("admin.price"), visible: false } } end def products_bulk_edit_columns + node = "admin.products.bulk_edit" { - producer: { name: t("products_producer"), visible: true }, - sku: { name: t("products_sku"), visible: false }, - name: { name: t("products_name"), visible: true }, - unit: { name: t("products_unit"), visible: true }, - price: { name: t("products_price"), visible: true }, - on_hand: { name: t("products_on_hand"), visible: true }, - on_demand: { name: t("products_on_demand"), visible: false }, - category: { name: t("products_category"), visible: false }, - tax_category: { name: t("products_tax_category"), visible: false }, - inherits_properties: { name: t("products_inherits_properties"), visible: false }, - available_on: { name: t("products_available_on"), visible: false } + producer: { name: I18n.t("admin.producer"), visible: true }, + sku: { name: I18n.t("admin.sku"), visible: false }, + name: { name: I18n.t("admin.name"), visible: true }, + unit: { name: I18n.t("#{node}.unit"), visible: true }, + price: { name: I18n.t("admin.price"), visible: true }, + on_hand: { name: I18n.t("admin.on_hand"), visible: true }, + on_demand: { name: I18n.t("admin.on_demand"), visible: false }, + category: { name: I18n.t("#{node}.category"), visible: false }, + tax_category: { name: I18n.t("#{node}.tax_category"), visible: false }, + inherits_properties: { name: I18n.t("#{node}.inherits_properties?"), visible: false }, + available_on: { name: I18n.t("#{node}.available_on"), visible: false } } end def enterprises_index_columns + node = "admin.enterprises.index" { - name: { name: "Name", visible: true }, - producer: { name: "Producer", visible: true }, - package: { name: "Package", visible: true }, - status: { name: "Status", visible: true }, - manage: { name: "Manage", visible: true } + name: { name: I18n.t("admin.name"), visible: true }, + producer: { name: I18n.t("#{node}.producer?"), visible: true }, + package: { name: I18n.t("#{node}.package"), visible: true }, + status: { name: I18n.t("#{node}.status"), visible: true }, + manage: { name: I18n.t("#{node}.manage"), visible: true } } end end diff --git a/spec/features/admin/bulk_product_update_spec.rb b/spec/features/admin/bulk_product_update_spec.rb index 260caf207e..f7f32f6523 100644 --- a/spec/features/admin/bulk_product_update_spec.rb +++ b/spec/features/admin/bulk_product_update_spec.rb @@ -250,7 +250,7 @@ feature %q{ find("div#columns-dropdown", :text => "COLUMNS").click find("div#columns-dropdown div.menu div.menu_item", text: "Available On").click - find("div#columns-dropdown div.menu div.menu_item", text: "Category").click + find("div#columns-dropdown div.menu div.menu_item", text: /^Category?/).click find("div#columns-dropdown div.menu div.menu_item", text: "Inherits Properties?").click find("div#columns-dropdown div.menu div.menu_item", text: "SKU").click find("div#columns-dropdown", :text => "COLUMNS").click diff --git a/spec/features/admin/variant_overrides_spec.rb b/spec/features/admin/variant_overrides_spec.rb index a3a08c2466..0af93d19c3 100644 --- a/spec/features/admin/variant_overrides_spec.rb +++ b/spec/features/admin/variant_overrides_spec.rb @@ -255,12 +255,12 @@ feature %q{ it "deletes overrides when values are cleared" do first("div#columns-dropdown", :text => "COLUMNS").click first("div#columns-dropdown div.menu div.menu_item", text: "On Demand").click - first("div#columns-dropdown div.menu div.menu_item", text: "Reset Stock Level").click + first("div#columns-dropdown div.menu div.menu_item", text: "Enable Stock Reset?").click first("div#columns-dropdown", :text => "COLUMNS").click # Clearing values by 'inheriting' first("div#columns-dropdown", :text => "COLUMNS").click - first("div#columns-dropdown div.menu div.menu_item", text: "Inheritance").click + first("div#columns-dropdown div.menu div.menu_item", text: "Inherit?").click first("div#columns-dropdown", :text => "COLUMNS").click check "variant-overrides-#{variant3.id}-inherit"