helpers: drop fast_link_to.
This commit is contained in:
@@ -36,38 +36,6 @@ module ApplicationHelper
|
||||
tag.li(link_to(text, url, id: "#{id}-link", **options), id: id, class: klass)
|
||||
end
|
||||
|
||||
def fast_link_to(text, link_params, options = {})
|
||||
if options
|
||||
attributes = options.map do |k, v|
|
||||
%{#{k}="#{h(v)}"}
|
||||
end.join(" ")
|
||||
else
|
||||
attributes = ""
|
||||
end
|
||||
|
||||
if link_params.is_a?(Hash)
|
||||
action = link_params.delete(:action)
|
||||
controller = link_params.delete(:controller) || controller_name
|
||||
id = link_params.delete(:id)
|
||||
|
||||
link_params = link_params.map {|k, v| "#{k}=#{u(v)}"}.join("&")
|
||||
|
||||
if link_params.present?
|
||||
link_params = "?#{link_params}"
|
||||
end
|
||||
|
||||
if id
|
||||
url = "/#{controller}/#{action}/#{id}#{link_params}"
|
||||
else
|
||||
url = "/#{controller}/#{action}#{link_params}"
|
||||
end
|
||||
else
|
||||
url = link_params
|
||||
end
|
||||
|
||||
raw %{<a href="#{h(url)}" #{attributes}>#{text}</a>}
|
||||
end
|
||||
|
||||
def format_text(text, **options)
|
||||
raw DTextRagel.parse(text, **options)
|
||||
rescue DTextRagel::Error => e
|
||||
|
||||
Reference in New Issue
Block a user