From 7a7b6c20122d1f6c868f6c8a13339bd12cac4c59 Mon Sep 17 00:00:00 2001 From: Bilel Kihal <61744974+Bilelkihal@users.noreply.github.com> Date: Mon, 15 Jan 2024 12:11:53 +0000 Subject: [PATCH] add recommender cite url --- app/components/buttons/regular_button_component.rb | 5 +++-- app/views/recommender/index.html.haml | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/components/buttons/regular_button_component.rb b/app/components/buttons/regular_button_component.rb index 1e994e803..55299a66b 100644 --- a/app/components/buttons/regular_button_component.rb +++ b/app/components/buttons/regular_button_component.rb @@ -2,7 +2,7 @@ class Buttons::RegularButtonComponent < ViewComponent::Base renders_one :icon_left renders_one :icon_right - def initialize(id: , value:, variant: "primary", color: "normal", href: "", size: "normal", state: "animate", type: 'button') + def initialize(id: , value:, variant: "primary", color: "normal", href: "", size: "normal", state: "animate", type: 'button', target: nil) @id = id @value = value @variant = variant @@ -11,6 +11,7 @@ def initialize(id: , value:, variant: "primary", color: "normal", href: "", size @size = size @state = state @type = type + @target = target end def button_label @@ -28,7 +29,7 @@ def button_elem on_click_event = load_animation? ? "displayAnimation(this, '#{@id}-loading-animation')" : '' if link? - link_to(@href, class: class_style, onclick: on_click_event, id: @id) do + link_to(@href, class: class_style, onclick: on_click_event, id: @id, target: @target) do button_label end else diff --git a/app/views/recommender/index.html.haml b/app/views/recommender/index.html.haml index c13fbafb9..fdb5d2e69 100644 --- a/app/views/recommender/index.html.haml +++ b/app/views/recommender/index.html.haml @@ -121,7 +121,7 @@ = render Input::RadioChipComponent.new(label: result[:annotations].length.to_s+' annotations', name: 'highlighted_recommendation', value: result[:annotations], checked: result[:highlighted]) .cite-us-button - = render Buttons::RegularButtonComponent.new(id:'regular-button', value: "Cite", variant: "secondary", href: "#", size: "slim") do |btn| + = render Buttons::RegularButtonComponent.new(id:'regular-button', value: "Cite", variant: "secondary", href: "https://doi.org/10.1186/s13326-017-0128-y", size: "slim", target: '_blank', state: "regular") do |btn| - btn.icon_left do = inline_svg_tag "icons/cite.svg"