railsstrap 4.0.0.beta2 → 4.0.0.beta3

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
  SHA256:
3
- metadata.gz: 2b4484053d467f665b57114a7096c965a6f203637aba4cb244cb857dae9d2789
4
- data.tar.gz: e3dbcf1ef81b7ad4dfc869feb5e3d90ba039bb9bf44162c49ccc2fe76c7e67fa
3
+ metadata.gz: 34a9242b16ded13eaa0e10e80737a5f289d7925cb8ad73ff5194dfdc3a602de4
4
+ data.tar.gz: ac0a0118896263220eb0edc24782e88c4aec99f6515da79c36e751dd3ca85de5
5
5
  SHA512:
6
- metadata.gz: 2d5c6d25924aabea4ac83531ceb29f6c306f5a72f978b053491cb1ffd0d3bc62dd41f02fc36aea4fd373bdc8d52f2fd9931c0e125dd0e0c0dcc1d843f3da626f
7
- data.tar.gz: 579343c8f0a3c68926beb709c40100e5493639a219a19408e96cde622a072c8414400a39405c50ca14825d81248e2a15f20a5b3f1e2ce15b9f60f50860eb9136
6
+ metadata.gz: 660f0cabbe043a7946995402d8a91d312db26c743212c51f6fefcd902028c3503ff39796d93d366f43c6e107d83abd8096d28a8528c417e6fb70617afdb4e98d
7
+ data.tar.gz: db56ed92b03270128f46190eb9c9cb1860be15010950e2f91b00abe3a0611e095ee0ad7f9535c7b579903a1e2f7eda5af59492238be5617f7149fb25d610972c
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'railsstrap/classes/base'
2
4
 
3
5
  module Railsstrap
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'railsstrap/classes/button'
2
4
 
3
5
  module Railsstrap
@@ -14,6 +16,11 @@ module Railsstrap
14
16
  super
15
17
  end
16
18
 
19
+ # @return [#to_s] appends .left or .right css class to the aside
20
+ def pin_to_class
21
+ Aside.pin_to[@options[:pin_to]]
22
+ end
23
+
17
24
  # @return [#to_s] the variant-related class to assign to the aside button.
18
25
  def button_variant_class
19
26
  Button.variants[@options.fetch(:button, {})[:variant]]
@@ -55,6 +62,13 @@ module Railsstrap
55
62
  end
56
63
  end
57
64
 
65
+ def self.pin_to
66
+ HashWithIndifferentAccess.new(:'left').tap do |klass|
67
+ klass[:left] = 'left'
68
+ klass[:right] = 'right'
69
+ end
70
+ end
71
+
58
72
  def extract_content_from(*args, &block)
59
73
  if block_given?
60
74
  super
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'railsstrap/classes/base'
2
4
 
3
5
  module Railsstrap
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'railsstrap/classes/base'
2
3
 
3
4
  module Railsstrap
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'railsstrap/classes/base'
2
3
 
3
4
  module Railsstrap
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'railsstrap/classes/base'
2
3
 
3
4
  module Railsstrap
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'railsstrap/classes/base'
2
3
 
3
4
  module Railsstrap
@@ -61,11 +61,8 @@ module Railsstrap
61
61
 
62
62
  # fetches popper js
63
63
  def self.popper_js(options = {})
64
- opts = {
65
- version: '1.13.0',
66
- path: 'ajax/libs/popper.js'
67
- }.merge(options)
68
- cdn_asset opts
64
+ options.merge!({version: '1.13.0'})
65
+ "https://cdnjs.cloudflare.com/ajax/libs/popper.js/#{options[:version]}/umd/popper.min.js"
69
66
  end
70
67
 
71
68
  # @return the url of the library from cdnjs.com
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'railsstrap/classes/base'
2
3
 
3
4
  module Railsstrap
@@ -18,6 +18,11 @@ module Railsstrap
18
18
  Nav.layouts[@options[:layout]]
19
19
  end
20
20
 
21
+ # @return [#to_s] choose between using <nav>, <ol>, or <ul> tags
22
+ def tag
23
+ @options[:tag] || :nav
24
+ end
25
+
21
26
  # @return [Hash<Symbol, String>] the classes that Bootstrap requires to
22
27
  # append to navs for each possible style.
23
28
 
@@ -36,6 +36,7 @@ module Railsstrap
36
36
  variant_types.each do |v|
37
37
  klass[v] = :"bg-#{v}"
38
38
  end
39
+ klass[:none] = ""
39
40
  end
40
41
  end
41
42
 
@@ -2,7 +2,7 @@ require 'railsstrap/classes/aside'
2
2
 
3
3
  module Railsstrap
4
4
  module Helpers
5
- # Displays a Bootstrap-styled aside. Asides inherit from Aside, but
5
+ # Displays a Bootstrap-styled aside. Asides inherit from Modal, but
6
6
  # are pinned to the left or right of the screen.
