|
| 1 | +(function ($, Backdrop) { |
| 2 | + /*global jQuery:false */ |
| 3 | + /*global Backdrop:false */ |
| 4 | + "use strict"; |
| 5 | + |
| 6 | + /** |
| 7 | + * Provide vertical tab summaries for Bootstrap 5 settings. |
| 8 | + */ |
| 9 | + Backdrop.behaviors.bootstrap5LiteSettingSummaries = { |
| 10 | + attach: function (context) { |
| 11 | + var $context = $(context); |
| 12 | + |
| 13 | + // Version and CDN |
| 14 | + |
| 15 | + $context.find('#edit-bootstrap5-lite-cdn').backdropSetSummary(function () { |
| 16 | + var summary = []; |
| 17 | + var bootstrap_version = 'Bootstrap: ' + $context.find('select[name="bootstrap5_lite_cdn"] :selected').text(); |
| 18 | + summary.push(bootstrap_version); |
| 19 | + return summary.join('<br>'); |
| 20 | + }); |
| 21 | + |
| 22 | + // Bootswatch theme |
| 23 | + |
| 24 | + $context.find('#edit-bootswatch').backdropSetSummary(function () { |
| 25 | + var bootswatch = $context.find('#edit-bootswatch input[checked="checked"]').parent().find('h3').text(); |
| 26 | + if (bootswatch == '') { |
| 27 | + bootswatch = Backdrop.t('Default'); |
| 28 | + } |
| 29 | + return bootswatch; |
| 30 | + }); |
| 31 | + |
| 32 | + // Navbar |
| 33 | + |
| 34 | + $context.find('#edit-navbar').backdropSetSummary(function () { |
| 35 | + var summary = []; |
| 36 | + var navbar_position = 'Position: ' + $context.find('select[name="bootstrap5_lite_navbar_position"] :selected').text(); |
| 37 | + summary.push(navbar_position); |
| 38 | + var menu_position = 'Menu position: ' + $context.find('select[name="bootstrap5_lite_navbar_menu_position"] :selected').text(); |
| 39 | + summary.push(menu_position); |
| 40 | + if ($context.find(':input[name="bootstrap5_lite_navbar_inverse"]').is(':checked')) { |
| 41 | + summary.push(Backdrop.t('Inverse navbar')); |
| 42 | + } |
| 43 | + if ($context.find(':input[name="bootstrap5_lite_navbar_user_menu"]').is(':checked')) { |
| 44 | + summary.push(Backdrop.t('Cog style')); |
| 45 | + } |
| 46 | + return summary.join('<br>'); |
| 47 | + }); |
| 48 | + |
| 49 | + // Breadcrumbs |
| 50 | + |
| 51 | + $context.find('#edit-breadcrumbs').backdropSetSummary(function () { |
| 52 | + var summary = []; |
| 53 | + if ($context.find(':input[name="bootstrap5_lite_breadcrumb_home"]').is(':checked')) { |
| 54 | + summary.push(Backdrop.t('Show home')); |
| 55 | + } |
| 56 | + if ($context.find(':input[name="bootstrap5_lite_breadcrumb_title"]').is(':checked')) { |
| 57 | + summary.push(Backdrop.t('Show current page')); |
| 58 | + } |
| 59 | + return summary.join('<br>'); |
| 60 | + }); |
| 61 | + |
| 62 | + // Tweaks |
| 63 | + |
| 64 | + $context.find('#edit-tweaks').backdropSetSummary(function () { |
| 65 | + var summary = []; |
| 66 | + var container_type = 'Container type: ' + $context.find('select[name="bootstrap5_lite_container"] :selected').text(); |
| 67 | + summary.push(container_type); |
| 68 | + if ($context.find(':input[name="bootstrap5_lite_datetime"]').is(':checked')) { |
| 69 | + summary.push(Backdrop.t('Show "XX time ago"')); |
| 70 | + } |
| 71 | + if ($context.find(':input[name="bootstrap5_lite_image_responsive"]').is(':checked')) { |
| 72 | + summary.push(Backdrop.t('Responsive images')); |
| 73 | + } |
| 74 | + return summary.join('<br>'); |
| 75 | + }); |
| 76 | + |
| 77 | + } |
| 78 | + }; |
| 79 | + |
| 80 | +})(jQuery, Backdrop); |
0 commit comments