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
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
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
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
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
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>
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
class Issue < ApplicationRecord
belongs_to :reportable, :polymorphic => true
- belongs_to :reported_user, :class_name => "User", :foreign_key => :reported_user_id
+ belongs_to :reported_user, :class_name => "User"
belongs_to :user_resolved, :class_name => "User", :foreign_key => :resolved_by
belongs_to :user_updated, :class_name => "User", :foreign_key => :updated_by
#
class NoteComment < ApplicationRecord
- belongs_to :note, :foreign_key => :note_id, :touch => true
- belongs_to :author, :class_name => "User", :foreign_key => :author_id
+ belongs_to :note, :touch => true
+ belongs_to :author, :class_name => "User"
validates :id, :uniqueness => true, :presence => { :on => :update },
:numericality => { :on => :update, :only_integer => true }
self.table_name = "current_relation_members"
self.primary_keys = "relation_id", "sequence_id"
- belongs_to :relation, :foreign_key => :relation_id
+ belongs_to :relation
belongs_to :member, :polymorphic => true
end
validate :moderator_permissions
validates :reason, :characters => true
- belongs_to :user, :class_name => "User", :foreign_key => :user_id
- belongs_to :creator, :class_name => "User", :foreign_key => :creator_id
- belongs_to :revoker, :class_name => "User", :foreign_key => :revoker_id
+ belongs_to :user, :class_name => "User"
+ belongs_to :creator, :class_name => "User"
+ belongs_to :revoker, :class_name => "User"
PERIODS = Settings.user_block_periods