tags: refactor tag lists to use ViewComponent.

This commit is contained in:
evazion
2021-01-30 14:01:07 -06:00
parent 9d60046f1d
commit 1f637867a4
25 changed files with 256 additions and 131 deletions

View File

@@ -19,7 +19,7 @@
</div>
<div class="row list-of-tags">
<strong>Tags</strong>
<%= post.presenter.inline_tag_list_html %>
<%= render_inline_tag_list(post) %>
</div>
</div>

View File

@@ -51,7 +51,7 @@
<div class="row list-of-tags">
<span class="info">
<strong>Tags</strong>
<%= post.presenter.inline_tag_list_html %>
<%= render_inline_tag_list(post) %>
</span>
</div>

View File

@@ -22,7 +22,10 @@
<%= post_version_field(post_version, :rating) %>
<%= post_version_field(post_version, :parent_id) %>
</div>
<div><b>Tags:</b> <%= TagSetPresenter.new(post_version.tag_array).inline_tag_list_html %></div>
<div>
<b>Tags:</b>
<%= render_inline_tag_list_from_names(post_version.tag_array) %>
</div>
<div>
<%= post_source_tag(post_version.source) %>
</div>

View File

@@ -13,7 +13,7 @@
<%= post_preview(vote.post, show_deleted: true) %>
<% end %>
<% t.column "Tags", td: {class: "col-expand"} do |vote| %>
<%= TagSetPresenter.new(vote.post.tag_array).inline_tag_list_html %>
<%= render_inline_tag_list(vote.post) %>
<% end %>
<% t.column "Score" do |vote| %>
<%= link_to sprintf("%+d", vote.score), post_votes_path(search: { score: vote.score }) %>

View File

@@ -7,7 +7,7 @@
<section id="tag-box">
<h2>Tags</h2>
<%= @post_set.tag_list_html(current_query: params[:tags], show_extra_links: policy(Post).show_extra_links?) %>
<%= render_search_tag_list(@post_set.related_tags, current_query: params[:tags], show_extra_links: policy(Post).show_extra_links?) %>
</section>
<%= render "posts/partials/index/options" %>

View File

@@ -52,6 +52,6 @@
<% end %>
</div>
<%= @post.presenter.inline_tag_list_html %>
<%= render_inline_tag_list(@post) %>
</div>
</div>

View File

@@ -11,7 +11,7 @@
<%= render "posts/partials/index/blacklist" %>
<section id="tag-list">
<%= @post.presenter.split_tag_list_html(current_query: params[:q], show_extra_links: policy(@post).show_extra_links?) %>
<%= render_categorized_tag_list(@post, current_query: params[:q], show_extra_links: policy(@post).show_extra_links?) %>
</section>
<section id="post-information">

View File

@@ -9,11 +9,11 @@
none
<% else %>
<% if source.artists.any?(&:is_banned?) %>
<%= TagSetPresenter.new(["banned_artist"]).tag_list_html(name_only: true) %>
<%= render_simple_tag_list(["banned_artist"]) %>
<% end %>
<% source.artists.each do |artist| %>
<%= TagSetPresenter.new([artist.name]).tag_list_html(name_only: true) %>
<%= render_simple_tag_list(["banned_artist"]) %>
<ul>
<% artist.sorted_urls.each do |url| %>

View File

@@ -3,6 +3,6 @@
<%= content_tag(:div, class: ["tag-column", local_assigns[:class] || "#{title.parameterize}-related-tags-column", "is-empty-#{tags.empty?}"].join(" ")) do %>
<% if tags.present? %>
<h3><%= title %></h3>
<%= TagSetPresenter.new(tags).tag_list_html(name_only: true) %>
<%= render_simple_tag_list(tags) %>
<% end %>
<% end %>

View File

@@ -11,7 +11,7 @@
<%= post_preview(upload_report.becomes(Post), show_deleted: true, tags: "user:#{upload_report.uploader.name}") %>
<% end %>
<% t.column "Tags added by uploader", width: "45%" do |upload_report| %>
<%= TagSetPresenter.new(upload_report.uploader_tags_array).inline_tag_list_html %>
<%= render_inline_tag_list(upload_report.uploader_tags_array) %>
<% end %>
<% t.column "Tags changed by other users", width: "45%" do |upload_report| %>
<%= render "reports/tag_diff_list", added_tags: upload_report.added_tags_array, removed_tags: upload_report.removed_tags_array %>

View File

@@ -47,7 +47,7 @@
<% if policy(upload).can_view_tags? %>
<span class="info">
<strong>Tags</strong>
<%= TagSetPresenter.new(upload.tag_string.split).inline_tag_list_html %>
<%= render_inline_tag_list_from_names(upload.tag_string.split) %>
</span>
<% end %>
<% end %>