2012-10-06 17:14:57 +02:00
|
|
|
# Configures your navigation
|
2013-02-22 00:37:17 +01:00
|
|
|
|
2012-10-06 17:14:57 +02:00
|
|
|
SimpleNavigation::Configuration.run do |navigation|
|
2013-10-29 21:47:36 +01:00
|
|
|
# allow engines to add to the menu - https://gist.github.com/mjtko/4873ee0c112b6bd646f8
|
2014-02-20 15:04:53 +01:00
|
|
|
engines = Rails::Engine.subclasses.map(&:instance).select { |e| e.respond_to?(:navigation) }
|
2013-10-29 21:47:36 +01:00
|
|
|
# to include an engine but keep it from modifying the menu:
|
2021-03-01 15:27:26 +01:00
|
|
|
# engines.reject! { |e| e.instance_of? FoodsoftMyplugin::Engine }
|
2013-10-29 21:47:36 +01:00
|
|
|
|
2012-10-06 17:14:57 +02:00
|
|
|
navigation.items do |primary|
|
|
|
|
primary.dom_class = 'nav'
|
|
|
|
|
2013-02-22 00:37:17 +01:00
|
|
|
primary.item :dashboard_nav_item, I18n.t('navigation.dashboard'), root_path(anchor: '')
|
2012-11-24 15:23:12 +01:00
|
|
|
|
2014-03-20 19:11:37 +01:00
|
|
|
primary.item :foodcoop, I18n.t('navigation.foodcoop'), '#' do |subnav|
|
|
|
|
subnav.item :members, I18n.t('navigation.members'), foodcoop_users_path
|
|
|
|
subnav.item :workgroups, I18n.t('navigation.workgroups'), foodcoop_workgroups_path
|
|
|
|
subnav.item :ordergroups, I18n.t('navigation.ordergroups'), foodcoop_ordergroups_path
|
|
|
|
subnav.item :tasks, I18n.t('navigation.tasks'), tasks_path
|
2012-10-06 17:14:57 +02:00
|
|
|
end
|
|
|
|
|
2014-03-20 19:11:37 +01:00
|
|
|
primary.item :orders, I18n.t('navigation.orders.title'), '#' do |subnav|
|
|
|
|
subnav.item :ordering, I18n.t('navigation.orders.ordering'), group_orders_path
|
|
|
|
subnav.item :ordering_archive, I18n.t('navigation.orders.archive'), archive_group_orders_path
|
2023-05-12 13:01:12 +02:00
|
|
|
subnav.item :orders, I18n.t('navigation.orders.manage'), orders_path, if: proc { current_user.role_orders? }
|
|
|
|
subnav.item :pickups, I18n.t('navigation.orders.pickups'), pickups_path, if: proc {
|
|
|
|
current_user.role_pickups?
|
|
|
|
}
|
2012-10-06 17:14:57 +02:00
|
|
|
end
|
|
|
|
|
2014-03-20 19:11:37 +01:00
|
|
|
primary.item :articles, I18n.t('navigation.articles.title'), '#',
|
2023-05-12 13:01:12 +02:00
|
|
|
if: proc { current_user.role_article_meta? or current_user.role_suppliers? } do |subnav|
|
2014-03-20 19:11:37 +01:00
|
|
|
subnav.item :suppliers, I18n.t('navigation.articles.suppliers'), suppliers_path
|
|
|
|
subnav.item :stockit, I18n.t('navigation.articles.stock'), stock_articles_path
|
|
|
|
subnav.item :categories, I18n.t('navigation.articles.categories'), article_categories_path
|
2012-10-06 17:14:57 +02:00
|
|
|
end
|
|
|
|
|
2023-05-12 13:01:12 +02:00
|
|
|
primary.item :finance, I18n.t('navigation.finances.title'), '#', if: proc {
|
|
|
|
current_user.role_finance? || current_user.role_invoices?
|
|
|
|
} do |subnav|
|
|
|
|
subnav.item :finance_home, I18n.t('navigation.finances.home'), finance_root_path, if: proc {
|
|
|
|
current_user.role_finance?
|
|
|
|
}
|
|
|
|
subnav.item :finance_home, I18n.t('navigation.finances.bank_accounts'), finance_bank_accounts_path, if: proc {
|
|
|
|
current_user.role_finance?
|
|
|
|
}
|
|
|
|
subnav.item :accounts, I18n.t('navigation.finances.accounts'), finance_ordergroups_path, if: proc {
|
|
|
|
current_user.role_finance?
|
|
|
|
}
|
|
|
|
subnav.item :balancing, I18n.t('navigation.finances.balancing'), finance_order_index_path, if: proc {
|
|
|
|
current_user.role_finance?
|
|
|
|
}
|
2014-03-20 19:11:37 +01:00
|
|
|
subnav.item :invoices, I18n.t('navigation.finances.invoices'), finance_invoices_path
|
2012-10-06 17:14:57 +02:00
|
|
|
end
|
|
|
|
|
2023-05-12 13:01:12 +02:00
|
|
|
primary.item :admin, I18n.t('navigation.admin.title'), '#', if: proc { current_user.role_admin? } do |subnav|
|
2013-02-22 00:37:17 +01:00
|
|
|
subnav.item :admin_home, I18n.t('navigation.admin.home'), admin_root_path
|
2014-03-20 19:11:37 +01:00
|
|
|
subnav.item :users, I18n.t('navigation.admin.users'), admin_users_path
|
|
|
|
subnav.item :ordergroups, I18n.t('navigation.admin.ordergroups'), admin_ordergroups_path
|
|
|
|
subnav.item :workgroups, I18n.t('navigation.admin.workgroups'), admin_workgroups_path
|
2023-05-12 13:01:12 +02:00
|
|
|
subnav.item :mail_delivery_status, I18n.t('navigation.admin.mail_delivery_status'),
|
|
|
|
admin_mail_delivery_status_index_path
|
2017-06-28 12:56:56 +02:00
|
|
|
subnav.item :finances, I18n.t('navigation.admin.finance'), admin_finances_path
|
2014-03-16 02:08:15 +01:00
|
|
|
subnav.item :config, I18n.t('navigation.admin.config'), admin_config_path
|
2012-10-06 17:14:57 +02:00
|
|
|
end
|
2013-10-29 21:47:36 +01:00
|
|
|
|
|
|
|
engines.each { |e| e.navigation(primary, self) }
|
2012-10-06 17:14:57 +02:00
|
|
|
end
|
|
|
|
end
|