bootstrap-navbar 2.2.4 → 2.3.0
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 +4 -4
 - data/.gitignore +1 -0
 - data/.travis.yml +6 -4
 - data/CHANGELOG.md +9 -1
 - data/README.md +8 -6
 - data/bootstrap-navbar.gemspec +3 -5
 - data/lib/bootstrap-navbar.rb +1 -0
 - data/lib/bootstrap-navbar/helpers/bootstrap2.rb +6 -6
 - data/lib/bootstrap-navbar/helpers/bootstrap3.rb +12 -12
 - data/lib/bootstrap-navbar/helpers/bootstrap4.rb +137 -0
 - data/lib/bootstrap-navbar/version.rb +1 -1
 - data/spec/bootstrap-navbar/helpers/bootstrap4_spec.rb +161 -0
 - metadata +10 -6
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 982a971198be58abfb4bca9437f239d32649042a
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: ce65e2dfd1f6a41baae61ae60ced9e19a3b0d649
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 440b131c834bccd2fa760c715e0a956a933ffad6f1d1e37ddf8f03e710bb4a2f53426285c378a579d1c63d39c54c9fbb46cf29812eb7c89f00596dc7f5d5554f
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: c801f1ba40965ef2479e8bf1d44bb9b4ded164891cb1a79f77e0eaa6db7e0c187083353aa95e271cb451f343f51f94452dd2fbb5b5ed76bba35ae34fb011a018
         
     | 
    
        data/.gitignore
    ADDED
    
    | 
         @@ -0,0 +1 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            Gemfile.lock
         
     | 
    
        data/.travis.yml
    CHANGED
    
    
    
        data/CHANGELOG.md
    CHANGED
    
    | 
         @@ -1,7 +1,15 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            ## 2. 
     | 
| 
      
 1 
     | 
    
         
            +
            ## 2.3.0
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            * Add support for Bootstrap 4
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            ## 2.2.4
         
     | 
| 
       2 
6 
     | 
    
         | 
| 
       3 
7 
     | 
    
         
             
            * Never mark menu item with path "#" as active
         
     | 
| 
       4 
8 
     | 
    
         | 
| 
      
 9 
     | 
    
         
            +
            ## 2.2.3
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
            * Allow navbar dropdown to receive list item and link parameters
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
       5 
13 
     | 
    
         
             
            ## 2.2.2
         
     | 
| 
       6 
14 
     | 
    
         | 
| 
       7 
15 
     | 
    
         
             
            * Fix marking menu items as active... again
         
     | 
    
        data/README.md
    CHANGED
    
    | 
         @@ -5,13 +5,13 @@ 
     | 
|
| 
       5 
