Sha256: d3d1fa6464f93fda32bae220984f4bce7631c433e934d93a2a77c4e32fd9db37

Contents?: true

Size: 1.96 KB

Versions: 2

Compression:

Stored size: 1.96 KB

Contents

{I"
class:ETI"ProcessedAsset;FI"logical_path;TI"peoplefinder/tagging.js;FI"
pathname;TI"V/Users/jakub/code/moj/peoplefinder/app/assets/javascripts/peoplefinder/tagging.js;FI"content_type;TI"application/javascript;TI"
mtime;Tl+Ñ_WTI"length;Ti¶I"digest;TI"%1c201d767eba10b9c0e8f618c4241d84;FI"source;TI"¶/* global $, addToList */

$(window).load(function() {

 if($('#person_tag_chooser').length > 0)
  {
    var the_form = $('input[id=person_tags]').parents('form:first');
    var initial_tags = $('#person_tags').attr('value');
    var tag_list = $('#tag_list').attr('value').split(',');

    $('.person_tags').remove();

    // add a hidden field to store the selected tags
    $('<input>').attr({
      type: 'hidden',
      id: 'person_tags',
      name: 'person[tags]',
      value: initial_tags
    }).appendTo(the_form);

    // init the select2 widget
    $('#person_tag_chooser').select2({
      tags: tag_list,
      width: '480',
      dropdownCssClass: 'form-control',
      tokenSeparators: [','],
    });

    // set the default state of the select2 widget
    $('#person_tag_chooser').select2('val', [initial_tags]);

    // enable adding a tag with the enter key
    $('select2-search-field > input.select2-input').on('keyup', function(e) {
      if(e.keyCode === 13) { addToList($(this).val()); }
    });

    // set the hidden field when the form is submitted
    the_form.on('submit', function() {
      $('#person_tags')[0].value = $('#person_tag_chooser').select2('val');
    });
  }
});
;TI"dependency_digest;TI"%d556c6db76cc1d033e31acf112e4c9f8;FI"required_paths;T[I"V/Users/jakub/code/moj/peoplefinder/app/assets/javascripts/peoplefinder/tagging.js;FI"dependency_paths;T[{I"	path;TI"V/Users/jakub/code/moj/peoplefinder/app/assets/javascripts/peoplefinder/tagging.js;FI"
mtime;TI"2014-11-03T10:58:25+00:00;TI"digest;TI"%727b3e10a945b0003bb97a5b27ba23c0;FI"
_version;TI"%01511319732b44ed6445e68132ed559b;F

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
peoplefinder-0.1.1 spec/dummy/tmp/cache/assets/development/sprockets/2a824638869d012d1fbc05ff7e37f230
peoplefinder-0.1.0 spec/dummy/tmp/cache/assets/development/sprockets/2a824638869d012d1fbc05ff7e37f230