Commit ae7527a3 authored by Eric Bremner's avatar Eric Bremner Committed by Kevin Paxman
Browse files

ISTWCMS-4619: adding exp/col all and making views use it for certain views

parent 2e5ffbbd
......@@ -623,3 +623,31 @@ else {
}
}
})(jQuery, document, Drupal);
/**
* @file
*/
(function ($, Drupal) {
Drupal.behaviors.uwexpcolall = {
attach: function (context, settings) {
$(document).ready(function () {
$('.uw-exp-col-expand-all').click(function () {
var uuid = $(this).attr('data-uuid');
$('[data-uuid="' + uuid + '"] details').each(function () {
$(this).attr("open", "");
});
});
$('.uw-exp-col-collapse-all').click(function () {
var uuid = $(this).attr('data-uuid');
$('[data-uuid="' + uuid + '"] details').each(function () {
$(this).removeAttr("open");
});
});
});
}
};
})(jQuery, Drupal);
\ No newline at end of file
......@@ -8,12 +8,12 @@
{% set button_class -%}
uw-tablinks {{ button_modifier_classes }}{% if type.button_class %} {{ type.button_class }}{% endif %}
{%- endset %}
<button class="{{ button_class }}">{{ type.text }}</button>
<button class="{{ button_class }}"{% if uuid %} data-uuid="{{ uuid }}"{% endif %}>{{ type.text }}</button>
{% else %}
{% set button_class -%}
uw-tablinks {{ button_modifier_classes }}{% if type.button_class %} {{ type.button_class }}{% endif %}
{%- endset %}
<button role="tab" class="{{ button_class }}" {% if loop.index == 1 %} aria-selected="true" {% else %} aria-selected="false" {% endif %} aria-controls="{{ type }}" id="tab-{{ loop.index }}" tabindex="0">{{ type }}</button>
<button role="tab" class="{{ button_class }}" {% if loop.index == 1 %} aria-selected="true" {% else %} aria-selected="false" {% endif %} aria-controls="{{ type }}" id="tab-{{ loop.index }}" tabindex="0" data-uuid="{{ rand }}">{{ type }}</button>
{% endif %}
{% endfor %}
</div>
......
......@@ -4,4 +4,5 @@
button_modifier_classes: button_modifier_classes,
tabs_modifier_class: tabs_modifier_class,
exp_col_all: exp_col_all,
uuid: uuid,
} %}
{% set content_list = {
'0': {
'text': 'Expand all',
'button_class': 'uw-exp-col-expand-all',
},
'1': {
'text': 'Collapse all',
'button_class': 'uw-exp-col-collapse-all',
}
} %}
{% include '@components/tabs/tabs--buttons/tabs--buttons.twig' with {
content_list: content_list,
tabs_modifier_class: 'uw-exp-col',
button_modifier_classes: 'uw-exp-col-button',
uuid: uuid,
} %}
\ No newline at end of file
/**
* @file
*/
(function ($, Drupal) {
Drupal.behaviors.uwexpcolall = {
attach: function (context, settings) {
$(document).ready(function () {
$('.uw-exp-col-expand-all').click(function () {
var uuid = $(this).attr('data-uuid');
$('[data-uuid="' + uuid + '"] details').each(function () {
$(this).attr("open", "");
});
});
$('.uw-exp-col-collapse-all').click(function () {
var uuid = $(this).attr('data-uuid');
$('[data-uuid="' + uuid + '"] details').each(function () {
$(this).removeAttr("open");
});
});
});
}
};
})(jQuery, Drupal);
\ No newline at end of file
......@@ -8,18 +8,19 @@
exposed ? 'with-filters',
]
%}
{% if exposed or feed_icons %}
<div class="view-interact">
{% if exposed %}
{# Print button when filters are present #}
{% include '@components/button/button.twig' with {
'is_button_tag': false,
'is_demo': false,
'url': '#view-filters',
'btn_id': 'offcanvasbutton',
'text': 'Filters',
'modifier_classes': 'button--icon view-filters__open',
} %}
{# Print button when filters are present #}
{% include '@components/button/button.twig' with {
'is_button_tag': false,
'is_demo': false,
'url': '#view-filters',
'btn_id': 'offcanvasbutton',
'text': 'Filters',
'modifier_classes': 'button--icon view-filters__open',
} %}
{% endif %}
{% if feed_icons %}
......@@ -29,29 +30,15 @@
{% endif %}
</div>
{% endif %}
{% set tabs = true %}
{% if tabs %}
<div class="view-tabs">
{% set content_list = {
'0': {
'text': 'Expand all',
'button_class': 'uw-contact-expand-all',
},
'1': {
'text': 'Collapse all',
'button_class': 'uw-contact-collapse-all',
}
} %}
{% include '@components/tabs/tabs--buttons/tabs--buttons.twig' with {
content_list: content_list,
tabs_modifier_class: 'uw-contact',
modifier_classes: 'uw-contact-button',
exp_col_all: true,
} %}
</div>
{% endif %}
{% if exp_col_all %}
{% set uuid = random() %}
<div class="view-tabs">
{% include '@components/tabs/tabs--exp-col-all/tabs--exp-col-all.twig' with {
uuid: uuid
}%}
</div>
{% endif %}
<div{{ attributes.addClass(classes) }}>
{{ title_prefix }}
......@@ -73,7 +60,13 @@
{% endif %}
{% if rows %}
{% include '@components/view/view-content/view-content.twig' %}
{% if exp_col_all %}
<div class="uw-exp-col-all" data-uuid="{{ uuid }}">
{% endif %}
{% include '@components/view/view-content/view-content.twig' %}
{% if exp_col_all %}
</div>
{% endif %}
{% else %}
<div class="view-content--message">
<div role="alert" class="message message--warning">
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment