Sha256: 7b817c026038c0fbe30f1937a9664ee5eed90f3dc53d268026b10f59df929fc0
Contents?: true
Size: 783 Bytes
Versions: 72
Compression:
Stored size: 783 Bytes
Contents
var tags = tags || { init: function() { $('input[data-tagbox]').udongo_tagbox({ on_add: tags.add, on_remove: tags.remove }); }, add: function(tag, input) { tags.call('POST', tag, input); }, remove: function(tag, input) { tags.call('DELETE', tag, input); }, call: function(type, tag, input) { if(typeof type == 'undefined') return; $.ajax({ url: input.data('base-path'), data: { locale: input.data('locale'), taggable_type: input.data('type'), taggable_id: input.data('id'), tag: tag }, type: type }).done(function(data){ if(type == 'POST' && !data.valid) { input.tagit('removeTagByLabel', data.tag); } }); } }; $(function(){ tags.init(); });
Version data entries
72 entries across 72 versions & 1 rubygems