Commit 544bfdb0 authored by Mark Halliwell's avatar Mark Halliwell
Browse files

Issue #2231215 by Mark Carver: Provide setting to change default table styles.

parent 03abb1ad
Loading
Loading
Loading
Loading
+8 −0
Changes for bootstrap.info: 8 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -43,6 +43,14 @@ settings[bootstrap_region_grid_dynamic-content][sidebar_second] = 'sidebar_secon
settings[bootstrap_image_shape] = ''
settings[bootstrap_image_responsive] = 1

; Tables
; --------------
settings[bootstrap_table_bordered] = 0
settings[bootstrap_table_condensed] = 0
settings[bootstrap_table_hover] = 1
settings[bootstrap_table_striped] = 1
settings[bootstrap_table_responsive] = 1

; Breadcrumbs
; --------------
settings[bootstrap_breadcrumb] = 1
+8 −7
Changes for js/bootstrap.admin.js: 8 added lines, 7 removed lines.
Original line number Diff line number Diff line
@@ -26,12 +26,6 @@
            '@size': size.text()
          }));
        }
        if ($context.find(':input[name="bootstrap_button_colorize"]').is(':checked')) {
          summary.push(Drupal.t('Colorize Buttons'));
        }
        if ($context.find(':input[name="bootstrap_button_iconize"]').is(':checked')) {
          summary.push(Drupal.t('Iconize Buttons'));
        }

        // Images.
        var shape = $context.find('select[name="bootstrap_image_shape"] :selected');
@@ -43,7 +37,14 @@
        if ($context.find(':input[name="bootstrap_image_responsive"]').is(':checked')) {
          summary.push(Drupal.t('Responsive Images'));
        }

        // Tables.
        if ($context.find(':input[name="bootstrap_table_responsive"]').is(':checked')) {
          summary.push(Drupal.t('Responsive Tables'));
        }

        return summary.join(', ');

      });

      // Components.
@@ -116,7 +117,7 @@
              $('<img/>').attr({
                src: themes[i].thumbnail,
                alt: themes[i].name
              })
              }).addClass('img-responsive')
            )
            .appendTo($preview);
          }
+2 −0
Changes for theme/process.inc: 2 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -88,12 +88,14 @@ function _bootstrap_process_input(&$element, &$form_state) {
  if (!empty($element['#type']) && (in_array($element['#type'], $types) || ($element['#type'] === 'file' && empty($element['#managed_file'])))) {
    $element['#attributes']['class'][] = 'form-control';
  }
  if ($element['#type'] !== 'checkbox' || $element['#type'] !== 'radio' || $element['#type'] !== 'checkboxes' || $element['#type'] !== 'radios') {
    if (!empty($element['#description']) && empty($element['#attributes']['title']) && _bootstrap_tooltip_description($element['#description'])) {
      $element['#attributes']['title'] = $element['#description'];
    }
    if (!empty($element['#attributes']['title'])) {
      $element['#attributes']['data-toggle'] = 'tooltip';
    }
  }
  return $element;
}

+38 −0
Changes for theme/settings.inc: 38 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -215,6 +215,44 @@ function _bootstrap_settings_form(&$form, $form_state) {
    '#description' => t('Images in Bootstrap 3 can be made responsive-friendly via the addition of the <code>.img-responsive</code> class. This applies <code>max-width: 100%;</code> and <code>height: auto;</code> to the image so that it scales nicely to the parent element.'),
  );

  // Tables.
  $form['general']['tables'] = array(
    '#type' => 'fieldset',
    '#title' => t('Tables'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );
  $form['general']['tables']['bootstrap_table_bordered'] = array(
    '#type' => 'checkbox',
    '#title' => t('Bordered table'),
    '#default_value' => theme_get_setting('bootstrap_table_bordered'),
    '#description' => t('Add borders on all sides of the table and cells.'),
  );
  $form['general']['tables']['bootstrap_table_condensed'] = array(
    '#type' => 'checkbox',
    '#title' => t('Condensed table'),
    '#default_value' => theme_get_setting('bootstrap_table_condensed'),
    '#description' => t('Make tables more compact by cutting cell padding in half.'),
  );
  $form['general']['tables']['bootstrap_table_hover'] = array(
    '#type' => 'checkbox',
    '#title' => t('Hover rows'),
    '#default_value' => theme_get_setting('bootstrap_table_hover'),
    '#description' => t('Enable a hover state on table rows.'),
  );
  $form['general']['tables']['bootstrap_table_striped'] = array(
    '#type' => 'checkbox',
    '#title' => t('Striped rows'),
    '#default_value' => theme_get_setting('bootstrap_table_striped'),
    '#description' => t('Add zebra-striping to any table row within the <code>&lt;tbody&gt;</code>. <strong>Note:</strong> Striped tables are styled via the <code>:nth-child</code> CSS selector, which is not available in Internet Explorer 8.'),
  );
  $form['general']['tables']['bootstrap_table_responsive'] = array(
    '#type' => 'checkbox',
    '#title' => t('Responsive tables'),
    '#default_value' => theme_get_setting('bootstrap_table_responsive'),
    '#description' => t('Makes tables responsive by wrapping them in <code>.table-responsive</code> to make them scroll horizontally up to small devices (under 768px). When viewing on anything larger than 768px wide, you will not see any difference in these tables.'),
  );

  // Components.
  $form['components'] = array(
    '#type' => 'fieldset',
+7 −1
Changes for theme/system/form-element.func.php: 7 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -68,6 +68,12 @@ function bootstrap_form_element(&$variables) {
    }
  }

  $tooltip_description = !empty($element['#description']) && _bootstrap_tooltip_description($element['#description']);
  if ($tooltip_description && ($element['#type'] === 'checkbox' || $element['#type'] === 'radio' || $element['#type'] === 'checkboxes' || $element['#type'] === 'radios')) {
    $wrapper_attributes['title'] = $element['#description'];
    $wrapper_attributes['data-toggle'] = 'tooltip';
  }

  $output = '<div' . drupal_attributes($wrapper_attributes) . '>' . "\n";

  // If #title is not set, we don't display any label or required marker.
@@ -122,7 +128,7 @@ function bootstrap_form_element(&$variables) {
      break;
  }

  if (!empty($element['#description']) && empty($element['#attributes']['title']) && !_bootstrap_tooltip_description($element['#description'])) {
  if (!empty($element['#description']) && !$tooltip_description && empty($element['#attributes']['title'])) {
    $output .= '<p class="help-block">' . $element['#description'] . "</p>\n";
  }

Loading