Skip to content

Instantly share code, notes, and snippets.

@daansari
Forked from angelacode/_form.html.erb
Created March 13, 2016 17:39
Show Gist options
  • Save daansari/a07e7c63287f5880fe0c to your computer and use it in GitHub Desktop.
Save daansari/a07e7c63287f5880fe0c 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'
};
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment