Commit d41c6b0d by tady

tag補完 jquery

parent d2746c40
......@@ -91,3 +91,13 @@ $(document).ready(function(){
}
});
});
// new post tags
$(document).ready(function(){
$("#post_tags").select2();
});
......@@ -21,6 +21,21 @@
<%= f.text_field :title, class: 'form-control' %>
</div>
</div>
<div class="field">
<div class="input-group">
<span class="input-group-addon"><%= f.label :tags %></span>
<select id="post_tags" multiple>
<% Tag.all.each do |tag| %>
<% if @post.tag_ids.include?(tag.id) %>
<option value="<%= tag.name %>" selected><%= tag.name %></option>
<% else %>
<option value="<%= tag.name %>"><%= tag.name %></option>
<% end %>
<% end %>
</select>
</div>
</div>
</div>
<div class="col-md-2">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment