From f198663263fced86017e390f4b85cfba65a62645 Mon Sep 17 00:00:00 2001 From: puppe1990 Date: Mon, 28 Oct 2024 20:33:00 -0300 Subject: [PATCH 1/2] add qr code in the sidebar --- app/views/shared/_sidebar.html.erb | 1 + app/views/shared/_sidebar_qr_scanner.html.erb | 6 ++++++ 2 files changed, 7 insertions(+) create mode 100644 app/views/shared/_sidebar_qr_scanner.html.erb diff --git a/app/views/shared/_sidebar.html.erb b/app/views/shared/_sidebar.html.erb index e3b975a4..8606e2ca 100644 --- a/app/views/shared/_sidebar.html.erb +++ b/app/views/shared/_sidebar.html.erb @@ -102,6 +102,7 @@ <% end %> + <%= render 'shared/sidebar_qr_scanner' %> <% if account_policy_enabled? %> <%= render 'shared/sidebar_dropdown', title: t("stores.two"), icon: 'fas fa-store' do %>
  • diff --git a/app/views/shared/_sidebar_qr_scanner.html.erb b/app/views/shared/_sidebar_qr_scanner.html.erb new file mode 100644 index 00000000..00ac7423 --- /dev/null +++ b/app/views/shared/_sidebar_qr_scanner.html.erb @@ -0,0 +1,6 @@ +
  • + <%= link_to qr_scanner_path, class: "nav-link" do %> + + QR Scanner + <% end %> +
  • \ No newline at end of file From 9b07b1c29d25b8287596db2d54d2443bc417bedf Mon Sep 17 00:00:00 2001 From: puppe1990 Date: Thu, 31 Oct 2024 11:40:49 -0300 Subject: [PATCH 2/2] add the missing helper --- app/helpers/application_helper.rb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 2c0d37e8..6a699b05 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -87,6 +87,14 @@ def localize(object, options = {}) alias l localize + def active_class(controller_name) + if controller_name.is_a?(Array) + 'active' if controller_name.include?(controller.controller_name) + else + 'active' if controller.controller_name == controller_name + end + end + private def active_actions?(controller, actions)