Sha256: b69983956d7f77f31480c6d9df5196e96875562628463b9c3f0925b4ac5af515

Contents?: true

Size: 788 Bytes

Versions: 2

Compression:

Stored size: 788 Bytes

Contents

require 'railsstrap/classes/base'

module Railsstrap
  module Classes
    class Vertical < Base
      def toggle_button(navbar_id, options = {})
        options[:class]         = :'navbar-toggler'
        options[:'data-target'] = :"##{navbar_id}"
        options[:'data-toggle'] = :collapse
        options[:type]          = :button
        options[:'aria-label']  = 'Toggle navigation'
        options[:'aria-controls']  = :"##{navbar_id}"
        @app.content_tag :button, options do
          safe_join [toggle_text, toggle_bar]
        end
      end

    private

      def toggle_text
        @app.content_tag :span, 'Toggle navigation', class: :'sr-only'
      end

      def toggle_bar
        @app.content_tag :span, nil, class: :'navbar-toggler-icon'
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
railsstrap-4.0.0.beta3 lib/railsstrap/classes/vertical.rb
railsstrap-4.0.0.beta2 lib/railsstrap/classes/vertical.rb