Sha256: 12a519d37f586bea9c4a7a73d194d93521b785bf87dcde0d5702c6e1bb81222c
Contents?: true
Size: 773 Bytes
Versions: 10
Compression:
Stored size: 773 Bytes
Contents
initSelect = -> $item = $('.select2-add-link') url = $item.data('relListUrl') $item.select2( multiple : false placeholder : I18n.t('rademade_admin.enter_search') initSelection : (element, callback) -> ids = element.val().replace(/\s*/g, '').split(',') $.getJSON(url, { search : { id : ids } } ).done (data) -> $item.select2('enable', true) callback(data[0]) ajax : url : url dataType : 'json' data : (term) -> { q : term } results : (data) -> { results : data } ).on 'change', (e) -> sendNew(e.added.link_url) sendNew = (linkUrl) -> $.ajax url : linkUrl type : 'POST' success : -> location.reload() $ -> $(document) .on('ready page:load init-select', initSelect)
Version data entries
10 entries across 10 versions & 1 rubygems