Module: Card::Set::Abstract::AccountDropdown::HtmlFormat

Extended by:
Card::Set::AbstractFormat
Defined in:
card/tmpsets/set/mod030-card-mod-layout/abstract/account_dropdown.rb,
card/tmpsets/set/mod031-card-mod-layout/abstract/account_dropdown.rb

Instance Method Summary collapse

Instance Method Details

#account_dropdown(&render_role_item) ⇒ Object



14
15
16
17
18
19
20
21
# File 'card/tmpsets/set/mod030-card-mod-layout/abstract/account_dropdown.rb', line 14

def  &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


9
10
11
12
# File 'card/tmpsets/set/mod030-card-mod-layout/abstract/account_dropdown.rb', line 9

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

#role_items(&block) ⇒ Object



27
28
29
30
31
# File 'card/tmpsets/set/mod030-card-mod-layout/abstract/account_dropdown.rb', line 27

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

#special_roles?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'card/tmpsets/set/mod030-card-mod-layout/abstract/account_dropdown.rb', line 23

def special_roles?
  Auth.current_roles.size > 1
end