hootstrap 0.3.2 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 52febde69e1cf0a8d39dc73fe217a21a7c7aa1ac67bfa628258ff63a074fefcc
|
4
|
+
data.tar.gz: 7ec8d1e8a88a6d6fbf31a35b5b1b50492109d7ac6d54cd7c9bc1eee37d2d28cb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 80d18958dde2d40b8b62e130c11d1e8f2a27996b842b58e44c83c0659769347afc3321fc7664e8ea8d5f1c8595fdab67ebc4b504cdfa76e74c9d012502dedf2f
|
7
|
+
data.tar.gz: 3f4590d82e52505f2936af89c5be6a32f643b3e905fb3973e24b121517ec4fca588c1f7445f4ea4a71f007d12e27e1e9ce48d0fab4756460d4ef52dd76c2e584
|
@@ -0,0 +1,71 @@
|
|
1
|
+
//= require ./utils/dynamicListener
|
2
|
+
//= require ./utils/turbolinks
|
3
|
+
|
4
|
+
document.addEventListener(HootstrapEvent, () => {
|
5
|
+
let activeDropdown = {};
|
6
|
+
|
7
|
+
addDynamicEventListener(
|
8
|
+
document.body,
|
9
|
+
'click',
|
10
|
+
'[data-toggle="dropdown"]',
|
11
|
+
openDropdown
|
12
|
+
);
|
13
|
+
|
14
|
+
document.body.addEventListener('click', event => {
|
15
|
+
if (!event.target.classList.contains('dropdown-toggle')) {
|
16
|
+
closeDropdown();
|
17
|
+
}
|
18
|
+
});
|
19
|
+
|
20
|
+
document.addEventListener('keyup', handleKeyup);
|
21
|
+
|
22
|
+
function openDropdown(event) {
|
23
|
+
event.preventDefault();
|
24
|
+
|
25
|
+
const button = event.target;
|
26
|
+
const dropdown = button.parentNode;
|
27
|
+
const children = dropdown.childNodes;
|
28
|
+
|
29
|
+
children.forEach(dropdownMenu => {
|
30
|
+
if (
|
31
|
+
dropdownMenu.classList &&
|
32
|
+
dropdownMenu.classList.contains('dropdown-menu')
|
33
|
+
) {
|
34
|
+
const cachedActiveDropdown = activeDropdown.dropdown;
|
35
|
+
closeDropdown({ focus: true });
|
36
|
+
|
37
|
+
if (dropdown === cachedActiveDropdown) {
|
38
|
+
return;
|
39
|
+
}
|
40
|
+
|
41
|
+
button.focus();
|
42
|
+
dropdown.classList.add('show');
|
43
|
+
dropdownMenu.classList.add('show');
|
44
|
+
button.setAttribute('aria-expanded', 'true');
|
45
|
+
activeDropdown = {
|
46
|
+
dropdown: dropdown,
|
47
|
+
button: button,
|
48
|
+
dropdownMenu: dropdownMenu
|
49
|
+
};
|
50
|
+
}
|
51
|
+
});
|
52
|
+
}
|
53
|
+
|
54
|
+
function closeDropdown(options = {}) {
|
55
|
+
if (activeDropdown.dropdown) {
|
56
|
+
activeDropdown.dropdown.classList.remove('show');
|
57
|
+
activeDropdown.dropdownMenu.classList.remove('show');
|
58
|
+
activeDropdown.button.setAttribute('aria-expanded', 'false');
|
59
|
+
if (options.focus) {
|
60
|
+
activeDropdown.button.focus();
|
61
|
+
}
|
62
|
+
activeDropdown = {};
|
63
|
+
}
|
64
|
+
}
|
65
|
+
|
66
|
+
function handleKeyup(event) {
|
67
|
+
if (event.keyCode == 27) {
|
68
|
+
closeDropdown({ focus: true });
|
69
|
+
}
|
70
|
+
}
|
71
|
+
});
|
data/lib/hootstrap/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hootstrap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justin Licata
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-07-
|
11
|
+
date: 2018-07-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -64,6 +64,7 @@ files:
|
|
64
64
|
- Rakefile
|
65
65
|
- assets/javascripts/hootstrap.js
|
66
66
|
- assets/javascripts/hootstrap/alerts.js
|
67
|
+
- assets/javascripts/hootstrap/dropdown.js
|
67
68
|
- assets/javascripts/hootstrap/modal.js
|
68
69
|
- assets/javascripts/hootstrap/rails.js
|
69
70
|
- assets/javascripts/hootstrap/toast.js
|
@@ -123,7 +124,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
123
124
|
version: '0'
|
124
125
|
requirements: []
|
125
126
|
rubyforge_project:
|
126
|
-
rubygems_version: 2.7.
|
127
|
+
rubygems_version: 2.7.6
|
127
128
|
signing_key:
|
128
129
|
specification_version: 4
|
129
130
|
summary: ProctorU's design system.
|