Sha256: c3815b05b7f8b6799e14ff6ae310b60cd55ebd0fac46fbaf12464880cc4b45ac

Contents?: true

Size: 761 Bytes

Versions: 6

Compression:

Stored size: 761 Bytes

Contents

= select_tag 'task_label_ids', options_for_select(normal_labels.map { |l| [l.name, l.id, { color: l.color }] }, selected_label_ids), { multiple: true, class: 'select2 col-12' }

:javascript
  $('#task_label_ids').select2({
    dropdownCssClass: 'labeling',
    templateSelection: function(data, container) {
      if (data.id == '') {
        return data.text;
      } else {
        return $('<span class="label-colors lc-' + $(data.element).attr('color') + '">' + data.text + '</span>');
      }
    },
    templateResult: function(data, container) {
      if (data.id == '') {
        return data.text;
      } else {
        return $('<span class="badge label-colors lc-' + $(data.element).attr('color') + '">' + data.text + '</span>');
      }
    }
  });

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
rails_execution-0.1.12 app/views/rails_execution/tasks/_label_collection_select.html.haml
rails_execution-0.1.11 app/views/rails_execution/tasks/_label_collection_select.html.haml
rails_execution-0.1.10 app/views/rails_execution/tasks/_label_collection_select.html.haml
rails_execution-0.1.9 app/views/rails_execution/tasks/_label_collection_select.html.haml
rails_execution-0.1.8 app/views/rails_execution/tasks/_label_collection_select.html.haml
rails_execution-0.1.7 app/views/rails_execution/tasks/_label_collection_select.html.haml