diff --git a/bootstrap_barrio.theme b/bootstrap_barrio.theme index 1231dfbf9d0aa89954af91ddf9bd52656699c00b..0de201bb8aae5268aa3bc9ed3a55be67d48762f6 100644 --- a/bootstrap_barrio.theme +++ b/bootstrap_barrio.theme @@ -175,13 +175,13 @@ function bootstrap_barrio_preprocess_page(&$variables) { // Calculate widths if (theme_get_setting('bootstrap_barrio_content_offset')) { - $variables['content_attributes']['class'][] = 'offset-md-' . theme_get_setting('bootstrap_barrio_content_offset'); + $variables['content_attributes']['class'][] = 'offset-md-' . theme_get_setting('bootstrap_barrio_content_offset'); } if (theme_get_setting('bootstrap_barrio_sidebar_first_offset')) { - $variables['sidebar_first_attributes']['class'][] = 'offset-md-' . theme_get_setting('bootstrap_barrio_sidebar_first_offset'); + $variables['sidebar_first_attributes']['class'][] = 'offset-md-' . theme_get_setting('bootstrap_barrio_sidebar_first_offset'); } if (theme_get_setting('bootstrap_barrio_sidebar_second_offset')) { - $variables['sidebar_second_attributes']['class'][] = 'offset-md-' . theme_get_setting('bootstrap_barrio_sidebar_second_offset'); + $variables['sidebar_second_attributes']['class'][] = 'offset-md-' . theme_get_setting('bootstrap_barrio_sidebar_second_offset'); } // Define column layout classes @@ -232,8 +232,8 @@ function bootstrap_barrio_preprocess_page(&$variables) { } if (theme_get_setting('bootstrap_barrio_sidebar_collapse')) { - $variables['content_attributes']['class'][] = 'sidebar-offcanvas'; - $variables['sidebar_collapse'] = TRUE; + $variables['content_attributes']['class'][] = 'sidebar-offcanvas'; + $variables['sidebar_collapse'] = TRUE; $variables['#attached']['library'][] = 'bootstrap_barrio/sidebar_collapse'; } @@ -341,6 +341,24 @@ function bootstrap_barrio_preprocess_menu_local_task(&$variables) { $variables['item'] = Link::fromTextAndUrl($link['title'], $url); } +/** + * Implements template_preprocess_table() + */ +function bootstrap_barrio_preprocess_table(&$variables) { + $variables['table_class'] = theme_get_setting('bootstrap_barrio_table_style'); + $variables['hover'] = theme_get_setting('bootstrap_barrio_table_hover'); + $variables['thead_class'] = theme_get_setting('bootstrap_barrio_table_head'); +} + +/** + * Implements template_preprocess_views_view_table() + */ +function bootstrap_barrio_preprocess_views_view_table(&$variables) { + $variables['table_class'] = theme_get_setting('bootstrap_barrio_table_style'); + $variables['hover'] = theme_get_setting('bootstrap_barrio_table_hover'); + $variables['thead_class'] = theme_get_setting('bootstrap_barrio_table_head'); +} + /** * Implements hook_theme_suggestions_HOOK_alter() for region templates. */ diff --git a/config/install/bootstrap_barrio.settings.yml b/config/install/bootstrap_barrio.settings.yml index 4559340032dd7f0141540c6d38a3703466c0bbc9..d4cf32c90ff4bff4d69a6ce0d2b572c27053552f 100644 --- a/config/install/bootstrap_barrio.settings.yml +++ b/config/install/bootstrap_barrio.settings.yml @@ -29,3 +29,6 @@ bootstrap_barrio_navbar_top_background: 'bg-secondary' bootstrap_barrio_navbar_position: '' bootstrap_barrio_navbar_color: 'navbar-dark' bootstrap_barrio_navbar_background: 'bg-primary' +# Colors +# -------------- +bootstrap_barrio_table_hover: 1 diff --git a/subtheme/bootstrap_barrio_subtheme.info.yml b/subtheme/bootstrap_barrio_subtheme.info.yml index 3b28543ab73c85c2d80635fd9e63690aceea0aad..3d686fde05e164b4b111e4dd8613dcaab952edb3 100644 --- a/subtheme/bootstrap_barrio_subtheme.info.yml +++ b/subtheme/bootstrap_barrio_subtheme.info.yml @@ -1,8 +1,8 @@ name: Bootstrap Barrio Subtheme type: theme description: 'Basic structure for a Bootstrap Barrio SubTheme.' -# version: VERSION -# core: 8.x +version: VERSION +core: 8.x base theme: bootstrap_barrio libraries: @@ -31,15 +31,3 @@ regions: footer_third: 'Footer third' footer_fourth: 'Footer fourth' footer_fifth: 'Footer fifth' - -# Information added by Drupal.org packaging script on 2015-11-29 -# version: '8.x-4.0-beta1' -# core: '8.x' -# project: 'bootstrap_barrio' -# datestamp: 1448759945 - -# Information added by Drupal.org packaging script on 2018-04-30 -version: '8.x-4.9' -core: '8.x' -project: 'bootstrap_barrio' -datestamp: 1525127885 diff --git a/subtheme/config/install/bootstrap_barrio_subtheme.settings.yml b/subtheme/config/install/bootstrap_barrio_subtheme.settings.yml index 5a4943a5d7319a87f68e3bdb97ba9909203af631..d4cf32c90ff4bff4d69a6ce0d2b572c27053552f 100644 --- a/subtheme/config/install/bootstrap_barrio_subtheme.settings.yml +++ b/subtheme/config/install/bootstrap_barrio_subtheme.settings.yml @@ -1,3 +1,6 @@ +# Library +# -------------- +bootstrap_barrio_library: 'production' # Layout # -------------- bootstrap_barrio_sidebar_position: 'both' @@ -22,7 +25,10 @@ bootstrap_barrio_navbar_toggle: 1 bootstrap_barrio_navbar_container: 'navbar-toggleable-md' bootstrap_barrio_navbar_top_position: '' bootstrap_barrio_navbar_top_color: 'navbar-dark' -bootstrap_barrio_navbar_top_background: 'bg-dark' +bootstrap_barrio_navbar_top_background: 'bg-secondary' bootstrap_barrio_navbar_position: '' bootstrap_barrio_navbar_color: 'navbar-dark' bootstrap_barrio_navbar_background: 'bg-primary' +# Colors +# -------------- +bootstrap_barrio_table_hover: 1 diff --git a/templates/dataset/table.html.twig b/templates/dataset/table.html.twig index 3dde185bf70e70a1b5ac757c743b8e7ea514fa3e..53fc0a3162784ac16e08fb3d3d81007e3dbfc62f 100644 --- a/templates/dataset/table.html.twig +++ b/templates/dataset/table.html.twig @@ -35,6 +35,7 @@ * any rows. * - no_striping: A boolean indicating that the row should receive no striping. * - header_columns: The number of columns in the header. + * - thead_class: Class for the table header * * @see template_preprocess_table() */ @@ -43,7 +44,7 @@ {% set table_classes = [ 'table', - 'table-hover', + hover ? 'table-hover', not no_striping ? 'table-striped' : 'table-bordered', ] %} @@ -66,7 +67,7 @@ {% endfor %} {% if header %} - <thead class='thead-light'> + <thead class='{{ thead_class }}'> <tr> {% for cell in header %} {% diff --git a/templates/navigation/pager.html.twig b/templates/navigation/pager.html.twig index 5dd6e8d11104ab52eb54dac33c17a91ee9f9388e..3db961a6ed0da69009d9985b7d28a6dd8b43d36c 100644 --- a/templates/navigation/pager.html.twig +++ b/templates/navigation/pager.html.twig @@ -58,11 +58,13 @@ {# Now generate the actual pager piece. #} {% for key, item in items.pages %} <li class="page-item {{ current == key ? 'active' : '' }}"> - {% if current == key %} - {% set title = 'Current page'|t %} - {% else %} - {% set title = 'Go to page @key'|t({'@key': key}) %} - {% endif %} + <span class="page-link"> + {% if current == key %} + {% set title = 'Current page'|t %} + {% else %} + {% set title = 'Go to page @key'|t({'@key': key}) %} + {% endif %} + </span> <a href="{{ item.href }}" title="{{ title }}"{{ item.attributes|without('href', 'title') }} class="page-link"> <span class="visually-hidden"> {{ current == key ? 'Current page'|t : 'Page'|t }} diff --git a/templates/navigation/views-mini-pager.html.twig b/templates/navigation/views-mini-pager.html.twig deleted file mode 100644 index f6caeb193bf6364589db5b24dd4cb52d2473fced..0000000000000000000000000000000000000000 --- a/templates/navigation/views-mini-pager.html.twig +++ /dev/null @@ -1,43 +0,0 @@ - {# - /** - * @file - * Default theme implementation for a views mini-pager. - * - * Available variables: - * - items: List of pager items. - * - * @see template_preprocess_views_mini_pager() - * - * @ingroup themeable - */ - #} - {% if items.previous or items.next %} - <nav aria-label="Page navigation"> - <h4 class="visually-hidden">{{ 'Pagination'|t }}</h4> - <ul class="js-pager__items pagination"> - {% if items.previous %} - <li class="page-item"> - <a class="page-link" href="{{ items.previous.href }}" title="{{ 'Go to previous page'|t }}" rel="prev"{{ items.previous.attributes|without('href', 'title', 'rel') }}> - <span class="visually-hidden">{{ 'Previous page'|t }}</span> - <span aria-hidden="true">{{ items.previous.text|default('‹‹'|t) }}</span> - </a> - </li> - {% endif %} - {% if items.current %} - <li class="page-item"> - {% trans %} - Page {{ items.current }} - {% endtrans %} - </li> - {% endif %} - {% if items.next %} - <li class="page-item"> - <a class="page-link" href="{{ items.next.href }}" title="{{ 'Go to next page'|t }}" rel="next"{{ items.next.attributes|without('href', 'title', 'rel') }}> - <span class="visually-hidden">{{ 'Next page'|t }}</span> - <span aria-hidden="true">{{ items.next.text|default('››'|t) }}</span> - </a> - </li> - {% endif %} - </ul> - </nav> - {% endif %} diff --git a/templates/views/views-mini-pager.html.twig b/templates/views/views-mini-pager.html.twig index 124700b477b6255f2489d2326b7e46d6a62621f0..e9ac6182c5c6a0c6aa1e16d7eaac487aa925d2c5 100644 --- a/templates/views/views-mini-pager.html.twig +++ b/templates/views/views-mini-pager.html.twig @@ -1,41 +1,45 @@ -{# -/** - * @file - * Theme override for a views mini-pager. - * - * Available variables: - * - items: List of pager items. - * - * @see template_preprocess_views_mini_pager() - */ -#} -{% if items.previous or items.next %} - <nav class="pager" role="navigation" aria-labelledby="pagination-heading"> - <h4 class="pager__heading visually-hidden">{{ 'Pagination'|t }}</h4> - <ul class="pager__items js-pager__items"> - {% if items.previous %} - <li class="pager__item pager__item--previous"> - <a href="{{ items.previous.href }}" title="{{ 'Go to previous page'|t }}" rel="prev"{{ items.previous.attributes|without('href', 'title', 'rel') }}> - <span class="visually-hidden">{{ 'Previous page'|t }}</span> - <span aria-hidden="true">{{ items.previous.text|default('‹‹'|t) }}</span> - </a> - </li> - {% endif %} - {% if items.current %} - <li class="pager__item is-active"> - {% trans %} - Page {{ items.current }} - {% endtrans %} - </li> - {% endif %} - {% if items.next %} - <li class="pager__item pager__item--next"> - <a href="{{ items.next.href }}" title="{{ 'Go to next page'|t }}" rel="next"{{ items.next.attributes|without('href', 'title', 'rel') }}> - <span class="visually-hidden">{{ 'Next page'|t }}</span> - <span aria-hidden="true">{{ items.next.text|default('››'|t) }}</span> - </a> - </li> - {% endif %} - </ul> - </nav> -{% endif %} + {# + /** + * @file + * Default theme implementation for a views mini-pager. + * + * Available variables: + * - items: List of pager items. + * + * @see template_preprocess_views_mini_pager() + * + * @ingroup themeable + */ + #} + {% if items.previous or items.next %} + <nav aria-label="Page navigation"> + <h4 class="visually-hidden">{{ 'Pagination'|t }}</h4> + <ul class="js-pager__items pagination"> + {% if items.previous %} + <li class="page-item"> + <a class="page-link" href="{{ items.previous.href }}" title="{{ 'Go to previous page'|t }}" rel="prev"{{ items.previous.attributes|without('href', 'title', 'rel') }}> + <span class="visually-hidden">{{ 'Previous page'|t }}</span> + <span aria-hidden="true">{{ items.previous.text|default('‹‹'|t) }}</span> + </a> + </li> + {% endif %} + {% if items.current %} + <li class="page-item"> + <span class="page-link"> + {% trans %} + Page {{ items.current }} + {% endtrans %} + </span> + </li> + {% endif %} + {% if items.next %} + <li class="page-item"> + <a class="page-link" href="{{ items.next.href }}" title="{{ 'Go to next page'|t }}" rel="next"{{ items.next.attributes|without('href', 'title', 'rel') }}> + <span class="visually-hidden">{{ 'Next page'|t }}</span> + <span aria-hidden="true">{{ items.next.text|default('››'|t) }}</span> + </a> + </li> + {% endif %} + </ul> + </nav> + {% endif %} diff --git a/templates/views/views-view-table.html.twig b/templates/views/views-view-table.html.twig index 0ecf5a5fcc3c9e893291e5023c8036e00d95226c..7abf8500dabdaaf7fdbdc2f4fa5c90224f91a7f2 100644 --- a/templates/views/views-view-table.html.twig +++ b/templates/views/views-view-table.html.twig @@ -33,6 +33,8 @@ {% set classes = [ 'table', + hover ? 'table-hover', + table_class, 'views-table', 'views-view-table', 'cols-' ~ header|length, @@ -40,6 +42,7 @@ sticky ? 'sticky-enabled', ] %} +<div class="table-responsive"> <table{{ attributes.addClass(classes) }}> {% if caption_needed %} <caption> @@ -61,7 +64,7 @@ </caption> {% endif %} {% if header %} - <thead> + <thead class='{{ thead_class }}'> <tr> {% for key, column in header %} {% if column.default_classes %} @@ -125,3 +128,4 @@ {% endfor %} </tbody> </table> +</div> diff --git a/theme-settings.php b/theme-settings.php index 29f20f14c079ecea1b00e8d0b06d46cc92e58812..a26c988134d5b8233075e314a7a847c3673bb82a 100644 --- a/theme-settings.php +++ b/theme-settings.php @@ -258,7 +258,6 @@ function bootstrap_barrio_form_system_theme_settings_alter(&$form, FormStateInte '#default_value' => theme_get_setting('bootstrap_barrio_navbar_top_background'), '#options' => array( 'bg-primary' => t('Primary'), - 'bg-secondary' => t('Secondary'), 'bg-light' => t('Light'), 'bg-dark' => t('Dark'), ), @@ -294,7 +293,6 @@ function bootstrap_barrio_form_system_theme_settings_alter(&$form, FormStateInte '#default_value' => theme_get_setting('bootstrap_barrio_navbar_background'), '#options' => array( 'bg-primary' => t('Primary'), - 'bg-secondary' => t('Secondary'), 'bg-light' => t('Light'), 'bg-dark' => t('Dark'), ), @@ -535,7 +533,7 @@ function bootstrap_barrio_form_system_theme_settings_alter(&$form, FormStateInte '#group' => 'bootstrap', ); - // Buttons. + // Alerts. $form['colors']['alerts'] = array( '#type' => 'details', '#title' => t('Colors'), @@ -553,4 +551,37 @@ function bootstrap_barrio_form_system_theme_settings_alter(&$form, FormStateInte ), '#description' => t('Replace standard color scheme for the system mantainance alerts with Google Material Design color scheme'), ); + $form['colors']['tables'] = array( + '#type' => 'details', + '#title' => t('Tables'), + '#collapsible' => TRUE, + '#collapsed' => FALSE, + ); + $form['colors']['tables']['bootstrap_barrio_table_style'] = array( + '#type' => 'select', + '#title' => t('Table cell style'), + '#default_value' => theme_get_setting('bootstrap_barrio_table_style'), + '#empty_option' => t('Default'), + '#options' => array( + 'messages_light' => t('Light'), + 'messages_dark' => t('Dark'), + ), + ); + $form['colors']['tables']['bootstrap_barrio_table_hover'] = array( + '#type' => 'checkbox', + '#title' => t('Hover efect over table cells'), + '#description' => t('Apply Bootstrap table hover effect.'), + '#default_value' => theme_get_setting('bootstrap_barrio_table_hover'), + ); + $form['colors']['tables']['bootstrap_barrio_table_head'] = array( + '#type' => 'select', + '#title' => t('Table Header Color Scheme'), + '#default_value' => theme_get_setting('bootstrap_barrio_table_head'), + '#empty_option' => t('Default'), + '#options' => array( + 'table-striped' => t('Striped'), + 'table-bordered' => t('Bordered'), + ), + '#description' => t('Select the table head color scheme'), + ); }