hootstrap 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7c0d6ec51952c42c60d7c3c63c7d79480639a0aa
4
- data.tar.gz: 8d808bfa5b571271e531df2415d10004a685f19d
3
+ metadata.gz: feb61b77a46ef0a3ac9f1a5457a42b1a8efae7c4
4
+ data.tar.gz: 5d29fd1c471af8d6efa307847cbe74f6fafbe318
5
5
  SHA512:
6
- metadata.gz: 6a09c2d1671096aab7ac9459d59cea13aef2d2b903b3b3873177136586adf9e979c8f0f4d9afc7609e97dcb82082862828106fb02a238581f3624ef63643170d
7
- data.tar.gz: 6b920b037823dfd9ebb3d80358fc5a87e6d20fbc95e52f333af1ca7bd55f821b47150c79a27508b3986d722ea091e989966fba6a35a625fdd4b17abea3bea569
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', git: 'git@github.com:ProctorU/hootstrap.git'
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
- Import `hootstrap` to your CSS files.
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('turbolinks:load', () => {
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({ something: 'hello' });
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();
@@ -1,3 +1,4 @@
1
+ //= require hootstrap/alerts
1
2
  //= require hootstrap/modal
2
3
  //= require hootstrap/rails
3
4
  //= require hootstrap/toast
@@ -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
+ }
@@ -1,3 +1,3 @@
1
1
  module Hootstrap
2
- VERSION = '0.1.2'
2
+ VERSION = '0.1.3'
3
3
  end
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.2
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-02 00:00:00.000000000 Z
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