Extract methods in admin menu component

Now that there's no naming confict with the helper method used in the
ProposalsDashboardHelper, we can easily simplify the view, moving the
logic to the Ruby class.
This commit is contained in:
Javi Martín
2020-06-20 14:41:35 +02:00
parent 60b3ca000a
commit e3bca85321
2 changed files with 9 additions and 2 deletions

View File

@@ -57,4 +57,12 @@ class Admin::MenuComponent < ApplicationComponent
controller_name == "local_census_records" ||
(controller_name == "imports" && controller.class.parent == Admin::LocalCensusRecords)
end
def messages_menu_active?
messages_sections.include?(controller_name)
end
def messages_sections
%w[newsletters emails_download admin_notifications system_emails]
end
end