story submission: make tag select box match tag description too

fixes #247
This commit is contained in:
joshua stein 2015-12-09 11:51:15 -06:00
parent 850131873b
commit b21f96cb1a
2 changed files with 10 additions and 7 deletions

View file

@ -182,6 +182,15 @@
Lobsters.fetchURLTitle($(this), $("#story_url"), $("#story_title"));
return false;
});
$("#story_tags_a").select2({
formatSelection: function(what) {
return what.id;
},
matcher: function(term, text, opt) {
return (text.toLowerCase().indexOf(term.toLowerCase()) >= 0);
},
});
});
</script>
<% end %>

View file

@ -39,13 +39,7 @@
<script>
$(document).ready(function() {
<% if @story.previewing %>
$("#story_tags_a").select2({
formatSelection: function(what) {
return what.id;
}
});
<% else %>
<% if !@story.previewing %>
$("#story_url").focus();
<% end %>
});