7
7
  # @see https://github.com/toadkicker/railsstrap/wiki/Aside-Helper
8
8
  # @return [String] the HTML to display a Bootstrap-styled aside.
@@ -39,7 +39,7 @@ module Railsstrap
39
39
 
40
40
  def aside(*args, &block)
41
41
  aside = Railsstrap::Aside.new self, *args, &block
42
- aside.extract! :button, :size, :body, :title, :id
42
+ aside.extract! :button, :size, :pin_to, :body, :title, :id
43
43
 
44
44
  aside.extract_from :button, [:variant, :size, :layout, :caption]
45
45
  aside.append_class_to! :button, :btn
@@ -47,6 +47,7 @@ module Railsstrap
47
47
  aside.append_class_to! :button, aside.button_size_class
48
48
  aside.merge! button: {caption: aside.caption}
49
49
 
50
+ aside.append_class_to! :script, aside.pin_to_class
50
51
  aside.append_class_to! :div, :'aside-dialog'
51
52
  aside.append_class_to! :div, aside.dialog_size_class
52
53
  aside.merge! div: {title: aside.title, id: aside.id}
@@ -28,7 +28,7 @@ module Railsstrap
28
28
  # @param [Hash] options the options for the card (see above).
29
29
  # @yieldreturn [#to_s] the content to display in the card.
30
30
  # @example Display a card with HTML content.
31
- # card title: 'Thanks' do
31
+ # card title: 'Thanks', button: {caption: icon('circle-plus', library: :fas), variant: :success} do
32
32
  # content_tag :div, class: 'card-body' do
33
33
  # content_tag :em, 'ou accepted the Terms of service.'
34
34
  # end
@@ -17,7 +17,7 @@ module Railsstrap
17
17
  # (alias `:lg`) or `:small` (alias `:sm`).
18
18
  # @option options [Hash] :button the options for the toggle button.
19
19
  # * :caption (#to_s) ('Modal') the caption of the toggle button.
20
- # * :context (#to_s) (:default) the contextual alternative to apply to
20
+ # * :variant (#to_s) (:default) the variant alternative to apply to
21
21
  # the toggle button. Can be `:danger`, `:info`, `:link`, `:primary`,
22
22
  # `:success` or `:warning`.
23
23
  # * :size (#to_s) the size of the toggle button. Can be `:extra_small`
@@ -25,7 +25,7 @@ module Railsstrap
25
25
  # * :layout (#to_s) if set to `:block`, span the button for the full
26
26
  # width of the parent.
27
27
  # @example Display a simple modal toggled by a blue button.
28
- # modal 'You clicked me!', title: 'Click me', button: {context: :info}
28
+ # modal 'You clicked me!', title: 'Click me', button: {variant: :info}
29
29
  # @overload modal(options = {}, &block)
30
30
  # @param [Hash] options the options for the modal (see above).
31
31
  # @yieldreturn [#to_s] the content to display in the modal.
@@ -37,7 +37,7 @@ module Railsstrap
37
37
  # end
38
38
  def modal(*args, &block)
39
39
  modal = Railsstrap::Modal.new self, *args, &block
40
- modal.extract! :button, :size, :body, :title, :id, :dismissable, :dismiss
40
+ modal.extract! :button, :size, :body, :title, :id, :dismissible, :dismiss
41
41
 
42
42
  modal.extract_from :button, [:variant, :size, :layout, :caption]
43
43
  modal.append_class_to! :button, :btn
@@ -19,16 +19,14 @@ module Railsstrap
19
19
  # end
20
20
  def nav(options = {}, &block)
21
21
  nav = Railsstrap::Nav.new(self, options, &block)
22
- nav.extract! :as, :layout
22
+ nav.extract! :as, :layout, :tag
23
23
 
24
24
  nav.append_class! :nav
25
25
  nav.append_class! nav.style_class
26
26
  nav.append_class! nav.layout_class
27
27
  nav.merge! role: :navigation
28
28
 
29
-
30
-
31
- nav.render_tag :nav
29
+ nav.render_tag nav.tag
32
30
  end
33
31
  end
34
32
  end
@@ -1,3 +1,3 @@
1
1
  module Railsstrap
2
- VERSION = '4.0.0.beta2'
2
+ VERSION = '4.0.0.beta3'
3
3
  end
@@ -1,14 +1,25 @@
1
1
  <button class="<%= button[:class] %>" data-toggle="modal" data-target="#<%= div[:id] %>"><%= button[:caption] %></button>
2
- <aside class="aside fade" id="<%= div[:id] %>" tabindex="-1" role="dialog" aria-labelledby="label-<%= div[:id] %>" aria-hidden="true">
2
+ <aside class="aside" id="<%= div[:id] %>" tabindex="-1" role="dialog" aria-labelledby="label-<%= div[:id] %>" aria-hidden="true">
3
3
  <div class="<%= div[:class] %>">
