Files
danbooru/app/views/dtext_links/index.html.erb
evazion 5c913d8ad1 table builder: fix various incorrect css classes.
Change calling convention to explicitly indicate whether the attributes
are for the <th> element or the <td> element. Fixes various cases where
the two were mixed up.

* Fix .col-expand classes not being set correctly on the /post_versions,
  /pool_versions, and /notes pages.

* Fix .updater and .updated-at classes not being set correctly on the
  /forum_topics page.

* Fix the name param being ignored (noticeable in the post count field
  on the /tags page).

* Don't pass empty string when column has no name.
2020-01-07 02:40:59 -06:00

42 lines
2.2 KiB
Plaintext

<div id="c-dtext-links">
<div id="a-index">
<%= search_form_for(dtext_links_path) do |f| %>
<%= f.input :link_target_ilike, label: "Link", hint: "Use * for wildcard", input_html: { value: params[:search][:link_target_ilike], data: { autocomplete: "wiki-page" } } %>
<%= f.input :model_type, label: "Page Type", collection: [["Wiki Page", "WikiPage"], ["Forum Post", "ForumPost"]], include_blank: true, selected: params[:search][:model_type] %>
<%= f.input :link_type, label: "Link Type", collection: [["Wiki", "0"], ["External", "1"]], include_blank: true, selected: params[:search][:link_type] %>
<%= f.input :linked_wiki_exists, label: "Wiki Exists?", collection: ["Yes", "No"], include_blank: true, selected: params[:search][:linked_wiki_exists] %>
<%= f.input :linked_tag_exists, label: "Tag Exists?", collection: ["Yes", "No"], include_blank: true, selected: params[:search][:linked_tag_exists] %>
<%= f.submit "Search" %>
<% end %>
<%= table_for @dtext_links, class: "striped autofit" do |t| %>
<% t.column "Page" do |dtext_link| %>
<% if dtext_link.model_type == "WikiPage" %>
<span class="category-<%= Tag.category_for(dtext_link.model.title) %>">
<%= link_to(dtext_link.model.title, dtext_link.model) %>
<%= link_to("»", dtext_links_path(search: { model_type: "WikiPage", model: { title: dtext_link.model.title }})) %>
</span>
<% elsif dtext_link.model_type == "ForumPost" %>
<%= link_to("forum ##{dtext_link.model_id}", dtext_link.model) %>
<% end %>
<% end %>
<% t.column "Link", td: { class: "col-expand" } do |dtext_link| %>
<% if dtext_link.external_link? %>
<%= external_link_to(dtext_link.link_target) %>
<% elsif dtext_link.wiki_link? %>
<%= link_to_wiki dtext_link.link_target, class: "tag-type-#{Tag.category_for(dtext_link.link_target)}" %>
<% end %>
<%= link_to("»", dtext_links_path(search: { link_target: dtext_link.link_target })) %>
<% end %>
<% t.column "Type" do |dtext_link| %>
<%= dtext_link.link_type.delete_suffix("_link").capitalize %>
<% end %>
<% end %>
<%= numbered_paginator(@dtext_links) %>
</div>
</div>