helpers: drop fast_link_to.

This commit is contained in:
evazion
2019-08-22 23:33:58 -05:00
parent 70e0d2fac2
commit bb82011bb2
2 changed files with 5 additions and 37 deletions

View File

@@ -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

View File

@@ -28,11 +28,11 @@
<section id="post-history">
<h1>History</h1>
<ul>
<li><%= fast_link_to "Tags", post_versions_path(:search => {:post_id => @post.id}) %></li>
<li><%= fast_link_to "Notes", note_versions_path(:search => {:post_id => @post.id}) %></li>
<li><%= fast_link_to "Moderation", post_events_path(@post.id) %></li>
<li><%= fast_link_to "Commentary", artist_commentary_versions_path(:search => {:post_id => @post.id}) %></li>
<li><%= fast_link_to "Replacements", post_replacements_path(:search => {:post_id => @post.id}) %></li>
<li><%= link_to "Tags", post_versions_path(search: { post_id: @post.id }) %></li>
<li><%= link_to "Notes", note_versions_path(search: { post_id: @post.id }) %></li>
<li><%= link_to "Moderation", post_events_path(@post.id) %></li>
<li><%= link_to "Commentary", artist_commentary_versions_path(search: { post_id: @post.id }) %></li>
<li><%= link_to "Replacements", post_replacements_path(search: {post_id: @post.id }) %></li>
</ul>
</section>