forked from ontoportal/ontoportal_web_ui
-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix: Federation portal button link #854
Merged
syphax-bouazzouni
merged 2 commits into
development
from
fix/federation-portal-button-link
Nov 23, 2024
+10
−1
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
app/components/federated_portal_button_component/federated_portal_button_component.html.haml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
%span{'data-controller': 'federation-portals-colors', | ||
'data-federation-portals-colors-color-value': color, | ||
'data-federation-portals-colors-portal-name-value': name.downcase} | ||
%a{ href: link, target: '_blank', 'data-controller' => 'tooltip', title: tooltip, class: 'federation-portal-button button icon-right', style: color ? "background-color: #{light_color} !important" : '' } | ||
%a{ href: link, target: internal? ? '_top' : '_blank', 'data-controller' => 'tooltip', title: tooltip, class: 'federation-portal-button button icon-right', style: color ? "background-color: #{light_color} !important" : '' } | ||
= inline_svg_tag('logos/ontoportal.svg', class: "federated-icon-#{name.downcase}") | ||
%div{ class: 'text', style: color ? "color: #{color} !important" : '' } | ||
= name.humanize.gsub("portal", "Portal") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here it should be
id.include?($REST_URL)
, because logically this function does not make sense if you are unaware of the existence ofontoportal_ui_link
hack.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't got you well, what do you mean by
ontoportal_ui_link
hack?Here basically, when a link is internal we pass it relative like this
/ontologies/acronym
and when it is external we pass it absolute like thishttps://data...
so the first one technically is not considered as a valid link this is why I used the function
link?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How do you enforce that
internal we pass it relative like this /ontologies/acronym and when it is external we pass it absolute like this https://data...
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the external, no choice it should be absolute.
And for the internal onces, this is the practice that we have in all the app.
What is the case that you have in your mind and can break this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the external, yes.
For the internal, you did this
which says if I understood well, check if the given link includes the internal rest URL, and in this case remove it from it. So that you enforce that the internal link is not absolute, what I propose is to not have this code and just directly test if includes or not
$REST_URL
inside your new functioninternal?
, with no need for any external expectation of absolute or relative URL.And also I think that this function does that already https://github.com/ontoportal-lirmm/bioportal_web_ui/blob/master/app/helpers/federation_helper.rb#L65, but to test if does work in this case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did not substruct the
$REST_URL
only to use it inside the other component here.If the url is internal the best practice is to use the relative one instead of the absolute.
And inside the component I built my logic based on that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Discussed, ok