From 1ecdaeb6c8ec49d1ba93468fc47d75f08115d811 Mon Sep 17 00:00:00 2001 From: Tomasz Donarski Date: Fri, 6 Oct 2023 12:00:52 +0200 Subject: [PATCH] Add missing id attribute --- app/models/spree/admin/actions/action.rb | 3 ++- app/models/spree/admin/actions/action_builder.rb | 4 +++- .../spree/admin/actions/orders_default_actions_builder.rb | 3 ++- .../spree/admin/actions/products_default_actions_builder.rb | 3 ++- .../spree/admin/actions/users_default_actions_builder.rb | 3 ++- app/views/spree/admin/orders/index.html.erb | 3 ++- app/views/spree/admin/products/index.html.erb | 3 ++- app/views/spree/admin/users/index.html.erb | 3 ++- 8 files changed, 17 insertions(+), 8 deletions(-) diff --git a/app/models/spree/admin/actions/action.rb b/app/models/spree/admin/actions/action.rb index e1e1372de1..abf636aa3b 100644 --- a/app/models/spree/admin/actions/action.rb +++ b/app/models/spree/admin/actions/action.rb @@ -2,7 +2,7 @@ module Spree module Admin module Actions class Action - attr_reader :icon_name, :name, :classes, :text, :method + attr_reader :icon_name, :name, :classes, :text, :method, :id def initialize(config) @icon_name = config[:icon_name] @@ -12,6 +12,7 @@ def initialize(config) @availability_check = config[:availability_check] @text = config[:text] @method = config[:method] + @id = config[:id] end def available?(current_ability, resource = nil) diff --git a/app/models/spree/admin/actions/action_builder.rb b/app/models/spree/admin/actions/action_builder.rb index fb285ab337..1cfa2383fd 100644 --- a/app/models/spree/admin/actions/action_builder.rb +++ b/app/models/spree/admin/actions/action_builder.rb @@ -11,6 +11,7 @@ def initialize(config) @classes = config[:classes] @availability_check = nil @method = config[:method] + @id = config[:id] end def build @@ -27,7 +28,8 @@ def build_config classes: @classes, availability_check: @availability_check, text: text, - method: @method + method: @method, + id: @id } end diff --git a/app/models/spree/admin/actions/orders_default_actions_builder.rb b/app/models/spree/admin/actions/orders_default_actions_builder.rb index 224de2e47e..085e93ed07 100644 --- a/app/models/spree/admin/actions/orders_default_actions_builder.rb +++ b/app/models/spree/admin/actions/orders_default_actions_builder.rb @@ -26,7 +26,8 @@ def new_order_config icon_name: 'add.svg', name: :new_order, url: new_admin_order_path, - classes: 'btn-success' + classes: 'btn-success', + id: 'admin_new_order' } end end diff --git a/app/models/spree/admin/actions/products_default_actions_builder.rb b/app/models/spree/admin/actions/products_default_actions_builder.rb index 1da5210f7f..53224297bc 100644 --- a/app/models/spree/admin/actions/products_default_actions_builder.rb +++ b/app/models/spree/admin/actions/products_default_actions_builder.rb @@ -26,7 +26,8 @@ def new_product_config icon_name: 'add.svg', name: :new_product, url: new_admin_product_path, - classes: 'btn-success' + classes: 'btn-success', + id: 'admin_new_product' } end end diff --git a/app/models/spree/admin/actions/users_default_actions_builder.rb b/app/models/spree/admin/actions/users_default_actions_builder.rb index 3e442b0ca6..c3460f4059 100644 --- a/app/models/spree/admin/actions/users_default_actions_builder.rb +++ b/app/models/spree/admin/actions/users_default_actions_builder.rb @@ -26,7 +26,8 @@ def new_user_config icon_name: 'add.svg', name: :new_user, url: new_admin_user_path, - classes: 'btn-success' + classes: 'btn-success', + id: 'admin_new_user_link' } end end diff --git a/app/views/spree/admin/orders/index.html.erb b/app/views/spree/admin/orders/index.html.erb index cc7907b8e3..3366403203 100644 --- a/app/views/spree/admin/orders/index.html.erb +++ b/app/views/spree/admin/orders/index.html.erb @@ -9,7 +9,8 @@ action.text, action.url, class: action.classes, - icon: action.icon_name + icon: action.icon_name, + id: action.id ) %> <% end %> <% end %> diff --git a/app/views/spree/admin/products/index.html.erb b/app/views/spree/admin/products/index.html.erb index 04455e35f0..8d3865e3fe 100644 --- a/app/views/spree/admin/products/index.html.erb +++ b/app/views/spree/admin/products/index.html.erb @@ -9,7 +9,8 @@ action.text, action.url, class: action.classes, - icon: action.icon_name + icon: action.icon_name, + id: action.id ) %> <% end %> <% end %> diff --git a/app/views/spree/admin/users/index.html.erb b/app/views/spree/admin/users/index.html.erb index 6b4ae8420d..ef0aa0a519 100644 --- a/app/views/spree/admin/users/index.html.erb +++ b/app/views/spree/admin/users/index.html.erb @@ -9,7 +9,8 @@ action.text, action.url, class: action.classes, - icon: action.icon_name + icon: action.icon_name, + id: action.id ) %> <% end %> <% end %>