activescaffold/active_scaffold

View on GitHub
app/assets/javascripts/jquery/active_scaffold_chosen.js

Summary

Maintainability
A
0 mins
Test Coverage
jQuery(document).ready(function() {
  var chosen_options = ActiveScaffold.config.chosen_options || {};
  jQuery(document).on('as:element_updated as:element_created', function(event) {
    jQuery('select.chosen', event.target).chosen(chosen_options);
  });
  jQuery(document).on('as:action_success', 'a.as_action', function(event, action_link) {
    if (action_link.adapter) {
      jQuery('select.chosen', action_link.adapter).chosen(chosen_options);
    }
  });
  jQuery('select.chosen').chosen(chosen_options);
  jQuery(document).on('turbolinks:load turbo:load', function($) {
    jQuery('select.chosen').chosen(chosen_options);
  });
});