<%= search_form_for(dtext_links_path) do |f| %> <%= f.input :link_target_ilike, label: "Link", input_html: { value: params[:search][:link_target_ilike], data: { autocomplete: "wiki-page" } } %> <%= f.input :model_type, label: "Page Type", collection: DtextLink.model_types.map { [_1.titleize, _1] }, 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 :has_linked_wiki, label: "Wiki Exists?", collection: ["Yes", "No"], include_blank: true, selected: params[:search][:has_linked_wiki] %> <%= f.input :has_linked_tag, label: "Tag Exists?", collection: ["Yes", "No"], include_blank: true, selected: params[:search][:has_linked_tag] %> <%= 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" %> <%= link_to(dtext_link.model.title, dtext_link.model) %> <%= link_to("»", dtext_links_path(search: { model_type: "WikiPage", model: { title: dtext_link.model.title }})) %> <% else %> <%= link_to(dtext_link.model.dtext_shortlink, 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_class(dtext_link.linked_wiki&.tag) %> <% 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) %>