Project

General

Profile

« Previous | Next » 

Revision 9042033c

Added by Tomer Brisker about 5 years ago

Fixes #26325 - Remove data-id aid attributes

These were used by QE automation to identify links but are no longer
needed since https://github.com/SatelliteQE/airgun/commit/8438e7274a73e01dcb7073f47068eba877e2bed5

View differences:

app/helpers/application_helper.rb
# Methods added to this helper will be available to all templates in the application
module ApplicationHelper
# Add autogenerated html data-id attribute if not present (prefixed with "aid_")
def link_to(*args)
return super(*args) if block_given?
options = args[1] || {}
html_options = args[2] || {}
unless html_options.has_key?(:'data-id') || (options.is_a?(String) && options.start_with?('mailto', 'javascript'))
begin
path = URI(url_for(options) || html_options['href']).path.split('/').reject(&:empty?)
id = if path.empty?
''
else
path.last([path.size, 3].max).join('_')
end
rescue => e
Foreman::Logging.exception("Failed generating link using #{args.inspect}", e)
id = ''
end
html_options[:'data-id'] = "aid_#{id}" unless id.empty?
end
if html_options[:confirm]
Foreman::Deprecation.deprecation_warning('1.24', 'passing :confirm parameter in html_options to link_to is deprecated. Please use `data: {confirm: "confirmation message?"}` instead.')
html_options[:data] ||= {}

Also available in: Unified diff