Skip to content

Instantly share code, notes, and snippets.

@angelacode
Created May 26, 2011 16:12
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save angelacode/993443 to your computer and use it in GitHub Desktop.
Save angelacode/993443 to your computer and use it in GitHub Desktop.
Getting jquery token to work with acts-as-taggable-on
- semantic_form_for @question do |f|
= f.input :title, :label => "Type Your Question",
:wrapper_html => {:style => "list-style-type:none"},
:input_html => {:class => 'main_question'}
= f.input :body, :input_html => {:class => 'autogrow', :rows => 5},
:wrapper_html => {:style => "list-style-type:none"},
:label => "Question Details (optional)"
= f.input :tag_list, :class => 'larger widest', :"data-pre" => @question.tags.map(&:attributes).to_json,
:wrapper_html => {:style => "list-style-type:none"}
= f.buttons do
= f.commit_button :label => "Ask Question",
:button_html => {:class => "main_question"}
/* this is for the jquery token input */
$(function() {
$("#question_tag_list").tokenInput("/questions/get_tags.json"), {
crossDomain: false,
prePopulate: $("#question_tag_list").data("pre"),
preventDuplicates: true,
theme: 'facebook'
};
});
@joemsak
Copy link

joemsak commented May 26, 2011

Assuming you're using my copy of jquery tokeninput, new tags should work by pressing "comma" after them...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment