compromise for tag search autoexpansion #3310
This commit is contained in:
@@ -122,8 +122,7 @@ select,
|
|||||||
textarea {
|
textarea {
|
||||||
font-size: 100%;
|
font-size: 100%;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
vertical-align: baseline;
|
vertical-align: middle;
|
||||||
*vertical-align: middle;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
button,
|
button,
|
||||||
|
|||||||
@@ -39,6 +39,8 @@ div#page {
|
|||||||
|
|
||||||
input[type=text] {
|
input[type=text] {
|
||||||
width: 8em;
|
width: 8em;
|
||||||
|
z-index: 1000;
|
||||||
|
position: relative;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<section id="search-box">
|
<section id="search-box">
|
||||||
<h1>Search</h1>
|
<h1>Search</h1>
|
||||||
<%= form_tag(path, :method => "get") do %>
|
<%= form_tag(path, :method => "get") do %>
|
||||||
<%= text_area_tag("tags", tags, :rows => 1, :cols => 15, :id => tags_dom_id, :data => { :autocomplete => "tag-query" }) %>
|
<%= text_field_tag("tags", tags, :size => 30, :id => tags_dom_id, :data => { :autocomplete => "tag-query" }) %>
|
||||||
<% if params[:raw] %>
|
<% if params[:raw] %>
|
||||||
<%= hidden_field_tag :raw, params[:raw] %>
|
<%= hidden_field_tag :raw, params[:raw] %>
|
||||||
<% end %>
|
<% end %>
|
||||||
@@ -29,19 +29,18 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<%= content_for(:html_header) do %>
|
<% content_for(:html_header) do %>
|
||||||
<script>
|
<script>
|
||||||
$(function() {
|
$(function() {
|
||||||
$("#tags").scroll(function(e) {
|
$("#tags").on("keypress autocompleteclose", function(e) {
|
||||||
var rows = parseInt($(e.target).attr("rows"));
|
if (!$(this).data("fakeWidth")) {
|
||||||
$(e.target).attr('rows', rows + 1);
|
$(this).data("fakeWidth", $('<span>').hide().appendTo(document.body));
|
||||||
$(e.target).css("width", "100%");
|
}
|
||||||
|
var width = $(this).data("fakeWidth").text($(this).val()).css('font', $(this).css("font")).width() + 15;
|
||||||
|
if (width > $(this).width()) {
|
||||||
|
$(this).width(width);
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
</script>
|
||||||
$("#tags").keydown("return", function(e) {
|
|
||||||
$("#search-box form").submit();
|
|
||||||
e.preventDefault();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
<% end %>
|
<% end %>
|
||||||
Reference in New Issue
Block a user