Skip to content
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

Add rel='noopener noreferrer' to links with target=_blank #3169

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/helpers/rails_admin/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def root_navigation

def static_navigation
li_stack = RailsAdmin::Config.navigation_static_links.collect do |title, url|
content_tag(:li, link_to(title.to_s, url, target: '_blank'))
content_tag(:li, link_to(title.to_s, url, target: '_blank', rel: 'noopener noreferrer'))
end.join

label = RailsAdmin::Config.navigation_static_label || t('admin.misc.navigation_static_label')
Expand Down
4 changes: 2 additions & 2 deletions lib/rails_admin/config/fields/types/file_upload.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ class FileUpload < RailsAdmin::Config::Fields::Base
if image
thumb_url = resource_url(thumb_method)
image_html = v.image_tag(thumb_url, class: 'img-thumbnail')
url != thumb_url ? v.link_to(image_html, url, target: '_blank') : image_html
url != thumb_url ? v.link_to(image_html, url, target: '_blank', rel: 'noopener noreferrer') : image_html
else
v.link_to(value, url, target: '_blank')
v.link_to(value, url, target: '_blank', rel: 'noopener noreferrer')
end
end
end
Expand Down
4 changes: 2 additions & 2 deletions lib/rails_admin/config/fields/types/multiple_file_upload.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ def initialize(value)
if image
thumb_url = resource_url(thumb_method)
image_html = v.image_tag(thumb_url, class: 'img-thumbnail')
url != thumb_url ? v.link_to(image_html, url, target: '_blank') : image_html
url != thumb_url ? v.link_to(image_html, url, target: '_blank', rel: 'noopener noreferrer') : image_html
else
v.link_to(value, url, target: '_blank')
v.link_to(value, url, target: '_blank', rel: 'noopener noreferrer')
end
end
end
Expand Down