Module: Card::Set::Self::AccountLinks::HtmlFormat
- Extended by:
- AbstractFormat
- Defined in:
- platypus/tmp/set/gem-defaults/mod031-layout/self/account_links.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#account_link_text(purpose) ⇒ Object
-
#can_disable_roles? ⇒ Boolean
-
#enabled_roles_card ⇒ Object
-
#interactive_roles_dropdown ⇒ Object
-
#nav_link_class(type) ⇒ Object
-
#navbar_item_views ⇒ Object
-
#navbar_items ⇒ Object
-
#not_signed_in? ⇒ Boolean
-
#role_list ⇒ Object
-
#show_invite_link? ⇒ Boolean
-
#show_signup_link? ⇒ Boolean
-
#view: core ⇒ Object
-
#view: invite ⇒ Object
-
#view: my_card ⇒ Object
-
#view: sign_in ⇒ Object
-
#view: sign_out ⇒ Object
-
#view: sign_up ⇒ Object
Class Method Details
.link_options(perms) ⇒ Object
36 37 38 |
# File 'platypus/tmp/set/gem-defaults/mod031-layout/self/account_links.rb', line 36 def self. perms { denial: :blank, cache: :never, perms: perms } end |
Instance Method Details
#account_link_text(purpose) ⇒ Object
85 86 87 |
# File 'platypus/tmp/set/gem-defaults/mod031-layout/self/account_links.rb', line 85 def account_link_text purpose voo.title || t("account_#{purpose}") end |
#can_disable_roles? ⇒ Boolean
80 81 82 83 |
# File 'platypus/tmp/set/gem-defaults/mod031-layout/self/account_links.rb', line 80 def can_disable_roles? Auth.current_roles.size > 1 && Card::Codename.exist?(:enabled_roles) # workaround for broken migrations end |
#enabled_roles_card ⇒ Object
72 73 74 |
# File 'platypus/tmp/set/gem-defaults/mod031-layout/self/account_links.rb', line 72 def enabled_roles_card Auth.current.fetch :enabled_roles, new: { type_id: SessionID } end |
#interactive_roles_dropdown ⇒ Object
67 68 69 70 |
# File 'platypus/tmp/set/gem-defaults/mod031-layout/self/account_links.rb', line 67 def interactive_roles_dropdown nest enabled_roles_card, view: :edit_inline, hide: %i[edit_inline_buttons name_formgroup] end |
#nav_link_class(type) ⇒ Object
89 90 91 |
# File 'platypus/tmp/set/gem-defaults/mod031-layout/self/account_links.rb', line 89 def nav_link_class type "nav-link #{classy(type)}" end |
#navbar_item_views ⇒ Object
32 33 34 |
# File 'platypus/tmp/set/gem-defaults/mod031-layout/self/account_links.rb', line 32 def %i[my_card sign_out sign_up sign_in] end |
#navbar_items ⇒ Object
24 25 26 27 28 29 30 |
# File 'platypus/tmp/set/gem-defaults/mod031-layout/self/account_links.rb', line 24 def # removed invite for now .map do |link_view| rendered = render link_view wrap_with_nav_item rendered if rendered.present? end.compact end |
#not_signed_in? ⇒ Boolean
93 94 95 |
# File 'platypus/tmp/set/gem-defaults/mod031-layout/self/account_links.rb', line 93 def not_signed_in? !Auth.signed_in? end |
#role_list ⇒ Object
76 77 78 |
# File 'platypus/tmp/set/gem-defaults/mod031-layout/self/account_links.rb', line 76 def role_list Auth.current_roles.map(&method(:link_to_card)) end |
#show_invite_link? ⇒ Boolean
101 102 103 104 |
# File 'platypus/tmp/set/gem-defaults/mod031-layout/self/account_links.rb', line 101 def show_invite_link? Auth.signed_in? && Card.new(type_id: Card.default_accounted_type_id).ok?(:create) end |
#show_signup_link? ⇒ Boolean
97 98 99 |
# File 'platypus/tmp/set/gem-defaults/mod031-layout/self/account_links.rb', line 97 def show_signup_link? not_signed_in? && Card.new(type: :signup).ok?(:create) end |
#view: core ⇒ Object
17 18 19 20 21 22 |
# File 'platypus/tmp/set/gem-defaults/mod031-layout/self/account_links.rb', line 17 view :core, cache: :never do status_class = Auth.signed_in? ? "logged-in" : "logged-out" wrap_with :div, id: "logging", class: status_class do .join "\n" end end |
#view: invite ⇒ Object
57 58 59 60 61 |
# File 'platypus/tmp/set/gem-defaults/mod031-layout/self/account_links.rb', line 57 view :invite, (:show_invite_link?) do link_to_card :signup, account_link_text(:invite), class: nav_link_class("invite-link"), path: { action: :new, mark: :signup } end |
#view: my_card ⇒ Object
63 64 65 |
# File 'platypus/tmp/set/gem-defaults/mod031-layout/self/account_links.rb', line 63 view :my_card, (:signed_in?) do can_disable_roles? ? interactive_roles_dropdown : account_dropdown end |
#view: sign_in ⇒ Object
46 47 48 49 |
# File 'platypus/tmp/set/gem-defaults/mod031-layout/self/account_links.rb', line 46 view :sign_in, (:not_signed_in?) do link_to_card :signin, account_link_text(:sign_in), class: nav_link_class("signin-link") end |
#view: sign_out ⇒ Object
51 52 53 54 55 |
# File 'platypus/tmp/set/gem-defaults/mod031-layout/self/account_links.rb', line 51 view :sign_out, (:signed_in?) do link_to_card :signin, account_link_text(:sign_out), class: nav_link_class("signout-link"), path: { action: :delete } end |
#view: sign_up ⇒ Object
40 41 42 43 44 |
# File 'platypus/tmp/set/gem-defaults/mod031-layout/self/account_links.rb', line 40 view :sign_up, (:show_signup_link?) do link_to_card :signup, account_link_text(:sign_up), class: nav_link_class("signup-link"), path: { action: :new, mark: :signup } end |