removes routes locale constrain and fixes some bugs

This commit is contained in:
Manuel Wiedenmann 2013-06-06 04:29:53 +02:00
parent 60c4c5510a
commit 0061e45198
5 changed files with 185 additions and 187 deletions

View file

@ -43,6 +43,7 @@ class User < ActiveRecord::Base
end
after_save do
return if settings_attributes.nil?
settings_attributes.each do |key, value|
value.each do |k, v|
case v

View file

@ -20,10 +20,10 @@
.well
%h4= t '.preference'
%table.table
- for setting in User::setting_keys.keys
- @user.settings.profile.each do |key, setting|
%tr
%td= User::setting_keys[setting]
%td= @user.settings[setting] == '1' ? t('simple_form.yes') : t('simple_form.no')
%td= t("simple_form.labels.settings.profile.#{key}")
%td= (setting != true and setting != false) ? setting : (setting === true ? t('simple_form.yes') : t('simple_form.no'))
.span3
.well
%h4= t '.groupabos'

View file

@ -14,9 +14,9 @@
- for user in @users
%tr
%td= user.nick
%td= user.name if @current_user.role_admin? || user.settings["profile.nameIsPublic"] == '1'
%td= user.email if @current_user.role_admin? || user.settings["profile.emailIsPublic"] == '1'
%td= user.phone if @current_user.role_admin? || user.settings["profile.phoneIsPublic"] == '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["email_is_public"]
%td= user.phone if @current_user.role_admin? || user.settings.profile["phone_is_public"]
%td= user.ordergroup_name
%td= user.workgroups.collect(&:name).join(', ')
%td= link_to_new_message(message_params: {mail_to: user.id})

View file

@ -8,187 +8,184 @@ Foodsoft::Application.routes.draw do
root :to => redirect("/#{FoodsoftConfig.scope}")
constraints(locale: /[a-z]{2}/) do
scope "(:locale)" do
scope '/:foodcoop' do
# Root path
root :to => 'home#index'
scope '/:foodcoop' do
########### Sessions
# Root path
root :to => 'home#index'
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]
########### Sessions
########### 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'
match '/home/ordergroup' => 'home#ordergroup', :as => 'my_ordergroup'
match '/home/cancel_membership' => 'home#cancel_membership', :as => 'cancel_membership'
########### User specific
############ 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
get :all, :on => :collection
get :version, :on => :member
get :revert, :on => :member
############ 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
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
match '/wiki/:permalink' => 'pages#show', :as => 'wiki_page' # , :constraints => {:permalink => /[^\s]+/}
match '/wiki' => 'pages#show', :defaults => {:permalink => 'Home'}, :as => 'wiki'
end
end
############ Orders, ordering
resources :article_categories
resources :orders do
member do
post :finish
post :add_comment
end
########### 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 :group_orders do
get :archive, :on => :collection
resources :order_articles
end
resources :group_order_articles do
member do
put :update_result
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
collection do
get :user
get :archive
get :workgroup
end
member do
post :accept
post :reject
post :set_done
end
end
########### Administration
resources :messages, :only => [:index, :show, :new, :create]
namespace :admin do
root :to => 'base#index'
namespace :foodcoop do
root :to => 'users#index'
resources :users
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]
end
############## Feedback
########### Article management
resource :feedback, :only => [:new, :create], :controller => 'feedback'
resources :stock_takings do
collection do
get :fill_new_stock_article_form
post :add_stock_article
end
end
############## The rest
resources :stock_articles, :to => 'stockit' do
collection do
get :articles_search
get :fill_new_stock_article_form
end
end
resources :users, :only => [:index]
resources :suppliers do
get :shared_suppliers, :on => :collection
# TODO: This is very error prone. Better deactivate this catch all route
match ':controller(/:action(/:id))(.:format)'
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
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 of /:foodcoop scope
end