bootstrap-navbar 3.0.5 → 3.0.6

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: bb5218185e5ba6cc70a64c3911abedebdc32a2297f80ad22ab4049e8738a65ff
4
- data.tar.gz: 102ec9fcf068836389359a03e3092d401287cc003e40e2f3c114d030f284c643
3
+ metadata.gz: 503df312703c1b1e21ba7c001b5cb57eb622f265e25c4387459c792375b2202a
4
+ data.tar.gz: 15d6d53635832ca900705bec6363c8823d1e0c17da181bdba4d0e0a507d02b13
5
5
  SHA512:
6
- metadata.gz: fa3f5f64c868a3e5dff75a2f379181cd5a7b47b2a271fe1fcd30b56c20941b67009978f832376adcad285b21b45eb97692b0bedb5408660636d61abd5f8d5731
7
- data.tar.gz: a62bd84aac9b3776d481643dbcbc162391ec2863a4194d226c88f9bb1849821307045e2f414c8dc7e4ece4c1ed324f0bba43109a3cb039e135f57fb4a1452b67
6
+ metadata.gz: e60999f19b6ed1f441d1886db34118a4c92f98b13856ecddd50061b2dd1445e1e62c3c0f04ffbcf5664df83bc054e0650a8ce21178d0b8b472386dc097f4cb95
7
+ data.tar.gz: b6ae2867cd7d0c87de839fa16676b35917c4500fb9063f8c83532da7e727e2f1a441840b22999978c34c2901d41860d1321c630b5bd0fe1bfc74c3ec50aa418a
@@ -15,7 +15,7 @@ module BootstrapNavbar::Helpers
15
15
  def attributes_for_tag(hash)
