35 lines
1.1 KiB
Plaintext
35 lines
1.1 KiB
Plaintext
<!--
|
|
- path
|
|
- tags
|
|
-->
|
|
|
|
<section id="search-box">
|
|
<h1>Search</h1>
|
|
<%= form_tag(path, :method => "get") do %>
|
|
<%= text_field_tag("tags", tags, :size => 30, :id => tags_dom_id, :data => { :autocomplete => "tag-query" }) %>
|
|
<% if params[:raw] %>
|
|
<%= hidden_field_tag :raw, params[:raw] %>
|
|
<% end %>
|
|
<% if params[:random] %>
|
|
<%= hidden_field_tag :random, params[:random] %>
|
|
<% end %>
|
|
<%= hidden_field_tag "ms", "1" %>
|
|
<%= submit_tag "Go", :name => nil, :class => "ui-button ui-widget ui-corner-all tiny gradient" %>
|
|
<% end %>
|
|
</section>
|
|
|
|
<% content_for(:html_header) do %>
|
|
<script>
|
|
$(function() {
|
|
$("#tags").on("keypress autocompleteclose", function(e) {
|
|
if (!$(this).data("fakeWidth")) {
|
|
$(this).data("fakeWidth", $('<span>').hide().appendTo(document.body));
|
|
}
|
|
var width = $(this).data("fakeWidth").text($(this).val()).css('font', $(this).css("font")).width() + 15;
|
|
if (width > $(this).width()) {
|
|
$(this).width(width);
|
|
}
|
|
});
|
|
});
|
|
</script>
|
|
<% end %> |