4
4
  <div class="aside-content">
5
5
  <div class="aside-header">
6
- <button type="button" class="close" data-dismiss="modal">
6
+ <h4 class="aside-title" id="label-<%= div[:id] %>"><%= div[:title] %></h4>
7
+ <button type="button" class="close" data-dismiss="modal" data-target="#<%= div[:id] %>">
7
8
  <span aria-hidden="true">&times;</span><span class="sr-only">Close</span>
8
9
  </button>
9
- <h4 class="aside-title" id="label-<%= div[:id] %>"><%= div[:title] %></h4>
10
10
  </div>
11
11
  <%= content %>
12
12
  </div>
13
13
  </div>
14
- </aside>
14
+ </aside>
15
+ <script>
16
+ document.addEventListener("DOMContentLoaded", function () {
17
+ $("[data-target='#<%=div[:id]%>']").on('click', function (e) {
18
+ $("#<%=div[:id]%>").modal('hide');
19
+ });
20
+
21
+ $("#<%= div[:id] %>").on('show.bs.modal', function (e) {
22
+ $(e.currentTarget).addClass("<%= script[:class] %>")
23
+ });
24
+ })
25
+ </script>
@@ -14,22 +14,7 @@ end
14
14
 
15
15
  shared_examples_for 'no aside options' do
16
16
  specify 'sets the role and the class to "aside", uses a generated ID and uses "Aside" as the title and caption' do
17
- html = <<-EOT.strip_heredoc.strip
18
- <button class="btn btn-primary" data-toggle="modal" data-target="#(.+)">Aside<\/button>
19
- <aside class="aside fade" id="\\1" tabindex="-1" role="dialog" aria-labelledby="label-\\1" aria-hidden="true">
20
- <div class="aside-dialog">
21
- <div class="aside-content">
22
- <div class="aside-header">
23
- <button type="button" class="close" data-dismiss="modal">
24
- <span aria-hidden="true">&times;<\/span><span class="sr-only">Close<\/span>
25
- <\/button>
26
- <h4 class="aside-title" id="label-\\1">Aside<\/h4>
27
- <\/div>
28
- (<div class=\"aside-body\">)*content(</div>)*
29
- <\/div>
30
- <\/div>
31
- <\/aside>
32
- EOT
17
+ html = %r{(button.*data-toggle="modal".*data-target)*(aside)}
33
18
  expect(:aside).to generate %r{#{html}}
34
19
  end
35
20
  end
@@ -88,8 +88,8 @@ shared_examples_for 'the button: :class modal option' do
88
88
  end
89
89
  end
90
90
 
91
- shared_examples_for 'the :dismissable modal option' do
92
- specify 'renders the dismissable button on the modal button' do
91
+ shared_examples_for 'the :dismissible modal option' do
92
+ specify 'renders the dismissible button on the modal button' do
93
93
  html = %r{.*(class="close").*(dismiss="modal")}
94
94
  expect(modal: {dismissible: true, dismiss: :modal}).to generate html
95
95
  end
@@ -82,7 +82,7 @@ $zindex-aside: 1050 !default;
82
82
  right: 0;
83
83
  left: auto;
84
84
  visibility: visible;
85
- @include animated;
85
+ @include animated();
86
86
  @extend .slideInRight;
87
87
  }
88
88
  }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: railsstrap
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0.beta2
4
+ version: 4.0.0.beta3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Todd Baur
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-01-30 00:00:00.000000000 Z
11
+ date: 2018-02-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionpack
@@ -170,28 +170,28 @@ dependencies:
170
170
  requirements:
171
171
  - - "~>"
172
172
  - !ruby/object:Gem::Version
173
- version: 0.14.1
173
+ version: 0.15.1
174
174
  type: :development
175
175
  prerelease: false
176
176
  version_requirements: !ruby/object:Gem::Requirement
177
177
  requirements:
178
178
  - - "~>"
179
179
  - !ruby/object:Gem::Version
180
- version: 0.14.1
180
+ version: 0.15.1
181
181
  - !ruby/object:Gem::Dependency
182
- name: coveralls
182
+ name: coveralls_reborn
183
183
  requirement: !ruby/object:Gem::Requirement
184
184
  requirements:
185
- - - ">="
185
+ - - "~>"
186
186
  - !ruby/object:Gem::Version
187
- version: '0'
187
+ version: 0.10.0
188
188
  type: :development
189
189
  prerelease: false
190
190
  version_requirements: !ruby/object:Gem::Requirement
191
191
  requirements:
192
- - - ">="
192
+ - - "~>"
193
193
  - !ruby/object:Gem::Version
194
- version: '0'
194
+ version: 0.10.0
195
195
  - !ruby/object:Gem::Dependency
196
196
  name: mocha
197
197
  requirement: !ruby/object:Gem::Requirement