Sha256: 8a388cc35c26cca270a65584512a3c9e62fc3ebeea22cdd4709a8e3fbbb492ed

Contents?: true

Size: 935 Bytes

Versions: 11

Compression:

Stored size: 935 Bytes

Contents

// Highlight the label for a select field on focus.
(function() {
  "use strict";

  function activateBehavior(selector) {
    $(selector).each(function() {
      var container = $(this);
      var input = container.find('select');
      var label = container.find('label');

      // Set the container's class when the input field receives focus.
      input.focus(function() {
        container.addClass('focused');
      });

      input.blur(function() {
        container.removeClass('focused');
      });
    });
  }

  App.register('component').enter(function() {
    activateBehavior('.input.country:not(.filter_form_field)');
    activateBehavior('.input.select:not(.filter_form_field)');

    $('.has_many_add').click(function() {
      setTimeout(function() {
        activateBehavior('.has_many_fields:last .input.country');
        activateBehavior('.has_many_fields:last .input.select');
      }, 0);
    });
  });
})();

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
active_admin_pro-0.2.4 app/assets/javascripts/active_admin_pro/components/select_input.js
active_admin_pro-0.2.3 app/assets/javascripts/active_admin_pro/components/select_input.js
active_admin_pro-0.2.2 app/assets/javascripts/active_admin_pro/components/select_input.js
active_admin_pro-0.2.1 app/assets/javascripts/active_admin_pro/components/select_input.js
active_admin_pro-0.2.0 app/assets/javascripts/active_admin_pro/components/select_input.js
active_admin_pro-0.1.8 app/assets/javascripts/active_admin_pro/components/select_input.js
active_admin_pro-0.1.7 app/assets/javascripts/active_admin_pro/components/select_input.js
active_admin_pro-0.1.6 app/assets/javascripts/active_admin_pro/components/select_input.js
active_admin_pro-0.1.5 app/assets/javascripts/active_admin_pro/components/select_input.js
active_admin_pro-0.1.4 app/assets/javascripts/active_admin_pro/components/select_input.js
active_admin_pro-0.1.3 app/assets/javascripts/active_admin_pro/components/select_input.js