Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closes #1273 Closes #3848: Allow multiple select menus on the same page #1387

Merged
Merged
Show file tree
Hide file tree
Changes from 82 commits
Commits
Show all changes
84 commits
Select commit Hold shift + click to select a range
968eb14
assign array and key value intstead of empty array
Mar 8, 2022
652028e
added data attributes
Mar 8, 2022
0d4107c
fixed spacing
Mar 8, 2022
98610f4
Closes #1331: Make sidebar not overlap text for Text with Background …
smayden Mar 4, 2022
9bfaeca
Closes #1350: Implement more flexible update hook numbering scheme. (…
joeparsons Mar 4, 2022
8819535
Jan 2022 Consolidated contrib module updates. (#1258)
joeparsons Mar 4, 2022
81a521d
Closes #1333: Configure system mail interface to use SMTP during inst…
kevcooper Mar 4, 2022
d9605b5
Closes #1317: Add update hook to delete problematic legacy global foo…
joeparsons Mar 4, 2022
bee804a
Closes #1371: Add az prefix to EntityEmbedProcess migrate plugin ID. …
joeparsons Mar 4, 2022
9ebd5be
Closes #892: Reduce paragraphs behavior settings migrate plugin compl…
trackleft Mar 4, 2022
4454682
#1367: Update composer branch alias for dev-main to 2.3.x-dev (#1377)
joeparsons Mar 4, 2022
358762d
Fixes #1385, Fixes #1386: Add patch for media_migation module issue b…
joeparsons Mar 11, 2022
eb1e0ae
Fixes #1384 Global Footer (after 2.2 Update) Formatting Incorrect (#1…
trackleft Mar 11, 2022
a305ec3
Closes #1390 by setting maxlength of Card Link URL field to 2048 char…
bberndt-uaz Mar 11, 2022
301100b
Fixes #1356 Adding z-index for rendering full-width backgrounds behin…
trackleft Mar 16, 2022
d7e8078
Fixes #1401: Update Drupal core to 9.2.15 for SA-CORE-2022-005. (#1402)
joeparsons Mar 16, 2022
266dc89
Fixes #1397 Update migrations to add text_media_spacing default and c…
trackleft Mar 18, 2022
0a1779f
Closes #876: Enable testing of related az-quickstart-dev branches in …
joeparsons Mar 18, 2022
600aeb1
Fixes #1415: Add required default_theme property to all tests. (#1417)
joeparsons Mar 21, 2022
dcb3f86
Closes #1421: Update Drupal core to 9.2.16 for SA-CORE-2022-006. (#1422)
joeparsons Mar 21, 2022
05ebc1f
Closes #595: Add az_security module (#915)
kevcooper Mar 23, 2022
006cdae
Closes #1311: Default XDebug config for VS Code (#1312)
kevcooper Mar 25, 2022
d18d8e7
Closes #396 Updated CKEditor icons for embed buttons (#1423)
cpoff Mar 25, 2022
fc6800f
Fixes #1232 Optionally add html paragraphs to migration lookup, and r…
trackleft Mar 25, 2022
bd30a75
Update Quickstart Migration README for developer workshop. (#1437)
trackleft Mar 30, 2022
52a0518
Closes #1231: Migrate front page (#1411)
trackleft Mar 30, 2022
b0e3004
Closes #1133 Adding required markup for subhead and moving to the top…
trackleft Mar 30, 2022
0fe4271
Fixes #1438: Add patch for AP Style Date module time display issue (#…
trackleft Apr 1, 2022
31001f9
Closes #1426: Change default CAS hostname to shibboleth.arizona.edu (…
MarkFischer Apr 1, 2022
86a4f57
Closes #1433 Fix alignment and label issues with Quickstart Select Me…
bberndt-uaz Apr 1, 2022
819cddd
Closes #1285: Add documentation to existing migrate plugins. (#1305)
joeparsons Apr 1, 2022
edd98a2
Closes #1454: Add steps to test to PR template. (#1455)
danahertzberg Apr 6, 2022
8b520fd
Closes #1302: Fix AZ News Feed if <30 stories match configured tag(s)…
joeparsons Apr 6, 2022
00d7394
Closes #1394: Updating views re-order notice blocks to use render arr…
trackleft Apr 8, 2022
e1a7add
Closes #1404: Push sidebar down and fix horizontal scroll problem. (#…
trackleft Apr 8, 2022
aa60c42
Closes #986: Strip HTML tags from Person address field during migrati…
joeparsons Apr 8, 2022
52292f3
Closes #880: Add new ViewsReferenceMapping process plugin with views …
joeparsons Apr 13, 2022
b77ec35
Closes #1366 Allow upgrade of smart_date and fix demo menu links migr…
trackleft Apr 13, 2022
116948e
Closes #1322: Add core patch to fix issue with CKEditor fields not al…
joeparsons Apr 13, 2022
43ea6b1
az-digital/az-icons#17: Update icon font with vimeo icon (#1464)
trackleft Apr 15, 2022
5190260
Closes 1403: Added style for Natural Image behavior (#1469)
cpoff Apr 15, 2022
6471329
Fixes #1460 Allow for Delayed Configuration Overrides. (#1471)
tadean Apr 15, 2022
393e935
Closes #1481: Increase soft limit widths to 1920px for az_full_width_…
joeparsons Apr 15, 2022
3925b53
Fixes #1495: Update Drupal core to 9.2.18 for SA-CORE-2022-008 (#1496)
joeparsons Apr 20, 2022
6097b89
Closes #1484: Provide default Antibot module config overrides in Quic…
joeparsons Apr 20, 2022
3258a9b
Add info about PHPStan to contributing document. (#1383)
trackleft Apr 22, 2022
6f0d186
#1280: Add some functional tests to check that modules can be uninsta…
trackleft Apr 22, 2022
ea8c582
Closes #1498: Update eslint and prettier (#1499)
trackleft Apr 22, 2022
800c05f
Closes #1501: Add environment_indicator module. (#1503)
joeparsons Apr 22, 2022
2108faa
Closes #1505: Enable errorexit for ProboCI migration tests. (#1506)
joeparsons Apr 27, 2022
30ee0a6
Closes #1462 Optimize javascript behaviors for full width elements. (…
trackleft May 4, 2022
dffeaf4
Closes #1531 Update quick_node_clone to 1.15 for SA-CONTRIB-2022-038 …
trackleft May 4, 2022
a29e825
Closes #1490: Adding content admin/editor permissions for node clone,…
smayden May 6, 2022
ccf39e1
Fixes #1535 Allow subthemes to override paragraphs and alphabetical l…
trackleft May 11, 2022
530e9ab
Update Arizona Bootstrap to 2.0.14 (#1547)
github-actions[bot] May 11, 2022
e5fc6c9
Closes #1548: Clean up existing configuration drift ahead of Drupal 9…
joeparsons May 11, 2022
e600446
Closes #1500 Feature display mode for the news feature (#1420)
cpoff May 11, 2022
79cf15d
Closes #1207 - Change card breakpoints to match Bootstrap 4 (break so…
akslay May 11, 2022
1511d09
Closes #1299: Adding documentation surrounding developing and applyin…
trackleft May 11, 2022
9f26667
Closes #1472: Consolidated contrib module updates for 2.3.x (#1473)
joeparsons May 12, 2022
d675bfb
Update drupal/core-recommended requirement from 9.2.18 to 9.2.19 (#1553)
dependabot[bot] May 12, 2022
7e74677
Update drupal/media_migration requirement from 1.0.0-alpha13 to 1.0.0…
dependabot[bot] May 12, 2022
99ab5dc
Closes #1363 Use navbar_offcanvas_attributes set in .theme file. (#1400)
trackleft May 13, 2022
8a44b49
Closes #821 Adding process plugin for datetime to smart_date to fix d…
trackleft May 13, 2022
3c06220
Closes #1348: Remove deprecated ParagraphsBehavior migrate process pl…
trackleft May 13, 2022
8ee72cc
Closes #1103: Add new AZ News view displays (#1539)
danahertzberg May 13, 2022
efcf5e0
Closes #1555: Cleanup existing PHPCS warnings ahead of 2.3.0. (#1556)
joeparsons May 16, 2022
76223b1
#1561: Update composer branch alias for dev-main to 2.4.x-dev. (#1562)
joeparsons May 17, 2022
a37c790
#1340, Closes #1180: Prepare Quickstart for Drupal core 9.3.x. (#1181)
joeparsons May 17, 2022
7c1a433
Closes #1570: Ensure better_exposed_filters module is installed. (#1571)
joeparsons May 18, 2022
5186b8b
Closes #1574 Update text in description of crop type `az_full_width_b…
trackleft May 18, 2022
02e53b3
Merge branch 'main' into issue/1273-az-select-menu-to-support-more-th…
trackleft May 18, 2022
916ed6b
Code suggestions for issue/1273 (#1577)
trackleft May 18, 2022
c45770a
Update modules/custom/az_select_menu/src/Plugin/Block/AzSelectMenu.php
trackleft Oct 30, 2024
bac7f6a
Merge branch 'main' into issue/1273-az-select-menu-to-support-more-th…
trackleft Oct 30, 2024
7395973
Fix unique IDs and add 'for' element to label
danahertzberg Oct 31, 2024
e43ac5a
Merge branch 'main' into issue/1273-az-select-menu-to-support-more-th…
danahertzberg Nov 1, 2024
63547c8
Update javascript reference
danahertzberg Nov 1, 2024
596228a
Update modules/custom/az_select_menu/src/Plugin/Block/AzSelectMenu.php
trackleft Nov 1, 2024
4ef96a2
Update modules/custom/az_select_menu/src/Plugin/Block/AzSelectMenu.php
trackleft Nov 1, 2024
7274397
Update menu name references
danahertzberg Nov 1, 2024
5e16913
Allow multiple form id's to be referenced with js
danahertzberg Nov 1, 2024
3ad4c68
Update modules/custom/az_select_menu/js/az-select-menu.es6.js
danahertzberg Nov 1, 2024
ec8bba3
Update with ids
danahertzberg Nov 1, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 41 additions & 38 deletions modules/custom/az_select_menu/js/az-select-menu.es6.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,45 +8,48 @@
attach(context, settings) {
// az_select_menu form id's are added in an array depending
// on the page you are on, and how many select menus are on the page.
for (let i = 0; i < settings.azSelectMenu.ids.length; i++) {
const selectFormId = settings.azSelectMenu.ids[i];
const selectForm = document.querySelector(`#${selectFormId}`);
once('azSelectMenu', selectForm, context).forEach((element) => {
$(element).popover();
element.addEventListener('focus', (event) => {
Drupal.azSelectMenu.handleEvents(event);
// casting settings.azSelectMenu values to an array azSelectMenuArr
danahertzberg marked this conversation as resolved.
Show resolved Hide resolved
Object.keys(settings.azSelectMenu).forEach(function (property) {
if (settings.azSelectMenu.hasOwnProperty(property)) {
joeparsons marked this conversation as resolved.
Show resolved Hide resolved
const selectFormId = settings.azSelectMenu.ids[property];
const selectForm = document.querySelector(`#${selectFormId}`);
once('azSelectMenu', selectForm, context).forEach((element) => {
$(element).popover();
element.addEventListener('focus', (event) => {
Drupal.azSelectMenu.handleEvents(event);
});
element.addEventListener('change', (event) => {
Drupal.azSelectMenu.handleEvents(event);
});
element.addEventListener('mouseenter', (event) => {
Drupal.azSelectMenu.handleEvents(event);
});
const button = element.querySelector('button');
button.addEventListener('click', (event) => {
Drupal.azSelectMenu.handleEvents(event);
});
button.addEventListener('touchstart', (event) => {
Drupal.azSelectMenu.handleEvents(event);
});
button.addEventListener('mouseenter', (event) => {
Drupal.azSelectMenu.handleEvents(event);
});
button.addEventListener('mouseleave', (event) => {
Drupal.azSelectMenu.handleEvents(event);
});
button.addEventListener('focus', (event) => {
Drupal.azSelectMenu.handleEvents(event);
});
button.addEventListener('blur', (event) => {
Drupal.azSelectMenu.handleEvents(event);
});
document.addEventListener('touchstart', (event) => {
Drupal.azSelectMenu.handleEvents(event);
});
element.classList.add('processed');
});
element.addEventListener('change', (event) => {
Drupal.azSelectMenu.handleEvents(event);
});
element.addEventListener('mouseenter', (event) => {
Drupal.azSelectMenu.handleEvents(event);
});
const button = element.querySelector('button');
button.addEventListener('click', (event) => {
Drupal.azSelectMenu.handleEvents(event);
});
button.addEventListener('touchstart', (event) => {
Drupal.azSelectMenu.handleEvents(event);
});
button.addEventListener('mouseenter', (event) => {
Drupal.azSelectMenu.handleEvents(event);
});
button.addEventListener('mouseleave', (event) => {
Drupal.azSelectMenu.handleEvents(event);
});
button.addEventListener('focus', (event) => {
Drupal.azSelectMenu.handleEvents(event);
});
button.addEventListener('blur', (event) => {
Drupal.azSelectMenu.handleEvents(event);
});
document.addEventListener('touchstart', (event) => {
Drupal.azSelectMenu.handleEvents(event);
});
element.classList.add('processed');
});
}
}
});
},
};

Expand Down
78 changes: 40 additions & 38 deletions modules/custom/az_select_menu/js/az-select-menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,45 +14,47 @@ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
Drupal.azSelectMenu = Drupal.azSelectMenu || {};
Drupal.behaviors.azSelectMenu = {
attach: function attach(context, settings) {
for (var i = 0; i < settings.azSelectMenu.ids.length; i++) {
var selectFormId = settings.azSelectMenu.ids[i];
var selectForm = document.querySelector("#".concat(selectFormId));
once('azSelectMenu', selectForm, context).forEach(function (element) {
$(element).popover();
element.addEventListener('focus', function (event) {
Drupal.azSelectMenu.handleEvents(event);
Object.keys(settings.azSelectMenu).forEach(function (property) {
if (settings.azSelectMenu.hasOwnProperty(property)) {
var selectFormId = settings.azSelectMenu.ids[property];
var selectForm = document.querySelector("#".concat(selectFormId));
once('azSelectMenu', selectForm, context).forEach(function (element) {
$(element).popover();
element.addEventListener('focus', function (event) {
Drupal.azSelectMenu.handleEvents(event);
});
element.addEventListener('change', function (event) {
Drupal.azSelectMenu.handleEvents(event);
});
element.addEventListener('mouseenter', function (event) {
Drupal.azSelectMenu.handleEvents(event);
});
var button = element.querySelector('button');
button.addEventListener('click', function (event) {
Drupal.azSelectMenu.handleEvents(event);
});
button.addEventListener('touchstart', function (event) {
Drupal.azSelectMenu.handleEvents(event);
});
button.addEventListener('mouseenter', function (event) {
Drupal.azSelectMenu.handleEvents(event);
});
button.addEventListener('mouseleave', function (event) {
Drupal.azSelectMenu.handleEvents(event);
});
button.addEventListener('focus', function (event) {
Drupal.azSelectMenu.handleEvents(event);
});
button.addEventListener('blur', function (event) {
Drupal.azSelectMenu.handleEvents(event);
});
document.addEventListener('touchstart', function (event) {
Drupal.azSelectMenu.handleEvents(event);
});
element.classList.add('processed');
});
element.addEventListener('change', function (event) {
Drupal.azSelectMenu.handleEvents(event);
});
element.addEventListener('mouseenter', function (event) {
Drupal.azSelectMenu.handleEvents(event);
});
var button = element.querySelector('button');
button.addEventListener('click', function (event) {
Drupal.azSelectMenu.handleEvents(event);
});
button.addEventListener('touchstart', function (event) {
Drupal.azSelectMenu.handleEvents(event);
});
button.addEventListener('mouseenter', function (event) {
Drupal.azSelectMenu.handleEvents(event);
});
button.addEventListener('mouseleave', function (event) {
Drupal.azSelectMenu.handleEvents(event);
});
button.addEventListener('focus', function (event) {
Drupal.azSelectMenu.handleEvents(event);
});
button.addEventListener('blur', function (event) {
Drupal.azSelectMenu.handleEvents(event);
});
document.addEventListener('touchstart', function (event) {
Drupal.azSelectMenu.handleEvents(event);
});
element.classList.add('processed');
});
}
}
});
}
};
Drupal.azSelectMenu.handleEvents = function (event) {
Expand Down
danahertzberg marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Drupal\az_select_menu\Plugin\Block;

use Drupal\Component\Utility\Html;
use Drupal\Core\Block\Attribute\Block;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\StringTranslation\TranslatableMarkup;
Expand Down Expand Up @@ -129,9 +130,10 @@ public function blockSubmit($form, FormStateInterface $form_state) {
public function build() {

$build = parent::build();
$menu_name = Html::getUniqueId('az-' . $build['#menu_name']);

$form_attributes = new Attribute([
'id' => 'az-select-menu-' . $build['#menu_name'] . '-form',
'id' => $menu_name . '-form',
'data-toggle' => 'popover',
'data-trigger' => 'focus',
'data-placement' => 'top',
Expand All @@ -141,7 +143,7 @@ public function build() {
$build['#form_attributes'] = $form_attributes;

$select_attributes = new Attribute([
'id' => 'az-select-menu-' . $build['#menu_name'] . '-select',
'id' => $menu_name . '-select',
'class' => [
'form-control',
'select-primary',
Expand All @@ -152,7 +154,7 @@ public function build() {
$build['#select_attributes'] = $select_attributes;

$button_attributes = new Attribute([
'id' => 'az-select-menu-' . $build['#menu_name'] . '-button',
'id' => $menu_name . '-button',
'class' => [
'btn',
'btn-primary',
Expand All @@ -168,7 +170,7 @@ public function build() {
$build['#button_attributes'] = $button_attributes;

$build['#attached']['library'][] = 'az_select_menu/az_select_menu';
$build['#attached']['drupalSettings']['azSelectMenu']['ids'][] = 'az-select-menu-' . $build['#menu_name'] . '-form';
$build['#attached']['drupalSettings']['azSelectMenu']['ids'][$menu_name] = $menu_name . '-form';

return $build;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
<div class="select-menu-label">{{menu_block_configuration.az_select_menu.preform_text}}</div>
</span>
{% endif %}
<label class="sr-only select-menu-label-sr">{{menu_block_configuration.az_select_menu.preform_text_sr_only}}</label>
<label class="sr-only select-menu-label-sr" for="{{ select_attributes.id }}">{{menu_block_configuration.az_select_menu.preform_text_sr_only}}</label>
{% import _self as menus %}
{% if items %}
<select {{ select_attributes }}>
Expand Down