diff --git a/css/views-admin.theme.css b/css/views-admin.theme.css index df45cdf..4564e7e 100644 --- a/css/views-admin.theme.css +++ b/css/views-admin.theme.css @@ -380,6 +380,7 @@ td.group-title { text-transform: uppercase; } +.grouped-description, .exposed-description { float: left; padding-top: 3px; diff --git a/handlers/views_handler_filter.inc b/handlers/views_handler_filter.inc index 1c8ba44..56480ef 100644 --- a/handlers/views_handler_filter.inc +++ b/handlers/views_handler_filter.inc @@ -334,39 +334,47 @@ class views_handler_filter extends views_handler { function show_build_group_button(&$form, &$form_state) { $form['group_button'] = array( - '#prefix' => '
', + '#prefix' => '
', '#suffix' => '
', // Should always come after the description and the relationship. '#weight' => -190, ); - $form['group_button']['checkbox'] = array( + $grouped_description = t('Grouped filters allow a choice between predefined operator|value pairs.'); + $form['group_button']['radios'] = array( '#theme_wrappers' => array('container'), '#attributes' => array('class' => array('js-only')), ); - $form['group_button']['checkbox']['checkbox'] = array( - '#title' => t('Build a group of filters'), - '#description' => t('In a single widget users can choose for a pair of operator|value predefined'), - '#type' => 'checkbox', + $form['group_button']['radios']['radios'] = array( + '#title' => t('Filter type to expose'), + '#description' => $grouped_description, + '#type' => 'radios', + '#options' => array( + t('Single filter'), + t('Grouped filters'), + ), ); if (empty($this->options['is_grouped'])) { + $form['group_button']['markup'] = array( + '#markup' => '
' . $grouped_description . '
', + ); $form['group_button']['button'] = array( '#limit_validation_errors' => array(), '#type' => 'submit', - '#value' => t('Build group'), + '#value' => t('Grouped filters'), '#submit' => array('views_ui_config_item_form_build_group'), ); - $form['group_button']['checkbox']['checkbox']['#default_value'] = 0; + $form['group_button']['radios']['radios']['#default_value'] = 0; } else { $form['group_button']['button'] = array( '#limit_validation_errors' => array(), '#type' => 'submit', - '#value' => t('Standard filter'), + '#value' => t('Single filter'), '#submit' => array('views_ui_config_item_form_build_group'), ); - $form['group_button']['checkbox']['checkbox']['#default_value'] = 1; + $form['group_button']['radios']['radios']['#default_value'] = 1; } } @@ -734,7 +742,7 @@ class views_handler_filter extends views_handler { $form['group_info']['widget'] = array( '#type' => 'radios', '#default_value' => $this->options['group_info']['widget'], - '#title' => t('Widget'), + '#title' => t('Widget type'), '#options' => array( 'radios' => t('Radios'), 'select' => t('Select'), diff --git a/js/views-admin.js b/js/views-admin.js index 4a7b446..d627256 100644 --- a/js/views-admin.js +++ b/js/views-admin.js @@ -840,13 +840,13 @@ Drupal.behaviors.viewsUiCheckboxify.attach = function (context, settings) { Drupal.viewsUi.Checkboxifier = function (button) { var $ = jQuery; this.$button = $(button); - this.$parent = this.$button.parent('div.views-expose'); - this.$checkbox = this.$parent.find('input:checkbox'); + this.$parent = this.$button.parent('div.views-expose, div.views-grouped'); + this.$input = this.$parent.find('input:checkbox, input:radio'); // Hide the button and its description. this.$button.hide(); - this.$parent.find('.exposed-description').hide(); + this.$parent.find('.exposed-description, .grouped-description').hide(); - this.$checkbox.click($.proxy(this, 'clickHandler')); + this.$input.click($.proxy(this, 'clickHandler')); }; /**