Search

<%= form_for :search, ~p"/search", [id: "searchform", method: "get", class: "js-search-form", enforce_utf8: false], fn f -> %> <%= text_input(f, :q, class: "input input--wide js-search-field", placeholder: "Search terms are chained with commas", autocapitalize: "none", name: "q", value: @conn.params["q"]) %>
NOT <%= if @conn.assigns.current_user do %> <% end %>
<%= submit("Search", class: "button button--state-primary") %> <% # = submit_tag "I'm Feeling Poni", class: 'button button--separate-left spacing-right', name: 'random_image' %> <% random_is_selected = to_string(@conn.params["sf"]) =~ ~r/\Arandom(:\d+)?\z/ random_seed = if random_is_selected do @conn.params["sf"] else "random:#{:rand.uniform(4_294_967_296)}" end sort_fields = [ "Sort by initial post date": :first_seen_at, "Sort by image ID": :id, "Sort by last modification date": :updated_at, "Sort by aspect ratio": :aspect_ratio, "Sort by fave count": :faves, "Sort by upvotes": :upvotes, "Sort by downvotes": :downvotes, "Sort by score": :score, "Sort by Wilson score": :wilson_score, "Sort by relevance": :_score, "Sort by width": :width, "Sort by height": :height, "Sort by comments": :comment_count, "Sort by tag count": :tag_count, "Sort by pixels": :pixels, "Sort by file size": :size, "Sort by duration": :duration, Random!: random_seed ] sort_directions = [Descending: :desc, Ascending: :asc] sort_hidden = ["Exclude Deleted": "", "Include Deleted/Merged": "1", "Deleted Only": "deleted", "Deleted/Merged Only": "only"] %> <%= select(f, :sf, sort_fields, class: "input input--separate-left", name: "sf", autocomplete: "off", selected: @conn.params["sf"]) %> <%= select(f, :sd, sort_directions, class: "input input--separate-left", name: "sd", autocomplete: "off", selected: @conn.params["sd"]) %> <%= if present?(@conn.params["hidden"]) do %> <%= hidden_input(f, :hidden, name: "hidden", value: @conn.params["hidden"]) %> <% end %> <%= if hides_images?(@conn) do %> <%= select(f, :del, sort_hidden, class: "input input--separate-left", name: "del", autocomplete: "off", selected: @conn.params["del"]) %> <% end %>
<% end %>