// This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// compiled file.
//
// Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
// about supported directives.
//
//= require support
//
//= require shared_mustache
//= require templates
//
//= require checkbox_filter
//= require live_search


jQuery(function($) {
  var filters = $('.js-openable-filter').map(function(){
    return new GOVUK.CheckboxFilter({el:$(this)});
  });

  if (filters.length > 0 && $('.js-openable-filter').not('.closed').length == 0) {
    filters[0].open();
  }

  var $form = $('.js-live-search-form'),
      $results = $('.js-live-search-results-block');

  if($form.length && $results.length){
    new GOVUK.LiveSearch({$form:$form, $results:$results});
  }
});

// This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// compiled file.
//
// Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
// about supported directives.
//
//= require support
//
//= require shared_mustache
//= require templates
//
//= require checkbox_filter
//= require live_search
//= require govuk_toolkit


jQuery(function($) {
  var filters = $('.js-openable-filter').map(function(){
    return new GOVUK.CheckboxFilter({el:$(this)});
  });

  if (filters.length > 0 && $('.js-openable-filter').not('.closed').length == 0) {
    filters[0].open();
  }

  var $form = $('.js-live-search-form'),
      $results = $('.js-live-search-results-block');

  if($form.length && $results.length){
    new GOVUK.LiveSearch({$form:$form, $results:$results});
  }

  var $buttons = $("label.block-label input[type='checkbox']");
  new GOVUK.SelectionButtons($buttons);
});

Add JS to make checkboxes work
Add JS to make checkboxes work
