diff --git a/og_ui/js/og_ui.js b/og_ui/js/og_ui.js new file mode 100644 index 00000000..6f74e3a9 --- /dev/null +++ b/og_ui/js/og_ui.js @@ -0,0 +1,31 @@ +(function ($) { + +Backdrop.behaviors.ogUiContentTypes = { + // Provide the vertical tab summaries for OG. + attach: function (context) {console.log('loaded'); + var $context = $(context); + $context.find('fieldset#edit-og').backdropSetSummary(function() {console.log('found it') + var vals = []; + if ($context.find('input[name="og_group_type"]:checked').length) { + vals.push(Backdrop.t('Is a "Group" content type')); + } + + if ($context.find('input[name="og_group_content_type"]:checked').length) { + vals.push(Backdrop.t('Is a "Group content" content type')); + var target_type = $context.find('select[name="target_type"]').find('option:selected').text(); + console.log(target_type); + if (target_type) { + vals.push(Backdrop.t('Target type: ' + target_type)); + } + var target_bundles = $context.find('select[name="target_bundles[]"]').find('option:selected').toArray().map(item => item.text).join(); + if (target_bundles) { + vals.push(Backdrop.t('Target bundles: ' + target_bundles)); + } + } + + return vals.length ? vals.join(', ') : Backdrop.t('Not set'); + }); + } +}; + +})(jQuery); diff --git a/og_ui/og_ui.module b/og_ui/og_ui.module index 979ffe65..17d6d4d7 100644 --- a/og_ui/og_ui.module +++ b/og_ui/og_ui.module @@ -911,6 +911,9 @@ function og_ui_form_node_type_form_alter(&$form, &$form_state) { '#collapsible' => TRUE, '#group' => 'additional_settings', '#description' => t('Specify how OG should treat content of this type. Content may behave as a group, as group content, or may not participate in OG at all.'), + '#attached' => array( + 'js' => array(backdrop_get_path('module', 'og_ui') . '/js/og_ui.js'), + ), ); // Group settings.