Switching to using wiki names in URLs instead of IDs: * https://danbooru.donami.us/wiki_pages/vocaloid * https://danbooru.donami.us/wiki_pages/hatsune_miku ID numbers can still be used, but they redirect to the name instead: * https://danbooru.donami.us/wiki_pages/11 (redirects to /wiki_pages/touhou). Numeric tags are prefixed with '~' to distinguish them from IDs: * https://danbooru.donami.us/wiki_pages/2019 (the wiki with id 2019) * https://danbooru.donami.us/wiki_pages/~2019 (the wiki for the tag named 2019) The tag names 'new' and 'search' are disallowed to prevent conflicts with existing routes: * https://danbooru.donami.us/wiki_pages/new * https://danbooru.donami.us/wiki_pages/search
52 lines
2.4 KiB
Plaintext
52 lines
2.4 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 class="striped autofit">
|
|
<thead>
|
|
<tr>
|
|
<th>Page</th>
|
|
<th>Link</th>
|
|
<th>Type</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<% @dtext_links.each do |dtext_link| %>
|
|
<tr>
|
|
<% if dtext_link.model_type == "WikiPage" %>
|
|
<td 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 }})) %>
|
|
</td>
|
|
<% elsif dtext_link.model_type == "ForumPost" %>
|
|
<td>
|
|
<%= link_to("forum ##{dtext_link.model_id}", dtext_link.model) %>
|
|
</td>
|
|
<% end %>
|
|
|
|
<td class="col-expand">
|
|
<% 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 })) %>
|
|
</td>
|
|
<td><%= dtext_link.link_type.delete_suffix("_link").capitalize %></td>
|
|
</tr>
|
|
<% end %>
|
|
</tbody>
|
|
</table>
|
|
|
|
<%= numbered_paginator(@dtext_links) %>
|
|
</div>
|
|
</div>
|