removes routes locale constrain and fixes some bugs
This commit is contained in:
parent
60c4c5510a
commit
0061e45198
5 changed files with 185 additions and 187 deletions
|
@ -43,6 +43,7 @@ class User < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
after_save do
|
after_save do
|
||||||
|
return if settings_attributes.nil?
|
||||||
settings_attributes.each do |key, value|
|
settings_attributes.each do |key, value|
|
||||||
value.each do |k, v|
|
value.each do |k, v|
|
||||||
case v
|
case v
|
||||||
|
|
|
@ -20,10 +20,10 @@
|
||||||
.well
|
.well
|
||||||
%h4= t '.preference'
|
%h4= t '.preference'
|
||||||
%table.table
|
%table.table
|
||||||
- for setting in User::setting_keys.keys
|
- @user.settings.profile.each do |key, setting|
|
||||||
%tr
|
%tr
|
||||||
%td= User::setting_keys[setting]
|
%td= t("simple_form.labels.settings.profile.#{key}")
|
||||||
%td= @user.settings[setting] == '1' ? t('simple_form.yes') : t('simple_form.no')
|
%td= (setting != true and setting != false) ? setting : (setting === true ? t('simple_form.yes') : t('simple_form.no'))
|
||||||
.span3
|
.span3
|
||||||
.well
|
.well
|
||||||
%h4= t '.groupabos'
|
%h4= t '.groupabos'
|
||||||
|
|
|
@ -14,9 +14,9 @@
|
||||||
- for user in @users
|
- for user in @users
|
||||||
%tr
|
%tr
|
||||||
%td= user.nick
|
%td= user.nick
|
||||||
%td= user.name if @current_user.role_admin? || user.settings["profile.nameIsPublic"] == '1'
|
%td= user.name if @current_user.role_admin? || user.settings.profile["name_is_public"]
|
||||||
%td= user.email if @current_user.role_admin? || user.settings["profile.emailIsPublic"] == '1'
|
%td= user.email if @current_user.role_admin? || user.settings.profile["email_is_public"]
|
||||||
%td= user.phone if @current_user.role_admin? || user.settings["profile.phoneIsPublic"] == '1'
|
%td= user.phone if @current_user.role_admin? || user.settings.profile["phone_is_public"]
|
||||||
%td= user.ordergroup_name
|
%td= user.ordergroup_name
|
||||||
%td= user.workgroups.collect(&:name).join(', ')
|
%td= user.workgroups.collect(&:name).join(', ')
|
||||||
%td= link_to_new_message(message_params: {mail_to: user.id})
|
%td= link_to_new_message(message_params: {mail_to: user.id})
|
||||||
|
|
309
config/routes.rb
309
config/routes.rb
|
@ -8,187 +8,184 @@ Foodsoft::Application.routes.draw do
|
||||||
|
|
||||||
root :to => redirect("/#{FoodsoftConfig.scope}")
|
root :to => redirect("/#{FoodsoftConfig.scope}")
|
||||||
|
|
||||||
constraints(locale: /[a-z]{2}/) do
|
|
||||||
scope "(:locale)" do
|
|
||||||
scope '/:foodcoop' do
|
|
||||||
|
|
||||||
# Root path
|
scope '/:foodcoop' do
|
||||||
root :to => 'home#index'
|
|
||||||
|
|
||||||
########### Sessions
|
# Root path
|
||||||
|
root :to => 'home#index'
|
||||||
|
|
||||||
match '/login' => 'sessions#new', :as => 'login'
|
########### Sessions
|
||||||
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
|
|
||||||
match '/login/accept_invitation/:token' => 'login#accept_invitation', as: :accept_invitation
|
|
||||||
resources :sessions, :only => [:new, :create, :destroy]
|
|
||||||
|
|
||||||
########### User specific
|
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
|
||||||
|
match '/login/accept_invitation/:token' => 'login#accept_invitation', as: :accept_invitation
|
||||||
|
resources :sessions, :only => [:new, :create, :destroy]
|
||||||
|
|
||||||
match '/home/profile' => 'home#profile', :as => 'my_profile'
|
########### User specific
|
||||||
match '/home/ordergroup' => 'home#ordergroup', :as => 'my_ordergroup'
|
|
||||||
match '/home/cancel_membership' => 'home#cancel_membership', :as => 'cancel_membership'
|
|
||||||
|
|
||||||
############ Wiki
|
match '/home/profile' => 'home#profile', :as => 'my_profile'
|
||||||
|
match '/home/ordergroup' => 'home#ordergroup', :as => 'my_ordergroup'
|
||||||
|
match '/home/cancel_membership' => 'home#cancel_membership', :as => 'cancel_membership'
|
||||||
|
|
||||||
resources :pages do
|
############ Wiki
|
||||||
get :all, :on => :collection
|
|
||||||
get :version, :on => :member
|
resources :pages do
|
||||||
get :revert, :on => :member
|
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
|
||||||
|
member do
|
||||||
|
post :finish
|
||||||
|
post :add_comment
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
resources :group_orders do
|
||||||
|
get :archive, :on => :collection
|
||||||
|
end
|
||||||
|
|
||||||
|
resources :order_comments, :only => [:new, :create]
|
||||||
|
|
||||||
|
############ Foodcoop orga
|
||||||
|
|
||||||
|
resources :invites, :only => [:new, :create]
|
||||||
|
|
||||||
|
resources :tasks do
|
||||||
|
collection do
|
||||||
|
get :user
|
||||||
|
get :archive
|
||||||
|
get :workgroup
|
||||||
|
end
|
||||||
|
member do
|
||||||
|
post :accept
|
||||||
|
post :reject
|
||||||
|
post :set_done
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
resources :messages, :only => [:index, :show, :new, :create]
|
||||||
|
|
||||||
|
namespace :foodcoop do
|
||||||
|
root :to => 'users#index'
|
||||||
|
|
||||||
|
resources :users, :only => [:index]
|
||||||
|
|
||||||
|
resources :ordergroups, :only => [:index]
|
||||||
|
|
||||||
|
resources :workgroups, :only => [:index, :edit, :update]
|
||||||
|
end
|
||||||
|
|
||||||
|
########### Article management
|
||||||
|
|
||||||
|
resources :stock_takings do
|
||||||
|
collection do
|
||||||
|
get :fill_new_stock_article_form
|
||||||
|
post :add_stock_article
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
resources :stock_articles, :to => 'stockit' do
|
||||||
|
collection do
|
||||||
|
get :articles_search
|
||||||
|
get :fill_new_stock_article_form
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
resources :suppliers do
|
||||||
|
get :shared_suppliers, :on => :collection
|
||||||
|
|
||||||
|
resources :deliveries do
|
||||||
|
post :drop_stock_change, :on => :member
|
||||||
|
post :add_stock_article, :on => :collection
|
||||||
|
end
|
||||||
|
|
||||||
|
resources :articles do
|
||||||
|
collection do
|
||||||
|
post :update_selected
|
||||||
|
get :edit_all
|
||||||
|
post :update_all
|
||||||
|
get :upload
|
||||||
|
post :parse_upload
|
||||||
|
post :create_from_upload
|
||||||
|
get :shared
|
||||||
|
get :import
|
||||||
|
post :sync
|
||||||
|
post :update_synchronized
|
||||||
end
|
end
|
||||||
match '/wiki/:permalink' => 'pages#show', :as => 'wiki_page' # , :constraints => {:permalink => /[^\s]+/}
|
end
|
||||||
match '/wiki' => 'pages#show', :defaults => {:permalink => 'Home'}, :as => 'wiki'
|
end
|
||||||
|
|
||||||
############ Orders, ordering
|
resources :article_categories
|
||||||
|
|
||||||
resources :orders do
|
########### Finance
|
||||||
member do
|
|
||||||
post :finish
|
namespace :finance do
|
||||||
post :add_comment
|
root :to => 'base#index'
|
||||||
end
|
|
||||||
|
resources :order, controller: 'balancing', path: 'balancing' do
|
||||||
|
member do
|
||||||
|
get :update_summary
|
||||||
|
get :edit_note
|
||||||
|
put :update_note
|
||||||
|
|
||||||
|
get :confirm
|
||||||
|
put :close
|
||||||
|
put :close_direct
|
||||||
end
|
end
|
||||||
|
|
||||||
resources :group_orders do
|
resources :order_articles
|
||||||
get :archive, :on => :collection
|
end
|
||||||
|
|
||||||
|
resources :group_order_articles do
|
||||||
|
member do
|
||||||
|
put :update_result
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
resources :order_comments, :only => [:new, :create]
|
resources :invoices
|
||||||
|
|
||||||
############ Foodcoop orga
|
resources :ordergroups, :only => [:index] do
|
||||||
|
resources :financial_transactions, :as => :transactions
|
||||||
|
end
|
||||||
|
|
||||||
resources :invites, :only => [:new, :create]
|
get 'transactions/new_collection' => 'financial_transactions#new_collection', :as => 'new_transaction_collection'
|
||||||
|
post 'transactions/create_collection' => 'financial_transactions#create_collection', :as => 'create_transaction_collection'
|
||||||
|
end
|
||||||
|
|
||||||
resources :tasks do
|
########### Administration
|
||||||
collection do
|
|
||||||
get :user
|
|
||||||
get :archive
|
|
||||||
get :workgroup
|
|
||||||
end
|
|
||||||
member do
|
|
||||||
post :accept
|
|
||||||
post :reject
|
|
||||||
post :set_done
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
resources :messages, :only => [:index, :show, :new, :create]
|
namespace :admin do
|
||||||
|
root :to => 'base#index'
|
||||||
|
|
||||||
namespace :foodcoop do
|
resources :users
|
||||||
root :to => 'users#index'
|
|
||||||
|
|
||||||
resources :users, :only => [:index]
|
resources :workgroups do
|
||||||
|
get :memberships, :on => :member
|
||||||
|
end
|
||||||
|
|
||||||
resources :ordergroups, :only => [:index]
|
resources :ordergroups do
|
||||||
|
get :memberships, :on => :member
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
resources :workgroups, :only => [:index, :edit, :update]
|
############## Feedback
|
||||||
end
|
|
||||||
|
|
||||||
########### Article management
|
resource :feedback, :only => [:new, :create], :controller => 'feedback'
|
||||||
|
|
||||||
resources :stock_takings do
|
############## The rest
|
||||||
collection do
|
|
||||||
get :fill_new_stock_article_form
|
|
||||||
post :add_stock_article
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
resources :stock_articles, :to => 'stockit' do
|
resources :users, :only => [:index]
|
||||||
collection do
|
|
||||||
get :articles_search
|
|
||||||
get :fill_new_stock_article_form
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
resources :suppliers do
|
# TODO: This is very error prone. Better deactivate this catch all route
|
||||||
get :shared_suppliers, :on => :collection
|
match ':controller(/:action(/:id))(.:format)'
|
||||||
|
|
||||||
resources :deliveries do
|
end # End of /:foodcoop scope
|
||||||
post :drop_stock_change, :on => :member
|
|
||||||
post :add_stock_article, :on => :collection
|
|
||||||
end
|
|
||||||
|
|
||||||
resources :articles do
|
|
||||||
collection do
|
|
||||||
post :update_selected
|
|
||||||
get :edit_all
|
|
||||||
post :update_all
|
|
||||||
get :upload
|
|
||||||
post :parse_upload
|
|
||||||
post :create_from_upload
|
|
||||||
get :shared
|
|
||||||
get :import
|
|
||||||
post :sync
|
|
||||||
post :update_synchronized
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
resources :article_categories
|
|
||||||
|
|
||||||
########### Finance
|
|
||||||
|
|
||||||
namespace :finance do
|
|
||||||
root :to => 'base#index'
|
|
||||||
|
|
||||||
resources :order, controller: 'balancing', path: 'balancing' do
|
|
||||||
member do
|
|
||||||
get :update_summary
|
|
||||||
get :edit_note
|
|
||||||
put :update_note
|
|
||||||
|
|
||||||
get :confirm
|
|
||||||
put :close
|
|
||||||
put :close_direct
|
|
||||||
end
|
|
||||||
|
|
||||||
resources :order_articles
|
|
||||||
end
|
|
||||||
|
|
||||||
resources :group_order_articles do
|
|
||||||
member do
|
|
||||||
put :update_result
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
resources :invoices
|
|
||||||
|
|
||||||
resources :ordergroups, :only => [:index] do
|
|
||||||
resources :financial_transactions, :as => :transactions
|
|
||||||
end
|
|
||||||
|
|
||||||
get 'transactions/new_collection' => 'financial_transactions#new_collection', :as => 'new_transaction_collection'
|
|
||||||
post 'transactions/create_collection' => 'financial_transactions#create_collection', :as => 'create_transaction_collection'
|
|
||||||
end
|
|
||||||
|
|
||||||
########### Administration
|
|
||||||
|
|
||||||
namespace :admin do
|
|
||||||
root :to => 'base#index'
|
|
||||||
|
|
||||||
resources :users
|
|
||||||
|
|
||||||
resources :workgroups do
|
|
||||||
get :memberships, :on => :member
|
|
||||||
end
|
|
||||||
|
|
||||||
resources :ordergroups do
|
|
||||||
get :memberships, :on => :member
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
############## Feedback
|
|
||||||
|
|
||||||
resource :feedback, :only => [:new, :create], :controller => 'feedback'
|
|
||||||
|
|
||||||
############## The rest
|
|
||||||
|
|
||||||
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 # End of /:locale scope
|
|
||||||
end # End of :locale constraints
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue