Sha256: 9c9c5c5b0a486bd0236caba9d34edb35f67396fa8dcfefc055e30daedc789fba

Contents?: true

Size: 569 Bytes

Versions: 11

Compression:

Stored size: 569 Bytes

Contents

format :html do
  def link_to_mycard
    link_to_card Auth.current.name, nil,
                 id: "my-card-link", class: "nav-link #{classy('my-card')}"
  end

  def account_dropdown &render_role_item
    split_button link_to_mycard, nil do
      [
        link_to_card([Auth.current, :account_settings], "Account"),
        (["Roles", role_items(&render_role_item)] if special_roles?)
      ]
    end
  end

  def special_roles?
    Auth.current_roles.size > 1
  end

  def role_items
    Auth.current_roles.map do |role_name|
      yield role_name
    end
  end
end

Version data entries

11 entries across 11 versions & 2 rubygems

Version Path
card-mod-layout-0.11.4 set/abstract/account_dropdown.rb
card-mod-layout-0.11.3 set/abstract/account_dropdown.rb
card-mod-layout-0.11.2 set/abstract/account_dropdown.rb
card-mod-layout-0.11.1 set/abstract/account_dropdown.rb
card-mod-layout-0.11.0 set/abstract/account_dropdown.rb
card-1.100.0 mod/navbar/set/abstract/account_dropdown.rb
card-1.99.6 mod/navbar/set/abstract/account_dropdown.rb
card-1.99.5 mod/navbar/set/abstract/account_dropdown.rb
card-1.99.4 mod/navbar/set/abstract/account_dropdown.rb
card-1.99.3 mod/navbar/set/abstract/account_dropdown.rb
card-1.99.2 mod/navbar/set/abstract/account_dropdown.rb