Class: Faalis::Dashboard::Models::Sidebar
- Inherits:
-
Object
- Object
- Faalis::Dashboard::Models::Sidebar
- Includes:
- ActionView::Helpers::TranslationHelper
- Defined in:
- lib/faalis/dashboard/models/sidebar.rb
Instance Method Summary collapse
- #children ⇒ Object
- #faalis_entries ⇒ Object
-
#initialize(title, **options) ⇒ Sidebar
constructor
A new instance of Sidebar.
- #item(name, **options) ⇒ Object
- #menu(name, **options, &block) ⇒ Object
- #title ⇒ Object
Methods included from ActionView::Helpers::TranslationHelper
Constructor Details
Instance Method Details
#children ⇒ Object
74 75 76 |
# File 'lib/faalis/dashboard/models/sidebar.rb', line 74 def children @tree end |
#faalis_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 |
# File 'lib/faalis/dashboard/models/sidebar.rb', line 101 def faalis_entries (t('faalis.dashboard.user_management'), icon: 'fa fa-users', model: 'Faalis::User') do item(I18n.t('faalis.dashboard.users'), model: 'Faalis::User', url: Faalis::Engine.routes.url_helpers.dashboard_auth_users_path) item(I18n.t('faalis.dashboard.groups'), model: 'Faalis::Group', url: Faalis::Engine.routes.url_helpers.dashboard_auth_groups_path) end (t('faalis.dashboard.user_message'), icon: 'fa fa-envelope-o', model: 'Faalis::UserMessage') do item(I18n.t('faalis.dashboard.user_messages.inbox'), model: 'Faalis::UserMessage', url: Faalis::Engine.routes.url_helpers.) item(I18n.t('faalis.dashboard.user_messages.sent'), model: 'Faalis::UserMessage', url: Faalis::Engine.routes.url_helpers.) item(I18n.t('faalis.dashboard.user_messages.draft'), model: 'Faalis::UserMessage', url: Faalis::Engine.routes.url_helpers.) end end |
#item(name, **options) ⇒ Object
96 97 98 99 |
# File 'lib/faalis/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/faalis/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/faalis/dashboard/models/sidebar.rb', line 78 def title @title || I18n.t('faalis.dashboard.sidebar.title') end |