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