From d8ea04045ed674ddfdfbf7a64c8c9eb0050ae87d Mon Sep 17 00:00:00 2001 From: Gaurav Kumar Rana <138654702+grana-equinix@users.noreply.github.com> Date: Wed, 27 Sep 2023 18:37:18 +0530 Subject: [PATCH 1/4] Passes cached_options_for_klient to support customizations --- app/controllers/kaui/invoices_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/kaui/invoices_controller.rb b/app/controllers/kaui/invoices_controller.rb index fa67c496..71f3deb1 100644 --- a/app/controllers/kaui/invoices_controller.rb +++ b/app/controllers/kaui/invoices_controller.rb @@ -39,7 +39,7 @@ def pagination end formatter = lambda do |invoice| row = [view_context.link_to(invoice.invoice_number, view_context.url_for(controller: :invoices, action: :show, account_id: invoice.account_id, id: invoice.invoice_id))] - row += Kaui.invoice_search_columns.call(invoice, view_context)[1] + row += Kaui.invoice_search_columns.call(invoice, view_context, invoice_search_columns)[1] row end else From 05c684b93156e20ecf9fca7aa48ab6cb333ebb08 Mon Sep 17 00:00:00 2001 From: Gaurav Kumar Rana <138654702+grana-equinix@users.noreply.github.com> Date: Wed, 27 Sep 2023 18:43:50 +0530 Subject: [PATCH 2/4] Adds cached_options_for_klient for customization support --- app/controllers/kaui/invoices_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/kaui/invoices_controller.rb b/app/controllers/kaui/invoices_controller.rb index 71f3deb1..b97a91e2 100644 --- a/app/controllers/kaui/invoices_controller.rb +++ b/app/controllers/kaui/invoices_controller.rb @@ -39,7 +39,7 @@ def pagination end formatter = lambda do |invoice| row = [view_context.link_to(invoice.invoice_number, view_context.url_for(controller: :invoices, action: :show, account_id: invoice.account_id, id: invoice.invoice_id))] - row += Kaui.invoice_search_columns.call(invoice, view_context, invoice_search_columns)[1] + row += Kaui.invoice_search_columns.call(invoice, view_context, cached_options_for_klient)[1] row end else From 3a4d1eb981c396c7992467a9ebc26fc2ef2e9503 Mon Sep 17 00:00:00 2001 From: Gaurav Kumar Rana <138654702+grana-equinix@users.noreply.github.com> Date: Wed, 27 Sep 2023 19:25:16 +0530 Subject: [PATCH 3/4] Adds cached_options_for_klient for function invoice_search_columns --- lib/kaui.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/kaui.rb b/lib/kaui.rb index bf51904a..dbf3a6db 100644 --- a/lib/kaui.rb +++ b/lib/kaui.rb @@ -68,7 +68,7 @@ module Kaui ] end - self.invoice_search_columns = lambda do |invoice = nil, view_context = nil| + self.invoice_search_columns = lambda do |invoice = nil, view_context = nil, cached_options_for_klient = nil| default_label = 'label-info' default_label = 'label-default' if invoice&.status == 'DRAFT' default_label = 'label-success' if invoice&.status == 'COMMITTED' From c99e98e369e413be986bd78b2ac36b44c3213f8c Mon Sep 17 00:00:00 2001 From: Gaurav Kumar Rana <138654702+grana-equinix@users.noreply.github.com> Date: Thu, 28 Sep 2023 20:41:13 +0530 Subject: [PATCH 4/4] Fixes rubocop eorror --- lib/kaui.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/kaui.rb b/lib/kaui.rb index dbf3a6db..c7becccd 100644 --- a/lib/kaui.rb +++ b/lib/kaui.rb @@ -68,7 +68,7 @@ module Kaui ] end - self.invoice_search_columns = lambda do |invoice = nil, view_context = nil, cached_options_for_klient = nil| + self.invoice_search_columns = lambda do |invoice = nil, view_context = nil, _cached_options_for_klient = nil| default_label = 'label-info' default_label = 'label-default' if invoice&.status == 'DRAFT' default_label = 'label-success' if invoice&.status == 'COMMITTED'