Skip to content

makaroni4/tag-it-autocomplete

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tag-it! with autocomplete

An example of Rails application with multiple tag select box using Tag-it! jQuery plugin and autocomplete.

Example

http://tag-it-autocomplete.heroku.com/

Setup instructions for running locally

  • Clone the repo with
git clone git://github.com/makaroni4/tag-it-autocomplete.git * rake db:migrate * rake tags:seed * rails s

Modifications in Tag-it!

Added 'show_tag_url' option. If it is specified each tag will become a link with path show_tag_url/tag.

Pay attention, that if onTagClicked and show_tag_url options are both specified after onTagClicked there will be redirect to tag page.

$(document).ready(function() {
  $("#mytags").tagit({
    tagSource: function(search, showChoices) {
      var that = this;
      $.ajax({
        url: "/tags/autocomplete.json",
        data: {q: search.term},
        success: function(choices) {
          showChoices(that._subtractArray(choices, that.assignedTags()));
        }
      });
    },
    show_tag_url: "/tags/",
    singleField: true,
    singleFieldNode: $('#submit_tag_names')
  });
});

Acknowledgements

About

Tag select with Tag-it! and Autocomplete

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages