Fix new rubocop warnings

This commit is contained in:
Tom Hughes 2020-06-11 19:19:12 +01:00
parent 2c341c438a
commit 39b60219fe
10 changed files with 22 additions and 23 deletions

View file

@ -21,15 +21,15 @@ module ApplicationHelper
id = "#{object_name}_#{method}"
type = options.delete(:format) || "markdown"
content_tag(:div, :id => "#{id}_container", :class => "richtext_container") do
output_buffer << content_tag(:div, :id => "#{id}_content", :class => "richtext_content") do
tag.div(:id => "#{id}_container", :class => "richtext_container") do
output_buffer << tag.div(:id => "#{id}_content", :class => "richtext_content") do
output_buffer << text_area(object_name, method, options.merge("data-preview-url" => preview_url(:type => type)))
output_buffer << content_tag(:div, "", :id => "#{id}_preview", :class => "richtext_preview richtext")
output_buffer << tag.div("", :id => "#{id}_preview", :class => "richtext_preview richtext")
end
output_buffer << content_tag(:div, :id => "#{id}_help", :class => "richtext_help") do
output_buffer << tag.div(:id => "#{id}_help", :class => "richtext_help") do
output_buffer << render("site/#{type}_help")
output_buffer << content_tag(:div, :class => "buttons") do
output_buffer << tag.div(:class => "buttons") do
output_buffer << submit_tag(I18n.t("site.richtext_area.edit"), :id => "#{id}_doedit", :class => "richtext_doedit deemphasize", :disabled => true)
output_buffer << submit_tag(I18n.t("site.richtext_area.preview"), :id => "#{id}_dopreview", :class => "richtext_dopreview deemphasize")
end
@ -46,11 +46,11 @@ module ApplicationHelper
end
def friendly_date(date)
content_tag(:span, time_ago_in_words(date), :title => l(date, :format => :friendly))
tag.span(time_ago_in_words(date), :title => l(date, :format => :friendly))
end
def friendly_date_ago(date)
content_tag(:span, time_ago_in_words(date, :scope => :'datetime.distance_in_words_ago'), :title => l(date, :format => :friendly))
tag.span(time_ago_in_words(date, :scope => :'datetime.distance_in_words_ago'), :title => l(date, :format => :friendly))
end
def body_class

View file

@ -16,11 +16,11 @@ module BrowseHelper
locale = available_locales.preferred(preferred_languages)
if object.tags.include? "name:#{locale}"
name = t "printable_name.with_name_html", :name => content_tag(:bdi, object.tags["name:#{locale}"].to_s), :id => content_tag(:bdi, name)
name = t "printable_name.with_name_html", :name => tag.bdi(object.tags["name:#{locale}"].to_s), :id => tag.bdi(name)
elsif object.tags.include? "name"
name = t "printable_name.with_name_html", :name => content_tag(:bdi, object.tags["name"].to_s), :id => content_tag(:bdi, name)
name = t "printable_name.with_name_html", :name => tag.bdi(object.tags["name"].to_s), :id => tag.bdi(name)
elsif object.tags.include? "ref"
name = t "printable_name.with_name_html", :name => content_tag(:bdi, object.tags["ref"].to_s), :id => content_tag(:bdi, name)
name = t "printable_name.with_name_html", :name => tag.bdi(object.tags["ref"].to_s), :id => tag.bdi(name)
end
end

View file

@ -30,7 +30,7 @@ module BrowseTagsHelper
end
safe_join(phones, "; ")
elsif colour_value = colour_preview(key, value)
content_tag(:span, "", :class => "colour-preview-box", :"data-colour" => colour_value, :title => t("browse.tag_details.colour_preview", :colour_value => colour_value)) + colour_value
tag.span("", :class => "colour-preview-box", :"data-colour" => colour_value, :title => t("browse.tag_details.colour_preview", :colour_value => colour_value)) + colour_value
else
linkify h(value)
end

View file

@ -28,9 +28,9 @@ module IssuesHelper
def open_issues_count
count = Issue.visible_to(current_user).open.limit(100).size
if count > 99
content_tag(:span, "99+", :class => "count-number")
tag.span("99+", :class => "count-number")
elsif count.positive?
content_tag(:span, count, :class => "count-number")
tag.span(count, :class => "count-number")
end
end
end

View file

@ -5,8 +5,7 @@ module NotifierHelper
def link_to_user(display_name)
link_to(
content_tag(
"strong",
tag.strong(
display_name,
# NB we need "text-decoration: none" twice: GMail only honours it on
# the <a> but Outlook only on the <strong>

View file

@ -29,7 +29,7 @@ module UserRolesHelper
if image
svg_icon = tag("source", :srcset => image_path("#{image}.svg"), :type => "image/svg+xml")
png_icon = image_tag("#{image}.png", :srcset => image_path("#{image}.svg"), :size => "20x20", :border => 0, :alt => alt, :title => title)
icon = content_tag("picture", svg_icon + png_icon)
icon = tag.picture(svg_icon + png_icon)
icon = link_to(icon, url, :method => :post, :confirm => confirm) if url
end