Mercurial > hg > isophonics-drupal-site
comparison core/modules/book/book.es6.js @ 17:129ea1e6d783
Update, including to Drupal core 8.6.10
author | Chris Cannam |
---|---|
date | Thu, 28 Feb 2019 13:21:36 +0000 |
parents | 4c8ae668cc8c |
children |
comparison
equal
deleted
inserted
replaced
16:c2387f117808 | 17:129ea1e6d783 |
---|---|
1 /** | 1 /** |
2 * @file | 2 * @file |
3 * Javascript behaviors for the Book module. | 3 * Javascript behaviors for the Book module. |
4 */ | 4 */ |
5 | 5 |
6 (function ($, Drupal) { | 6 (function($, Drupal) { |
7 /** | 7 /** |
8 * Adds summaries to the book outline form. | 8 * Adds summaries to the book outline form. |
9 * | 9 * |
10 * @type {Drupal~behavior} | 10 * @type {Drupal~behavior} |
11 * | 11 * |
12 * @prop {Drupal~behaviorAttach} attach | 12 * @prop {Drupal~behaviorAttach} attach |
13 * Attaches summary behavior to book outline forms. | 13 * Attaches summary behavior to book outline forms. |
14 */ | 14 */ |
15 Drupal.behaviors.bookDetailsSummaries = { | 15 Drupal.behaviors.bookDetailsSummaries = { |
16 attach(context) { | 16 attach(context) { |
17 $(context).find('.book-outline-form').drupalSetSummary((context) => { | 17 $(context) |
18 const $select = $(context).find('.book-title-select'); | 18 .find('.book-outline-form') |
19 const val = $select.val(); | 19 .drupalSetSummary(context => { |
20 const $select = $(context).find('.book-title-select'); | |
21 const val = $select.val(); | |
20 | 22 |
21 if (val === '0') { | 23 if (val === '0') { |
22 return Drupal.t('Not in book'); | 24 return Drupal.t('Not in book'); |
23 } | 25 } |
24 else if (val === 'new') { | 26 if (val === 'new') { |
25 return Drupal.t('New book'); | 27 return Drupal.t('New book'); |
26 } | 28 } |
27 | 29 |
28 return Drupal.checkPlain($select.find(':selected').text()); | 30 return Drupal.checkPlain($select.find(':selected').text()); |
29 }); | 31 }); |
30 }, | 32 }, |
31 }; | 33 }; |
32 }(jQuery, Drupal)); | 34 })(jQuery, Drupal); |