Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 0 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ gemspec

gem 'rails', '~> 7.0.1'

# Lock i18n to 1.14.x for: https://github.com/ruby-i18n/i18n/issues/735
gem 'i18n', '~> 1.14.0'

# Lock minitest to 5.x until Rails 7.1+ adds Minitest 6.0 support
# Minitest 6.0.0 was released Dec 2024 with breaking API changes
gem 'minitest', '~> 5.0'
Expand Down
22 changes: 8 additions & 14 deletions app/views/kaui/components/menu_dropdown/_menu_dropdown.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

<ul class="dropdown-menu header-menu shadow border-0 rounded-3"
id="<%= dropdown_id %>_menu"
aria-labelledby="<%= dropdown_id %>_button"
style="min-width: 6.25rem; display: none;">
<% menu_items&.each do |item| %>
<li>
Expand All @@ -31,28 +32,21 @@

<%= javascript_tag do %>
document.addEventListener('DOMContentLoaded', function () {
const button = document.getElementById('<%= dropdown_id %>_button');
const menu = document.getElementById('<%= dropdown_id %>_menu');
const wrapper = document.getElementById('<%= dropdown_id %>_wrapper');
var button = document.getElementById('<%= dropdown_id %>_button');
var menu = document.getElementById('<%= dropdown_id %>_menu');
var wrapper = document.getElementById('<%= dropdown_id %>_wrapper');

button.addEventListener('click', function (e) {
e.stopPropagation();
const isShown = menu.style.display === 'block';

// Close all other open dropdowns first (including other dots menus)
document.querySelectorAll('.dropdown-menu').forEach(function (m) {
if (m !== menu) {
m.style.display = 'none';
}
});

// Toggle this one
var isShown = menu.style.display === 'block';
menu.style.display = isShown ? 'none' : 'block';
button.setAttribute('aria-expanded', !isShown);
});

document.addEventListener('click', function (e) {
if (!wrapper.contains(e.target)) {
if (!wrapper.contains(e.target) && menu.style.display === 'block') {
menu.style.display = 'none';
button.setAttribute('aria-expanded', 'false');
}
});
});
Expand Down
17 changes: 8 additions & 9 deletions app/views/kaui/invoices/_multi_functions_bar.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,7 @@
type: "button",
html_class: "kaui-button custom-hover",
html_options: {
id: "dropdownMenu1",
data: {
bs_toggle: "dropdown"
}
id: "dropdownMenu1"
}
} %>
<ul class="dropdown-menu" id="column-visibility" aria-labelledby="dropdownMenu1">
Expand Down Expand Up @@ -213,13 +210,15 @@

<%= javascript_tag do %>
$(document).ready(function() {
// Initialize Bootstrap dropdown
var dropdownElementList = [].slice.call(document.querySelectorAll('.dropdown-toggle'));
var dropdownList = dropdownElementList.map(function (dropdownToggleEl) {
return new bootstrap.Dropdown(dropdownToggleEl);
// Toggle Edit Columns dropdown
$('#dropdownMenu1').on('click', function(e) {
e.stopPropagation();
var $menu = $('#column-visibility');
$menu.toggleClass('show');
$(this).attr('aria-expanded', $menu.hasClass('show'));
});

$('.dropdown-menu').on('click', 'input[type="checkbox"], label', function(event) {
$('#column-visibility').on('click', 'input[type="checkbox"], label', function(event) {
event.stopPropagation();
});

Expand Down
17 changes: 8 additions & 9 deletions app/views/kaui/payments/_multi_functions_bar.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,7 @@
type: "button",
html_class: "kaui-button custom-hover",
html_options: {
id: "dropdownMenu1",
data: {
bs_toggle: "dropdown"
}
id: "dropdownMenu1"
}
} %>
<ul class="dropdown-menu" id="column-visibility" aria-labelledby="dropdownMenu1">
Expand Down Expand Up @@ -213,13 +210,15 @@

<%= javascript_tag do %>
$(document).ready(function() {
// Initialize Bootstrap dropdown
var dropdownElementList = [].slice.call(document.querySelectorAll('.dropdown-toggle'));
var dropdownList = dropdownElementList.map(function (dropdownToggleEl) {
return new bootstrap.Dropdown(dropdownToggleEl);
// Toggle Edit Columns dropdown
$('#dropdownMenu1').on('click', function(e) {
e.stopPropagation();
var $menu = $('#column-visibility');
$menu.toggleClass('show');
$(this).attr('aria-expanded', $menu.hasClass('show'));
});

$('.dropdown-menu').on('click', 'input[type="checkbox"], label', function(event) {
$('#column-visibility').on('click', 'input[type="checkbox"], label', function(event) {
event.stopPropagation();
});

Expand Down
Loading