Class: Underworld::Dashboard::Models::Sidebar
- Inherits:
-
Object
- Object
- Underworld::Dashboard::Models::Sidebar
- Includes:
- ActionView::Helpers::TranslationHelper
- Defined in:
- lib/underworld/dashboard/models/sidebar.rb
Instance Method Summary collapse
- #children ⇒ Object
-
#initialize(title, **options) ⇒ Sidebar
constructor
A new instance of Sidebar.
- #item(name, **options) ⇒ Object
- #menu(name, **options, &block) ⇒ Object
- #title ⇒ Object
- #underworld_entries ⇒ Object
Methods included from ActionView::Helpers::TranslationHelper
Constructor Details
Instance Method Details
#children ⇒ Object
74 75 76 |
# File 'lib/underworld/dashboard/models/sidebar.rb', line 74 def children @tree end |
#item(name, **options) ⇒ Object
96 97 98 99 |
# File 'lib/underworld/dashboard/models/sidebar.rb', line 96 def item(name, **) item = Item.new(name, ) @current_node.add_child item end |
#menu(name, **options, &block) ⇒ Object
82 83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/underworld/dashboard/models/sidebar.rb', line 82 def (name, **, &block) item = Menu.new(name, ) @current_node.add_child item prev_node = @current_node @current_node = item block.call if block_given? @current_node = prev_node end |
#title ⇒ Object
78 79 80 |
# File 'lib/underworld/dashboard/models/sidebar.rb', line 78 def title @title || I18n.t('underworld.dashboard.sidebar.title') end |
#underworld_entries ⇒ Object
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 |
# File 'lib/underworld/dashboard/models/sidebar.rb', line 101 def underworld_entries (t('underworld.dashboard.user_management'), icon: 'fa fa-users', model: 'Underworld::User') do item(I18n.t('underworld.dashboard.users'), model: 'Underworld::User', url: Underworld::Engine.routes.url_helpers.dashboard_auth_users_path) item(I18n.t('underworld.dashboard.groups'), model: 'Underworld::Group', url: Underworld::Engine.routes.url_helpers.dashboard_auth_groups_path) end (t('underworld.dashboard.user_message'), icon: 'fa fa-envelope-o', model: 'Underworld::UserMessage') do item(I18n.t('underworld.dashboard.user_messages.inbox'), model: 'Underworld::UserMessage', url: Underworld::Engine.routes.url_helpers.) item(I18n.t('underworld.dashboard.user_messages.sent'), model: 'Underworld::UserMessage', url: Underworld::Engine.routes.url_helpers.) item(I18n.t('underworld.dashboard.user_messages.draft'), model: 'Underworld::UserMessage', url: Underworld::Engine.routes.url_helpers.) end end |