Merge pull request #194 from foodcoop-adam/plugin-move
Better support for plugins (engines) + move wiki to plugin
This commit is contained in:
commit
bb5a67033d
36 changed files with 185 additions and 37 deletions
|
|
@ -3,6 +3,11 @@
|
|||
|
||||
SimpleNavigation::Configuration.run do |navigation|
|
||||
|
||||
# allow engines to add to the menu - https://gist.github.com/mjtko/4873ee0c112b6bd646f8
|
||||
engines = Rails.application.railties.engines.select { |e| e.respond_to?(:navigation) }
|
||||
# to include an engine but keep it from modifying the menu:
|
||||
#engines.reject! { |e| e.instance_of? FoodsoftMyplugin::Engine }
|
||||
|
||||
navigation.items do |primary|
|
||||
primary.dom_class = 'nav'
|
||||
|
||||
|
|
@ -16,11 +21,6 @@ SimpleNavigation::Configuration.run do |navigation|
|
|||
subnav.item :tasks, I18n.t('navigation.tasks'), tasks_path, id: nil
|
||||
end
|
||||
|
||||
primary.item :wiki, I18n.t('navigation.wiki.title'), '#', id: nil do |subnav|
|
||||
subnav.item :wiki_home, I18n.t('navigation.wiki.home'), wiki_path, id: nil
|
||||
subnav.item :all_pages, I18n.t('navigation.wiki.all_pages'), all_pages_path, id: nil
|
||||
end
|
||||
|
||||
primary.item :orders, I18n.t('navigation.orders.title'), '#', id: nil do |subnav|
|
||||
subnav.item :ordering, I18n.t('navigation.orders.ordering'), group_orders_path, id: nil
|
||||
subnav.item :ordering_archive, I18n.t('navigation.orders.archive'), archive_group_orders_path, id: nil
|
||||
|
|
@ -47,6 +47,8 @@ SimpleNavigation::Configuration.run do |navigation|
|
|||
subnav.item :ordergroups, I18n.t('navigation.admin.ordergroups'), admin_ordergroups_path, id: nil
|
||||
subnav.item :workgroups, I18n.t('navigation.admin.workgroups'), admin_workgroups_path, id: nil
|
||||
end
|
||||
|
||||
engines.each { |e| e.navigation(primary, self) }
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
|
|
@ -18,27 +18,20 @@ Foodsoft::Application.routes.draw do
|
|||
|
||||
match '/login' => 'sessions#new', :as => 'login'
|
||||
match '/logout' => 'sessions#destroy', :as => 'logout'
|
||||
get '/login/forgot_password' => 'login#forgot_password', as: :forgot_password
|
||||
get '/login/new_password' => 'login#new_password', as: :new_password
|
||||
get '/login/forgot_password' => 'login#forgot_password', as: :forgot_password
|
||||
post '/login/reset_password' => 'login#reset_password', as: :reset_password
|
||||
get '/login/new_password' => 'login#new_password', as: :new_password
|
||||
get '/login/update_password' => 'login#update_password', as: :update_password
|
||||
match '/login/accept_invitation/:token' => 'login#accept_invitation', as: :accept_invitation
|
||||
resources :sessions, :only => [:new, :create, :destroy]
|
||||
|
||||
########### User specific
|
||||
|
||||
match '/home/profile' => 'home#profile', :as => 'my_profile'
|
||||
put '/home/update_profile' => 'home#update_profile', :as => 'update_profile'
|
||||
match '/home/ordergroup' => 'home#ordergroup', :as => 'my_ordergroup'
|
||||
match '/home/cancel_membership' => 'home#cancel_membership', :as => 'cancel_membership'
|
||||
|
||||
############ Wiki
|
||||
|
||||
resources :pages do
|
||||
get :all, :on => :collection
|
||||
get :version, :on => :member
|
||||
get :revert, :on => :member
|
||||
end
|
||||
match '/wiki/:permalink' => 'pages#show', :as => 'wiki_page' # , :constraints => {:permalink => /[^\s]+/}
|
||||
match '/wiki' => 'pages#show', :defaults => {:permalink => 'Home'}, :as => 'wiki'
|
||||
|
||||
############ Orders, ordering
|
||||
|
||||
resources :orders do
|
||||
|
|
@ -191,8 +184,5 @@ Foodsoft::Application.routes.draw do
|
|||
|
||||
resources :users, :only => [:index]
|
||||
|
||||
# TODO: This is very error prone. Better deactivate this catch all route
|
||||
match ':controller(/:action(/:id))(.:format)'
|
||||
|
||||
end # End of /:foodcoop scope
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue