Mercurial > hg > isophonics-drupal-site
annotate core/modules/media_library/js/media_library.view.js @ 19:fa3358dc1485 tip
Add ndrum files
author | Chris Cannam |
---|---|
date | Wed, 28 Aug 2019 13:14:47 +0100 |
parents | af1871eacc83 |
children |
rev | line source |
---|---|
Chris@17 | 1 /** |
Chris@17 | 2 * DO NOT EDIT THIS FILE. |
Chris@17 | 3 * See the following change record for more information, |
Chris@17 | 4 * https://www.drupal.org/node/2815083 |
Chris@17 | 5 * @preserve |
Chris@17 | 6 **/ |
Chris@17 | 7 |
Chris@17 | 8 (function ($, Drupal) { |
Chris@17 | 9 Drupal.behaviors.MediaLibrarySelectAll = { |
Chris@17 | 10 attach: function attach(context) { |
Chris@18 | 11 var $view = $('.js-media-library-view', context).once('media-library-select-all'); |
Chris@18 | 12 if ($view.length && $view.find('.js-media-library-item').length) { |
Chris@18 | 13 var $checkbox = $('<input type="checkbox" class="form-checkbox" />').on('click', function (_ref) { |
Chris@18 | 14 var currentTarget = _ref.currentTarget; |
Chris@17 | 15 |
Chris@18 | 16 var $checkboxes = $(currentTarget).closest('.media-library-view').find('.js-media-library-item input[type="checkbox"]'); |
Chris@17 | 17 $checkboxes.prop('checked', $(currentTarget).prop('checked')).trigger('change'); |
Chris@17 | 18 |
Chris@17 | 19 var announcement = $(currentTarget).prop('checked') ? Drupal.t('Zero items selected') : Drupal.t('All @count items selected', { |
Chris@17 | 20 '@count': $checkboxes.length |
Chris@17 | 21 }); |
Chris@17 | 22 Drupal.announce(announcement); |
Chris@17 | 23 }); |
Chris@17 | 24 var $label = $('<label class="media-library-select-all"></label>').text(Drupal.t('Select all media')); |
Chris@17 | 25 $label.prepend($checkbox); |
Chris@18 | 26 $view.find('.js-media-library-item').first().before($label); |
Chris@17 | 27 } |
Chris@17 | 28 } |
Chris@17 | 29 }; |
Chris@17 | 30 })(jQuery, Drupal); |