16
16
  string = hash.map { |k, v| %(#{k}="#{v}") }.join(' ')
17
17
  if string.length > 0
18
- ' ' << string
18
+ ' '.dup << string
19
19
  else
20
20
  string
21
21
  end
@@ -2,11 +2,26 @@ module BootstrapNavbar::Helpers::Bootstrap4
2
2
  def navbar(options = {}, &block)
3
3
  options = options.dup
4
4
  container = options.key?(:container) ? options.delete(:container) : false
5
+ brand = if options[:brand]
6
+ prepare_html <<~HTML
7
+ <a href="#{options.delete(:brand_url) || '/'}" class="navbar-brand">
8
+ #{options.delete(:brand)}
9
+ </a>
10
+ HTML
11
+ end
5
12
  wrapper options do
6
13
  if container
7
- container(&block)
14
+ container container do
15
+ prepare_html <<~HTML
16
+ #{brand}
17
+ #{capture(&block) if block_given?}
18
+ HTML
19
+ end
8
20
  else
9
- capture(&block) if block_given?
21
+ prepare_html <<~HTML
22
+ #{brand}
23
+ #{capture(&block) if block_given?}
24
+ HTML
10
25
  end
11
26
  end
12
27
  end
@@ -26,25 +41,25 @@ module BootstrapNavbar::Helpers::Bootstrap4
26
41
  'aria-expanded' => false,
27
42
  'aria-label' => 'Toggle navigation'
28
43
  )
29
- prepare_html <<-HTML.chomp!
30
- <button#{toggler_attributes}>
31
- <span class="navbar-toggler-icon"></span>
32
- </button>
33
- <div#{attributes}>
34
- #{capture(&block) if block_given?}
35
- </div>
36
- HTML
44
+ prepare_html <<~HTML
45
+ <button#{toggler_attributes}>
46
+ <span class="navbar-toggler-icon"></span>
47
+ </button>
48
+ <div#{attributes}>
49
+ #{capture(&block) if block_given?}
50
+ </div>
51
+ HTML
37
52
  end
38
53
 
39
54
  def navbar_group(options = {}, &block)
40
55
  options = options.dup
41
56
  options[:class] = [options[:class], 'navbar-nav'].compact.join(' ')
42
57
  attributes = attributes_for_tag(options)
43
- prepare_html <<-HTML.chomp!
44
- <ul#{attributes}>
45
- #{capture(&block) if block_given?}
46
- </ul>
47
- HTML
58
+ prepare_html <<~HTML
59
+ <ul#{attributes}>
60
+ #{capture(&block) if block_given?}
61
+ </ul>
62
+ HTML
48
63
  end
49
64
 
50
65
  def navbar_item(text, url = nil, list_item_options = nil, link_options = nil, &block)
@@ -58,13 +73,13 @@ HTML
58
73
  link_options[:class] = link_options[:class].join(' ')
59
74
  list_item_attributes = attributes_for_tag(list_item_options)
60
75
  link_attributes = attributes_for_tag(link_options)
61
- prepare_html <<-HTML.chomp!
62
- <li#{list_item_attributes}>
63
- <a href="#{url}"#{link_attributes}>
64
- #{text}
65
- </a>
66
- </li>
67
- HTML
76
+ prepare_html <<~HTML
77
+ <li#{list_item_attributes}>
78
+ <a href="#{url}"#{link_attributes}>
79
+ #{text}
80
+ </a>
81
+ </li>
82
+ HTML
68
83
  end
69
84
 
70
85
  def navbar_dropdown(text, id = '', list_item_options = {}, link_options = {}, &block)
@@ -75,14 +90,14 @@ HTML
75
90
  link_options[:class] = [link_options[:class], 'nav-link', 'dropdown-toggle'].compact.join(' ')
76
91
  id ||= "navbarDropdownMenuLink#{text}"
77
92
  link_attributes = attributes_for_tag(link_options)
78
- prepare_html <<-HTML.chomp!
79
- <li#{list_item_attributes}>
80
- <a href="#" data-toggle="dropdown" id="##{id}" aria-haspopup="true" aria-expanded="false" role="button" #{link_attributes}>#{text}</a>
81
- <div class="#{wrapper_class}" aria-labelledby="#{id}">
82
- #{capture(&block) if block_given?}
83
- </div>
84
- </li>
85
- HTML
93
+ prepare_html <<~HTML
94
+ <li#{list_item_attributes}>
95
+ <a href="#" data-toggle="dropdown" id="##{id}" aria-haspopup="true" aria-expanded="false" role="button" #{link_attributes}>#{text}</a>
96
+ <div class="#{wrapper_class}" aria-labelledby="#{id}">
97
+ #{capture(&block) if block_given?}
98
+ </div>
99
+ </li>
100
+ HTML
86
101
  end
87
102
 
88
103
  def navbar_dropdown_item(text, url = '#', link_options = {}, &block)
@@ -91,42 +106,39 @@ HTML
91
106
  link_options[:class] << 'active' if current_url_or_sub_url?(url)
92
107
  link_options[:class] = link_options[:class].join(' ')
93
108
  link_attributes = attributes_for_tag(link_options)
94
- prepare_html <<-HTML.chomp!
95
- <a href="#{url}"#{link_attributes}>
96
- #{text}
97
- </a>
98
- HTML
109
+ prepare_html <<~HTML
110
+ <a href="#{url}"#{link_attributes}>
111
+ #{text}
112
+ </a>
113
+ HTML
99
114
  end
100
115
 
101
116
  def navbar_dropdown_divider
102
- prepare_html <<-HTML.chomp!
103
- <div class="dropdown-divider"></div>
104
- HTML
117
+ '<div class="dropdown-divider"></div>'
105
118
  end
106
119
 
107
120
  private
108
121
 
109
- def container(&block)
110
- prepare_html <<-HTML.chomp!
111
- <div class="container">
112
- #{capture(&block) if block_given?}
113
- </div>
114
- HTML
115
- end
116
-
117
- def brand_link(text, url = nil)
118
- prepare_html <<-HTML.chomp!
119
- <a href="#{url || '/'}" class="navbar-brand">
120
- #{text}
121
- </a>
122
- HTML
122
+ def container(container, &block)
123
+ container_class = [
124
+ 'container',
125
+ (container unless container == true)
126
+ ].compact.join('-')
127
+ attributes = attributes_for_tag(class: container_class)
128
+ prepare_html <<~HTML
129
+ <div#{attributes}>
130
+ #{capture(&block) if block_given?}
131
+ </div>
132
+ HTML
123
133
  end
124
134
 
125
135
  def wrapper(options, &block)
126
136
  options = options.dup
127
137
  options[:class] = [options[:class], 'navbar'].compact
128
138
  options[:class] << "navbar-#{options.key?(:color_scheme) ? options.delete(:color_scheme) : 'dark'}"
129
- options[:class] << "bg-#{options.delete(:bg) || 'dark'}" unless options[:bg] == false
139
+ if bg = options.delete(:bg)
140
+ options[:class] << "bg-#{bg == true ? 'dark' : bg}"
141
+ end
130
142
  if options.key?(:sticky) && options.delete(:sticky) === true
131
143
  options[:class] << 'sticky-top'
132
144
  elsif options.key?(:placement)
@@ -134,13 +146,12 @@ HTML
134
146
  end
135
147
  options[:class] << "navbar-expand-#{options.delete(:expand_at) || 'sm'}"
136
148
  options[:class] = options[:class].join(' ')
137
- brand = brand_link(options.delete(:brand), options.delete(:brand_url)) if options[:brand]
138
149
  attributes = attributes_for_tag(options)
139
- prepare_html <<-HTML.chomp!
140
- <nav#{attributes}>
141
- #{brand}
142
- #{capture(&block) if block_given?}
143
- </nav>
144
- HTML
150
+ prepare_html <<~HTML
151
+ <nav#{attributes}>
152
+ #{brand}
153
+ #{capture(&block) if block_given?}
154
+ </nav>
155
+ HTML
145
156
  end
146
157
  end
@@ -1,3 +1,3 @@
1
1
  module BootstrapNavbar
2
- VERSION = '3.0.5'
2
+ VERSION = '3.0.6'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bootstrap-navbar
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.5
4
+ version: 3.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Manuel Meurer
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-06-11 00:00:00.000000000 Z
11
+ date: 2020-10-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -153,7 +153,7 @@ homepage: http://bootstrap-ruby.github.io/bootstrap-navbar
153
153
  licenses:
154
154
  - MIT
155
155
  metadata: {}
156
- post_install_message:
156
+ post_install_message:
157
157
  rdoc_options: []
158
158
  require_paths:
159
159
  - lib
@@ -168,8 +168,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
168
168
  - !ruby/object:Gem::Version
169
169
  version: '0'
170
170
  requirements: []
171
- rubygems_version: 3.0.2
172
- signing_key:
171
+ rubygems_version: 3.1.3
172
+ signing_key:
173
173
  specification_version: 4
174
174
  summary: Helpers to generate a Bootstrap style navbar
175
175
  test_files: