Reorganizes manager menu and creates helper
This commit is contained in:
46
app/helpers/management_helper.rb
Normal file
46
app/helpers/management_helper.rb
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
module ManagementHelper
|
||||||
|
|
||||||
|
def menu_users?
|
||||||
|
["users", "email_verifications", "document_verifications"].include?(controller_name)
|
||||||
|
end
|
||||||
|
|
||||||
|
def menu_edit_password_email?
|
||||||
|
controller_name == "account" && action_name == "edit_password_email"
|
||||||
|
end
|
||||||
|
|
||||||
|
def menu_edit_password_manually?
|
||||||
|
controller_name == "account" && action_name == "edit_password_manually"
|
||||||
|
end
|
||||||
|
|
||||||
|
def menu_create_proposal?
|
||||||
|
controller_name == "proposals" && action_name == "new"
|
||||||
|
end
|
||||||
|
|
||||||
|
def menu_support_proposal?
|
||||||
|
controller_name == "proposals" && action_name == "index"
|
||||||
|
end
|
||||||
|
|
||||||
|
def menu_print_proposals?
|
||||||
|
controller_name == "proposals" && action_name == "print"
|
||||||
|
end
|
||||||
|
|
||||||
|
def menu_create_investments?
|
||||||
|
(controller_name == "budget_investments" && action_name == "new") ||
|
||||||
|
(controller_name == "budgets" && action_name == "create_investments")
|
||||||
|
end
|
||||||
|
|
||||||
|
def menu_support_investments?
|
||||||
|
(controller_name == "budget_investments" && action_name == "index") ||
|
||||||
|
(controller_name == "budgets" && action_name == "support_investments")
|
||||||
|
end
|
||||||
|
|
||||||
|
def menu_print_investments?
|
||||||
|
(controller_name == "budget_investments" && action_name == "print") ||
|
||||||
|
(controller_name == "budgets" && action_name == "print_investments")
|
||||||
|
end
|
||||||
|
|
||||||
|
def menu_user_invites?
|
||||||
|
controller_name == "user_invites"
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
@@ -1,45 +1,72 @@
|
|||||||
<div class="admin-sidebar">
|
<div class="admin-sidebar">
|
||||||
<ul id="admin_menu" data-accordion-menu data-multi-open="false">
|
<ul id="admin_menu" data-accordion-menu>
|
||||||
<li <%= "class=is-active" if controller_name == "document_verifications" ||
|
|
||||||
controller_name == "email_verifications" ||
|
|
||||||
controller_name == "users" %>>
|
|
||||||
<%= link_to management_document_verifications_path do %>
|
|
||||||
<span class="icon-user"></span>
|
|
||||||
<%= t("management.menu.users") %>
|
|
||||||
<% end %>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<li class="section-title">
|
<li class="section-title">
|
||||||
<a href="#">
|
<a href="#">
|
||||||
<span class="icon-user"></span>
|
<span class="icon-user"></span>
|
||||||
<strong><%= t("management.menu.edit_user_accounts") %></strong>
|
<strong><%= t("management.menu.users") %></strong>
|
||||||
</a>
|
</a>
|
||||||
<ul <%= "class=is-active" if controller_name == "account" %>>
|
<ul class="is-active">
|
||||||
|
|
||||||
|
<li <%= "class=is-active" if menu_users? %>>
|
||||||
|
<%= link_to t("management.menu.select_user"), management_document_verifications_path %>
|
||||||
|
</li>
|
||||||
|
|
||||||
<% if managed_user.email %>
|
<% if managed_user.email %>
|
||||||
<li>
|
<li <%= "class=is-active" if menu_edit_password_email? %>>
|
||||||
<%= link_to t("management.account.menu.reset_password_email"), edit_password_email_management_account_path %>
|
<%= link_to t("management.account.menu.reset_password_email"), edit_password_email_management_account_path %>
|
||||||
</li>
|
</li>
|
||||||
<% end %>
|
<% end %>
|
||||||
<li>
|
|
||||||
|
<li <%= "class=is-active" if menu_edit_password_manually? %>>
|
||||||
<%= link_to t("management.account.menu.reset_password_manually"), edit_password_manually_management_account_path %>
|
<%= link_to t("management.account.menu.reset_password_manually"), edit_password_manually_management_account_path %>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
|
<li <%= "class=is-active" if menu_create_proposal? %>>
|
||||||
|
<%= link_to t("management.menu.create_proposal"), new_management_proposal_path %>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li <%= "class=is-active" if menu_support_proposal? %>>
|
||||||
|
<%= link_to t("management.menu.support_proposals"), management_proposals_path %>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<% if Setting['feature.budgets'] %>
|
||||||
|
<li <%= "class=is-active" if menu_create_investments? %>>
|
||||||
|
<%= link_to t("management.menu.create_budget_investment"), create_investments_management_budgets_path %>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li <%= "class=is-active" if menu_support_investments? %>>
|
||||||
|
<%= link_to t("management.menu.support_budget_investments"), support_investments_management_budgets_path %>
|
||||||
|
</li>
|
||||||
|
<% end %>
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li <%= "class=is-active" if controller_name == "proposals" && action_name == "new" %>>
|
<% if Setting['feature.budgets'] %>
|
||||||
<%= link_to new_management_proposal_path do %>
|
<li <%= "class=is-active" if menu_print_investments? %>>
|
||||||
<span class="icon-proposals"></span>
|
<%= link_to print_investments_management_budgets_path do %>
|
||||||
<%= t("management.menu.create_proposal") %>
|
<span class="icon-print"></span>
|
||||||
|
<%= t("management.menu.print_budget_investments") %>
|
||||||
|
<% end %>
|
||||||
|
</li>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<li <%= "class=is-active" if menu_print_proposals? %>>
|
||||||
|
<%= link_to print_management_proposals_path do %>
|
||||||
|
<span class="icon-print"></span>
|
||||||
|
<%= t("management.menu.print_proposals") %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li <%= "class=is-active" if controller_name == "proposals" && action_name == "index" %>>
|
<li <%= "class=is-active" if menu_user_invites? %>>
|
||||||
<%= link_to management_proposals_path do %>
|
<%= link_to new_management_user_invite_path do %>
|
||||||
<span class="icon-like"></span>
|
<span class="icon-letter"></span>
|
||||||
<%= t("management.menu.support_proposals") %>
|
<%= t("management.menu.user_invites") %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
|
<%# temporarily commenting until obsolete spending_proposals is removed %>
|
||||||
|
<% if false %>
|
||||||
<li <%= "class=is-active" if controller_name == "spending_proposals" && action_name == "new" %>>
|
<li <%= "class=is-active" if controller_name == "spending_proposals" && action_name == "new" %>>
|
||||||
<%= link_to new_management_spending_proposal_path do %>
|
<%= link_to new_management_spending_proposal_path do %>
|
||||||
<span class="icon-budget"></span>
|
<span class="icon-budget"></span>
|
||||||
@@ -54,51 +81,12 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<% if Setting['feature.budgets'] %>
|
|
||||||
<li <%= "class=is-active" if (controller_name == "budget_investments" && action_name == "new") ||
|
|
||||||
(controller_name == "budget" && action_name == 'create_investments') %>>
|
|
||||||
<%= link_to create_investments_management_budgets_path do %>
|
|
||||||
<span class="icon-budget"></span>
|
|
||||||
<%= t("management.menu.create_budget_investment") %>
|
|
||||||
<% end %>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<li <%= "class=is-active" if (controller_name == "budget_investments" && action_name == "index") ||
|
|
||||||
(controller_name == "budget" && action_name == "support_investments")%>>
|
|
||||||
<%= link_to support_investments_management_budgets_path do %>
|
|
||||||
<span class="icon-like"></span>
|
|
||||||
<%= t("management.menu.support_budget_investments") %>
|
|
||||||
<% end %>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<li <%= "class=is-active" if (controller_name == "budget_investments" && action_name == "print") ||
|
|
||||||
(controller_name == "budgets" && action_name == "print_investments") %>>
|
|
||||||
<%= link_to print_investments_management_budgets_path do %>
|
|
||||||
<span class="icon-print"></span>
|
|
||||||
<%= t("management.menu.print_budget_investments") %>
|
|
||||||
<% end %>
|
|
||||||
</li>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<li <%= "class=is-active" if controller_name == "proposals" && action_name == "print" %>>
|
|
||||||
<%= link_to print_management_proposals_path do %>
|
|
||||||
<span class="icon-print"></span>
|
|
||||||
<%= t("management.menu.print_proposals") %>
|
|
||||||
<% end %>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<li <%= "class=is-active" if controller_name == "spending_proposals" && action_name == "print" %>>
|
<li <%= "class=is-active" if controller_name == "spending_proposals" && action_name == "print" %>>
|
||||||
<%= link_to print_management_spending_proposals_path do %>
|
<%= link_to print_management_spending_proposals_path do %>
|
||||||
<span class="icon-print"></span>
|
<span class="icon-print"></span>
|
||||||
<%= t("management.menu.print_spending_proposals") %>
|
<%= t("management.menu.print_spending_proposals") %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li>
|
|
||||||
<%= link_to new_management_user_invite_path do %>
|
|
||||||
<span class="icon-letter"></span>
|
|
||||||
<%= t("management.menu.user_invites") %>
|
|
||||||
<% end %>
|
<% end %>
|
||||||
</li>
|
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user