Module: Card::Set::All::Bootstrap::Navbar::HtmlFormat
- Extended by:
- Card::Set::AbstractFormat
- Defined in:
- tmpsets/set/mod026-bootstrap/all/bootstrap/navbar.rb
Instance Method Summary collapse
- #breadcrumb(items) ⇒ Object
-
#navbar(id, opts = {}) ⇒ Object
Options.
- #navbar_header(brand) ⇒ Object
- #navbar_nocollapse(content, nav_opts) ⇒ Object
- #navbar_responsive(id, content, opts, nav_opts) ⇒ Object
- #navbar_toggle(id, align) ⇒ Object
Instance Method Details
#breadcrumb(items) ⇒ Object
66 67 68 69 70 71 72 |
# File 'tmpsets/set/mod026-bootstrap/all/bootstrap/navbar.rb', line 66 def items wrap_with :ol, class: "breadcrumb" do items.map do |item| wrap_with :li, item, class: "breadcrumb-item" end.join end end |
#navbar(id, opts = {}) ⇒ Object
Options
17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'tmpsets/set/mod026-bootstrap/all/bootstrap/navbar.rb', line 17 def id, opts={} nav_opts = opts[:navbar_opts] || {} nav_opts[:class] ||= opts[:class] add_class nav_opts, "navbar navbar-dark bg-#{opts.delete(:navbar_type) || 'primary'}" content = yield if opts[:no_collapse] content, nav_opts else id, content, opts, nav_opts end end |
#navbar_header(brand) ⇒ Object
47 48 49 50 51 52 53 54 55 |
# File 'tmpsets/set/mod026-bootstrap/all/bootstrap/navbar.rb', line 47 def brand return "" unless brand if brand.is_a? String "<span class='navbar-brand'>#{brand}</span>" else link = brand[:href] || "#" "<a class='navbar-brand' href='#{link}#'>#{brand[:name]}</a>" end end |
#navbar_nocollapse(content, nav_opts) ⇒ Object
30 31 32 33 |
# File 'tmpsets/set/mod026-bootstrap/all/bootstrap/navbar.rb', line 30 def content, nav_opts # content = wrap_with(:div, content) wrap_with :nav, content, nav_opts end |
#navbar_responsive(id, content, opts, nav_opts) ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 |
# File 'tmpsets/set/mod026-bootstrap/all/bootstrap/navbar.rb', line 35 def id, content, opts, nav_opts opts[:toggle_align] ||= :right wrap_with :nav, nav_opts do [ (opts[:brand]), (id, opts[:toggle_align]), wrap_with(:div, class: "collapse navbar-collapse", id: "navbar-collapse-#{id}") { content } ] end end |
#navbar_toggle(id, align) ⇒ Object
57 58 59 60 61 62 63 64 |
# File 'tmpsets/set/mod026-bootstrap/all/bootstrap/navbar.rb', line 57 def id, align content ||= %(<span class="navbar-toggler-icon"></span>) <<-HTML <button class="navbar-toggler navbar-toggler-#{align}" type="button" data-toggle="collapse" data-target="#navbar-collapse-#{id}" aria-controls="navbar-collapse-#{id}" aria-expanded="false" aria-label="Toggle navigation"> #{content} </button> HTML end |