5 
     | 
    
         
             
            [](https://gemnasium.com/bootstrap-ruby/bootstrap-navbar)
         
     | 
| 
       6 
6 
     | 
    
         
             
            [](https://codeclimate.com/github/bootstrap-ruby/bootstrap-navbar)
         
     | 
| 
       7 
7 
     | 
    
         | 
| 
       8 
     | 
    
         
            -
            Helpers to generate a  
     | 
| 
      
 8 
     | 
    
         
            +
            Helpers to generate a Bootstrap style navbar
         
     | 
| 
       9 
9 
     | 
    
         | 
| 
       10 
10 
     | 
    
         
             
            ## Installation
         
     | 
| 
       11 
11 
     | 
    
         | 
| 
       12 
12 
     | 
    
         
             
            This gem only provides a helper module with methods to generate HTML. It can be used by other gems to make these helpers available to a framework's rendering engine, e.g.:
         
     | 
| 
       13 
13 
     | 
    
         | 
| 
       14 
     | 
    
         
            -
            * For Rails: https://github.com/ 
     | 
| 
      
 14 
     | 
    
         
            +
            * For Rails: https://github.com/bootstrap-ruby/rails-bootstrap-navbar
         
     | 
| 
       15 
15 
     | 
    
         
             
            * For [Middleman](http://middlemanapp.com/): https://github.com/bootstrap-ruby/middleman-bootstrap-navbar
         
     | 
| 
       16 
16 
     | 
    
         | 
| 
       17 
17 
     | 
    
         
             
            In short: __Unless you know what you're doing, do not use this gem directly in your app!__
         
     | 
| 
         @@ -28,7 +28,7 @@ BootstrapNavbar needs to know what version of Bootstrap it's dealing with since 
     | 
|
| 
       28 
28 
     | 
    
         | 
| 
       29 
29 
     | 
    
         
             
            ```ruby
         
     | 
| 
       30 
30 
     | 
    
         
             
            BootstrapNavbar.configure do |config|
         
     | 
| 
       31 
     | 
    
         
            -
              config.bootstrap_version = ' 
     | 
| 
      
 31 
     | 
    
         
            +
              config.bootstrap_version = '4.0.0'
         
     | 
| 
       32 
32 
     | 
    
         
             
            end
         
     | 
| 
       33 
33 
     | 
    
         
             
            ```
         
     | 
| 
       34 
34 
     | 
    
         | 
| 
         @@ -67,11 +67,13 @@ ActionView::Base.send :include, BootstrapNavbar::Helpers 
     | 
|
| 
       67 
67 
     | 
    
         | 
| 
       68 
68 
     | 
    
         
             
            ## Usage
         
     | 
| 
       69 
69 
     | 
    
         | 
| 
       70 
     | 
    
         
            -
            Since the navbar format  
     | 
| 
      
 70 
     | 
    
         
            +
            Since the navbar format differs quite a bit between Bootstrap 2, 3 and 4, generating them using this gem works quite differently as well. Check out the Wiki pages for detailed instructions:
         
     | 
| 
       71 
71 
     | 
    
         | 
| 
       72 
     | 
    
         
            -
            [Usage with Bootstrap 2 
     | 
| 
      
 72 
     | 
    
         
            +
            [Usage with Bootstrap 2](https://github.com/bootstrap-ruby/bootstrap-navbar/wiki/Usage-with-Bootstrap-2)
         
     | 
| 
       73 
73 
     | 
    
         | 
| 
       74 
     | 
    
         
            -
            [Usage with Bootstrap 3 
     | 
| 
      
 74 
     | 
    
         
            +
            [Usage with Bootstrap 3](https://github.com/bootstrap-ruby/bootstrap-navbar/wiki/Usage-with-Bootstrap-3)
         
     | 
| 
      
 75 
     | 
    
         
            +
             
     | 
| 
      
 76 
     | 
    
         
            +
            [Usage with Bootstrap 4](https://github.com/bootstrap-ruby/bootstrap-navbar/wiki/Usage-with-Bootstrap-4)
         
     | 
| 
       75 
77 
     | 
    
         | 
| 
       76 
78 
     | 
    
         
             
            ## Changes
         
     | 
| 
       77 
79 
     | 
    
         | 
    
        data/bootstrap-navbar.gemspec
    CHANGED
    
    | 
         @@ -11,9 +11,9 @@ Gem::Specification.new do |gem| 
     | 
|
| 
       11 
11 
     | 
    
         
             
              gem.platform      = Gem::Platform::RUBY
         
     | 
| 
       12 
12 
     | 
    
         
             
              gem.author        = 'Manuel Meurer'
         
     | 
| 
       13 
13 
     | 
    
         
             
              gem.email         = 'manuel@krautcomputing.com'
         
     | 
| 
       14 
     | 
    
         
            -
              gem.summary       = 'Helpers to generate a  
     | 
| 
       15 
     | 
    
         
            -
              gem.description   = 'Helpers to generate a  
     | 
| 
       16 
     | 
    
         
            -
              gem.homepage      = 'http:// 
     | 
| 
      
 14 
     | 
    
         
            +
              gem.summary       = 'Helpers to generate a Bootstrap style navbar'
         
     | 
| 
      
 15 
     | 
    
         
            +
              gem.description   = 'Helpers to generate a Bootstrap style navbar'
         
     | 
| 
      
 16 
     | 
    
         
            +
              gem.homepage      = 'http://bootstrap-ruby.github.io/bootstrap-navbar'
         
     | 
| 
       17 
17 
     | 
    
         
             
              gem.license       = 'MIT'
         
     | 
| 
       18 
18 
     | 
    
         | 
| 
       19 
19 
     | 
    
         
             
              gem.files         = `git ls-files`.split($/)
         
     | 
| 
         @@ -26,8 +26,6 @@ Gem::Specification.new do |gem| 
     | 
|
| 
       26 
26 
     | 
    
         
             
              gem.add_development_dependency 'rspec-html-matchers', '~> 0.6'
         
     | 
| 
       27 
27 
     | 
    
         
             
              gem.add_development_dependency 'guard-rspec', '~> 4.2'
         
     | 
| 
       28 
28 
     | 
    
         
             
              gem.add_development_dependency 'padrino-helpers', '~> 0.12'
         
     | 
| 
       29 
     | 
    
         
            -
              # Listen >= 2.0.0 only works with Ruby >= 1.9.3
         
     | 
| 
       30 
     | 
    
         
            -
              gem.add_development_dependency 'listen', '< 2.0.0' if RUBY_VERSION < '1.9.3'
         
     | 
| 
       31 
29 
     | 
    
         
             
              gem.add_development_dependency 'bootstrap-sass', '3.0.2.0'
         
     | 
| 
       32 
30 
     | 
    
         
             
              gem.add_runtime_dependency 'gem_config', '~> 0.3'
         
     | 
| 
       33 
31 
     | 
    
         
             
            end
         
     | 
    
        data/lib/bootstrap-navbar.rb
    CHANGED
    
    
| 
         @@ -10,8 +10,8 @@ module BootstrapNavbar::Helpers::Bootstrap2 
     | 
|
| 
       10 
10 
     | 
    
         
             
              def navbar_group(options = {}, &block)
         
     | 
| 
       11 
11 
     | 
    
         
             
                options = options.dup
         
     | 
| 
       12 
12 
     | 
    
         
             
                css_classes = %w(nav).tap do |css_classes|
         
     | 
| 
       13 
     | 
    
         
            -
                  css_classes << "pull-#{options.delete(:pull)}" if options. 
     | 
| 
       14 
     | 
    
         
            -
                  css_classes << options.delete(:class) if options. 
     | 
| 
      
 13 
     | 
    
         
            +
                  css_classes << "pull-#{options.delete(:pull)}" if options.key?(:pull)
         
     | 
| 
      
 14 
     | 
    
         
            +
                  css_classes << options.delete(:class) if options.key?(:class)
         
     | 
| 
       15 
15 
     | 
    
         
             
                end
         
     | 
| 
       16 
16 
     | 
    
         
             
                attributes = attributes_for_tag({ class: css_classes.join(' ') }.merge(options))
         
     | 
| 
       17 
17 
     | 
    
         
             
                prepare_html <<-HTML.chomp!
         
     | 
| 
         @@ -28,7 +28,7 @@ HTML 
     | 
|
| 
       28 
28 
     | 
    
         
             
                link_options        = link_options.nil?      ? {} : link_options.dup
         
     | 
| 
       29 
29 
     | 
    
         
             
                list_item_css_classes = [].tap do |css_classes|
         
     | 
| 
       30 
30 
     | 
    
         
             
                  css_classes << 'active' if current_url_or_sub_url?(path)
         
     | 
| 
       31 
     | 
    
         
            -
                  css_classes << list_item_options.delete(:class) if list_item_options. 
     | 
| 
      
 31 
     | 
    
         
            +
                  css_classes << list_item_options.delete(:class) if list_item_options.key?(:class)
         
     | 
| 
       32 
32 
     | 
    
         
             
                end
         
     | 
| 
       33 
33 
     | 
    
         
             
                list_item_attributes = attributes_for_tag(
         
     | 
| 
       34 
34 
     | 
    
         
             
                  { class: list_item_css_classes.join(' ') }
         
     | 
| 
         @@ -59,7 +59,7 @@ HTML 
     | 
|
| 
       59 
59 
     | 
    
         
             
              def navbar_sub_dropdown(name, list_item_options = {}, link_options = {}, &block)
         
     | 
| 
       60 
60 
     | 
    
         
             
                list_item_options, link_options = list_item_options.dup, link_options.dup
         
     | 
| 
       61 
61 
     | 
    
         
             
                list_item_css_classes = %w(dropdown-submenu).tap do |css_classes|
         
     | 
| 
       62 
     | 
    
         
            -
                  css_classes << list_item_options.delete(:class) if list_item_options. 
     | 
| 
      
 62 
     | 
    
         
            +
                  css_classes << list_item_options.delete(:class) if list_item_options.key?(:class)
         
     | 
| 
       63 
63 
     | 
    
         
             
                end
         
     | 
| 
       64 
64 
     | 
    
         
             
                list_item_attributes = attributes_for_tag({ class: list_item_css_classes.join(' ') }.merge(list_item_options))
         
     | 
| 
       65 
65 
     | 
    
         
             
                link_attributes = attributes_for_tag(link_options)
         
     | 
| 
         @@ -105,9 +105,9 @@ HTML 
     | 
|
| 
       105 
105 
     | 
    
         
             
              def wrapper(options, html_options, &block)
         
     | 
| 
       106 
106 
     | 
    
         
             
                options, html_options = options.dup, html_options.dup
         
     | 
| 
       107 
107 
     | 
    
         
             
                position = case
         
     | 
| 
       108 
     | 
    
         
            -
                when options. 
     | 
| 
      
 108 
     | 
    
         
            +
                when options.key?(:static)
         
     | 
| 
       109 
109 
     | 
    
         
             
                  "static-#{options[:static]}"
         
     | 
| 
       110 
     | 
    
         
            -
                when options. 
     | 
| 
      
 110 
     | 
    
         
            +
                when options.key?(:fixed)
         
     | 
| 
       111 
111 
     | 
    
         
             
                  "fixed-#{options[:fixed]}"
         
     | 
| 
       112 
112 
     | 
    
         
             
                end
         
     | 
| 
       113 
113 
     | 
    
         
             
                css_classes = %w(navbar).tap do |css_classes|
         
     | 
| 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            module BootstrapNavbar::Helpers::Bootstrap3
         
     | 
| 
       2 
2 
     | 
    
         
             
              def navbar(options = {}, &block)
         
     | 
| 
       3 
3 
     | 
    
         
             
                options = options.dup
         
     | 
| 
       4 
     | 
    
         
            -
                container = options. 
     | 
| 
      
 4 
     | 
    
         
            +
                container = options.key?(:container) ? options.delete(:container) : true
         
     | 
| 
       5 
5 
     | 
    
         
             
                wrapper options do
         
     | 
| 
       6 
6 
     | 
    
         
             
                  if container
         
     | 
| 
       7 
7 
     | 
    
         
             
                    container(container, &block)
         
     | 
| 
         @@ -15,7 +15,7 @@ module BootstrapNavbar::Helpers::Bootstrap3 
     | 
|
| 
       15 
15 
     | 
    
         
             
                options = options.dup
         
     | 
| 
       16 
16 
     | 
    
         
             
                brand, brand_link = options.delete(:brand), options.delete(:brand_link)
         
     | 
| 
       17 
17 
     | 
    
         
             
                css_classes = %w(navbar-header).tap do |css_classes|
         
     | 
| 
       18 
     | 
    
         
            -
                  css_classes << options.delete(:class) if options. 
     | 
| 
      
 18 
     | 
    
         
            +
                  css_classes << options.delete(:class) if options.key?(:class)
         
     | 
| 
       19 
19 
     | 
    
         
             
                end
         
     | 
| 
       20 
20 
     | 
    
         
             
                attributes = attributes_for_tag(options.reverse_merge(class: css_classes.join(' ')))
         
     | 
| 
       21 
21 
     | 
    
         
             
                prepare_html <<-HTML.chomp!
         
     | 
| 
         @@ -35,7 +35,7 @@ HTML 
     | 
|
| 
       35 
35 
     | 
    
         
             
              def navbar_collapse(options = {}, &block)
         
     | 
| 
       36 
36 
     | 
    
         
             
                options = options.dup
         
     | 
| 
       37 
37 
     | 
    
         
             
                css_classes = %w(collapse navbar-collapse).tap do |css_classes|
         
     | 
| 
       38 
     | 
    
         
            -
                  css_classes << options.delete(:class) if options. 
     | 
| 
      
 38 
     | 
    
         
            +
                  css_classes << options.delete(:class) if options.key?(:class)
         
     | 
| 
       39 
39 
     | 
    
         
             
                end
         
     | 
| 
       40 
40 
     | 
    
         
             
                attributes = attributes_for_tag(options.reverse_merge(class: css_classes.join(' '), id: 'navbar-collapsable'))
         
     | 
| 
       41 
41 
     | 
    
         
             
                prepare_html <<-HTML.chomp!
         
     | 
| 
         @@ -48,8 +48,8 @@ HTML 
     | 
|
| 
       48 
48 
     | 
    
         
             
              def navbar_group(options = {}, &block)
         
     | 
| 
       49 
49 
     | 
    
         
             
                options = options.dup
         
     | 
| 
       50 
50 
     | 
    
         
             
                css_classes = %w(nav navbar-nav).tap do |css_classes|
         
     | 
| 
       51 
     | 
    
         
            -
                  css_classes << "navbar-#{options.delete(:align)}" if options. 
     | 
| 
       52 
     | 
    
         
            -
                  css_classes << options.delete(:class) if options. 
     | 
| 
      
 51 
     | 
    
         
            +
                  css_classes << "navbar-#{options.delete(:align)}" if options.key?(:align)
         
     | 
| 
      
 52 
     | 
    
         
            +
                  css_classes << options.delete(:class) if options.key?(:class)
         
     | 
| 
       53 
53 
     | 
    
         
             
                end
         
     | 
| 
       54 
54 
     | 
    
         
             
                attributes = attributes_for_tag(options.reverse_merge(class: css_classes.join(' ')))
         
     | 
| 
       55 
55 
     | 
    
         
             
                prepare_html <<-HTML.chomp!
         
     | 
| 
         @@ -66,7 +66,7 @@ HTML 
     | 
|
| 
       66 
66 
     | 
    
         
             
                link_options        = link_options.nil?      ? {} : link_options.dup
         
     | 
| 
       67 
67 
     | 
    
         
             
                list_item_css_classes = [].tap do |css_classes|
         
     | 
| 
       68 
68 
     | 
    
         
             
                  css_classes << 'active' if current_url_or_sub_url?(url)
         
     | 
| 
       69 
     | 
    
         
            -
                  css_classes << list_item_options.delete(:class) if list_item_options. 
     | 
| 
      
 69 
     | 
    
         
            +
                  css_classes << list_item_options.delete(:class) if list_item_options.key?(:class)
         
     | 
| 
       70 
70 
     | 
    
         
             
                end
         
     | 
| 
       71 
71 
     | 
    
         
             
                list_item_attributes = attributes_for_tag(
         
     | 
| 
       72 
72 
     | 
    
         
             
                  { class: list_item_css_classes.join(' ') }
         
     | 
| 
         @@ -86,8 +86,8 @@ HTML 
     | 
|
| 
       86 
86 
     | 
    
         
             
              def navbar_form(url, options = {}, &block)
         
     | 
| 
       87 
87 
     | 
    
         
             
                options = options.dup
         
     | 
| 
       88 
88 
     | 
    
         
             
                css_classes = %w(navbar-form).tap do |css_classes|
         
     | 
| 
       89 
     | 
    
         
            -
                  css_classes << "navbar-#{options.delete(:align)}" if options. 
     | 
| 
       90 
     | 
    
         
            -
                  css_classes << options.delete(:class) if options. 
     | 
| 
      
 89 
     | 
    
         
            +
                  css_classes << "navbar-#{options.delete(:align)}" if options.key?(:align)
         
     | 
| 
      
 90 
     | 
    
         
            +
                  css_classes << options.delete(:class) if options.key?(:class)
         
     | 
| 
       91 
91 
     | 
    
         
             
                end
         
     | 
| 
       92 
92 
     | 
    
         
             
                role = options.delete(:role) || 'form'
         
     | 
| 
       93 
93 
     | 
    
         
             
                attributes = attributes_for_tag(options.reverse_merge(class: css_classes.join(' '), role: role))
         
     | 
| 
         @@ -103,7 +103,7 @@ HTML 
     | 
|
| 
       103 
103 
     | 
    
         
             
                options = options.dup
         
     | 
| 
       104 
104 
     | 
    
         
             
                text ||= capture(&block)
         
     | 
| 
       105 
105 
     | 
    
         
             
                css_classes = %w(navbar-text).tap do |css_classes|
         
     | 
| 
       106 
     | 
    
         
            -
                  css_classes << options.delete(:class) if options. 
     | 
| 
      
 106 
     | 
    
         
            +
                  css_classes << options.delete(:class) if options.key?(:class)
         
     | 
| 
       107 
107 
     | 
    
         
             
                end
         
     | 
| 
       108 
108 
     | 
    
         
             
                attributes = attributes_for_tag(options.reverse_merge(class: css_classes.join(' ')))
         
     | 
| 
       109 
109 
     | 
    
         
             
                prepare_html <<-HTML.chomp!
         
     | 
| 
         @@ -114,7 +114,7 @@ HTML 
     | 
|
| 
       114 
114 
     | 
    
         
             
              def navbar_button(text, options = {})
         
     | 
| 
       115 
115 
     | 
    
         
             
                options = options.dup
         
     | 
| 
       116 
116 
     | 
    
         
             
                css_classes = %w(btn navbar-btn).tap do |css_classes|
         
     | 
| 
       117 
     | 
    
         
            -
                  css_classes << options.delete(:class) if options. 
     | 
| 
      
 117 
     | 
    
         
            +
                  css_classes << options.delete(:class) if options.key?(:class)
         
     | 
| 
       118 
118 
     | 
    
         
             
                end
         
     | 
| 
       119 
119 
     | 
    
         
             
                type = options.delete(:type) || 'button'
         
     | 
| 
       120 
120 
     | 
    
         
             
                attributes = attributes_for_tag(options.reverse_merge(class: css_classes.join(' '), type: type))
         
     | 
| 
         @@ -179,9 +179,9 @@ HTML 
     | 
|
| 
       179 
179 
     | 
    
         
             
                options = options.dup
         
     | 
| 
       180 
180 
     | 
    
         
             
                css_classes = %w(navbar).tap do |css_classes|
         
     | 
| 
       181 
181 
     | 
    
         
             
                  css_classes << "navbar-#{options.delete(:inverse) ? 'inverse' : 'default'}"
         
     | 
| 
       182 
     | 
    
         
            -
                  css_classes << "navbar-fixed-#{options.delete(:fixed)}" if options. 
     | 
| 
      
 182 
     | 
    
         
            +
                  css_classes << "navbar-fixed-#{options.delete(:fixed)}" if options.key?(:fixed)
         
     | 
| 
       183 
183 
     | 
    
         
             
                  css_classes << 'navbar-static-top' if options.delete(:static)
         
     | 
| 
       184 
     | 
    
         
            -
                  css_classes << options.delete(:class) if options. 
     | 
| 
      
 184 
     | 
    
         
            +
                  css_classes << options.delete(:class) if options.key?(:class)
         
     | 
| 
       185 
185 
     | 
    
         
             
                end
         
     | 
| 
       186 
186 
     | 
    
         
             
                role = options.delete(:role) || 'navigation'
         
     | 
| 
       187 
187 
     | 
    
         
             
                attributes = attributes_for_tag(options.reverse_merge(class: css_classes.join(' '), role: role))
         
     | 
| 
         @@ -0,0 +1,137 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module BootstrapNavbar::Helpers::Bootstrap4
         
     | 
| 
      
 2 
     | 
    
         
            +
              def navbar(options = {}, &block)
         
     | 
| 
      
 3 
     | 
    
         
            +
                options = options.dup
         
     | 
| 
      
 4 
     | 
    
         
            +
                container = options.key?(:container) ? options.delete(:container) : false
         
     | 
| 
      
 5 
     | 
    
         
            +
                wrapper options do
         
     | 
| 
      
 6 
     | 
    
         
            +
                  if container
         
     | 
| 
      
 7 
     | 
    
         
            +
                    container(&block)
         
     | 
| 
      
 8 
     | 
    
         
            +
                  else
         
     | 
| 
      
 9 
     | 
    
         
            +
                    capture(&block) if block_given?
         
     | 
| 
      
 10 
     | 
    
         
            +
                  end
         
     | 
| 
      
 11 
     | 
    
         
            +
                end
         
     | 
| 
      
 12 
     | 
    
         
            +
              end
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
              def navbar_collapse(options = {}, &block)
         
     | 
| 
      
 15 
     | 
    
         
            +
                options = options.dup
         
     | 
| 
      
 16 
     | 
    
         
            +
                if options.key?(:toggleable)
         
     | 
| 
      
 17 
     | 
    
         
            +
                  toggleable = options.delete(:toggleable)
         
     | 
| 
      
 18 
     | 
    
         
            +
                  toggleable = 'xs' if toggleable == true
         
     | 
| 
      
 19 
     | 
    
         
            +
                end
         
     | 
| 
      
 20 
     | 
    
         
            +
                css_classes = %w(collapse).tap do |css_classes|
         
     | 
| 
      
 21 
     | 
    
         
            +
                  css_classes << options.delete(:class) if options.key?(:class)
         
     | 
| 
      
 22 
     | 
    
         
            +
                  css_classes << "navbar-toggleable-#{toggleable}" if toggleable
         
     | 
| 
      
 23 
     | 
    
         
            +
                end
         
     | 
| 
      
 24 
     | 
    
         
            +
                toggler_css_classes = %w(navbar-toggler).tap do |css_classes|
         
     | 
| 
      
 25 
     | 
    
         
            +
                  if toggleable
         
     | 
| 
      
 26 
     | 
    
         
            +
                    following_grid_size = case toggleable
         
     | 
| 
      
 27 
     | 
    
         
            +
                    when 'xs' then 'sm'
         
     | 
| 
      
 28 
     | 
    
         
            +
                    when 'sm' then 'md'
         
     | 
| 
      
 29 
     | 
    
         
            +
                    when 'md' then 'lg'
         
     | 
| 
      
 30 
     | 
    
         
            +
                    when 'lg' then 'xl'
         
     | 
| 
      
 31 
     | 
    
         
            +
                    else
         
     | 
| 
      
 32 
     | 
    
         
            +
                      fail %(Unexpected "toggleable" parameter: #{toggleable}. Must be "xs", "sm", "md", "lg" or `true` (equals "xs").)
         
     | 
| 
      
 33 
     | 
    
         
            +
                    end
         
     | 
| 
      
 34 
     | 
    
         
            +
                    css_classes << "hidden-#{following_grid_size}-up"
         
     | 
| 
      
 35 
     | 
    
         
            +
                  end
         
     | 
| 
      
 36 
     | 
    
         
            +
                end
         
     | 
| 
      
 37 
     | 
    
         
            +
                id = options.delete(:id) || 'navbar-collapsable'
         
     | 
| 
      
 38 
     | 
    
         
            +
                attributes = attributes_for_tag(options.reverse_merge(class: css_classes.join(' '), id: id))
         
     | 
| 
      
 39 
     | 
    
         
            +
                toggler_attributes = attributes_for_tag(
         
     | 
| 
      
 40 
     | 
    
         
            +
                  class:             toggler_css_classes.join(' '),
         
     | 
| 
      
 41 
     | 
    
         
            +
                  type:              'button',
         
     | 
| 
      
 42 
     | 
    
         
            +
                  'data-toggle'   => 'collapse',
         
     | 
| 
      
 43 
     | 
    
         
            +
                  'data-target'   => "##{id}",
         
     | 
| 
      
 44 
     | 
    
         
            +
                  'aria-controls' => id,
         
     | 
| 
      
 45 
     | 
    
         
            +
                  'aria-expanded' => false,
         
     | 
| 
      
 46 
     | 
    
         
            +
                  'aria-label'    => 'Toggle navigation'
         
     | 
| 
      
 47 
     | 
    
         
            +
                )
         
     | 
| 
      
 48 
     | 
    
         
            +
                prepare_html <<-HTML.chomp!
         
     | 
| 
      
 49 
     | 
    
         
            +
            <button#{toggler_attributes}>
         
     | 
| 
      
 50 
     | 
    
         
            +
              ☰
         
     | 
| 
      
 51 
     | 
    
         
            +
            </button>
         
     | 
| 
      
 52 
     | 
    
         
            +
            <div#{attributes}>
         
     | 
| 
      
 53 
     | 
    
         
            +
              #{capture(&block) if block_given?}
         
     | 
| 
      
 54 
     | 
    
         
            +
            </div>
         
     | 
| 
      
 55 
     | 
    
         
            +
            HTML
         
     | 
| 
      
 56 
     | 
    
         
            +
              end
         
     | 
| 
      
 57 
     | 
    
         
            +
             
     | 
| 
      
 58 
     | 
    
         
            +
              def navbar_group(options = {}, &block)
         
     | 
| 
      
 59 
     | 
    
         
            +
                options = options.dup
         
     | 
| 
      
 60 
     | 
    
         
            +
                css_classes = %w(nav navbar-nav).tap do |css_classes|
         
     | 
| 
      
 61 
     | 
    
         
            +
                  css_classes << options.delete(:class) if options.key?(:class)
         
     | 
| 
      
 62 
     | 
    
         
            +
                end
         
     | 
| 
      
 63 
     | 
    
         
            +
                attributes = attributes_for_tag(options.reverse_merge(class: css_classes.join(' ')))
         
     | 
| 
      
 64 
     | 
    
         
            +
                prepare_html <<-HTML.chomp!
         
     | 
| 
      
 65 
     | 
    
         
            +
            <ul#{attributes}>
         
     | 
| 
      
 66 
     | 
    
         
            +
              #{capture(&block) if block_given?}
         
     | 
| 
      
 67 
     | 
    
         
            +
            </ul>
         
     | 
| 
      
 68 
     | 
    
         
            +
            HTML
         
     | 
| 
      
 69 
     | 
    
         
            +
              end
         
     | 
| 
      
 70 
     | 
    
         
            +
             
     | 
| 
      
 71 
     | 
    
         
            +
              def navbar_item(text, url = nil, list_item_options = nil, link_options = nil, &block)
         
     | 
| 
      
 72 
     | 
    
         
            +
                text, url, list_item_options, link_options = capture(&block), text, url, list_item_options if block_given?
         
     | 
| 
      
 73 
     | 
    
         
            +
                url               ||= '#'
         
     | 
| 
      
 74 
     | 
    
         
            +
                list_item_options   = list_item_options.nil? ? {} : list_item_options.dup
         
     | 
| 
      
 75 
     | 
    
         
            +
                link_options        = link_options.nil?      ? {} : link_options.dup
         
     | 
| 
      
 76 
     | 
    
         
            +
                list_item_css_classes = %w(nav-item).tap do |css_classes|
         
     | 
| 
      
 77 
     | 
    
         
            +
                  css_classes << 'active' if current_url_or_sub_url?(url)
         
     | 
| 
      
 78 
     | 
    
         
            +
                  css_classes << list_item_options.delete(:class) if list_item_options.key?(:class)
         
     | 
| 
      
 79 
     | 
    
         
            +
                end
         
     | 
| 
      
 80 
     | 
    
         
            +
                link_css_classes = %w(nav-link).tap do |css_classes|
         
     | 
| 
      
 81 
     | 
    
         
            +
                  css_classes << link_options.delete(:class) if link_options.key?(:class)
         
     | 
| 
      
 82 
     | 
    
         
            +
                end
         
     | 
| 
      
 83 
     | 
    
         
            +
                list_item_attributes = attributes_for_tag(
         
     | 
| 
      
 84 
     | 
    
         
            +
                  { class: list_item_css_classes.join(' ') }
         
     | 
| 
      
 85 
     | 
    
         
            +
                    .delete_if { |k, v| v.empty? }
         
     | 
| 
      
 86 
     | 
    
         
            +
                    .merge(list_item_options)
         
     | 
| 
      
 87 
     | 
    
         
            +
                )
         
     | 
| 
      
 88 
     | 
    
         
            +
                link_attributes = attributes_for_tag(
         
     | 
| 
      
 89 
     | 
    
         
            +
                  { class: link_css_classes.join(' ') }
         
     | 
| 
      
 90 
     | 
    
         
            +
                    .delete_if { |k, v| v.empty? }
         
     | 
| 
      
 91 
     | 
    
         
            +
                    .merge(link_options)
         
     | 
| 
      
 92 
     | 
    
         
            +
                )
         
     | 
| 
      
 93 
     | 
    
         
            +
                prepare_html <<-HTML.chomp!
         
     | 
| 
      
 94 
     | 
    
         
            +
            <li#{list_item_attributes}>
         
     | 
| 
      
 95 
     | 
    
         
            +
              <a href="#{url}"#{link_attributes}>
         
     | 
| 
      
 96 
     | 
    
         
            +
                #{text}
         
     | 
| 
      
 97 
     | 
    
         
            +
              </a>
         
     | 
| 
      
 98 
     | 
    
         
            +
            </li>
         
     | 
| 
      
 99 
     | 
    
         
            +
            HTML
         
     | 
| 
      
 100 
     | 
    
         
            +
              end
         
     | 
| 
      
 101 
     | 
    
         
            +
             
     | 
| 
      
 102 
     | 
    
         
            +
              private
         
     | 
| 
      
 103 
     | 
    
         
            +
             
     | 
| 
      
 104 
     | 
    
         
            +
              def container(&block)
         
     | 
| 
      
 105 
     | 
    
         
            +
                prepare_html <<-HTML.chomp!
         
     | 
| 
      
 106 
     | 
    
         
            +
            <div class="container">
         
     | 
| 
      
 107 
     | 
    
         
            +
              #{capture(&block) if block_given?}
         
     | 
| 
      
 108 
     | 
    
         
            +
            </div>
         
     | 
| 
      
 109 
     | 
    
         
            +
            HTML
         
     | 
| 
      
 110 
     | 
    
         
            +
              end
         
     | 
| 
      
 111 
     | 
    
         
            +
             
     | 
| 
      
 112 
     | 
    
         
            +
              def brand_link(text, url = nil)
         
     | 
| 
      
 113 
     | 
    
         
            +
                prepare_html <<-HTML.chomp!
         
     | 
| 
      
 114 
     | 
    
         
            +
            <a href="#{url || '/'}" class="navbar-brand">
         
     | 
| 
      
 115 
     | 
    
         
            +
              #{text}
         
     | 
| 
      
 116 
     | 
    
         
            +
            </a>
         
     | 
| 
      
 117 
     | 
    
         
            +
            HTML
         
     | 
| 
      
 118 
     | 
    
         
            +
              end
         
     | 
| 
      
 119 
     | 
    
         
            +
             
     | 
| 
      
 120 
     | 
    
         
            +
              def wrapper(options, &block)
         
     | 
| 
      
 121 
     | 
    
         
            +
                options = options.dup
         
     | 
| 
      
 122 
     | 
    
         
            +
                css_classes = %w(navbar).tap do |css_classes|
         
     | 
| 
      
 123 
     | 
    
         
            +
                  css_classes << "navbar-#{options.key?(:color_scheme) ? options.delete(:color_scheme) : 'dark'}"
         
     | 
| 
      
 124 
     | 
    
         
            +
                  css_classes << "bg-#{options.delete(:bg) || 'primary'}" unless options[:bg] == false
         
     | 
| 
      
 125 
     | 
    
         
            +
                  css_classes << "navbar-#{options.delete(:placement)}" if options.key?(:placement)
         
     | 
| 
      
 126 
     | 
    
         
            +
                  css_classes << options.delete(:class) if options.key?(:class)
         
     | 
| 
      
 127 
     | 
    
         
            +
                end
         
     | 
| 
      
 128 
     | 
    
         
            +
                brand = brand_link(options[:brand], options[:brand_url]) if options[:brand]
         
     | 
| 
      
 129 
     | 
    
         
            +
                attributes = attributes_for_tag(options.reverse_merge(class: css_classes.join(' ')))
         
     | 
| 
      
 130 
     | 
    
         
            +
                prepare_html <<-HTML.chomp!
         
     | 
| 
      
 131 
     | 
    
         
            +
            <nav#{attributes}>
         
     | 
| 
      
 132 
     | 
    
         
            +
              #{brand}
         
     | 
| 
      
 133 
     | 
    
         
            +
              #{capture(&block) if block_given?}
         
     | 
| 
      
 134 
     | 
    
         
            +
            </nav>
         
     | 
| 
      
 135 
     | 
    
         
            +
            HTML
         
     | 
| 
      
 136 
     | 
    
         
            +
              end
         
     | 
| 
      
 137 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,161 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'spec_helper'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            describe BootstrapNavbar::Helpers::Bootstrap4 do
         
     | 
| 
      
 4 
     | 
    
         
            +
              before do
         
     | 
| 
      
 5 
     | 
    
         
            +
                BootstrapNavbar.configure do |config|
         
     | 
| 
      
 6 
     | 
    
         
            +
                  config.current_url_method = '"/"'
         
     | 
| 
      
 7 
     | 
    
         
            +
                  config.bootstrap_version  = '4.0.0'
         
     | 
| 
      
 8 
     | 
    
         
            +
                end
         
     | 
| 
      
 9 
     | 
    
         
            +
              end
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
              it 'includes the correct module' do
         
     | 
| 
      
 12 
     | 
    
         
            +
                expect(renderer.class.ancestors).to_not include(BootstrapNavbar::Helpers::Bootstrap3)
         
     | 
| 
      
 13 
     | 
    
         
            +
                expect(renderer.class.ancestors).to_not include(BootstrapNavbar::Helpers::Bootstrap2)
         
     | 
| 
      
 14 
     | 
    
         
            +
                expect(renderer.class.ancestors).to include(BootstrapNavbar::Helpers::Bootstrap4)
         
     | 
| 
      
 15 
     | 
    
         
            +
              end
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
              describe '#navbar' do
         
     | 
| 
      
 18 
     | 
    
         
            +
                context 'without parameters' do
         
     | 
| 
      
 19 
     | 
    
         
            +
                  it 'generates the correct HTML' do
         
     | 
| 
      
 20 
     | 
    
         
            +
                    expect(renderer.navbar { 'foo' }).to have_tag(:nav, with: { class: 'navbar navbar-dark bg-primary' }, text: /foo/)
         
     | 
| 
      
 21 
     | 
    
         
            +
                  end
         
     | 
| 
      
 22 
     | 
    
         
            +
                end
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
      
 24 
     | 
    
         
            +
                context 'with "color_scheme" parameter' do
         
     | 
| 
      
 25 
     | 
    
         
            +
                  it 'generates the correct HTML' do
         
     | 
| 
      
 26 
     | 
    
         
            +
                    expect(renderer.navbar(color_scheme: 'light')).to have_tag(:nav, with: { class: 'navbar navbar-light bg-primary' })
         
     | 
| 
      
 27 
     | 
    
         
            +
                    expect(renderer.navbar(color_scheme: 'dark')).to have_tag(:nav, with: { class: 'navbar navbar-dark bg-primary' })
         
     | 
| 
      
 28 
     | 
    
         
            +
                  end
         
     | 
| 
      
 29 
     | 
    
         
            +
                end
         
     | 
| 
      
 30 
     | 
    
         
            +
             
     | 
| 
      
 31 
     | 
    
         
            +
                context 'with "bg" parameter' do
         
     | 
| 
      
 32 
     | 
    
         
            +
                  it 'generates the correct HTML' do
         
     | 
| 
      
 33 
     | 
    
         
            +
                    expect(renderer.navbar(bg: 'primary')).to have_tag(:nav, with: { class: 'navbar navbar-dark bg-primary' })
         
     | 
| 
      
 34 
     | 
    
         
            +
                    expect(renderer.navbar(bg: 'inverse')).to have_tag(:nav, with: { class: 'navbar navbar-dark bg-inverse' })
         
     | 
| 
      
 35 
     | 
    
         
            +
                    expect(renderer.navbar(bg: false)).to have_tag(:nav, with: { class: 'navbar navbar-dark' }, without: { class: 'bg-primary' })
         
     | 
| 
      
 36 
     | 
    
         
            +
                  end
         
     | 
| 
      
 37 
     | 
    
         
            +
                end
         
     | 
| 
      
 38 
     | 
    
         
            +
             
     | 
| 
      
 39 
     | 
    
         
            +
                context 'with "placement" parameter' do
         
     | 
| 
      
 40 
     | 
    
         
            +
                  it 'generates the correct HTML' do
         
     | 
| 
      
 41 
     | 
    
         
            +
                    %w(full fixed-top fixed-bottom).each do |placement|
         
     | 
| 
      
 42 
     | 
    
         
            +
                      expect(renderer.navbar(placement: placement)).to have_tag(:nav, with: { class: "navbar navbar-dark bg-primary navbar-#{placement}" })
         
     | 
| 
      
 43 
     | 
    
         
            +
                    end
         
     | 
| 
      
 44 
     | 
    
         
            +
                  end
         
     | 
| 
      
 45 
     | 
    
         
            +
                end
         
     | 
| 
      
 46 
     | 
    
         
            +
             
     | 
| 
      
 47 
     | 
    
         
            +
                context 'with "container" parameter' do
         
     | 
| 
      
 48 
     | 
    
         
            +
                  it 'generates the correct HTML' do
         
     | 
| 
      
 49 
     | 
    
         
            +
                    expect(renderer.navbar(container: true)).to have_tag(:nav, with: { class: 'navbar navbar-dark bg-primary' }) do
         
     | 
| 
      
 50 
     | 
    
         
            +
                      with_tag :div, with: { class: 'container' }
         
     | 
| 
      
 51 
     | 
    
         
            +
                    end
         
     | 
| 
      
 52 
     | 
    
         
            +
                    expect(renderer.navbar(container: false)).to have_tag(:nav, with: { class: 'navbar navbar-dark bg-primary' }) do
         
     | 
| 
      
 53 
     | 
    
         
            +
                      without_tag :div, with: { class: 'container' }
         
     | 
| 
      
 54 
     | 
    
         
            +
                    end
         
     | 
| 
      
 55 
     | 
    
         
            +
                  end
         
     | 
| 
      
 56 
     | 
    
         
            +
                end
         
     | 
| 
      
 57 
     | 
    
         
            +
             
     | 
| 
      
 58 
     | 
    
         
            +
                context 'with "class" parameter' do
         
     | 
| 
      
 59 
     | 
    
         
            +
                  it 'generates the correct HTML' do
         
     | 
| 
      
 60 
     | 
    
         
            +
                    expect(renderer.navbar(class: 'foo')).to have_tag(:nav, with: { class: 'navbar navbar-dark bg-primary foo' })
         
     | 
| 
      
 61 
     | 
    
         
            +
                  end
         
     | 
| 
      
 62 
     | 
    
         
            +
                end
         
     | 
| 
      
 63 
     | 
    
         
            +
             
     | 
| 
      
 64 
     | 
    
         
            +
                context 'with "brand" parameter' do
         
     | 
| 
      
 65 
     | 
    
         
            +
                  it 'generates the correct HTML' do
         
     | 
| 
      
 66 
     | 
    
         
            +
                    expect(renderer.navbar(brand: 'Huhu')).to have_tag(:nav, with: { class: 'navbar navbar-dark bg-primary' }) do
         
     | 
| 
      
 67 
     | 
    
         
            +
                      with_tag :a, with: { class: 'navbar-brand' }, text: /Huhu/
         
     | 
| 
      
 68 
     | 
    
         
            +
                    end
         
     | 
| 
      
 69 
     | 
    
         
            +
                    expect(renderer.navbar(brand: false)).to have_tag(:nav, with: { class: 'navbar navbar-dark bg-primary' }) do
         
     | 
| 
      
 70 
     | 
    
         
            +
                      without_tag :a, with: { class: 'navbar-brand' }
         
     | 
| 
      
 71 
     | 
    
         
            +
                    end
         
     | 
| 
      
 72 
     | 
    
         
            +
                  end
         
     | 
| 
      
 73 
     | 
    
         
            +
                end
         
     | 
| 
      
 74 
     | 
    
         
            +
             
     | 
| 
      
 75 
     | 
    
         
            +
                context 'with "brand_url" parameter' do
         
     | 
| 
      
 76 
     | 
    
         
            +
                  it 'generates the correct HTML' do
         
     | 
| 
      
 77 
     | 
    
         
            +
                    expect(renderer.navbar(brand: true, brand_url: '/huhu')).to have_tag(:nav, with: { class: 'navbar navbar-dark bg-primary' }) do
         
     | 
| 
      
 78 
     | 
    
         
            +
                      with_tag :a, with: { class: 'navbar-brand', href: '/huhu' }
         
     | 
| 
      
 79 
     | 
    
         
            +
                    end
         
     | 
| 
      
 80 
     | 
    
         
            +
                  end
         
     | 
| 
      
 81 
     | 
    
         
            +
                end
         
     | 
| 
      
 82 
     | 
    
         
            +
              end
         
     | 
| 
      
 83 
     | 
    
         
            +
             
     | 
| 
      
 84 
     | 
    
         
            +
              describe '#navbar_collapse' do
         
     | 
| 
      
 85 
     | 
    
         
            +
                context 'without parameters' do
         
     | 
| 
      
 86 
     | 
    
         
            +
                  it 'generates the correct HTML' do
         
     | 
| 
      
 87 
     | 
    
         
            +
                    output = renderer.navbar_collapse { 'foo' }
         
     | 
| 
      
 88 
     | 
    
         
            +
                    expect(output).to have_tag :div, with: { class: 'collapse', id: 'navbar-collapsable' }, text: /foo/
         
     | 
| 
      
 89 
     | 
    
         
            +
                    button_attributes = {
         
     | 
| 
      
 90 
     | 
    
         
            +
                      class:             'navbar-toggler',
         
     | 
| 
      
 91 
     | 
    
         
            +
                      type:              'button',
         
     | 
| 
      
 92 
     | 
    
         
            +
                      'data-toggle'   => 'collapse',
         
     | 
| 
      
 93 
     | 
    
         
            +
                      'data-target'   => "#navbar-collapsable",
         
     | 
| 
      
 94 
     | 
    
         
            +
                      'aria-controls' => 'navbar-collapsable',
         
     | 
| 
      
 95 
     | 
    
         
            +
                      'aria-expanded' => false,
         
     | 
| 
      
 96 
     | 
    
         
            +
                      'aria-label'    => 'Toggle navigation'
         
     | 
| 
      
 97 
     | 
    
         
            +
                    }
         
     | 
| 
      
 98 
     | 
    
         
            +
                    expect(output).to have_tag :button, with: button_attributes
         
     | 
| 
      
 99 
     | 
    
         
            +
                  end
         
     | 
| 
      
 100 
     | 
    
         
            +
                end
         
     | 
| 
      
 101 
     | 
    
         
            +
             
     | 
| 
      
 102 
     | 
    
         
            +
                context 'with "toggleable" parameter' do
         
     | 
| 
      
 103 
     | 
    
         
            +
                  it 'generates the correct HTML' do
         
     | 
| 
      
 104 
     | 
    
         
            +
                    output = renderer.navbar_collapse(toggleable: true) { 'foo' }
         
     | 
| 
      
 105 
     | 
    
         
            +
                    expect(output).to have_tag :div, with: { class: 'collapse navbar-toggleable-xs', id: 'navbar-collapsable' }, text: /foo/
         
     | 
| 
      
 106 
     | 
    
         
            +
                    button_attributes = {
         
     | 
| 
      
 107 
     | 
    
         
            +
                      class:             'navbar-toggler hidden-sm-up',
         
     | 
| 
      
 108 
     | 
    
         
            +
                      type:              'button',
         
     | 
| 
      
 109 
     | 
    
         
            +
                      'data-toggle'   => 'collapse',
         
     | 
| 
      
 110 
     | 
    
         
            +
                      'data-target'   => "#navbar-collapsable",
         
     | 
| 
      
 111 
     | 
    
         
            +
                      'aria-controls' => 'navbar-collapsable',
         
     | 
| 
      
 112 
     | 
    
         
            +
                      'aria-expanded' => false,
         
     | 
| 
      
 113 
     | 
    
         
            +
                      'aria-label'    => 'Toggle navigation'
         
     | 
| 
      
 114 
     | 
    
         
            +
                    }
         
     | 
| 
      
 115 
     | 
    
         
            +
                    expect(output).to have_tag :button, with: button_attributes
         
     | 
| 
      
 116 
     | 
    
         
            +
                  end
         
     | 
| 
      
 117 
     | 
    
         
            +
                end
         
     | 
| 
      
 118 
     | 
    
         
            +
              end
         
     | 
| 
      
 119 
     | 
    
         
            +
             
     | 
| 
      
 120 
     | 
    
         
            +
              describe '#navbar_group' do
         
     | 
| 
      
 121 
     | 
    
         
            +
                context 'without parameters' do
         
     | 
| 
      
 122 
     | 
    
         
            +
                  it 'generates the correct HTML' do
         
     | 
| 
      
 123 
     | 
    
         
            +
                    expect(renderer.navbar_group).to have_tag(:ul, with: { class: 'nav navbar-nav' })
         
     | 
| 
      
 124 
     | 
    
         
            +
                  end
         
     | 
| 
      
 125 
     | 
    
         
            +
                end
         
     | 
| 
      
 126 
     | 
    
         
            +
             
     | 
| 
      
 127 
     | 
    
         
            +
                context 'with "class" parameter' do
         
     | 
| 
      
 128 
     | 
    
         
            +
                  it 'generates the correct HTML' do
         
     | 
| 
      
 129 
     | 
    
         
            +
                    expect(renderer.navbar_group(class: 'foo')).to have_tag(:ul, with: { class: 'nav navbar-nav foo' })
         
     | 
| 
      
 130 
     | 
    
         
            +
                  end
         
     | 
| 
      
 131 
     | 
    
         
            +
                end
         
     | 
| 
      
 132 
     | 
    
         
            +
              end
         
     | 
| 
      
 133 
     | 
    
         
            +
             
     | 
| 
      
 134 
     | 
    
         
            +
              describe '#navbar_item' do
         
     | 
| 
      
 135 
     | 
    
         
            +
                it_behaves_like 'marking the navbar items as active correctly'
         
     | 
| 
      
 136 
     | 
    
         
            +
             
     | 
| 
      
 137 
     | 
    
         
            +
                context 'with block' do
         
     | 
| 
      
 138 
     | 
    
         
            +
                  it 'generates the correct HTML' do
         
     | 
| 
      
 139 
     | 
    
         
            +
                    expect(renderer.navbar_item('/foo', { class: 'list-item' }, class: 'link') { 'link-text' }).to have_tag(:li, with: { class: 'nav-item list-item' }) do
         
     | 
| 
      
 140 
     | 
    
         
            +
                      with_tag :a, with: { href: '/foo', class: 'nav-link link' }, text: /link-text/
         
     | 
| 
      
 141 
     | 
    
         
            +
                    end
         
     | 
| 
      
 142 
     | 
    
         
            +
                  end
         
     | 
| 
      
 143 
     | 
    
         
            +
                end
         
     | 
| 
      
 144 
     | 
    
         
            +
             
     | 
| 
      
 145 
     | 
    
         
            +
                context 'without current URL' do
         
     | 
| 
      
 146 
     | 
    
         
            +
                  it 'generates the correct HTML' do
         
     | 
| 
      
 147 
     | 
    
         
            +
                    BootstrapNavbar.configuration.current_url_method = '"/foo"'
         
     | 
| 
      
 148 
     | 
    
         
            +
                    expect(renderer.navbar_item('foo', '/')).to have_tag(:li, without: { class: 'active' }) do
         
     | 
| 
      
 149 
     | 
    
         
            +
                      with_tag :a, with: { href: '/' }, text: /foo/
         
     | 
| 
      
 150 
     | 
    
         
            +
                    end
         
     | 
| 
      
 151 
     | 
    
         
            +
                    expect(renderer.navbar_item('foo', '/bar')).to have_tag(:li, without: { class: 'active' }) do
         
     | 
| 
      
 152 
     | 
    
         
            +
                      with_tag :a, with: { href: '/bar' }, text: /foo/
         
     | 
| 
      
 153 
     | 
    
         
            +
                    end
         
     | 
| 
      
 154 
     | 
    
         
            +
                    BootstrapNavbar.configuration.current_url_method = '"/"'
         
     | 
| 
      
 155 
     | 
    
         
            +
                    expect(renderer.navbar_item('foo', '/foo')).to have_tag(:li, without: { class: 'active' }) do
         
     | 
| 
      
 156 
     | 
    
         
            +
                      with_tag :a, with: { href: '/foo' }, text: /foo/
         
     | 
| 
      
 157 
     | 
    
         
            +
                    end
         
     | 
| 
      
 158 
     | 
    
         
            +
                  end
         
     | 
| 
      
 159 
     | 
    
         
            +
                end
         
     | 
| 
      
 160 
     | 
    
         
            +
              end
         
     | 
| 
      
 161 
     | 
    
         
            +
            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: 2. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 2.3.0
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Manuel Meurer
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date:  
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2016-08-10 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: rake
         
     | 
| 
         @@ -108,12 +108,13 @@ dependencies: 
     | 
|
| 
       108 
108 
     | 
    
         
             
                - - "~>"
         
     | 
| 
       109 
109 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       110 
110 
     | 
    
         
             
                    version: '0.3'
         
     | 
| 
       111 
     | 
    
         
            -
            description: Helpers to generate a  
     | 
| 
      
 111 
     | 
    
         
            +
            description: Helpers to generate a Bootstrap style navbar
         
     | 
| 
       112 
112 
     | 
    
         
             
            email: manuel@krautcomputing.com
         
     | 
| 
       113 
113 
     | 
    
         
             
            executables: []
         
     | 
| 
       114 
114 
     | 
    
         
             
            extensions: []
         
     | 
| 
       115 
115 
     | 
    
         
             
            extra_rdoc_files: []
         
     | 
| 
       116 
116 
     | 
    
         
             
            files:
         
     | 
| 
      
 117 
     | 
    
         
            +
            - ".gitignore"
         
     | 
| 
       117 
118 
     | 
    
         
             
            - ".travis.yml"
         
     | 
| 
       118 
119 
     | 
    
         
             
            - CHANGELOG.md
         
     | 
| 
       119 
120 
     | 
    
         
             
            - Gemfile
         
     | 
| 
         @@ -126,13 +127,15 @@ files: 
     | 
|
| 
       126 
127 
     | 
    
         
             
            - lib/bootstrap-navbar/helpers.rb
         
     | 
| 
       127 
128 
     | 
    
         
             
            - lib/bootstrap-navbar/helpers/bootstrap2.rb
         
     | 
| 
       128 
129 
     | 
    
         
             
            - lib/bootstrap-navbar/helpers/bootstrap3.rb
         
     | 
| 
      
 130 
     | 
    
         
            +
            - lib/bootstrap-navbar/helpers/bootstrap4.rb
         
     | 
| 
       129 
131 
     | 
    
         
             
            - lib/bootstrap-navbar/version.rb
         
     | 
| 
       130 
132 
     | 
    
         
             
            - spec/bootstrap-navbar/helpers/bootstrap2_spec.rb
         
     | 
| 
       131 
133 
     | 
    
         
             
            - spec/bootstrap-navbar/helpers/bootstrap3_spec.rb
         
     | 
| 
      
 134 
     | 
    
         
            +
            - spec/bootstrap-navbar/helpers/bootstrap4_spec.rb
         
     | 
| 
       132 
135 
     | 
    
         
             
            - spec/bootstrap-navbar/helpers_spec.rb
         
     | 
| 
       133 
136 
     | 
    
         
             
            - spec/spec_helper.rb
         
     | 
| 
       134 
137 
     | 
    
         
             
            - spec/support/helpers.rb
         
     | 
| 
       135 
     | 
    
         
            -
            homepage: http:// 
     | 
| 
      
 138 
     | 
    
         
            +
            homepage: http://bootstrap-ruby.github.io/bootstrap-navbar
         
     | 
| 
       136 
139 
     | 
    
         
             
            licenses:
         
     | 
| 
       137 
140 
     | 
    
         
             
            - MIT
         
     | 
| 
       138 
141 
     | 
    
         
             
            metadata: {}
         
     | 
| 
         @@ -152,13 +155,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       152 
155 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       153 
156 
     | 
    
         
             
            requirements: []
         
     | 
| 
       154 
157 
     | 
    
         
             
            rubyforge_project: 
         
     | 
| 
       155 
     | 
    
         
            -
            rubygems_version: 2. 
     | 
| 
      
 158 
     | 
    
         
            +
            rubygems_version: 2.6.6
         
     | 
| 
       156 
159 
     | 
    
         
             
            signing_key: 
         
     | 
| 
       157 
160 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       158 
     | 
    
         
            -
            summary: Helpers to generate a  
     | 
| 
      
 161 
     | 
    
         
            +
            summary: Helpers to generate a Bootstrap style navbar
         
     | 
| 
       159 
162 
     | 
    
         
             
            test_files:
         
     | 
| 
       160 
163 
     | 
    
         
             
            - spec/bootstrap-navbar/helpers/bootstrap2_spec.rb
         
     | 
| 
       161 
164 
     | 
    
         
             
            - spec/bootstrap-navbar/helpers/bootstrap3_spec.rb
         
     | 
| 
      
 165 
     | 
    
         
            +
            - spec/bootstrap-navbar/helpers/bootstrap4_spec.rb
         
     | 
| 
       162 
166 
     | 
    
         
             
            - spec/bootstrap-navbar/helpers_spec.rb
         
     | 
| 
       163 
167 
     | 
    
         
             
            - spec/spec_helper.rb
         
     | 
| 
       164 
168 
     | 
    
         
             
            - spec/support/helpers.rb
         
     |