diff --git a/app/components/dropdown_link_component.html.erb b/app/components/dropdown_link_component.html.erb index eb15ffc..8800f7e 100644 --- a/app/components/dropdown_link_component.html.erb +++ b/app/components/dropdown_link_component.html.erb @@ -1,4 +1,4 @@ -<%= link_to @href, class: @class, data: { +<%= link_to @href, class: @class, target: @target, data: { 'dropdown-target': "menuItem", 'action': "keydown.up->dropdown#previousItem:prevent keydown.down->dropdown#nextItem:prevent" } do %> diff --git a/app/components/dropdown_link_component.rb b/app/components/dropdown_link_component.rb index 4eabc8e..e9dec36 100644 --- a/app/components/dropdown_link_component.rb +++ b/app/components/dropdown_link_component.rb @@ -1,8 +1,9 @@ # frozen_string_literal: true class DropdownLinkComponent < ViewComponent::Base - def initialize(href:, separator: false, add_class: nil) + def initialize(href:, open_in_new_tab: false, separator: false, add_class: nil) @href = href + @target = open_in_new_tab ? "_blank" : nil @class = class_str(separator, add_class) end diff --git a/app/components/rs_auth_component.html.erb b/app/components/rs_auth_component.html.erb index 535dc1b..a26d35d 100644 --- a/app/components/rs_auth_component.html.erb +++ b/app/components/rs_auth_component.html.erb @@ -12,7 +12,8 @@ <%= render DropdownComponent.new do %> <%= render DropdownLinkComponent.new( - href: launch_app_services_storage_rs_auth_url(@auth) + href: launch_app_services_storage_rs_auth_url(@auth), + open_in_new_tab: true ) do %> Launch app <% end %>