Extract methods to render management menu links
So this is similar to what we're doing in the `Admin::MenuComponent` class.
This commit is contained in:
@@ -1,19 +1 @@
|
|||||||
<ul id="admin_menu" data-accordion-menu>
|
<%= link_list(*links, id: "admin_menu", data: { "accordion-menu": true }) %>
|
||||||
<li class="section-title">
|
|
||||||
<%= user_links %>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<% if Setting["process.budgets"] %>
|
|
||||||
<li <%= "class=is-active" if print_investments? %>>
|
|
||||||
<%= link_to t("management.menu.print_budget_investments"), print_investments_management_budgets_path, class: "print-investments-link" %>
|
|
||||||
</li>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<li <%= "class=is-active" if print_proposals? %>>
|
|
||||||
<%= link_to t("management.menu.print_proposals"), print_management_proposals_path, class: "print-proposals-link" %>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<li <%= "class=is-active" if user_invites? %>>
|
|
||||||
<%= link_to t("management.menu.user_invites"), new_management_user_invite_path, class: "invitations-link" %>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
|
|||||||
@@ -1,6 +1,15 @@
|
|||||||
class Management::MenuComponent < ApplicationComponent
|
class Management::MenuComponent < ApplicationComponent
|
||||||
use_helpers :managed_user, :link_list
|
use_helpers :managed_user, :link_list
|
||||||
|
|
||||||
|
def links
|
||||||
|
[
|
||||||
|
user_links,
|
||||||
|
(print_investments_link if Setting["process.budgets"]),
|
||||||
|
print_proposals_link,
|
||||||
|
user_invites_link
|
||||||
|
]
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def user_links
|
def user_links
|
||||||
@@ -73,6 +82,33 @@ class Management::MenuComponent < ApplicationComponent
|
|||||||
]
|
]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def print_investments_link
|
||||||
|
[
|
||||||
|
t("management.menu.print_budget_investments"),
|
||||||
|
print_investments_management_budgets_path,
|
||||||
|
print_investments?,
|
||||||
|
class: "print-investments-link"
|
||||||
|
]
|
||||||
|
end
|
||||||
|
|
||||||
|
def print_proposals_link
|
||||||
|
[
|
||||||
|
t("management.menu.print_proposals"),
|
||||||
|
print_management_proposals_path,
|
||||||
|
print_proposals?,
|
||||||
|
class: "print-proposals-link"
|
||||||
|
]
|
||||||
|
end
|
||||||
|
|
||||||
|
def user_invites_link
|
||||||
|
[
|
||||||
|
t("management.menu.user_invites"),
|
||||||
|
new_management_user_invite_path,
|
||||||
|
user_invites?,
|
||||||
|
class: "invitations-link"
|
||||||
|
]
|
||||||
|
end
|
||||||
|
|
||||||
def users?
|
def users?
|
||||||
["users", "email_verifications", "document_verifications"].include?(controller_name)
|
["users", "email_verifications", "document_verifications"].include?(controller_name)
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user