hootstrap 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +11 -8
- data/assets/javascripts/hootstrap/alerts.js +18 -0
- data/assets/javascripts/hootstrap/rails.js +3 -2
- data/assets/javascripts/hootstrap/utils/closest.js +16 -0
- data/assets/javascripts/hootstrap/utils/turbolinks.js +13 -0
- data/assets/javascripts/hootstrap.js +1 -0
- data/assets/stylesheets/hootstrap/components/_alert.scss +17 -0
- data/lib/hootstrap/version.rb +1 -1
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: feb61b77a46ef0a3ac9f1a5457a42b1a8efae7c4
|
4
|
+
data.tar.gz: 5d29fd1c471af8d6efa307847cbe74f6fafbe318
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 83f002547129855efa82fcac774fc6f756a2f20c2f04cefc311624f05769fe1a1ebf4c63a5d80e83a7311250cbd278ff4327539ef638bd11c1dd05d7f7523a51
|
7
|
+
data.tar.gz: 0d09ed21b329727a7322e65907b5cd84d3ca6ebeaf552e33c3cf38f2fc26bce1f1e06efeba7a961b76ee32130a8c3bc655be016a2cc1d7a252a92614fac63dfa
|
data/README.md
CHANGED
@@ -8,29 +8,32 @@ distributed via RubyGems, so it's easy to include in your Rails projects.
|
|
8
8
|
- [Credits](#credits)
|
9
9
|
|
10
10
|
## Installation
|
11
|
+
|
11
12
|
Add this line to your application's Gemfile:
|
12
13
|
|
13
14
|
```ruby
|
14
|
-
gem 'hootstrap'
|
15
|
+
gem 'hootstrap'
|
15
16
|
```
|
16
17
|
|
17
18
|
And then execute:
|
18
19
|
```bash
|
19
|
-
$ bundle
|
20
|
-
```
|
21
|
-
|
22
|
-
Or install it yourself as:
|
23
|
-
```bash
|
24
|
-
$ gem install hootstrap
|
20
|
+
$ bundle install
|
25
21
|
```
|
26
22
|
|
27
23
|
## Usage
|
28
|
-
|
24
|
+
|
25
|
+
Import `hootstrap` CSS to your asset pipeline.
|
29
26
|
|
30
27
|
```scss
|
31
28
|
@import "hootstrap";
|
32
29
|
```
|
33
30
|
|
31
|
+
Import `hootstrap` JS to your asset pipeline.
|
32
|
+
|
33
|
+
```js
|
34
|
+
//= require hootstrap
|
35
|
+
```
|
36
|
+
|
34
37
|
## Credits
|
35
38
|
|
36
39
|
Hootstrap is maintained and funded by [ProctorU](https://twitter.com/ProctorU),
|
@@ -0,0 +1,18 @@
|
|
1
|
+
//= require ./utils/closest
|
2
|
+
//= require ./utils/dynamicListener
|
3
|
+
//= require ./utils/turbolinks
|
4
|
+
|
5
|
+
document.addEventListener(HootstrapEvent, () => {
|
6
|
+
addDynamicEventListener(
|
7
|
+
document.body,
|
8
|
+
'click',
|
9
|
+
'[data-dismiss="alert"]',
|
10
|
+
handleClose
|
11
|
+
);
|
12
|
+
|
13
|
+
function handleClose(event) {
|
14
|
+
const alert = closest(event.target, '.alert');
|
15
|
+
|
16
|
+
alert.parentNode.removeChild(alert);
|
17
|
+
}
|
18
|
+
});
|
@@ -1,6 +1,7 @@
|
|
1
1
|
//= require ./utils/dynamicListener
|
2
|
+
//= require ./utils/turbolinks
|
2
3
|
|
3
|
-
document.addEventListener(
|
4
|
+
document.addEventListener(HootstrapEvent, () => {
|
4
5
|
let confirmed = false;
|
5
6
|
|
6
7
|
addDynamicEventListener(document.body, 'click', '[data-prompt]', handleClick);
|
@@ -21,7 +22,7 @@ document.addEventListener('turbolinks:load', () => {
|
|
21
22
|
action: 'OK',
|
22
23
|
onClick: () => {
|
23
24
|
confirmed = true;
|
24
|
-
target.click(
|
25
|
+
target.click();
|
25
26
|
}
|
26
27
|
});
|
27
28
|
}
|
@@ -0,0 +1,16 @@
|
|
1
|
+
function closest(el, selector) {
|
2
|
+
const matchesSelector =
|
3
|
+
el.matches ||
|
4
|
+
el.webkitMatchesSelector ||
|
5
|
+
el.mozMatchesSelector ||
|
6
|
+
el.msMatchesSelector;
|
7
|
+
|
8
|
+
while (el) {
|
9
|
+
if (matchesSelector.call(el, selector)) {
|
10
|
+
return el;
|
11
|
+
} else {
|
12
|
+
el = el.parentElement;
|
13
|
+
}
|
14
|
+
}
|
15
|
+
return null;
|
16
|
+
}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
function checkTurbolinks() {
|
2
|
+
if (window.Turbolinks != null && window.Turbolinks.supported) {
|
3
|
+
if (window.Turbolinks.EVENTS != null) {
|
4
|
+
return 'page:change';
|
5
|
+
} else {
|
6
|
+
return 'turbolinks:load';
|
7
|
+
}
|
8
|
+
} else {
|
9
|
+
return 'ready';
|
10
|
+
}
|
11
|
+
}
|
12
|
+
|
13
|
+
window.HootstrapEvent = checkTurbolinks();
|
@@ -5,3 +5,20 @@
|
|
5
5
|
.alert-alert {
|
6
6
|
@extend .alert-danger;
|
7
7
|
}
|
8
|
+
|
9
|
+
// Close styles
|
10
|
+
|
11
|
+
@each $color, $value in $theme-colors {
|
12
|
+
$text-color: theme-color-level($color, 6);
|
13
|
+
|
14
|
+
.alert-#{$color}.alert-dismissible .close {
|
15
|
+
color: $text-color;
|
16
|
+
opacity: 0.75;
|
17
|
+
text-shadow: none;
|
18
|
+
|
19
|
+
@include hover-focus {
|
20
|
+
color: $text-color;
|
21
|
+
opacity: 1;
|
22
|
+
}
|
23
|
+
}
|
24
|
+
}
|
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.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justin Licata
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-12-
|
11
|
+
date: 2017-12-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -77,10 +77,13 @@ files:
|
|
77
77
|
- README.md
|
78
78
|
- Rakefile
|
79
79
|
- assets/javascripts/hootstrap.js
|
80
|
+
- assets/javascripts/hootstrap/alerts.js
|
80
81
|
- assets/javascripts/hootstrap/modal.js
|
81
82
|
- assets/javascripts/hootstrap/rails.js
|
82
83
|
- assets/javascripts/hootstrap/toast.js
|
84
|
+
- assets/javascripts/hootstrap/utils/closest.js
|
83
85
|
- assets/javascripts/hootstrap/utils/dynamicListener.js
|
86
|
+
- assets/javascripts/hootstrap/utils/turbolinks.js
|
84
87
|
- assets/stylesheets/hootstrap.scss
|
85
88
|
- assets/stylesheets/hootstrap/base/_base.scss
|
86
89
|
- assets/stylesheets/hootstrap/base/_variables.scss
|