migrate to Rails 4.0 (closes foodcoops#214)
Conflicts: Gemfile.lock
This commit is contained in:
parent
12d1221bfc
commit
7841245795
97 changed files with 659 additions and 557 deletions
|
@ -1,6 +1,6 @@
|
||||||
language: ruby
|
language: ruby
|
||||||
rvm:
|
rvm:
|
||||||
- 1.9.3
|
- 2.0.0
|
||||||
services:
|
services:
|
||||||
- redis-server
|
- redis-server
|
||||||
env: COVERALLS=1
|
env: COVERALLS=1
|
||||||
|
|
31
Gemfile
31
Gemfile
|
@ -1,19 +1,17 @@
|
||||||
# A sample Gemfile
|
# A sample Gemfile
|
||||||
source "https://rubygems.org"
|
source "https://rubygems.org"
|
||||||
ruby "1.9.3"
|
ruby "2.0.0"
|
||||||
|
|
||||||
gem "rails", '~> 3.2.9'
|
gem "rails", '~> 4.0.0'
|
||||||
|
|
||||||
|
|
||||||
|
gem 'sass-rails', '~> 4.0.0'
|
||||||
|
gem 'coffee-rails', '~> 4.0.0'
|
||||||
|
gem 'less-rails'
|
||||||
|
gem 'uglifier', '>= 1.0.3'
|
||||||
|
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
|
||||||
|
gem 'therubyracer', platforms: :ruby
|
||||||
|
|
||||||
# Gems used only for assets and not required
|
|
||||||
# in production environments by default.
|
|
||||||
group :assets do
|
|
||||||
gem 'sass-rails', '~> 3.2.3'
|
|
||||||
gem 'coffee-rails', '~> 3.2.1'
|
|
||||||
gem 'less-rails'
|
|
||||||
gem 'uglifier', '>= 1.0.3'
|
|
||||||
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
|
|
||||||
gem 'therubyracer', platforms: :ruby
|
|
||||||
end
|
|
||||||
|
|
||||||
gem 'jquery-rails'
|
gem 'jquery-rails'
|
||||||
gem 'select2-rails'
|
gem 'select2-rails'
|
||||||
|
@ -27,19 +25,20 @@ gem 'prawn'
|
||||||
gem 'haml-rails'
|
gem 'haml-rails'
|
||||||
gem 'kaminari'
|
gem 'kaminari'
|
||||||
gem 'simple_form'
|
gem 'simple_form'
|
||||||
gem 'client_side_validations'
|
gem 'client_side_validations', git: 'git://github.com/bcardarella/client_side_validations.git', branch: '4-0-beta'
|
||||||
gem 'client_side_validations-simple_form'
|
gem 'client_side_validations-simple_form', git: 'git://github.com/saveritemedical/client_side_validations-simple_form.git'
|
||||||
gem 'inherited_resources'
|
gem 'inherited_resources'
|
||||||
gem 'localize_input', git: "git://github.com/bennibu/localize_input.git"
|
gem 'localize_input', git: "git://github.com/bennibu/localize_input.git"
|
||||||
gem 'daemons'
|
gem 'daemons'
|
||||||
gem 'twitter-bootstrap-rails'
|
gem 'twitter-bootstrap-rails'
|
||||||
gem 'simple-navigation'
|
gem 'simple-navigation'
|
||||||
gem 'simple-navigation-bootstrap'
|
gem 'simple-navigation-bootstrap'
|
||||||
gem 'meta_search'
|
gem 'ransack'
|
||||||
gem 'acts_as_tree'
|
gem 'acts_as_tree'
|
||||||
gem "rails-settings-cached", "0.2.4"
|
gem "rails-settings-cached", "0.3.1"
|
||||||
gem 'resque'
|
gem 'resque'
|
||||||
gem 'whenever', require: false # For defining cronjobs, see config/schedule.rb
|
gem 'whenever', require: false # For defining cronjobs, see config/schedule.rb
|
||||||
|
gem 'protected_attributes'
|
||||||
|
|
||||||
# we use the git version of acts_as_versioned, and need to include it in this Gemfile
|
# we use the git version of acts_as_versioned, and need to include it in this Gemfile
|
||||||
gem 'acts_as_versioned', git: 'git://github.com/technoweenie/acts_as_versioned.git'
|
gem 'acts_as_versioned', git: 'git://github.com/technoweenie/acts_as_versioned.git'
|
||||||
|
|
204
Gemfile.lock
204
Gemfile.lock
|
@ -1,3 +1,10 @@
|
||||||
|
GIT
|
||||||
|
remote: git://github.com/bcardarella/client_side_validations.git
|
||||||
|
revision: 9461cb92e1dfb64895d590c6d435cdf48fcede45
|
||||||
|
branch: 4-0-beta
|
||||||
|
specs:
|
||||||
|
client_side_validations (3.2.2)
|
||||||
|
|
||||||
GIT
|
GIT
|
||||||
remote: git://github.com/bennibu/localize_input.git
|
remote: git://github.com/bennibu/localize_input.git
|
||||||
revision: 5eb188d2525a073d09e142cf8b0b04e6ace6e7b0
|
revision: 5eb188d2525a073d09e142cf8b0b04e6ace6e7b0
|
||||||
|
@ -19,6 +26,14 @@ GIT
|
||||||
i18n-js (2.1.2)
|
i18n-js (2.1.2)
|
||||||
i18n
|
i18n
|
||||||
|
|
||||||
|
GIT
|
||||||
|
remote: git://github.com/saveritemedical/client_side_validations-simple_form.git
|
||||||
|
revision: b97c938be745de1134169026425aa0c990b8b072
|
||||||
|
specs:
|
||||||
|
client_side_validations-simple_form (2.1.0)
|
||||||
|
client_side_validations (~> 3.2.1)
|
||||||
|
simple_form (>= 2.1.0, < 4.0)
|
||||||
|
|
||||||
GIT
|
GIT
|
||||||
remote: git://github.com/technoweenie/acts_as_versioned.git
|
remote: git://github.com/technoweenie/acts_as_versioned.git
|
||||||
revision: 63b1fc8529d028fae632fe80ec0cb25df56cd76b
|
revision: 63b1fc8529d028fae632fe80ec0cb25df56cd76b
|
||||||
|
@ -33,42 +48,40 @@ PATH
|
||||||
acts_as_versioned
|
acts_as_versioned
|
||||||
content_for_in_controllers
|
content_for_in_controllers
|
||||||
diffy
|
diffy
|
||||||
rails (~> 3.2.15)
|
rails
|
||||||
wikicloth
|
wikicloth
|
||||||
|
|
||||||
GEM
|
GEM
|
||||||
remote: https://rubygems.org/
|
remote: https://rubygems.org/
|
||||||
specs:
|
specs:
|
||||||
actionmailer (3.2.17)
|
actionmailer (4.0.3)
|
||||||
actionpack (= 3.2.17)
|
actionpack (= 4.0.3)
|
||||||
mail (~> 2.5.4)
|
mail (~> 2.5.4)
|
||||||
actionpack (3.2.17)
|
actionpack (4.0.3)
|
||||||
activemodel (= 3.2.17)
|
activesupport (= 4.0.3)
|
||||||
activesupport (= 3.2.17)
|
builder (~> 3.1.0)
|
||||||
builder (~> 3.0.0)
|
|
||||||
erubis (~> 2.7.0)
|
erubis (~> 2.7.0)
|
||||||
journey (~> 1.0.4)
|
rack (~> 1.5.2)
|
||||||
rack (~> 1.4.5)
|
rack-test (~> 0.6.2)
|
||||||
rack-cache (~> 1.2)
|
activemodel (4.0.3)
|
||||||
rack-test (~> 0.6.1)
|
activesupport (= 4.0.3)
|
||||||
sprockets (~> 2.2.1)
|
builder (~> 3.1.0)
|
||||||
activemodel (3.2.17)
|
activerecord (4.0.3)
|
||||||
activesupport (= 3.2.17)
|
activemodel (= 4.0.3)
|
||||||
builder (~> 3.0.0)
|
activerecord-deprecated_finders (~> 1.0.2)
|
||||||
activerecord (3.2.17)
|
activesupport (= 4.0.3)
|
||||||
activemodel (= 3.2.17)
|
arel (~> 4.0.0)
|
||||||
activesupport (= 3.2.17)
|
activerecord-deprecated_finders (1.0.3)
|
||||||
arel (~> 3.0.2)
|
activesupport (4.0.3)
|
||||||
tzinfo (~> 0.3.29)
|
|
||||||
activeresource (3.2.17)
|
|
||||||
activemodel (= 3.2.17)
|
|
||||||
activesupport (= 3.2.17)
|
|
||||||
activesupport (3.2.17)
|
|
||||||
i18n (~> 0.6, >= 0.6.4)
|
i18n (~> 0.6, >= 0.6.4)
|
||||||
multi_json (~> 1.0)
|
minitest (~> 4.2)
|
||||||
|
multi_json (~> 1.3)
|
||||||
|
thread_safe (~> 0.1)
|
||||||
|
tzinfo (~> 0.3.37)
|
||||||
acts_as_tree (1.5.0)
|
acts_as_tree (1.5.0)
|
||||||
activerecord (>= 3.0.0)
|
activerecord (>= 3.0.0)
|
||||||
arel (3.0.3)
|
arel (4.0.2)
|
||||||
|
atomic (1.1.14)
|
||||||
better_errors (1.1.0)
|
better_errors (1.1.0)
|
||||||
coderay (>= 1.0.0)
|
coderay (>= 1.0.0)
|
||||||
erubis (>= 2.6.6)
|
erubis (>= 2.6.6)
|
||||||
|
@ -76,7 +89,7 @@ GEM
|
||||||
debug_inspector (>= 0.0.1)
|
debug_inspector (>= 0.0.1)
|
||||||
bootstrap-datepicker-rails (1.3.0.1)
|
bootstrap-datepicker-rails (1.3.0.1)
|
||||||
railties (>= 3.0)
|
railties (>= 3.0)
|
||||||
builder (3.0.4)
|
builder (3.1.4)
|
||||||
bullet (4.8.0)
|
bullet (4.8.0)
|
||||||
activesupport
|
activesupport
|
||||||
uniform_notifier (>= 1.4.0)
|
uniform_notifier (>= 1.4.0)
|
||||||
|
@ -99,14 +112,10 @@ GEM
|
||||||
childprocess (0.5.1)
|
childprocess (0.5.1)
|
||||||
ffi (~> 1.0, >= 1.0.11)
|
ffi (~> 1.0, >= 1.0.11)
|
||||||
chronic (0.10.2)
|
chronic (0.10.2)
|
||||||
client_side_validations (3.2.6)
|
|
||||||
client_side_validations-simple_form (2.1.0)
|
|
||||||
client_side_validations (~> 3.2.5)
|
|
||||||
simple_form (~> 2.1.0)
|
|
||||||
coderay (1.1.0)
|
coderay (1.1.0)
|
||||||
coffee-rails (3.2.2)
|
coffee-rails (4.0.1)
|
||||||
coffee-script (>= 2.2.0)
|
coffee-script (>= 2.2.0)
|
||||||
railties (~> 3.2.0)
|
railties (>= 4.0.0, < 5.0)
|
||||||
coffee-script (2.2.0)
|
coffee-script (2.2.0)
|
||||||
coffee-script-source
|
coffee-script-source
|
||||||
execjs
|
execjs
|
||||||
|
@ -143,11 +152,11 @@ GEM
|
||||||
ffi (1.9.3)
|
ffi (1.9.3)
|
||||||
haml (4.0.5)
|
haml (4.0.5)
|
||||||
tilt
|
tilt
|
||||||
haml-rails (0.4)
|
haml-rails (0.5.3)
|
||||||
actionpack (>= 3.1, < 4.1)
|
actionpack (>= 4.0.1)
|
||||||
activesupport (>= 3.1, < 4.1)
|
activesupport (>= 4.0.1)
|
||||||
haml (>= 3.1, < 4.1)
|
haml (>= 3.1, < 5.0)
|
||||||
railties (>= 3.1, < 4.1)
|
railties (>= 4.0.1)
|
||||||
has_scope (0.6.0.rc)
|
has_scope (0.6.0.rc)
|
||||||
actionpack (>= 3.2, < 5)
|
actionpack (>= 3.2, < 5)
|
||||||
activesupport (>= 3.2, < 5)
|
activesupport (>= 3.2, < 5)
|
||||||
|
@ -160,7 +169,6 @@ GEM
|
||||||
responders (~> 1.0.0.rc)
|
responders (~> 1.0.0.rc)
|
||||||
iso (0.2.0)
|
iso (0.2.0)
|
||||||
i18n
|
i18n
|
||||||
journey (1.0.4)
|
|
||||||
jquery-rails (3.1.0)
|
jquery-rails (3.1.0)
|
||||||
railties (>= 3.0, < 5.0)
|
railties (>= 3.0, < 5.0)
|
||||||
thor (>= 0.14, < 2.0)
|
thor (>= 0.14, < 2.0)
|
||||||
|
@ -177,73 +185,68 @@ GEM
|
||||||
mail (2.5.4)
|
mail (2.5.4)
|
||||||
mime-types (~> 1.16)
|
mime-types (~> 1.16)
|
||||||
treetop (~> 1.4.8)
|
treetop (~> 1.4.8)
|
||||||
mailcatcher (0.5.12)
|
mailcatcher (0.2.4)
|
||||||
activesupport (~> 3.0)
|
eventmachine
|
||||||
eventmachine (~> 1.0.0)
|
haml
|
||||||
haml (>= 3.1, < 5)
|
i18n
|
||||||
mail (~> 2.3)
|
json
|
||||||
sinatra (~> 1.2)
|
mail
|
||||||
skinny (~> 0.2.3)
|
sinatra
|
||||||
sqlite3 (~> 1.3)
|
skinny (>= 0.1.2)
|
||||||
thin (~> 1.5.0)
|
sqlite3-ruby
|
||||||
meta_search (1.1.3)
|
thin
|
||||||
actionpack (~> 3.1)
|
|
||||||
activerecord (~> 3.1)
|
|
||||||
activesupport (~> 3.1)
|
|
||||||
polyamorous (~> 0.5.0)
|
|
||||||
mime-types (1.25.1)
|
mime-types (1.25.1)
|
||||||
mini_portile (0.5.2)
|
mini_portile (0.5.2)
|
||||||
|
minitest (4.7.5)
|
||||||
mono_logger (1.1.0)
|
mono_logger (1.1.0)
|
||||||
multi_json (1.8.4)
|
multi_json (1.8.4)
|
||||||
mysql2 (0.3.15)
|
mysql2 (0.3.15)
|
||||||
net-scp (1.1.2)
|
net-scp (1.1.2)
|
||||||
net-ssh (>= 2.6.5)
|
net-ssh (>= 2.6.5)
|
||||||
net-ssh (2.7.0)
|
net-ssh (2.8.0)
|
||||||
nokogiri (1.6.1)
|
nokogiri (1.6.1)
|
||||||
mini_portile (~> 0.5.0)
|
mini_portile (~> 0.5.0)
|
||||||
pdf-core (0.1.6)
|
pdf-core (0.1.6)
|
||||||
polyamorous (0.5.0)
|
polyamorous (0.6.4)
|
||||||
activerecord (~> 3.0)
|
activerecord (>= 3.0)
|
||||||
polyglot (0.3.4)
|
polyglot (0.3.4)
|
||||||
prawn (0.15.0)
|
prawn (0.15.0)
|
||||||
pdf-core (~> 0.1.3)
|
pdf-core (~> 0.1.3)
|
||||||
ttfunk (~> 1.1.0)
|
ttfunk (~> 1.1.0)
|
||||||
|
protected_attributes (1.0.5)
|
||||||
|
activemodel (>= 4.0.1, < 5.0)
|
||||||
quiet_assets (1.0.2)
|
quiet_assets (1.0.2)
|
||||||
railties (>= 3.1, < 5.0)
|
railties (>= 3.1, < 5.0)
|
||||||
rack (1.4.5)
|
rack (1.5.2)
|
||||||
rack-cache (1.2)
|
|
||||||
rack (>= 0.4)
|
|
||||||
rack-protection (1.5.2)
|
rack-protection (1.5.2)
|
||||||
rack
|
rack
|
||||||
rack-ssl (1.3.3)
|
|
||||||
rack
|
|
||||||
rack-test (0.6.2)
|
rack-test (0.6.2)
|
||||||
rack (>= 1.0)
|
rack (>= 1.0)
|
||||||
rails (3.2.17)
|
rails (4.0.3)
|
||||||
actionmailer (= 3.2.17)
|
actionmailer (= 4.0.3)
|
||||||
actionpack (= 3.2.17)
|
actionpack (= 4.0.3)
|
||||||
activerecord (= 3.2.17)
|
activerecord (= 4.0.3)
|
||||||
activeresource (= 3.2.17)
|
activesupport (= 4.0.3)
|
||||||
activesupport (= 3.2.17)
|
bundler (>= 1.3.0, < 2.0)
|
||||||
bundler (~> 1.0)
|
railties (= 4.0.3)
|
||||||
railties (= 3.2.17)
|
sprockets-rails (~> 2.0.0)
|
||||||
rails-assets-listjs (0.2.0.beta.4)
|
rails-assets-listjs (0.2.0.beta.4)
|
||||||
railties (>= 3.1)
|
railties (>= 3.1)
|
||||||
rails-i18n (3.0.0)
|
rails-i18n (4.0.1)
|
||||||
i18n (~> 0.5)
|
i18n (~> 0.6)
|
||||||
rails (>= 3.0.0, < 4.0.0)
|
rails (~> 4.0)
|
||||||
rails-settings-cached (0.2.4)
|
rails-settings-cached (0.3.1)
|
||||||
rails (>= 3.0.0)
|
rails (>= 4.0.0.beta1)
|
||||||
railties (3.2.17)
|
railties (4.0.3)
|
||||||
actionpack (= 3.2.17)
|
actionpack (= 4.0.3)
|
||||||
activesupport (= 3.2.17)
|
activesupport (= 4.0.3)
|
||||||
rack-ssl (~> 1.3.2)
|
|
||||||
rake (>= 0.8.7)
|
rake (>= 0.8.7)
|
||||||
rdoc (~> 3.4)
|
thor (>= 0.18.1, < 2.0)
|
||||||
thor (>= 0.14.6, < 2.0)
|
|
||||||
rake (10.1.1)
|
rake (10.1.1)
|
||||||
rdoc (3.12.2)
|
ransack (1.1.0)
|
||||||
json (~> 1.4)
|
actionpack (>= 3.0)
|
||||||
|
activerecord (>= 3.0)
|
||||||
|
polyamorous (~> 0.6.0)
|
||||||
redis (3.0.7)
|
redis (3.0.7)
|
||||||
redis-namespace (1.4.1)
|
redis-namespace (1.4.1)
|
||||||
redis (~> 3.0.4)
|
redis (~> 3.0.4)
|
||||||
|
@ -280,10 +283,10 @@ GEM
|
||||||
ruby-prof (0.14.2)
|
ruby-prof (0.14.2)
|
||||||
rubyzip (1.1.0)
|
rubyzip (1.1.0)
|
||||||
sass (3.2.14)
|
sass (3.2.14)
|
||||||
sass-rails (3.2.6)
|
sass-rails (4.0.1)
|
||||||
railties (~> 3.2.0)
|
railties (>= 4.0.0, < 5.0)
|
||||||
sass (>= 3.1.10)
|
sass (>= 3.1.10)
|
||||||
tilt (~> 1.3)
|
sprockets-rails (~> 2.0.0)
|
||||||
select2-rails (3.5.2)
|
select2-rails (3.5.2)
|
||||||
thor (~> 0.14)
|
thor (~> 0.14)
|
||||||
selenium-webdriver (2.39.0)
|
selenium-webdriver (2.39.0)
|
||||||
|
@ -296,9 +299,9 @@ GEM
|
||||||
simple-navigation-bootstrap (1.0.0)
|
simple-navigation-bootstrap (1.0.0)
|
||||||
railties (>= 3.1)
|
railties (>= 3.1)
|
||||||
simple-navigation (>= 3.7.0)
|
simple-navigation (>= 3.7.0)
|
||||||
simple_form (2.1.1)
|
simple_form (3.0.1)
|
||||||
actionpack (~> 3.0)
|
actionpack (>= 4.0.0, < 4.1)
|
||||||
activemodel (~> 3.0)
|
activemodel (>= 4.0.0, < 4.1)
|
||||||
simplecov (0.8.2)
|
simplecov (0.8.2)
|
||||||
docile (~> 1.1.0)
|
docile (~> 1.1.0)
|
||||||
multi_json
|
multi_json
|
||||||
|
@ -311,12 +314,18 @@ GEM
|
||||||
skinny (0.2.3)
|
skinny (0.2.3)
|
||||||
eventmachine (~> 1.0.0)
|
eventmachine (~> 1.0.0)
|
||||||
thin (~> 1.5.0)
|
thin (~> 1.5.0)
|
||||||
sprockets (2.2.2)
|
sprockets (2.10.1)
|
||||||
hike (~> 1.2)
|
hike (~> 1.2)
|
||||||
multi_json (~> 1.0)
|
multi_json (~> 1.0)
|
||||||
rack (~> 1.0)
|
rack (~> 1.0)
|
||||||
tilt (~> 1.1, != 1.3.0)
|
tilt (~> 1.1, != 1.3.0)
|
||||||
|
sprockets-rails (2.0.1)
|
||||||
|
actionpack (>= 3.0)
|
||||||
|
activesupport (>= 3.0)
|
||||||
|
sprockets (~> 2.8)
|
||||||
sqlite3 (1.3.8)
|
sqlite3 (1.3.8)
|
||||||
|
sqlite3-ruby (1.3.3)
|
||||||
|
sqlite3 (>= 1.3.3)
|
||||||
sshkit (1.3.0)
|
sshkit (1.3.0)
|
||||||
net-scp (>= 1.1.2)
|
net-scp (>= 1.1.2)
|
||||||
net-ssh
|
net-ssh
|
||||||
|
@ -331,6 +340,8 @@ GEM
|
||||||
eventmachine (>= 0.12.6)
|
eventmachine (>= 0.12.6)
|
||||||
rack (>= 1.0.0)
|
rack (>= 1.0.0)
|
||||||
thor (0.18.1)
|
thor (0.18.1)
|
||||||
|
thread_safe (0.1.3)
|
||||||
|
atomic
|
||||||
tilt (1.4.1)
|
tilt (1.4.1)
|
||||||
tins (1.0.0)
|
tins (1.0.0)
|
||||||
treetop (1.4.15)
|
treetop (1.4.15)
|
||||||
|
@ -375,9 +386,9 @@ DEPENDENCIES
|
||||||
capistrano-rails
|
capistrano-rails
|
||||||
capistrano-rvm!
|
capistrano-rvm!
|
||||||
capybara
|
capybara
|
||||||
client_side_validations
|
client_side_validations!
|
||||||
client_side_validations-simple_form
|
client_side_validations-simple_form!
|
||||||
coffee-rails (~> 3.2.1)
|
coffee-rails (~> 4.0.0)
|
||||||
connection_pool
|
connection_pool
|
||||||
coveralls
|
coveralls
|
||||||
daemons
|
daemons
|
||||||
|
@ -395,21 +406,22 @@ DEPENDENCIES
|
||||||
less-rails
|
less-rails
|
||||||
localize_input!
|
localize_input!
|
||||||
mailcatcher
|
mailcatcher
|
||||||
meta_search
|
|
||||||
mysql2
|
mysql2
|
||||||
prawn
|
prawn
|
||||||
|
protected_attributes
|
||||||
quiet_assets
|
quiet_assets
|
||||||
rails (~> 3.2.9)
|
rails (~> 4.0.0)
|
||||||
rails-assets-listjs (= 0.2.0.beta.4)
|
rails-assets-listjs (= 0.2.0.beta.4)
|
||||||
rails-i18n
|
rails-i18n
|
||||||
rails-settings-cached (= 0.2.4)
|
rails-settings-cached (= 0.3.1)
|
||||||
|
ransack
|
||||||
resque
|
resque
|
||||||
rspec-core
|
rspec-core
|
||||||
rspec-expectations
|
rspec-expectations
|
||||||
rspec-rails
|
rspec-rails
|
||||||
rspec-rerun
|
rspec-rerun
|
||||||
ruby-prof
|
ruby-prof
|
||||||
sass-rails (~> 3.2.3)
|
sass-rails (~> 4.0.0)
|
||||||
select2-rails
|
select2-rails
|
||||||
selenium-webdriver
|
selenium-webdriver
|
||||||
simple-navigation
|
simple-navigation
|
||||||
|
|
|
@ -3,8 +3,8 @@ class Admin::BaseController < ApplicationController
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@user = self.current_user
|
@user = self.current_user
|
||||||
@groups = Group.find(:all, :limit => 10, :order => 'created_on DESC', :conditions => {:deleted_at => nil})
|
@groups = Group.where(deleted_at: nil).order('created_on DESC').limit(10)
|
||||||
@users = User.find(:all, :limit => 10, :order => 'created_on DESC')
|
@users = User.order('created_on DESC').limit(10)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -15,6 +15,6 @@ class Admin::WorkgroupsController < Admin::BaseController
|
||||||
@workgroup.destroy
|
@workgroup.destroy
|
||||||
redirect_to admin_workgroups_url, notice: t('admin.workgroups.destroy.notice')
|
redirect_to admin_workgroups_url, notice: t('admin.workgroups.destroy.notice')
|
||||||
rescue => error
|
rescue => error
|
||||||
redirect_to admin_workgroups_url, alert: t('admin.workgroups.destroy.error')
|
redirect_to admin_workgroups_url, alert: t('admin.workgroups.destroy.error', error: error.message)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -199,11 +199,11 @@ class ArticlesController < ApplicationController
|
||||||
# renders a view to import articles in local database
|
# renders a view to import articles in local database
|
||||||
#
|
#
|
||||||
def shared
|
def shared
|
||||||
# build array of keywords, required for meta search _all suffix
|
# build array of keywords, required for ransack _all suffix
|
||||||
params[:search][:name_contains_all] = params[:search][:name_contains_all].split(' ') if params[:search]
|
params[:q][:name_cont_all] = params[:q][:name_cont_all].split(' ') if params[:q]
|
||||||
# Build search with meta search plugin
|
# Build search with meta search plugin
|
||||||
@search = @supplier.shared_supplier.shared_articles.search(params[:search])
|
@search = @supplier.shared_supplier.shared_articles.search(params[:q])
|
||||||
@articles = @search.page(params[:page]).per(10)
|
@articles = @search.result.page(params[:page]).per(10)
|
||||||
render :layout => false
|
render :layout => false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ class DeliveriesController < ApplicationController
|
||||||
before_filter :find_supplier, :exclude => :fill_new_stock_article_form
|
before_filter :find_supplier, :exclude => :fill_new_stock_article_form
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@deliveries = @supplier.deliveries.all :order => 'delivered_on DESC'
|
@deliveries = @supplier.deliveries.order('delivered_on DESC')
|
||||||
end
|
end
|
||||||
|
|
||||||
def show
|
def show
|
||||||
|
|
|
@ -16,13 +16,13 @@ class Finance::BalancingController < Finance::BaseController
|
||||||
sort_param = params['sort'] || 'name'
|
sort_param = params['sort'] || 'name'
|
||||||
@articles = case sort_param
|
@articles = case sort_param
|
||||||
when 'name' then
|
when 'name' then
|
||||||
OrderArticle.sort_by_name(@articles)
|
@articles.order('articles.name ASC')
|
||||||
when 'name_reverse' then
|
when 'name_reverse' then
|
||||||
OrderArticle.sort_by_name(@articles).reverse
|
@articles.order('articles.name DESC')
|
||||||
when 'order_number' then
|
when 'order_number' then
|
||||||
OrderArticle.sort_by_order_number(@articles)
|
@articles.order('articles.order_number ASC')
|
||||||
when 'order_number_reverse' then
|
when 'order_number_reverse' then
|
||||||
OrderArticle.sort_by_order_number(@articles).reverse
|
@articles.order('articles.order_number DESC')
|
||||||
else
|
else
|
||||||
@articles
|
@articles
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,7 +4,7 @@ class Foodcoop::WorkgroupsController < ApplicationController
|
||||||
:except => [:index]
|
:except => [:index]
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@workgroups = Workgroup.all :order => "name"
|
@workgroups = Workgroup.order("name")
|
||||||
end
|
end
|
||||||
|
|
||||||
def edit
|
def edit
|
||||||
|
|
|
@ -74,8 +74,7 @@ class GroupOrdersController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def ensure_open_order
|
def ensure_open_order
|
||||||
@order = Order.find((params[:order_id] || params[:group_order][:order_id]),
|
@order = Order.includes([:supplier, :order_articles]).find(params[:order_id] || params[:group_order][:order_id])
|
||||||
:include => [:supplier, :order_articles])
|
|
||||||
unless @order.open?
|
unless @order.open?
|
||||||
flash[:notice] = I18n.t('group_orders.errors.closed')
|
flash[:notice] = I18n.t('group_orders.errors.closed')
|
||||||
redirect_to :action => 'index'
|
redirect_to :action => 'index'
|
||||||
|
|
|
@ -21,7 +21,7 @@ class OrdersController < ApplicationController
|
||||||
else
|
else
|
||||||
sort = "ends DESC"
|
sort = "ends DESC"
|
||||||
end
|
end
|
||||||
@orders = Order.closed.page(params[:page]).per(@per_page).includes(:supplier).order(sort)
|
@orders = Order.closed.includes(:supplier).order(sort).page(params[:page]).per(@per_page)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Gives a view for the results to a specific order
|
# Gives a view for the results to a specific order
|
||||||
|
@ -145,7 +145,7 @@ class OrdersController < ApplicationController
|
||||||
text += "****** " + I18n.t('orders.fax.articles') + "\n\n"
|
text += "****** " + I18n.t('orders.fax.articles') + "\n\n"
|
||||||
text += I18n.t('orders.fax.number') + " " + I18n.t('orders.fax.amount') + " " + I18n.t('orders.fax.name') + "\n"
|
text += I18n.t('orders.fax.number') + " " + I18n.t('orders.fax.amount') + " " + I18n.t('orders.fax.name') + "\n"
|
||||||
# now display all ordered articles
|
# now display all ordered articles
|
||||||
@order.order_articles.ordered.all(:include => [:article, :article_price]).each do |oa|
|
@order.order_articles.ordered.includes([:article, :article_price]).each do |oa|
|
||||||
number = oa.article.order_number
|
number = oa.article.order_number
|
||||||
(8 - number.size).times { number += " " }
|
(8 - number.size).times { number += " " }
|
||||||
quantity = oa.units_to_order.to_i.to_s
|
quantity = oa.units_to_order.to_i.to_s
|
||||||
|
|
|
@ -58,7 +58,7 @@ class OrderFax < OrderPdf
|
||||||
# Articles
|
# Articles
|
||||||
total = 0
|
total = 0
|
||||||
data = [I18n.t('documents.order_fax.rows')]
|
data = [I18n.t('documents.order_fax.rows')]
|
||||||
data += @order.order_articles.ordered.all(include: :article).collect do |a|
|
data += @order.order_articles.ordered.includes(:article).collect do |a|
|
||||||
subtotal = a.units_to_order * a.price.unit_quantity * a.price.price
|
subtotal = a.units_to_order * a.price.unit_quantity * a.price.price
|
||||||
total += subtotal
|
total += subtotal
|
||||||
[a.article.order_number,
|
[a.article.order_number,
|
||||||
|
|
|
@ -60,13 +60,13 @@ class OrderMatrix < OrderPdf
|
||||||
# Collect group results
|
# Collect group results
|
||||||
groups_data = [header]
|
groups_data = [header]
|
||||||
|
|
||||||
@order.group_orders.includes(:ordergroup).all.each do |group_order|
|
@order.group_orders.includes(:ordergroup).each do |group_order|
|
||||||
|
|
||||||
group_result = [group_order.ordergroup.name.truncate(20)]
|
group_result = [group_order.ordergroup.name.truncate(20)]
|
||||||
|
|
||||||
for order_article in current_order_articles
|
for order_article in current_order_articles
|
||||||
# get the Ordergroup result for this order_article
|
# get the Ordergroup result for this order_article
|
||||||
goa = order_article.group_order_articles.first conditions: { group_order_id: group_order.id }
|
goa = order_article.group_order_articles.where(group_order_id: group_order.id).first
|
||||||
group_result << ((goa.nil? || goa.result == 0) ? "" : goa.result.to_i)
|
group_result << ((goa.nil? || goa.result == 0) ? "" : goa.result.to_i)
|
||||||
end
|
end
|
||||||
groups_data << group_result
|
groups_data << group_result
|
||||||
|
|
|
@ -14,6 +14,6 @@ module ArticlesHelper
|
||||||
|
|
||||||
# Flatten search params, used in import from external database
|
# Flatten search params, used in import from external database
|
||||||
def search_params
|
def search_params
|
||||||
Hash[params[:search].map { |k,v| [k, (v.is_a?(Array) ? v.join(" ") : v)] }]
|
Hash[params[:q].map { |k,v| [k, (v.is_a?(Array) ? v.join(" ") : v)] }]
|
||||||
end
|
end
|
||||||
end
|
end
|
|
@ -13,7 +13,7 @@ module OrdersHelper
|
||||||
|
|
||||||
def options_for_suppliers_to_select
|
def options_for_suppliers_to_select
|
||||||
options = [[I18n.t('helpers.orders.option_choose')]]
|
options = [[I18n.t('helpers.orders.option_choose')]]
|
||||||
options += Supplier.all.map {|s| [ s.name, url_for(action: "new", supplier_id: s)] }
|
options += Supplier.map {|s| [ s.name, url_for(action: "new", supplier_id: s)] }
|
||||||
options += [[I18n.t('helpers.orders.option_stock'), url_for(action: 'new', supplier_id: 0)]]
|
options += [[I18n.t('helpers.orders.option_stock'), url_for(action: 'new', supplier_id: 0)]]
|
||||||
options_for_select(options)
|
options_for_select(options)
|
||||||
end
|
end
|
||||||
|
@ -98,7 +98,7 @@ module OrdersHelper
|
||||||
if group_orders.count == 0
|
if group_orders.count == 0
|
||||||
return txt
|
return txt
|
||||||
else
|
else
|
||||||
desc = group_orders.all.map {|g| g.ordergroup.name}.join(', ')
|
desc = group_orders.includes(:ordergroup).map {|g| g.ordergroup.name}.join(', ')
|
||||||
content_tag(:abbr, txt, title: desc).html_safe
|
content_tag(:abbr, txt, title: desc).html_safe
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
class DeltaInput < SimpleForm::Inputs::StringInput
|
class DeltaInput < SimpleForm::Inputs::StringInput
|
||||||
# for now, need to pass id or it won't work
|
# for now, need to pass id or it won't work
|
||||||
def input
|
def input
|
||||||
|
@input_html_options[:type] = 'text'
|
||||||
@input_html_options[:data] ||= {}
|
@input_html_options[:data] ||= {}
|
||||||
@input_html_options[:data][:delta] ||= 1
|
@input_html_options[:data][:delta] ||= 1
|
||||||
@input_html_options[:autocomplete] ||= 'off'
|
@input_html_options[:autocomplete] ||= 'off'
|
||||||
|
|
|
@ -7,11 +7,11 @@ class Article < ActiveRecord::Base
|
||||||
# Associations
|
# Associations
|
||||||
belongs_to :supplier
|
belongs_to :supplier
|
||||||
belongs_to :article_category
|
belongs_to :article_category
|
||||||
has_many :article_prices, :order => "created_at DESC"
|
has_many :article_prices, -> { order("created_at DESC") }
|
||||||
|
|
||||||
scope :undeleted, -> { where(deleted_at: nil) }
|
scope :undeleted, -> { where(deleted_at: nil) }
|
||||||
scope :available, -> { undeleted.where(availability: true) }
|
scope :available, -> { undeleted.where(availability: true) }
|
||||||
scope :not_in_stock, :conditions => {:type => nil}
|
scope :not_in_stock, -> { where(type: nil) }
|
||||||
|
|
||||||
# Validations
|
# Validations
|
||||||
validates_presence_of :name, :unit, :price, :tax, :deposit, :unit_quantity, :supplier_id, :article_category
|
validates_presence_of :name, :unit, :price, :tax, :deposit, :unit_quantity, :supplier_id, :article_category
|
||||||
|
@ -44,7 +44,7 @@ class Article < ActiveRecord::Base
|
||||||
# If the article is used in an open Order, the Order will be returned.
|
# If the article is used in an open Order, the Order will be returned.
|
||||||
def in_open_order
|
def in_open_order
|
||||||
@in_open_order ||= begin
|
@in_open_order ||= begin
|
||||||
order_articles = OrderArticle.all(:conditions => ['order_id IN (?)', Order.open.collect(&:id)])
|
order_articles = OrderArticle.where(order_id: Order.open.collect(&:id))
|
||||||
order_article = order_articles.detect {|oa| oa.article_id == id }
|
order_article = order_articles.detect {|oa| oa.article_id == id }
|
||||||
order_article ? order_article.order : nil
|
order_article ? order_article.order : nil
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,12 +2,9 @@ class Delivery < ActiveRecord::Base
|
||||||
|
|
||||||
belongs_to :supplier
|
belongs_to :supplier
|
||||||
has_one :invoice
|
has_one :invoice
|
||||||
has_many :stock_changes,
|
has_many :stock_changes, -> { includes(:stock_article).order('articles.name ASC') }, :dependent => :destroy
|
||||||
:dependent => :destroy,
|
|
||||||
:include => 'stock_article',
|
|
||||||
:order => 'articles.name ASC'
|
|
||||||
|
|
||||||
scope :recent, :order => 'created_at DESC', :limit => 10
|
scope :recent, -> { order('created_at DESC').limit(10) }
|
||||||
|
|
||||||
validates_presence_of :supplier_id, :delivered_on
|
validates_presence_of :supplier_id, :delivered_on
|
||||||
validate :stock_articles_must_be_unique
|
validate :stock_articles_must_be_unique
|
||||||
|
|
|
@ -17,7 +17,7 @@ class Group < ActiveRecord::Base
|
||||||
|
|
||||||
# Returns all NONmembers and a checks for possible multiple Ordergroup-Memberships
|
# Returns all NONmembers and a checks for possible multiple Ordergroup-Memberships
|
||||||
def non_members
|
def non_members
|
||||||
User.natural_order.all.reject { |u| users.include?(u) }
|
User.natural_order.reject { |u| users.include?(u) }
|
||||||
end
|
end
|
||||||
|
|
||||||
def user_tokens=(ids)
|
def user_tokens=(ids)
|
||||||
|
|
|
@ -14,10 +14,10 @@ class GroupOrder < ActiveRecord::Base
|
||||||
validates_numericality_of :price
|
validates_numericality_of :price
|
||||||
validates_uniqueness_of :ordergroup_id, :scope => :order_id # order groups can only order once per order
|
validates_uniqueness_of :ordergroup_id, :scope => :order_id # order groups can only order once per order
|
||||||
|
|
||||||
scope :in_open_orders, joins(:order).merge(Order.open)
|
scope :in_open_orders, -> { joins(:order).merge(Order.open) }
|
||||||
scope :in_finished_orders, joins(:order).merge(Order.finished_not_closed)
|
scope :in_finished_orders, -> { joins(:order).merge(Order.finished_not_closed) }
|
||||||
|
|
||||||
scope :ordered, :include => :ordergroup, :order => 'groups.name'
|
scope :ordered, -> { includes(:ordergroup).order('groups.name') }
|
||||||
|
|
||||||
# Generate some data for the javascript methods in ordering view
|
# Generate some data for the javascript methods in ordering view
|
||||||
def load_data
|
def load_data
|
||||||
|
@ -55,7 +55,7 @@ class GroupOrder < ActiveRecord::Base
|
||||||
def save_group_order_articles
|
def save_group_order_articles
|
||||||
for order_article in order.order_articles
|
for order_article in order.order_articles
|
||||||
# Find the group_order_article, create a new one if necessary...
|
# Find the group_order_article, create a new one if necessary...
|
||||||
group_order_article = group_order_articles.find_or_create_by_order_article_id(order_article.id)
|
group_order_article = group_order_articles.where(order_article_id: order_article.id).first_or_create
|
||||||
|
|
||||||
# Get ordered quantities and update group_order_articles/_quantities...
|
# Get ordered quantities and update group_order_articles/_quantities...
|
||||||
quantities = group_order_articles_attributes.fetch(order_article.id.to_s, {:quantity => 0, :tolerance => 0})
|
quantities = group_order_articles_attributes.fetch(order_article.id.to_s, {:quantity => 0, :tolerance => 0})
|
||||||
|
|
|
@ -13,18 +13,18 @@ class GroupOrderArticle < ActiveRecord::Base
|
||||||
validates_inclusion_of :tolerance, :in => 0..99
|
validates_inclusion_of :tolerance, :in => 0..99
|
||||||
validates_uniqueness_of :order_article_id, :scope => :group_order_id # just once an article per group order
|
validates_uniqueness_of :order_article_id, :scope => :group_order_id # just once an article per group order
|
||||||
|
|
||||||
scope :ordered, :conditions => 'group_order_articles.result > 0 OR group_order_articles.quantity > 0 OR group_order_articles.tolerance > 0', :include => {:group_order => :ordergroup}, :order => 'groups.name'
|
scope :ordered, -> { includes(:group_order => :ordergroup).where('group_order_articles.result > 0 OR group_order_articles.quantity > 0 OR group_order_articles.tolerance > 0').order('groups.name') }
|
||||||
|
|
||||||
localize_input_of :result
|
localize_input_of :result
|
||||||
|
|
||||||
# Setter used in group_order_article#new
|
# Setter used in group_order_article#new
|
||||||
# We have to create an group_order, if the ordergroup wasn't involved in the order yet
|
# We have to create an group_order, if the ordergroup wasn't involved in the order yet
|
||||||
def ordergroup_id=(id)
|
def ordergroup_id=(id)
|
||||||
self.group_order = GroupOrder.find_or_initialize_by_order_id_and_ordergroup_id(order_article.order_id, id)
|
self.group_order = GroupOrder.where(order_id: order_article.order_id, ordergroup_id: id).first_or_initialize
|
||||||
end
|
end
|
||||||
|
|
||||||
def ordergroup_id
|
def ordergroup_id
|
||||||
group_order.try(:ordergroup_id)
|
group_order.try!(:ordergroup_id)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Updates the quantity/tolerance for this GroupOrderArticle by updating both GroupOrderArticle properties
|
# Updates the quantity/tolerance for this GroupOrderArticle by updating both GroupOrderArticle properties
|
||||||
|
@ -36,7 +36,7 @@ class GroupOrderArticle < ActiveRecord::Base
|
||||||
logger.debug("Current quantity = #{self.quantity}, tolerance = #{self.tolerance}")
|
logger.debug("Current quantity = #{self.quantity}, tolerance = #{self.tolerance}")
|
||||||
|
|
||||||
# Get quantities ordered with the newest item first.
|
# Get quantities ordered with the newest item first.
|
||||||
quantities = group_order_article_quantities.find(:all, :order => 'created_on desc')
|
quantities = group_order_article_quantities.order('created_on DESC').to_a
|
||||||
logger.debug("GroupOrderArticleQuantity items found: #{quantities.size}")
|
logger.debug("GroupOrderArticleQuantity items found: #{quantities.size}")
|
||||||
|
|
||||||
if (quantities.size == 0)
|
if (quantities.size == 0)
|
||||||
|
@ -120,8 +120,7 @@ class GroupOrderArticle < ActiveRecord::Base
|
||||||
# In total there are enough units ordered. Now check the individual result for the ordergroup (group_order).
|
# In total there are enough units ordered. Now check the individual result for the ordergroup (group_order).
|
||||||
#
|
#
|
||||||
# Get all GroupOrderArticleQuantities for this OrderArticle...
|
# Get all GroupOrderArticleQuantities for this OrderArticle...
|
||||||
order_quantities = GroupOrderArticleQuantity.all(
|
order_quantities = GroupOrderArticleQuantity.where(group_order_article_id: order_article.group_order_article_ids).order('created_on')
|
||||||
:conditions => ["group_order_article_id IN (?)", order_article.group_order_article_ids], :order => 'created_on')
|
|
||||||
logger.debug "GroupOrderArticleQuantity records found: #{order_quantities.size}"
|
logger.debug "GroupOrderArticleQuantity records found: #{order_quantities.size}"
|
||||||
|
|
||||||
# Determine quantities to be ordered...
|
# Determine quantities to be ordered...
|
||||||
|
|
|
@ -5,7 +5,7 @@ class Invite < ActiveRecord::Base
|
||||||
belongs_to :user
|
belongs_to :user
|
||||||
belongs_to :group
|
belongs_to :group
|
||||||
|
|
||||||
validates_format_of :email, :with => /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i
|
validates_format_of :email, :with => /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i
|
||||||
validates_presence_of :user
|
validates_presence_of :user
|
||||||
validates_presence_of :group
|
validates_presence_of :group
|
||||||
validates_presence_of :token
|
validates_presence_of :token
|
||||||
|
|
|
@ -7,7 +7,7 @@ class Invoice < ActiveRecord::Base
|
||||||
validates_presence_of :supplier_id
|
validates_presence_of :supplier_id
|
||||||
validates_numericality_of :amount, :deposit, :deposit_credit
|
validates_numericality_of :amount, :deposit, :deposit_credit
|
||||||
|
|
||||||
scope :unpaid, :conditions => { :paid_on => nil }
|
scope :unpaid, -> { where(paid_on: nil) }
|
||||||
|
|
||||||
# Replace numeric seperator with database format
|
# Replace numeric seperator with database format
|
||||||
localize_input_of :amount, :deposit, :deposit_credit
|
localize_input_of :amount, :deposit, :deposit_credit
|
||||||
|
|
|
@ -5,14 +5,12 @@ class Membership < ActiveRecord::Base
|
||||||
|
|
||||||
before_destroy :check_last_admin
|
before_destroy :check_last_admin
|
||||||
|
|
||||||
# messages
|
|
||||||
ERR_NO_ADMIN_MEMBER_DELETE = I18n.t('model.membership.no_admin_delete')
|
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
||||||
# check if this is the last admin-membership and deny
|
# check if this is the last admin-membership and deny
|
||||||
def check_last_admin
|
def check_last_admin
|
||||||
raise ERR_NO_ADMIN_MEMBER_DELETE if self.group.role_admin? && self.group.memberships.size == 1 && Group.find_all_by_role_admin(true).size == 1
|
raise I18n.t('model.membership.no_admin_delete') if self.group.role_admin? && self.group.memberships.size == 1 && Group.where(role_admin: true).count == 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -4,9 +4,9 @@ class Message < ActiveRecord::Base
|
||||||
serialize :recipients_ids, Array
|
serialize :recipients_ids, Array
|
||||||
attr_accessor :sent_to_all, :group_id, :recipient_tokens, :reply_to
|
attr_accessor :sent_to_all, :group_id, :recipient_tokens, :reply_to
|
||||||
|
|
||||||
scope :pending, where(:email_state => 0)
|
scope :pending, -> { where(:email_state => 0) }
|
||||||
scope :sent, where(:email_state => 1)
|
scope :sent, -> { where(:email_state => 1) }
|
||||||
scope :public, where(:private => false)
|
scope :public, -> { where(:private => false) }
|
||||||
|
|
||||||
# Values for the email_state attribute: :none, :pending, :sent, :failed
|
# Values for the email_state attribute: :none, :pending, :sent, :failed
|
||||||
EMAIL_STATE = {
|
EMAIL_STATE = {
|
||||||
|
|
|
@ -10,7 +10,7 @@ class Order < ActiveRecord::Base
|
||||||
has_many :group_orders, :dependent => :destroy
|
has_many :group_orders, :dependent => :destroy
|
||||||
has_many :ordergroups, :through => :group_orders
|
has_many :ordergroups, :through => :group_orders
|
||||||
has_one :invoice
|
has_one :invoice
|
||||||
has_many :comments, :class_name => "OrderComment", :order => "created_at"
|
has_many :comments, -> { order('created_at') }, :class_name => "OrderComment"
|
||||||
has_many :stock_changes
|
has_many :stock_changes
|
||||||
belongs_to :supplier
|
belongs_to :supplier
|
||||||
belongs_to :updated_by, :class_name => 'User', :foreign_key => 'updated_by_user_id'
|
belongs_to :updated_by, :class_name => 'User', :foreign_key => 'updated_by_user_id'
|
||||||
|
@ -25,11 +25,11 @@ class Order < ActiveRecord::Base
|
||||||
after_save :save_order_articles, :update_price_of_group_orders
|
after_save :save_order_articles, :update_price_of_group_orders
|
||||||
|
|
||||||
# Finders
|
# Finders
|
||||||
scope :open, where(state: 'open').order('ends DESC')
|
scope :open, -> { where(state: 'open').order('ends DESC') }
|
||||||
scope :finished, where("orders.state = 'finished' OR orders.state = 'closed'").order('ends DESC')
|
scope :finished, -> { where("orders.state = 'finished' OR orders.state = 'closed'").order('ends DESC') }
|
||||||
scope :finished_not_closed, where(state: 'finished').order('ends DESC')
|
scope :finished_not_closed, -> { where(state: 'finished').order('ends DESC') }
|
||||||
scope :closed, where(state: 'closed').order('ends DESC')
|
scope :closed, -> { where(state: 'closed').order('ends DESC') }
|
||||||
scope :stockit, where(supplier_id: 0).order('ends DESC')
|
scope :stockit, -> { where(supplier_id: 0).order('ends DESC') }
|
||||||
|
|
||||||
def stockit?
|
def stockit?
|
||||||
supplier_id == 0
|
supplier_id == 0
|
||||||
|
@ -43,12 +43,12 @@ class Order < ActiveRecord::Base
|
||||||
if stockit?
|
if stockit?
|
||||||
# make sure to include those articles which are no longer available
|
# make sure to include those articles which are no longer available
|
||||||
# but which have already been ordered in this stock order
|
# but which have already been ordered in this stock order
|
||||||
StockArticle.available.all(:include => :article_category,
|
StockArticle.available.includes(:article_category).
|
||||||
:order => 'article_categories.name, articles.name').reject{ |a|
|
order('article_categories.name, articles.name').reject{ |a|
|
||||||
a.quantity_available <= 0 and not a.ordered_in_order?(self)
|
a.quantity_available <= 0 and not a.ordered_in_order?(self)
|
||||||
}.group_by { |a| a.article_category.name }
|
}.group_by { |a| a.article_category.name }
|
||||||
else
|
else
|
||||||
supplier.articles.available.all.group_by { |a| a.article_category.name }
|
supplier.articles.available.group_by { |a| a.article_category.name }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -107,7 +107,7 @@ class Order < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def articles_sort_by_category
|
def articles_sort_by_category
|
||||||
order_articles.all(:include => [:article], :order => 'articles.name').sort do |a,b|
|
order_articles.includes(:article).order('articles.name').sort do |a,b|
|
||||||
a.article.article_category.name <=> b.article.article_category.name
|
a.article.article_category.name <=> b.article.article_category.name
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -168,7 +168,7 @@ class Order < ActiveRecord::Base
|
||||||
# Update order_articles. Save the current article_price to keep price consistency
|
# Update order_articles. Save the current article_price to keep price consistency
|
||||||
# Also save results for each group_order_result
|
# Also save results for each group_order_result
|
||||||
# Clean up
|
# Clean up
|
||||||
order_articles.all(:include => :article).each do |oa|
|
order_articles.includes(:article).each do |oa|
|
||||||
oa.update_attribute(:article_price, oa.article.article_prices.first)
|
oa.update_attribute(:article_price, oa.article.article_prices.first)
|
||||||
oa.group_order_articles.each do |goa|
|
oa.group_order_articles.each do |goa|
|
||||||
goa.save_results!
|
goa.save_results!
|
||||||
|
@ -199,7 +199,7 @@ class Order < ActiveRecord::Base
|
||||||
transaction_note = I18n.t('orders.model.notice_close', :name => name,
|
transaction_note = I18n.t('orders.model.notice_close', :name => name,
|
||||||
:ends => ends.strftime(I18n.t('date.formats.default')))
|
:ends => ends.strftime(I18n.t('date.formats.default')))
|
||||||
|
|
||||||
gos = group_orders.all(:include => :ordergroup) # Fetch group_orders
|
gos = group_orders.includes(:ordergroup) # Fetch group_orders
|
||||||
gos.each { |group_order| group_order.update_price! } # Update prices of group_orders
|
gos.each { |group_order| group_order.update_price! } # Update prices of group_orders
|
||||||
|
|
||||||
transaction do # Start updating account balances
|
transaction do # Start updating account balances
|
||||||
|
@ -209,7 +209,7 @@ class Order < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
if stockit? # Decreases the quantity of stock_articles
|
if stockit? # Decreases the quantity of stock_articles
|
||||||
for oa in order_articles.all(:include => :article)
|
for oa in order_articles.includes(:article)
|
||||||
oa.update_results! # Update units_to_order of order_article
|
oa.update_results! # Update units_to_order of order_article
|
||||||
stock_changes.create! :stock_article => oa.article, :quantity => oa.units_to_order*-1
|
stock_changes.create! :stock_article => oa.article, :quantity => oa.units_to_order*-1
|
||||||
end
|
end
|
||||||
|
@ -236,7 +236,7 @@ class Order < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def keep_ordered_articles
|
def keep_ordered_articles
|
||||||
chosen_order_articles = order_articles.find_all_by_article_id(article_ids)
|
chosen_order_articles = order_articles.where(article_id: article_ids)
|
||||||
to_be_removed = order_articles - chosen_order_articles
|
to_be_removed = order_articles - chosen_order_articles
|
||||||
to_be_removed_but_ordered = to_be_removed.select { |a| a.quantity > 0 or a.tolerance > 0 }
|
to_be_removed_but_ordered = to_be_removed.select { |a| a.quantity > 0 or a.tolerance > 0 }
|
||||||
unless to_be_removed_but_ordered.empty? or ignore_warnings
|
unless to_be_removed_but_ordered.empty? or ignore_warnings
|
||||||
|
|
|
@ -19,17 +19,6 @@ class OrderArticle < ActiveRecord::Base
|
||||||
before_create :init_from_balancing
|
before_create :init_from_balancing
|
||||||
after_destroy :update_ordergroup_prices
|
after_destroy :update_ordergroup_prices
|
||||||
|
|
||||||
def self.sort_by_name(order_articles)
|
|
||||||
order_articles.sort { |a,b| a.article.name <=> b.article.name }
|
|
||||||
end
|
|
||||||
|
|
||||||
def self.sort_by_order_number(order_articles)
|
|
||||||
order_articles.sort do |a,b|
|
|
||||||
a.article.order_number.to_s.gsub(/[^[:digit:]]/, "").to_i <=>
|
|
||||||
b.article.order_number.to_s.gsub(/[^[:digit:]]/, "").to_i
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
# This method returns either the ArticlePrice or the Article
|
# This method returns either the ArticlePrice or the Article
|
||||||
# The first will be set, when the the order is finished
|
# The first will be set, when the the order is finished
|
||||||
def price
|
def price
|
||||||
|
|
|
@ -62,9 +62,9 @@ class Ordergroup < Group
|
||||||
|
|
||||||
def update_stats!
|
def update_stats!
|
||||||
# Get hours for every job of each user in period
|
# Get hours for every job of each user in period
|
||||||
jobs = users.sum { |u| u.tasks.done.sum(:duration, :conditions => ["updated_on > ?", APPLE_MONTH_AGO.month.ago]) }
|
jobs = users.to_a.sum { |u| u.tasks.done.where('updated_on > ?', APPLE_MONTH_AGO.month.ago).sum(:duration) }
|
||||||
# Get group_order.price for every finished order in this period
|
# Get group_order.price for every finished order in this period
|
||||||
orders_sum = group_orders.includes(:order).merge(Order.finished).where('orders.ends >= ?', APPLE_MONTH_AGO.month.ago).sum(:price)
|
orders_sum = group_orders.includes(:order).merge(Order.finished).where('orders.ends >= ?', APPLE_MONTH_AGO.month.ago).references(:orders).sum(:price)
|
||||||
|
|
||||||
@readonly = false # Dirty hack, avoid getting RecordReadOnly exception when called in task after_save callback. A rails bug?
|
@readonly = false # Dirty hack, avoid getting RecordReadOnly exception when called in task after_save callback. A rails bug?
|
||||||
update_attribute(:stats, {:jobs_size => jobs, :orders_sum => orders_sum})
|
update_attribute(:stats, {:jobs_size => jobs, :orders_sum => orders_sum})
|
||||||
|
@ -113,8 +113,8 @@ class Ordergroup < Group
|
||||||
|
|
||||||
# Make sure, the name is uniq, add usefull message if uniq group is already deleted
|
# Make sure, the name is uniq, add usefull message if uniq group is already deleted
|
||||||
def uniqueness_of_name
|
def uniqueness_of_name
|
||||||
group = Ordergroup.where('groups.name = ?', name)
|
group = Ordergroup.where(name: name)
|
||||||
group = group.where('groups.id != ?', self.id) unless new_record?
|
group = group.where.not(id: self.id) unless new_record?
|
||||||
if group.exists?
|
if group.exists?
|
||||||
message = group.first.deleted? ? :taken_with_deleted : :taken
|
message = group.first.deleted? ? :taken_with_deleted : :taken
|
||||||
errors.add :name, message
|
errors.add :name, message
|
||||||
|
|
|
@ -3,7 +3,7 @@ class StockArticle < Article
|
||||||
|
|
||||||
has_many :stock_changes
|
has_many :stock_changes
|
||||||
|
|
||||||
scope :available, -> { undeleted.where'quantity > 0' }
|
scope :available, -> { undeleted.where('quantity > 0') }
|
||||||
|
|
||||||
before_destroy :check_quantity
|
before_destroy :check_quantity
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ class StockArticle < Article
|
||||||
|
|
||||||
def quantity_ordered
|
def quantity_ordered
|
||||||
OrderArticle.where(article_id: id).
|
OrderArticle.where(article_id: id).
|
||||||
joins(:order).where("orders.state = 'open' OR orders.state = 'finished'").sum(:units_to_order)
|
joins(:order).where(orders: {state: ['open', 'finished']}).sum(:units_to_order)
|
||||||
end
|
end
|
||||||
|
|
||||||
def quantity_history
|
def quantity_history
|
||||||
|
|
|
@ -1,14 +1,13 @@
|
||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
class Supplier < ActiveRecord::Base
|
class Supplier < ActiveRecord::Base
|
||||||
|
has_many :articles, -> { where(:type => nil).includes(:article_category).order('article_categories.name', 'articles.name') }
|
||||||
has_many :articles, :conditions => {:type => nil},
|
has_many :stock_articles, -> { includes(:article_category).order('article_categories.name', 'articles.name') }
|
||||||
:include => [:article_category], :order => 'article_categories.name, articles.name'
|
|
||||||
has_many :stock_articles, :include => [:article_category], :order => 'article_categories.name, articles.name'
|
|
||||||
has_many :orders
|
has_many :orders
|
||||||
has_many :deliveries
|
has_many :deliveries
|
||||||
has_many :invoices
|
has_many :invoices
|
||||||
belongs_to :shared_supplier # for the sharedLists-App
|
belongs_to :shared_supplier # for the sharedLists-App
|
||||||
|
|
||||||
|
include ActiveModel::MassAssignmentSecurity
|
||||||
attr_accessible :name, :address, :phone, :phone2, :fax, :email, :url, :contact_person, :customer_number,
|
attr_accessible :name, :address, :phone, :phone2, :fax, :email, :url, :contact_person, :customer_number,
|
||||||
:delivery_days, :order_howto, :note, :shared_supplier_id, :min_order_quantity
|
:delivery_days, :order_howto, :note, :shared_supplier_id, :min_order_quantity
|
||||||
|
|
||||||
|
@ -82,8 +81,8 @@ class Supplier < ActiveRecord::Base
|
||||||
|
|
||||||
# Make sure, the name is uniq, add usefull message if uniq group is already deleted
|
# Make sure, the name is uniq, add usefull message if uniq group is already deleted
|
||||||
def uniqueness_of_name
|
def uniqueness_of_name
|
||||||
supplier = Supplier.where('suppliers.name = ?', name)
|
supplier = Supplier.where(name: name)
|
||||||
supplier = supplier.where('suppliers.id != ?', self.id) unless new_record?
|
supplier = supplier.where.not(id: self.id) unless new_record?
|
||||||
if supplier.exists?
|
if supplier.exists?
|
||||||
message = supplier.first.deleted? ? :taken_with_deleted : :taken
|
message = supplier.first.deleted? ? :taken_with_deleted : :taken
|
||||||
errors.add :name, message
|
errors.add :name, message
|
||||||
|
|
|
@ -5,13 +5,14 @@ class Task < ActiveRecord::Base
|
||||||
belongs_to :workgroup
|
belongs_to :workgroup
|
||||||
belongs_to :periodic_task_group
|
belongs_to :periodic_task_group
|
||||||
|
|
||||||
scope :non_group, where(workgroup_id: nil, done: false)
|
scope :non_group, -> { where(workgroup_id: nil, done: false) }
|
||||||
scope :done, where(done: true)
|
scope :done, -> { where(done: true) }
|
||||||
scope :undone, where(done: false)
|
scope :undone, -> { where(done: false) }
|
||||||
|
|
||||||
attr_accessor :current_user_id
|
attr_accessor :current_user_id
|
||||||
|
|
||||||
# form will send user in string. responsibilities will added later
|
# form will send user in string. responsibilities will added later
|
||||||
|
include ActiveModel::MassAssignmentSecurity
|
||||||
attr_protected :users
|
attr_protected :users
|
||||||
|
|
||||||
validates :name, :presence => true, :length => { :minimum => 3 }
|
validates :name, :presence => true, :length => { :minimum => 3 }
|
||||||
|
|
|
@ -26,7 +26,7 @@ class User < ActiveRecord::Base
|
||||||
|
|
||||||
validates_presence_of :email
|
validates_presence_of :email
|
||||||
validates_presence_of :password, :on => :create
|
validates_presence_of :password, :on => :create
|
||||||
validates_format_of :email, :with => /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i
|
validates_format_of :email, :with => /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i
|
||||||
validates_uniqueness_of :email, :case_sensitive => false
|
validates_uniqueness_of :email, :case_sensitive => false
|
||||||
validates_presence_of :first_name # for simple_form validations
|
validates_presence_of :first_name # for simple_form validations
|
||||||
validates_length_of :first_name, :in => 2..50
|
validates_length_of :first_name, :in => 2..50
|
||||||
|
@ -157,7 +157,7 @@ class User < ActiveRecord::Base
|
||||||
|
|
||||||
#Returns an array with the users groups (but without the Ordergroups -> because tpye=>"")
|
#Returns an array with the users groups (but without the Ordergroups -> because tpye=>"")
|
||||||
def member_of_groups()
|
def member_of_groups()
|
||||||
self.groups.find(:all, :conditions => {:type => ""})
|
self.groups.where(type: '')
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.authenticate(login, password)
|
def self.authenticate(login, password)
|
||||||
|
|
|
@ -3,7 +3,7 @@ class Workgroup < Group
|
||||||
|
|
||||||
has_many :tasks
|
has_many :tasks
|
||||||
# returns all non-finished tasks
|
# returns all non-finished tasks
|
||||||
has_many :open_tasks, :class_name => 'Task', :conditions => ['done = ?', false], order: 'due_date ASC, name ASC'
|
has_many :open_tasks, -> { where(:done => false).order('due_date ASC, name ASC') }, :class_name => 'Task'
|
||||||
|
|
||||||
validates_uniqueness_of :name
|
validates_uniqueness_of :name
|
||||||
validate :last_admin_on_earth, :on => :update
|
validate :last_admin_on_earth, :on => :update
|
||||||
|
@ -13,7 +13,7 @@ class Workgroup < Group
|
||||||
|
|
||||||
# Check before destroy a group, if this is the last group with admin role
|
# Check before destroy a group, if this is the last group with admin role
|
||||||
def check_last_admin_group
|
def check_last_admin_group
|
||||||
if role_admin && Workgroup.where(:role_admin => true).size == 1
|
if role_admin && Workgroup.where(role_admin: true).size == 1
|
||||||
raise I18n.t('workgroups.error_last_admin_group')
|
raise I18n.t('workgroups.error_last_admin_group')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -21,7 +21,7 @@ class Workgroup < Group
|
||||||
# add validation check on update
|
# add validation check on update
|
||||||
# Return an error if this is the last group with admin role and role_admin should set to false
|
# Return an error if this is the last group with admin role and role_admin should set to false
|
||||||
def last_admin_on_earth
|
def last_admin_on_earth
|
||||||
if !role_admin && !Workgroup.where('role_admin = ? AND id != ?', true, id).exists?
|
if !role_admin && !Workgroup.where(role_admin: true).where.not(id: id).exists?
|
||||||
errors.add(:role_admin, I18n.t('workgroups.error_last_admin_role'))
|
errors.add(:role_admin, I18n.t('workgroups.error_last_admin_role'))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -18,5 +18,5 @@
|
||||||
%td= ordergroup.users.size
|
%td= ordergroup.users.size
|
||||||
%td
|
%td
|
||||||
= link_to t('ui.edit'), edit_admin_ordergroup_path(ordergroup), class: 'btn btn-mini'
|
= link_to t('ui.edit'), edit_admin_ordergroup_path(ordergroup), class: 'btn btn-mini'
|
||||||
= link_to t('ui.delete'), [:admin, ordergroup], :confirm => t('admin.confirm', name: ordergroup.name),
|
= link_to t('ui.delete'), [:admin, ordergroup], :data => {:confirm => t('admin.confirm', name: ordergroup.name)},
|
||||||
:method => :delete, class: 'btn btn-mini btn-danger'
|
:method => :delete, class: 'btn btn-mini btn-danger'
|
||||||
|
|
|
@ -2,5 +2,5 @@
|
||||||
|
|
||||||
%section= render 'shared/group', group: @ordergroup
|
%section= render 'shared/group', group: @ordergroup
|
||||||
= link_to t('ui.edit'), edit_admin_ordergroup_path(@ordergroup), class: 'btn'
|
= link_to t('ui.edit'), edit_admin_ordergroup_path(@ordergroup), class: 'btn'
|
||||||
= link_to t('ui.delete'), [:admin, @ordergroup], :confirm => t('.confirm'), :method => :delete, class: 'btn btn-danger'
|
= link_to t('ui.delete'), [:admin, @ordergroup], :data => {:confirm => t('.confirm')}, :method => :delete, class: 'btn btn-danger'
|
||||||
= link_to t('.send_message'), new_message_path(:message => {:group_id => @ordergroup.id}), class: 'btn'
|
= link_to t('.send_message'), new_message_path(:message => {:group_id => @ordergroup.id}), class: 'btn'
|
||||||
|
|
|
@ -21,5 +21,5 @@
|
||||||
%td= format_roles(user)
|
%td= format_roles(user)
|
||||||
%td= format_time(user.last_login)
|
%td= format_time(user.last_login)
|
||||||
%td= link_to t('ui.edit'), edit_admin_user_path(user), class: 'btn btn-mini'
|
%td= link_to t('ui.edit'), edit_admin_user_path(user), class: 'btn btn-mini'
|
||||||
%td= link_to t('ui.delete'), [:admin, user], :confirm => t('admin.confirm', name: user.name),
|
%td= link_to t('ui.delete'), [:admin, user], :data => {:confirm => t('admin.confirm', name: user.name)},
|
||||||
:method => :delete, class: 'btn btn-danger btn-mini'
|
:method => :delete, class: 'btn btn-danger btn-mini'
|
||||||
|
|
|
@ -29,12 +29,12 @@
|
||||||
.well
|
.well
|
||||||
%h4= t '.groupabos'
|
%h4= t '.groupabos'
|
||||||
%ul.unstyled
|
%ul.unstyled
|
||||||
- for membership in Membership.find_all_by_user_id(@user.id)
|
- for membership in Membership.where(user: @user)
|
||||||
%li= link_to(membership.group.name, [:admin, membership.group])
|
%li= link_to(membership.group.name, [:admin, membership.group])
|
||||||
|
|
||||||
%hr/
|
%hr/
|
||||||
%p
|
%p
|
||||||
= link_to t('ui.edit'), edit_admin_user_path(@user), class: 'btn'
|
= link_to t('ui.edit'), edit_admin_user_path(@user), class: 'btn'
|
||||||
= link_to t('ui.delete'), [:admin, @user], :confirm => t('.confirm', user: @user.first_name),
|
= link_to t('ui.delete'), [:admin, @user], :data => {:confirm => t('.confirm', user: @user.first_name)},
|
||||||
:method => :delete, class: 'btn btn-danger'
|
:method => :delete, class: 'btn btn-danger'
|
||||||
= link_to t('.send_message'), new_message_path(:message => {:mail_to => @user.id}), class: 'btn'
|
= link_to t('.send_message'), new_message_path(:message => {:mail_to => @user.id}), class: 'btn'
|
||||||
|
|
|
@ -16,5 +16,5 @@
|
||||||
%td= format_roles(workgroup)
|
%td= format_roles(workgroup)
|
||||||
%td
|
%td
|
||||||
= link_to t('ui.edit'), edit_admin_workgroup_path(workgroup), class: 'btn btn-mini'
|
= link_to t('ui.edit'), edit_admin_workgroup_path(workgroup), class: 'btn btn-mini'
|
||||||
= link_to t('ui.delete'), [:admin, workgroup], :confirm => t('admin.confirm', name: workgroup.name),
|
= link_to t('ui.delete'), [:admin, workgroup], :data => {:confirm => t('admin.confirm', name: workgroup.name)},
|
||||||
:method => :delete, class: 'btn btn-mini btn-danger'
|
:method => :delete, class: 'btn btn-mini btn-danger'
|
||||||
|
|
|
@ -2,5 +2,5 @@
|
||||||
|
|
||||||
%section= render 'shared/group', group: @workgroup
|
%section= render 'shared/group', group: @workgroup
|
||||||
= link_to t('ui.edit'), edit_admin_workgroup_path(@workgroup), class: 'btn'
|
= link_to t('ui.edit'), edit_admin_workgroup_path(@workgroup), class: 'btn'
|
||||||
= link_to t('ui.delete'), [:admin, @workgroup], :confirm => t('.confirm'), :method => :delete, class: 'btn btn-danger'
|
= link_to t('ui.delete'), [:admin, @workgroup], :data => {:confirm => t('.confirm')}, :method => :delete, class: 'btn btn-danger'
|
||||||
= link_to_new_message(message_params: {group_id: @workgroup.id})
|
= link_to_new_message(message_params: {group_id: @workgroup.id})
|
||||||
|
|
|
@ -15,5 +15,5 @@
|
||||||
%td= article_category.description
|
%td= article_category.description
|
||||||
%td
|
%td
|
||||||
= link_to t('ui.edit'), edit_article_category_path(article_category), class: 'btn btn-mini'
|
= link_to t('ui.edit'), edit_article_category_path(article_category), class: 'btn btn-mini'
|
||||||
= link_to t('ui.delete'), article_category, :method => :delete, :confirm => t('.confirm_delete'),
|
= link_to t('ui.delete'), article_category, :method => :delete, :data => {:confirm => t('.confirm_delete')},
|
||||||
class: 'btn btn-mini btn-danger'
|
class: 'btn btn-mini btn-danger'
|
||||||
|
|
|
@ -14,4 +14,4 @@
|
||||||
%td= link_to t('ui.edit'), edit_supplier_article_path(@supplier, article),
|
%td= link_to t('ui.edit'), edit_supplier_article_path(@supplier, article),
|
||||||
:remote => true, class: 'btn btn-mini'
|
:remote => true, class: 'btn btn-mini'
|
||||||
%td= link_to t('ui.delete'), [@supplier, article],
|
%td= link_to t('ui.delete'), [@supplier, article],
|
||||||
:method => :delete, :confirm => t('.confirm_delete'), :remote => true, class: 'btn btn-mini btn-danger'
|
:method => :delete, :data => {:confirm => t('.confirm_delete')}, :remote => true, class: 'btn btn-mini btn-danger'
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
= check_box_tag :checkall, 1, false, 'data-check-all' => '#articlesInListForm', 'data-ignore-onchange' => true
|
= check_box_tag :checkall, 1, false, 'data-check-all' => '#articlesInListForm', 'data-ignore-onchange' => true
|
||||||
%select{:name => "selected_action", 'data-submit-onchange' => true}
|
%select{:name => "selected_action", 'data-submit-onchange' => true}
|
||||||
%option{:value => '', :selected => 'selected'}= t '.option_select'
|
%option{:value => '', :selected => 'selected'}= t '.option_select'
|
||||||
%option{:value => "destroy", 'data-confirm' => t('.confirm_delete')}= t '.option_delete'
|
%option{:value => "destroy", :data => {:confirm => t('.confirm_delete')}}= t '.option_delete'
|
||||||
%option{:value => "setNotAvailable"}= t '.option_not_available'
|
%option{:value => "setNotAvailable"}= t '.option_not_available'
|
||||||
%option{:value => "setAvailable"}= t '.option_available'
|
%option{:value => "setAvailable"}= t '.option_available'
|
||||||
= hidden_field_tag 'supplier_id', @supplier.id
|
= hidden_field_tag 'supplier_id', @supplier.id
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
- if @articles.empty?
|
- if @articles.empty?
|
||||||
%p= t '.not_found'
|
%p= t '.not_found'
|
||||||
- else
|
- else
|
||||||
= pagination_links_remote @articles, :params => {:search => search_params}
|
= pagination_links_remote @articles, :params => {:q => search_params}
|
||||||
%table.table.table-striped
|
%table.table.table-striped
|
||||||
%thead
|
%thead
|
||||||
%tr
|
%tr
|
||||||
|
@ -16,7 +16,7 @@
|
||||||
%tbody
|
%tbody
|
||||||
- for article in @articles
|
- for article in @articles
|
||||||
%tr
|
%tr
|
||||||
%td= highlight article.name, params[:search][:name_contains_all]
|
%td= highlight article.name, params[:q][:name_cont_all]
|
||||||
%td= article.origin
|
%td= article.origin
|
||||||
%td= article.manufacturer
|
%td= article.manufacturer
|
||||||
%td= article.note
|
%td= article.note
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
= t '.change_supplier'
|
= t '.change_supplier'
|
||||||
%span.caret
|
%span.caret
|
||||||
%ul.dropdown-menu
|
%ul.dropdown-menu
|
||||||
- Supplier.undeleted.where('id != ?', @supplier.id).order('suppliers.name ASC').each do |supplier|
|
- Supplier.undeleted.where.not(id: @supplier.id).order('suppliers.name ASC').each do |supplier|
|
||||||
%li= link_to supplier.name, supplier_articles_path(supplier), tabindex: -1
|
%li= link_to supplier.name, supplier_articles_path(supplier), tabindex: -1
|
||||||
|
|
||||||
- unless @supplier.shared_supplier.nil?
|
- unless @supplier.shared_supplier.nil?
|
||||||
|
@ -36,10 +36,10 @@
|
||||||
= form_tag shared_supplier_articles_path(@supplier), method: :get, remote: true, class: 'form-search',
|
= form_tag shared_supplier_articles_path(@supplier), method: :get, remote: true, class: 'form-search',
|
||||||
'data-submit-onchange' => true do
|
'data-submit-onchange' => true do
|
||||||
%h3= t '.import.title'
|
%h3= t '.import.title'
|
||||||
= text_field_tag "search[name_contains_all]", "", class: 'input-medium search-query',
|
= text_field_tag "q[name_cont_all]", "", class: 'input-medium search-query',
|
||||||
placeholder: t('.import.placeholder')
|
placeholder: t('.import.placeholder')
|
||||||
%label.checkbox
|
%label.checkbox
|
||||||
= check_box_tag "search[origin_equals]", "REG", false
|
= check_box_tag "q[origin_eq]", "REG", false
|
||||||
= t '.import.restrict_region'
|
= t '.import.restrict_region'
|
||||||
#search_results.clearfix
|
#search_results.clearfix
|
||||||
= link_to t('ui.close'), "#import", 'data-toggle-this' => '#import'
|
= link_to t('ui.close'), "#import", 'data-toggle-this' => '#import'
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
%td
|
%td
|
||||||
= link_to t('ui.show'), [@supplier, delivery], class: 'btn btn-mini'
|
= link_to t('ui.show'), [@supplier, delivery], class: 'btn btn-mini'
|
||||||
= link_to t('ui.edit'), edit_supplier_delivery_path(@supplier,delivery), class: 'btn btn-mini'
|
= link_to t('ui.edit'), edit_supplier_delivery_path(@supplier,delivery), class: 'btn btn-mini'
|
||||||
= link_to t('ui.delete'), [@supplier,delivery], :confirm => t('.confirm_delete'), :method => :delete,
|
= link_to t('ui.delete'), [@supplier,delivery], :data => {:confirm => t('.confirm_delete')}, :method => :delete,
|
||||||
class: 'btn btn-mini btn-danger'
|
class: 'btn btn-mini btn-danger'
|
||||||
|
|
||||||
= link_to t('.new_delivery', supplier: @supplier.name), new_supplier_delivery_path(@supplier), class: 'btn btn-primary'
|
= link_to t('.new_delivery', supplier: @supplier.name), new_supplier_delivery_path(@supplier), class: 'btn btn-primary'
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
%th.numeric= t '.sum'
|
%th.numeric= t '.sum'
|
||||||
%tbody
|
%tbody
|
||||||
- total_net, total_gross = 0,0
|
- total_net, total_gross = 0,0
|
||||||
- @delivery.stock_changes.all.each do |stock_change|
|
- @delivery.stock_changes.each do |stock_change|
|
||||||
- quantity = stock_change.quantity
|
- quantity = stock_change.quantity
|
||||||
- sum = quantity * stock_change.stock_article.price
|
- sum = quantity * stock_change.stock_article.price
|
||||||
- total_net += sum
|
- total_net += sum
|
||||||
|
|
|
@ -24,4 +24,4 @@
|
||||||
class: 'btn btn-mini'
|
class: 'btn btn-mini'
|
||||||
%td
|
%td
|
||||||
= link_to t('ui.delete'), order_order_article_path(order_article.order, order_article), method: :delete,
|
= link_to t('ui.delete'), order_order_article_path(order_article.order, order_article), method: :delete,
|
||||||
remote: true, confirm: t('.confirm'), class: 'btn btn-danger btn-mini'
|
remote: true, data: {confirm: t('.confirm')}, class: 'btn btn-danger btn-mini'
|
||||||
|
|
|
@ -26,6 +26,6 @@
|
||||||
= link_to t('orders.index.action_receive'), '#', class: 'btn btn-mini disabled'
|
= link_to t('orders.index.action_receive'), '#', class: 'btn btn-mini disabled'
|
||||||
= link_to t('.clear'), new_finance_order_path(order_id: order.id), class: 'btn btn-mini btn-primary'
|
= link_to t('.clear'), new_finance_order_path(order_id: order.id), class: 'btn btn-mini btn-primary'
|
||||||
= link_to t('.close'), close_direct_finance_order_path(order),
|
= link_to t('.close'), close_direct_finance_order_path(order),
|
||||||
:confirm => t('.confirm'), :method => :put, class: 'btn btn-mini'
|
:data => {:confirm => t('.confirm')}, :method => :patch, class: 'btn btn-mini'
|
||||||
- else
|
- else
|
||||||
%i= t('.no_closed_orders')
|
%i= t('.no_closed_orders')
|
||||||
|
|
|
@ -6,5 +6,5 @@
|
||||||
%td= group_order.ordergroup.name
|
%td= group_order.ordergroup.name
|
||||||
%td.numeric= number_to_currency(group_order.price)
|
%td.numeric= number_to_currency(group_order.price)
|
||||||
.form-actions
|
.form-actions
|
||||||
= link_to t('.clear'), close_finance_order_path(@order), method: :put, class: 'btn btn-primary'
|
= link_to t('.clear'), close_finance_order_path(@order), method: :patch, class: 'btn btn-primary'
|
||||||
= link_to t('.or_cancel'), new_finance_order_path(order_id: @order.id)
|
= link_to t('.or_cancel'), new_finance_order_path(order_id: @order.id)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
%tr.transaction
|
%tr.transaction
|
||||||
%td
|
%td
|
||||||
= select_tag 'financial_transactions[][ordergroup_id]',
|
= select_tag 'financial_transactions[][ordergroup_id]',
|
||||||
options_for_select(Ordergroup.order(:name).all.map { |g| [ g.name, g.id ] })
|
options_for_select(Ordergroup.order(:name).map { |g| [ g.name, g.id ] })
|
||||||
%td= text_field_tag 'financial_transactions[][amount]', nil, class: 'input-small'
|
%td= text_field_tag 'financial_transactions[][amount]', nil, class: 'input-small'
|
||||||
%td= link_to t('.remove'), "#", :title => t('.remove_group'), 'data-remove-transaction' => true,
|
%td= link_to t('.remove'), "#", :title => t('.remove_group'), 'data-remove-transaction' => true,
|
||||||
class: 'btn btn-small'
|
class: 'btn btn-small'
|
|
@ -27,5 +27,5 @@
|
||||||
%td= link_to format_date(invoice.order.ends), new_finance_order_path(order_id: invoice.order_id) if invoice.order
|
%td= link_to format_date(invoice.order.ends), new_finance_order_path(order_id: invoice.order_id) if invoice.order
|
||||||
%td= truncate(invoice.note)
|
%td= truncate(invoice.note)
|
||||||
%td= link_to t('ui.edit'), edit_finance_invoice_path(invoice), class: 'btn btn-mini'
|
%td= link_to t('ui.edit'), edit_finance_invoice_path(invoice), class: 'btn btn-mini'
|
||||||
%td= link_to t('ui.delete'), finance_invoice_path(invoice), :confirm => t('.confirm_delete'), :method => :delete,
|
%td= link_to t('ui.delete'), finance_invoice_path(invoice), :data => {:confirm => t('.confirm_delete')}, :method => :delete,
|
||||||
class: 'btn btn-danger btn-mini'
|
class: 'btn btn-danger btn-mini'
|
||||||
|
|
|
@ -34,6 +34,6 @@
|
||||||
- unless Order.closed.empty?
|
- unless Order.closed.empty?
|
||||||
%section
|
%section
|
||||||
%h2= t '.closed_orders.title'
|
%h2= t '.closed_orders.title'
|
||||||
= render :partial => "orders", :locals => {:orders => Order.closed.all(:limit => 5), :pagination => false}
|
= render :partial => "orders", :locals => {:orders => Order.closed.limit(5), :pagination => false}
|
||||||
%br/
|
%br/
|
||||||
= link_to t('.closed_orders.more'), archive_group_orders_path
|
= link_to t('.closed_orders.more'), archive_group_orders_path
|
||||||
|
|
|
@ -19,5 +19,5 @@
|
||||||
remote: true, class: 'btn btn-success btn-small'
|
remote: true, class: 'btn btn-success btn-small'
|
||||||
- if membership.group.type != 'Ordergroup'
|
- if membership.group.type != 'Ordergroup'
|
||||||
%td= link_to t('.groups.cancel'), cancel_membership_path(membership_id: membership),
|
%td= link_to t('.groups.cancel'), cancel_membership_path(membership_id: membership),
|
||||||
confirm: t('.groups.cancel_confirm'), method: :post,
|
:data => {confirm: t('.groups.cancel_confirm')}, method: :post,
|
||||||
class: 'btn btn-danger btn-small'
|
class: 'btn btn-danger btn-small'
|
||||||
|
|
|
@ -36,8 +36,8 @@
|
||||||
= t('.list.mail', email: mail_to(FoodsoftConfig[:mailing_list_subscribe])).html_safe
|
= t('.list.mail', email: mail_to(FoodsoftConfig[:mailing_list_subscribe])).html_safe
|
||||||
|
|
||||||
#recipients
|
#recipients
|
||||||
= f.input :recipient_tokens, :input_html => { 'data-pre' => User.find_all_by_id(@message.recipients_ids).map(&:token_attributes).to_json }
|
= f.input :recipient_tokens, :input_html => { 'data-pre' => User.where(id: @message.recipients_ids).map(&:token_attributes).to_json }
|
||||||
= f.input :group_id, :as => :select, :collection => Group.undeleted.order('type DESC, name ASC').all.reject { |g| g.memberships.empty? }
|
= f.input :group_id, :as => :select, :collection => Group.undeleted.order('type DESC, name ASC').reject { |g| g.memberships.empty? }
|
||||||
= f.input :private
|
= f.input :private
|
||||||
= f.input :subject, input_html: {class: 'input-xxlarge'}
|
= f.input :subject, input_html: {class: 'input-xxlarge'}
|
||||||
= f.input :body, input_html: {class: 'input-xxlarge'}
|
= f.input :body, input_html: {class: 'input-xxlarge'}
|
||||||
|
|
|
@ -33,13 +33,13 @@
|
||||||
%td= format_time(order.ends) unless order.ends.nil?
|
%td= format_time(order.ends) unless order.ends.nil?
|
||||||
%td= truncate(order.note)
|
%td= truncate(order.note)
|
||||||
%td= link_to t('.action_end'), finish_order_path(order),
|
%td= link_to t('.action_end'), finish_order_path(order),
|
||||||
confirm: t('.confirm_end', order: order.name), method: :post,
|
data: {confirm: t('.confirm_end', order: order.name)}, method: :post,
|
||||||
class: 'btn btn-small btn-success'
|
class: 'btn btn-small btn-success'
|
||||||
|
|
||||||
%td
|
%td
|
||||||
= link_to t('ui.edit'), edit_order_path(order), class: 'btn btn-small'
|
= link_to t('ui.edit'), edit_order_path(order), class: 'btn btn-small'
|
||||||
= link_to t('ui.show'), order, class: 'btn btn-small'
|
= link_to t('ui.show'), order, class: 'btn btn-small'
|
||||||
= link_to t('ui.delete'), order, confirm: t('.confirm_delete'), method: :delete,
|
= link_to t('ui.delete'), order, data: {confirm: t('.confirm_delete')}, method: :delete,
|
||||||
class: 'btn btn-small btn-danger'
|
class: 'btn btn-small btn-danger'
|
||||||
|
|
||||||
- unless @finished_orders.empty?
|
- unless @finished_orders.empty?
|
||||||
|
@ -60,7 +60,7 @@
|
||||||
%td
|
%td
|
||||||
= link_to t('ui.edit'), '#', class: 'btn btn-small disabled', tabindex: -1
|
= link_to t('ui.edit'), '#', class: 'btn btn-small disabled', tabindex: -1
|
||||||
= link_to t('ui.show'), order, class: 'btn btn-small'
|
= link_to t('ui.show'), order, class: 'btn btn-small'
|
||||||
= link_to t('ui.delete'), order, confirm: t('.confirm_delete'), method: :delete,
|
= link_to t('ui.delete'), order, data: {confirm: t('.confirm_delete')}, method: :delete,
|
||||||
class: 'btn btn-small btn-danger'
|
class: 'btn btn-small btn-danger'
|
||||||
|
|
||||||
%h2= t '.orders_settled'
|
%h2= t '.orders_settled'
|
||||||
|
|
|
@ -59,16 +59,15 @@
|
||||||
|
|
||||||
- if @order.open?
|
- if @order.open?
|
||||||
= link_to t('.action_end'), finish_order_path(@order), method: :post, class: 'btn btn-success',
|
= link_to t('.action_end'), finish_order_path(@order), method: :post, class: 'btn btn-success',
|
||||||
confirm: t('.confirm_end', order: @order.name)
|
data: {confirm: t('.confirm_end', order: @order.name)}
|
||||||
= link_to t('ui.edit'), edit_order_path(@order), class: 'btn'
|
= link_to t('ui.edit'), edit_order_path(@order), class: 'btn'
|
||||||
- elsif not @order.closed? and not @order.stockit?
|
- elsif not @order.closed? and not @order.stockit?
|
||||||
-# TODO btn-success class only if not received before
|
-# TODO btn-success class only if not received before
|
||||||
= link_to t('orders.index.action_receive'), receive_order_path(@order), class: 'btn btn-success'
|
= link_to t('orders.index.action_receive'), receive_order_path(@order), class: 'btn btn-success'
|
||||||
- unless @order.closed?
|
- unless @order.closed?
|
||||||
= link_to t('ui.delete'), @order, confirm: t('.confirm_delete'), method: :delete,
|
= link_to t('ui.delete'), @order, data_confirm: t('.confirm_delete'), method: :delete,
|
||||||
class: 'btn btn-danger'
|
class: 'btn btn-danger'
|
||||||
|
|
||||||
|
|
||||||
%section#articles_table
|
%section#articles_table
|
||||||
= render @partial, order: @order
|
= render @partial, order: @order
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
= number_to_currency(f.object.fc_price) rescue nil
|
= number_to_currency(f.object.fc_price) rescue nil
|
||||||
|
|
||||||
-# do this inline, since it's being used in ajax forms only
|
-# do this inline, since it's being used in ajax forms only
|
||||||
- field = f.object.class.model_name.underscore
|
- field = f.object.class.model_name.to_s.underscore
|
||||||
:javascript
|
:javascript
|
||||||
var form = $('#article_fc_price').closest('form');
|
var form = $('#article_fc_price').closest('form');
|
||||||
$('##{field}_price, ##{field}_tax, ##{field}_deposit', form).on('change keyup', function() {
|
$('##{field}_price, ##{field}_tax, ##{field}_deposit', form).on('change keyup', function() {
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
%acronym{:title => t('shared.articles.received_desc')}= t 'shared.articles.received'
|
%acronym{:title => t('shared.articles.received_desc')}= t 'shared.articles.received'
|
||||||
%th= t 'shared.articles_by.price'
|
%th= t 'shared.articles_by.price'
|
||||||
|
|
||||||
- for order_article in order.order_articles.ordered.all(:include => [:article, :article_price])
|
- for order_article in order.order_articles.ordered.includes([:article, :article_price])
|
||||||
= render 'shared/articles_by/article_single', order_article: order_article, edit: (edit rescue nil)
|
= render 'shared/articles_by/article_single', order_article: order_article, edit: (edit rescue nil)
|
||||||
%tr
|
%tr
|
||||||
%td{colspan: 4}
|
%td{colspan: 4}
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
%th{colspan: 9}
|
%th{colspan: 9}
|
||||||
%h4.name= group_order.ordergroup.name
|
%h4.name= group_order.ordergroup.name
|
||||||
- total = 0
|
- total = 0
|
||||||
- for goa in group_order.group_order_articles.ordered.all(:include => :order_article)
|
- for goa in group_order.group_order_articles.ordered.includes(:order_article)
|
||||||
- total += goa.total_price
|
- total += goa.total_price
|
||||||
= render 'shared/articles_by/group_single_goa', goa: goa, edit: (edit rescue nil)
|
= render 'shared/articles_by/group_single_goa', goa: goa, edit: (edit rescue nil)
|
||||||
%tr{class: cycle('even', 'odd', :name => 'articles')}
|
%tr{class: cycle('even', 'odd', :name => 'articles')}
|
||||||
|
|
|
@ -15,5 +15,5 @@
|
||||||
%td= truncate stock_taking.note
|
%td= truncate stock_taking.note
|
||||||
%td
|
%td
|
||||||
= link_to t('ui.edit'), edit_stock_taking_path(stock_taking), class: 'btn btn-mini'
|
= link_to t('ui.edit'), edit_stock_taking_path(stock_taking), class: 'btn btn-mini'
|
||||||
= link_to t('ui.delete'), stock_taking, :confirm => t('.confirm_delete'), :method => :delete,
|
= link_to t('ui.delete'), stock_taking, :data => {:confirm => t('.confirm_delete')}, :method => :delete,
|
||||||
class: 'btn btn-mini btn-danger'
|
class: 'btn btn-mini btn-danger'
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
%th= t '.supplier'
|
%th= t '.supplier'
|
||||||
%th= t '.unit'
|
%th= t '.unit'
|
||||||
%th= t '.amount'
|
%th= t '.amount'
|
||||||
- for stock_change in @stock_taking.stock_changes.all
|
- for stock_change in @stock_taking.stock_changes
|
||||||
%tr
|
%tr
|
||||||
%td= stock_change.stock_article.name
|
%td= stock_change.stock_article.name
|
||||||
%td= stock_change.stock_article.supplier.name
|
%td= stock_change.stock_article.supplier.name
|
||||||
|
@ -23,5 +23,5 @@
|
||||||
.btn-group
|
.btn-group
|
||||||
= link_to t('ui.edit'), edit_stock_taking_path(@stock_taking), class: 'btn'
|
= link_to t('ui.edit'), edit_stock_taking_path(@stock_taking), class: 'btn'
|
||||||
= link_to t('.overview'), stock_takings_path, class: 'btn'
|
= link_to t('.overview'), stock_takings_path, class: 'btn'
|
||||||
= link_to t('ui.delete'), @stock_taking, :method => :delete, :confirm => t('.confirm_delete'),
|
= link_to t('ui.delete'), @stock_taking, :method => :delete, :data => {:confirm => t('.confirm_delete')},
|
||||||
class: 'btn btn-danger'
|
class: 'btn btn-danger'
|
||||||
|
|
|
@ -10,5 +10,5 @@
|
||||||
%td= stock_article.article_category.name
|
%td= stock_article.article_category.name
|
||||||
%td
|
%td
|
||||||
= link_to t('ui.edit'), edit_stock_article_path(stock_article), remote: true, class: 'btn btn-mini'
|
= link_to t('ui.edit'), edit_stock_article_path(stock_article), remote: true, class: 'btn btn-mini'
|
||||||
= link_to t('ui.delete'), stock_article, :method => :delete, :confirm => t('.confirm_delete', :name => stock_article.name),
|
= link_to t('ui.delete'), stock_article, :method => :delete, :data => {:confirm => t('.confirm_delete', :name => stock_article.name)},
|
||||||
class: 'btn btn-mini btn-danger', :remote => true
|
class: 'btn btn-mini btn-danger', :remote => true
|
||||||
|
|
|
@ -24,4 +24,4 @@
|
||||||
%td
|
%td
|
||||||
= link_to t('ui.edit'), edit_supplier_path(supplier), class: 'btn btn-mini'
|
= link_to t('ui.edit'), edit_supplier_path(supplier), class: 'btn btn-mini'
|
||||||
= link_to t('ui.delete'), supplier_path(supplier), method: :delete,
|
= link_to t('ui.delete'), supplier_path(supplier), method: :delete,
|
||||||
confirm: t('.confirm_del', name: supplier.name), class: 'btn btn-mini btn-danger'
|
:data => {confirm: t('.confirm_del', name: supplier.name)}, class: 'btn btn-mini btn-danger'
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
- if @current_user.role_suppliers?
|
- if @current_user.role_suppliers?
|
||||||
.form-actions
|
.form-actions
|
||||||
= link_to t('ui.edit'), edit_supplier_path(@supplier), class: 'btn'
|
= link_to t('ui.edit'), edit_supplier_path(@supplier), class: 'btn'
|
||||||
= link_to t('ui.delete'), @supplier, :confirm => t('.confirm_delete'), :method => :delete, class: 'btn btn-danger'
|
= link_to t('ui.delete'), @supplier, :data => {:confirm => t('.confirm_delete')}, :method => :delete, class: 'btn btn-danger'
|
||||||
|
|
||||||
.span6
|
.span6
|
||||||
%h2= t '.last_deliveries'
|
%h2= t '.last_deliveries'
|
||||||
|
|
|
@ -30,8 +30,8 @@
|
||||||
- unless @task.done?
|
- unless @task.done?
|
||||||
= link_to t('.mark_done'), set_done_task_path(@task), method: :post, class: 'btn'
|
= link_to t('.mark_done'), set_done_task_path(@task), method: :post, class: 'btn'
|
||||||
= link_to t('ui.edit'), edit_task_path(@task), class: 'btn'
|
= link_to t('ui.edit'), edit_task_path(@task), class: 'btn'
|
||||||
= link_to t('ui.delete'), task_path(@task), :method => :delete, :confirm => t('.confirm_delete_single'),
|
= link_to t('ui.delete'), task_path(@task), :method => :delete, :data => {:confirm => t('.confirm_delete_single')},
|
||||||
class: 'btn btn-danger'
|
class: 'btn btn-danger'
|
||||||
- if @task.periodic?
|
- if @task.periodic?
|
||||||
= link_to t('.delete_group'), task_path(@task, periodic: true), method: :delete,
|
= link_to t('.delete_group'), task_path(@task, periodic: true), method: :delete,
|
||||||
confirm: t('.confirm_delete_group'), class: 'btn btn-danger'
|
:data => {confirm: t('.confirm_delete_group')}, class: 'btn btn-danger'
|
||||||
|
|
16
bin/autospec
Executable file
16
bin/autospec
Executable file
|
@ -0,0 +1,16 @@
|
||||||
|
#!/usr/bin/env ruby
|
||||||
|
#
|
||||||
|
# This file was generated by Bundler.
|
||||||
|
#
|
||||||
|
# The application 'autospec' is installed as part of a gem, and
|
||||||
|
# this file is here to facilitate running it.
|
||||||
|
#
|
||||||
|
|
||||||
|
require 'pathname'
|
||||||
|
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
|
||||||
|
Pathname.new(__FILE__).realpath)
|
||||||
|
|
||||||
|
require 'rubygems'
|
||||||
|
require 'bundler/setup'
|
||||||
|
|
||||||
|
load Gem.bin_path('rspec-core', 'autospec')
|
3
bin/bundle
Executable file
3
bin/bundle
Executable file
|
@ -0,0 +1,3 @@
|
||||||
|
#!/usr/bin/env ruby
|
||||||
|
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
|
||||||
|
load Gem.bin_path('bundler', 'bundle')
|
16
bin/cap
Executable file
16
bin/cap
Executable file
|
@ -0,0 +1,16 @@
|
||||||
|
#!/usr/bin/env ruby
|
||||||
|
#
|
||||||
|
# This file was generated by Bundler.
|
||||||
|
#
|
||||||
|
# The application 'cap' is installed as part of a gem, and
|
||||||
|
# this file is here to facilitate running it.
|
||||||
|
#
|
||||||
|
|
||||||
|
require 'pathname'
|
||||||
|
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
|
||||||
|
Pathname.new(__FILE__).realpath)
|
||||||
|
|
||||||
|
require 'rubygems'
|
||||||
|
require 'bundler/setup'
|
||||||
|
|
||||||
|
load Gem.bin_path('capistrano', 'cap')
|
16
bin/capify
Executable file
16
bin/capify
Executable file
|
@ -0,0 +1,16 @@
|
||||||
|
#!/usr/bin/env ruby
|
||||||
|
#
|
||||||
|
# This file was generated by Bundler.
|
||||||
|
#
|
||||||
|
# The application 'capify' is installed as part of a gem, and
|
||||||
|
# this file is here to facilitate running it.
|
||||||
|
#
|
||||||
|
|
||||||
|
require 'pathname'
|
||||||
|
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
|
||||||
|
Pathname.new(__FILE__).realpath)
|
||||||
|
|
||||||
|
require 'rubygems'
|
||||||
|
require 'bundler/setup'
|
||||||
|
|
||||||
|
load Gem.bin_path('capistrano', 'capify')
|
16
bin/mailcatcher
Executable file
16
bin/mailcatcher
Executable file
|
@ -0,0 +1,16 @@
|
||||||
|
#!/usr/bin/env ruby
|
||||||
|
#
|
||||||
|
# This file was generated by Bundler.
|
||||||
|
#
|
||||||
|
# The application 'mailcatcher' is installed as part of a gem, and
|
||||||
|
# this file is here to facilitate running it.
|
||||||
|
#
|
||||||
|
|
||||||
|
require 'pathname'
|
||||||
|
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
|
||||||
|
Pathname.new(__FILE__).realpath)
|
||||||
|
|
||||||
|
require 'rubygems'
|
||||||
|
require 'bundler/setup'
|
||||||
|
|
||||||
|
load Gem.bin_path('mailcatcher', 'mailcatcher')
|
4
bin/rails
Executable file
4
bin/rails
Executable file
|
@ -0,0 +1,4 @@
|
||||||
|
#!/usr/bin/env ruby
|
||||||
|
APP_PATH = File.expand_path('../../config/application', __FILE__)
|
||||||
|
require_relative '../config/boot'
|
||||||
|
require 'rails/commands'
|
4
bin/rake
Executable file
4
bin/rake
Executable file
|
@ -0,0 +1,4 @@
|
||||||
|
#!/usr/bin/env ruby
|
||||||
|
require_relative '../config/boot'
|
||||||
|
require 'rake'
|
||||||
|
Rake.application.run
|
16
bin/resque
Executable file
16
bin/resque
Executable file
|
@ -0,0 +1,16 @@
|
||||||
|
#!/usr/bin/env ruby
|
||||||
|
#
|
||||||
|
# This file was generated by Bundler.
|
||||||
|
#
|
||||||
|
# The application 'resque' is installed as part of a gem, and
|
||||||
|
# this file is here to facilitate running it.
|
||||||
|
#
|
||||||
|
|
||||||
|
require 'pathname'
|
||||||
|
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
|
||||||
|
Pathname.new(__FILE__).realpath)
|
||||||
|
|
||||||
|
require 'rubygems'
|
||||||
|
require 'bundler/setup'
|
||||||
|
|
||||||
|
load Gem.bin_path('resque', 'resque')
|
16
bin/resque-web
Executable file
16
bin/resque-web
Executable file
|
@ -0,0 +1,16 @@
|
||||||
|
#!/usr/bin/env ruby
|
||||||
|
#
|
||||||
|
# This file was generated by Bundler.
|
||||||
|
#
|
||||||
|
# The application 'resque-web' is installed as part of a gem, and
|
||||||
|
# this file is here to facilitate running it.
|
||||||
|
#
|
||||||
|
|
||||||
|
require 'pathname'
|
||||||
|
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
|
||||||
|
Pathname.new(__FILE__).realpath)
|
||||||
|
|
||||||
|
require 'rubygems'
|
||||||
|
require 'bundler/setup'
|
||||||
|
|
||||||
|
load Gem.bin_path('resque', 'resque-web')
|
16
bin/rspec
Executable file
16
bin/rspec
Executable file
|
@ -0,0 +1,16 @@
|
||||||
|
#!/usr/bin/env ruby
|
||||||
|
#
|
||||||
|
# This file was generated by Bundler.
|
||||||
|
#
|
||||||
|
# The application 'rspec' is installed as part of a gem, and
|
||||||
|
# this file is here to facilitate running it.
|
||||||
|
#
|
||||||
|
|
||||||
|
require 'pathname'
|
||||||
|
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
|
||||||
|
Pathname.new(__FILE__).realpath)
|
||||||
|
|
||||||
|
require 'rubygems'
|
||||||
|
require 'bundler/setup'
|
||||||
|
|
||||||
|
load Gem.bin_path('rspec-core', 'rspec')
|
|
@ -6,12 +6,9 @@ require 'rails/all'
|
||||||
# http://stackoverflow.com/questions/20361428
|
# http://stackoverflow.com/questions/20361428
|
||||||
I18n.enforce_available_locales = true
|
I18n.enforce_available_locales = true
|
||||||
|
|
||||||
if defined?(Bundler)
|
# Require the gems listed in Gemfile, including any gems
|
||||||
# If you precompile assets before deploying to production, use this line
|
# you've limited to :test, :development, or :production.
|
||||||
Bundler.require(*Rails.groups(:assets => %w(development test)))
|
Bundler.require(:default, Rails.env)
|
||||||
# If you want your assets lazily compiled in production, use this line
|
|
||||||
# Bundler.require(:default, :assets, Rails.env)
|
|
||||||
end
|
|
||||||
|
|
||||||
module Foodsoft
|
module Foodsoft
|
||||||
class Application < Rails::Application
|
class Application < Rails::Application
|
||||||
|
@ -26,9 +23,6 @@ module Foodsoft
|
||||||
# :all can be used as a placeholder for all plugins not explicitly named.
|
# :all can be used as a placeholder for all plugins not explicitly named.
|
||||||
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]
|
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]
|
||||||
|
|
||||||
# Activate observers that should always be running.
|
|
||||||
# config.active_record.observers = :cacher, :garbage_collector, :forum_observer
|
|
||||||
|
|
||||||
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
||||||
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
||||||
# config.time_zone = 'Central Time (US & Canada)'
|
# config.time_zone = 'Central Time (US & Canada)'
|
||||||
|
@ -41,9 +35,6 @@ module Foodsoft
|
||||||
# Configure the default encoding used in templates for Ruby 1.9.
|
# Configure the default encoding used in templates for Ruby 1.9.
|
||||||
config.encoding = "utf-8"
|
config.encoding = "utf-8"
|
||||||
|
|
||||||
# Configure sensitive parameters which will be filtered from the log file.
|
|
||||||
config.filter_parameters += [:password]
|
|
||||||
|
|
||||||
# Enable escaping HTML in JSON.
|
# Enable escaping HTML in JSON.
|
||||||
config.active_support.escape_html_entities_in_json = true
|
config.active_support.escape_html_entities_in_json = true
|
||||||
|
|
||||||
|
@ -56,7 +47,8 @@ module Foodsoft
|
||||||
# This will create an empty whitelist of attributes available for mass-assignment for all models
|
# This will create an empty whitelist of attributes available for mass-assignment for all models
|
||||||
# in your app. As such, your models will need to explicitly whitelist or blacklist accessible
|
# in your app. As such, your models will need to explicitly whitelist or blacklist accessible
|
||||||
# parameters by using an attr_accessible or attr_protected declaration.
|
# parameters by using an attr_accessible or attr_protected declaration.
|
||||||
config.active_record.whitelist_attributes = false # TODO: Bette re-activate this!
|
# TODO Re-activate this. Uncommenting this line will currently cause rspec to fail.
|
||||||
|
config.active_record.whitelist_attributes = false
|
||||||
|
|
||||||
# Enable the asset pipeline
|
# Enable the asset pipeline
|
||||||
config.assets.enabled = true
|
config.assets.enabled = true
|
||||||
|
@ -67,5 +59,9 @@ module Foodsoft
|
||||||
# It would be nice not to enable database connection when precompiling assets,
|
# It would be nice not to enable database connection when precompiling assets,
|
||||||
# but i18n-js requires initialization, that's why it's on.
|
# but i18n-js requires initialization, that's why it's on.
|
||||||
config.assets.initialize_on_precompile = true
|
config.assets.initialize_on_precompile = true
|
||||||
|
|
||||||
|
# Load legacy scripts from vendor
|
||||||
|
config.assets.precompile += [ 'vendor/assets/javascripts/*.js' ]
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# Load the rails application
|
# Load the Rails application.
|
||||||
require File.expand_path('../application', __FILE__)
|
require File.expand_path('../application', __FILE__)
|
||||||
|
|
||||||
# Initialize the rails application
|
# Initialize the Rails application.
|
||||||
Foodsoft::Application.initialize!
|
Foodsoft::Application.initialize!
|
||||||
|
|
|
@ -1,38 +1,33 @@
|
||||||
Foodsoft::Application.configure do
|
Foodsoft::Application.configure do
|
||||||
# Settings specified here will take precedence over those in config/application.rb
|
# Settings specified here will take precedence over those in config/application.rb.
|
||||||
|
|
||||||
# In the development environment your application's code is reloaded on
|
# In the development environment your application's code is reloaded on
|
||||||
# every request. This slows down response time but is perfect for development
|
# every request. This slows down response time but is perfect for development
|
||||||
# since you don't have to restart the web server when you make code changes.
|
# since you don't have to restart the web server when you make code changes.
|
||||||
config.cache_classes = false
|
config.cache_classes = false
|
||||||
|
|
||||||
# Log error messages when you accidentally call methods on nil.
|
# Do not eager load code on boot.
|
||||||
config.whiny_nils = true
|
config.eager_load = false
|
||||||
|
|
||||||
# Show full error reports and disable caching
|
# Show full error reports and disable caching.
|
||||||
config.consider_all_requests_local = true
|
config.consider_all_requests_local = true
|
||||||
config.action_controller.perform_caching = false
|
config.action_controller.perform_caching = false
|
||||||
|
|
||||||
# Don't care if the mailer can't send
|
# Don't care if the mailer can't send.
|
||||||
config.action_mailer.raise_delivery_errors = false
|
config.action_mailer.raise_delivery_errors = false
|
||||||
|
|
||||||
# Print deprecation notices to the Rails logger
|
# Print deprecation notices to the Rails logger.
|
||||||
config.active_support.deprecation = :log
|
config.active_support.deprecation = :log
|
||||||
|
|
||||||
# Only use best-standards-support built into browsers
|
|
||||||
config.action_dispatch.best_standards_support = :builtin
|
|
||||||
|
|
||||||
# Raise exception on mass assignment protection for Active Record models
|
# Raise exception on mass assignment protection for Active Record models
|
||||||
config.active_record.mass_assignment_sanitizer = :strict
|
config.active_record.mass_assignment_sanitizer = :strict
|
||||||
|
|
||||||
# Log the query plan for queries taking more than this (works
|
# Raise an error on page load if there are pending migrations
|
||||||
# with SQLite, MySQL, and PostgreSQL)
|
config.active_record.migration_error = :page_load
|
||||||
config.active_record.auto_explain_threshold_in_seconds = 0.5
|
|
||||||
|
|
||||||
# Do not compress assets
|
# Debug mode disables concatenation and preprocessing of assets.
|
||||||
config.assets.compress = false
|
# This option may cause significant delays in view rendering with a large
|
||||||
|
# number of complex assets.
|
||||||
# Expands the lines which load the assets
|
|
||||||
config.assets.debug = true
|
config.assets.debug = true
|
||||||
|
|
||||||
# Required for i18n-js
|
# Required for i18n-js
|
||||||
|
|
|
@ -1,70 +1,80 @@
|
||||||
Foodsoft::Application.configure do
|
Foodsoft::Application.configure do
|
||||||
# Settings specified here will take precedence over those in config/application.rb
|
# Settings specified here will take precedence over those in config/application.rb.
|
||||||
|
|
||||||
# Code is not reloaded between requests
|
# Code is not reloaded between requests.
|
||||||
config.cache_classes = true
|
config.cache_classes = true
|
||||||
|
|
||||||
# Full error reports are disabled and caching is turned on
|
# Eager load code on boot. This eager loads most of Rails and
|
||||||
|
# your application in memory, allowing both thread web servers
|
||||||
|
# and those relying on copy on write to perform better.
|
||||||
|
# Rake tasks automatically ignore this option for performance.
|
||||||
|
config.eager_load = true
|
||||||
|
|
||||||
|
# Full error reports are disabled and caching is turned on.
|
||||||
config.consider_all_requests_local = false
|
config.consider_all_requests_local = false
|
||||||
config.action_controller.perform_caching = true
|
config.action_controller.perform_caching = true
|
||||||
|
|
||||||
# Disable Rails's static asset server (Apache or nginx will already do this)
|
# Enable Rack::Cache to put a simple HTTP cache in front of your application
|
||||||
|
# Add `rack-cache` to your Gemfile before enabling this.
|
||||||
|
# For large-scale production use, consider using a caching reverse proxy like nginx, varnish or squid.
|
||||||
|
# config.action_dispatch.rack_cache = true
|
||||||
|
|
||||||
|
# Disable Rails's static asset server (Apache or nginx will already do this).
|
||||||
config.serve_static_assets = false
|
config.serve_static_assets = false
|
||||||
|
|
||||||
# Compress JavaScripts and CSS
|
# Compress JavaScripts and CSS.
|
||||||
config.assets.compress = true
|
config.assets.js_compressor = :uglifier
|
||||||
|
config.assets.css_compressor = :sass
|
||||||
|
|
||||||
# Don't fallback to assets pipeline if a precompiled asset is missed
|
# Do not fallback to assets pipeline if a precompiled asset is missed.
|
||||||
config.assets.compile = false
|
config.assets.compile = false
|
||||||
|
|
||||||
# Generate digests for assets URLs
|
# Generate digests for assets URLs.
|
||||||
config.assets.digest = true
|
config.assets.digest = true
|
||||||
|
|
||||||
# # Defaults to nil and saved in location specified by config.assets.prefix
|
# Version of your assets, change this if you want to expire all your assets.
|
||||||
# config.assets.manifest = YOUR_PATH
|
config.assets.version = '1.0'
|
||||||
|
|
||||||
# Specifies the header that your server uses for sending files
|
# Specifies the header that your server uses for sending files.
|
||||||
# config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
|
# config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
|
||||||
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
|
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
|
||||||
|
|
||||||
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
||||||
config.force_ssl = true
|
# config.force_ssl = true
|
||||||
|
|
||||||
# See everything in the log (default is :info)
|
# Set to :debug to see everything in the log.
|
||||||
# config.log_level = :debug
|
config.log_level = :info
|
||||||
|
|
||||||
# Prepend all log lines with the following tags
|
# Prepend all log lines with the following tags.
|
||||||
# config.log_tags = [ :subdomain, :uuid ]
|
# config.log_tags = [ :subdomain, :uuid ]
|
||||||
|
|
||||||
# Use a different logger for distributed setups
|
# Use a different logger for distributed setups.
|
||||||
# config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
|
# config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
|
||||||
|
|
||||||
# Use a different cache store in production
|
# Use a different cache store in production.
|
||||||
# config.cache_store = :mem_cache_store
|
# config.cache_store = :mem_cache_store
|
||||||
|
|
||||||
# Enable serving of images, stylesheets, and JavaScripts from an asset server
|
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
|
||||||
# config.action_controller.asset_host = "http://assets.example.com"
|
# config.action_controller.asset_host = "http://assets.example.com"
|
||||||
|
|
||||||
# Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
|
# Precompile additional assets.
|
||||||
|
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
|
||||||
# config.assets.precompile += %w( search.js )
|
# config.assets.precompile += %w( search.js )
|
||||||
|
|
||||||
# Disable delivery errors, bad email addresses will be ignored
|
# Ignore bad email addresses and do not raise email delivery errors.
|
||||||
|
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
|
||||||
# config.action_mailer.raise_delivery_errors = false
|
# config.action_mailer.raise_delivery_errors = false
|
||||||
|
|
||||||
# Enable threaded mode
|
|
||||||
# config.threadsafe!
|
|
||||||
|
|
||||||
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
||||||
# the I18n.default_locale when a translation can not be found)
|
# the I18n.default_locale when a translation can not be found).
|
||||||
config.i18n.fallbacks = true
|
config.i18n.fallbacks = true
|
||||||
|
|
||||||
# Send deprecation notices to registered listeners
|
# Send deprecation notices to registered listeners.
|
||||||
config.active_support.deprecation = :notify
|
config.active_support.deprecation = :notify
|
||||||
|
|
||||||
# Log the query plan for queries taking more than this (works
|
# Disable automatic flushing of the log to improve performance.
|
||||||
# with SQLite, MySQL, and PostgreSQL)
|
# config.autoflush_log = false
|
||||||
# config.active_record.auto_explain_threshold_in_seconds = 0.5
|
|
||||||
|
|
||||||
# Use sendmail to avoid ssl cert problems
|
# Use default logging formatter so that PID and timestamp are not suppressed.
|
||||||
config.action_mailer.delivery_method = :sendmail
|
config.log_formatter = ::Logger::Formatter.new
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,40 +1,39 @@
|
||||||
Foodsoft::Application.configure do
|
Foodsoft::Application.configure do
|
||||||
# Settings specified here will take precedence over those in config/application.rb
|
# Settings specified here will take precedence over those in config/application.rb.
|
||||||
|
|
||||||
# The test environment is used exclusively to run your application's
|
# The test environment is used exclusively to run your application's
|
||||||
# test suite. You never need to work with it otherwise. Remember that
|
# test suite. You never need to work with it otherwise. Remember that
|
||||||
# your test database is "scratch space" for the test suite and is wiped
|
# your test database is "scratch space" for the test suite and is wiped
|
||||||
# and recreated between test runs. Don't rely on the data there!
|
# and recreated between test runs. Don't rely on the data there!
|
||||||
config.cache_classes = true
|
config.cache_classes = true
|
||||||
|
|
||||||
# Configure static asset server for tests with Cache-Control for performance
|
# Do not eager load code on boot. This avoids loading your whole application
|
||||||
config.serve_static_assets = true
|
# just for the purpose of running a single test. If you are using a tool that
|
||||||
config.static_cache_control = "public, max-age=3600"
|
# preloads Rails for running tests, you may have to set it to true.
|
||||||
|
config.eager_load = false
|
||||||
|
|
||||||
# Required for i18n-js
|
# Required for i18n-js
|
||||||
config.assets.initialize_on_precompile = true
|
config.assets.initialize_on_precompile = true
|
||||||
|
|
||||||
# Log error messages when you accidentally call methods on nil
|
# Configure static asset server for tests with Cache-Control for performance.
|
||||||
config.whiny_nils = true
|
config.serve_static_assets = true
|
||||||
|
config.static_cache_control = "public, max-age=3600"
|
||||||
|
|
||||||
# Show full error reports and disable caching
|
# Show full error reports and disable caching.
|
||||||
config.consider_all_requests_local = true
|
config.consider_all_requests_local = true
|
||||||
config.action_controller.perform_caching = false
|
config.action_controller.perform_caching = false
|
||||||
|
|
||||||
# Raise exceptions instead of rendering exception templates
|
# Raise exceptions instead of rendering exception templates.
|
||||||
config.action_dispatch.show_exceptions = false
|
config.action_dispatch.show_exceptions = false
|
||||||
|
|
||||||
# Disable request forgery protection in test environment
|
# Disable request forgery protection in test environment.
|
||||||
config.action_controller.allow_forgery_protection = false
|
config.action_controller.allow_forgery_protection = false
|
||||||
|
|
||||||
# Tell Action Mailer not to deliver emails to the real world.
|
# Tell Action Mailer not to deliver emails to the real world.
|
||||||
# The :test delivery method accumulates sent emails in the
|
# The :test delivery method accumulates sent emails in the
|
||||||
# ActionMailer::Base.deliveries array.
|
# ActionMailer::Base.deliveries array.
|
||||||
config.action_mailer.delivery_method = :test
|
config.action_mailer.delivery_method = :test
|
||||||
|
|
||||||
# Raise exception on mass assignment protection for Active Record models
|
# Print deprecation notices to the stderr.
|
||||||
config.active_record.mass_assignment_sanitizer = :strict
|
|
||||||
|
|
||||||
# Print deprecation notices to the stderr
|
|
||||||
config.active_support.deprecation = :stderr
|
config.active_support.deprecation = :stderr
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
# ClientSideValidations Initializer
|
# ClientSideValidations Initializer
|
||||||
|
|
||||||
|
# DISABLED FOR RAILS4
|
||||||
# Uncomment to disable uniqueness validator, possible security issue
|
# Uncomment to disable uniqueness validator, possible security issue
|
||||||
# Disabled because of possible security issue and because of bug
|
# Disabled because of possible security issue and because of bug
|
||||||
# https://github.com/bcardarella/client_side_validations/pull/532
|
# https://github.com/bcardarella/client_side_validations/pull/532
|
||||||
ClientSideValidations::Config.disabled_validators = [:uniqueness]
|
#ClientSideValidations::Config.disabled_validators = [:uniqueness]
|
||||||
|
|
||||||
# Uncomment to validate number format with current I18n locale
|
# Uncomment to validate number format with current I18n locale
|
||||||
# Foodsoft is currently using localize_input which is activated on certain
|
# Foodsoft is currently using localize_input which is activated on certain
|
||||||
|
|
4
config/initializers/filter_parameter_logging.rb
Normal file
4
config/initializers/filter_parameter_logging.rb
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
# Be sure to restart your server when you modify this file.
|
||||||
|
|
||||||
|
# Configure sensitive parameters which will be filtered from the log file.
|
||||||
|
Rails.application.config.filter_parameters += [:password]
|
|
@ -1,16 +1,16 @@
|
||||||
# Be sure to restart your server when you modify this file.
|
# Be sure to restart your server when you modify this file.
|
||||||
|
|
||||||
# Add new inflection rules using the following format
|
# Add new inflection rules using the following format. Inflections
|
||||||
# (all these examples are active by default):
|
# are locale specific, and you may define rules for as many different
|
||||||
# ActiveSupport::Inflector.inflections do |inflect|
|
# locales as you wish. All of these examples are active by default:
|
||||||
|
# ActiveSupport::Inflector.inflections(:en) do |inflect|
|
||||||
# inflect.plural /^(ox)$/i, '\1en'
|
# inflect.plural /^(ox)$/i, '\1en'
|
||||||
# inflect.singular /^(ox)en/i, '\1'
|
# inflect.singular /^(ox)en/i, '\1'
|
||||||
# inflect.irregular 'person', 'people'
|
# inflect.irregular 'person', 'people'
|
||||||
# inflect.uncountable %w( fish sheep )
|
# inflect.uncountable %w( fish sheep )
|
||||||
# end
|
# end
|
||||||
#
|
|
||||||
# These inflection rules are supported but not enabled by default:
|
# These inflection rules are supported but not enabled by default:
|
||||||
# ActiveSupport::Inflector.inflections do |inflect|
|
# ActiveSupport::Inflector.inflections(:en) do |inflect|
|
||||||
# inflect.acronym 'RESTful'
|
# inflect.acronym 'RESTful'
|
||||||
# end
|
# end
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
# Use this setup block to configure all options available in SimpleForm.
|
# Use this setup block to configure all options available in SimpleForm.
|
||||||
|
require 'simple_form'
|
||||||
SimpleForm.setup do |config|
|
SimpleForm.setup do |config|
|
||||||
# Wrappers are used by the form builder to generate a
|
# Wrappers are used by the form builder to generate a
|
||||||
# complete input. You can remove any component from the
|
# complete input. You can remove any component from the
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
# Be sure to restart your server when you modify this file.
|
# Be sure to restart your server when you modify this file.
|
||||||
#
|
|
||||||
# This file contains settings for ActionController::ParamsWrapper which
|
# This file contains settings for ActionController::ParamsWrapper which
|
||||||
# is enabled by default.
|
# is enabled by default.
|
||||||
|
|
||||||
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
|
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
|
||||||
ActiveSupport.on_load(:action_controller) do
|
ActiveSupport.on_load(:action_controller) do
|
||||||
wrap_parameters format: [:json]
|
wrap_parameters format: [:json] if respond_to?(:wrap_parameters)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Disable root element in JSON by default.
|
# To enable root element in JSON for ActiveRecord objects.
|
||||||
ActiveSupport.on_load(:active_record) do
|
# ActiveSupport.on_load(:active_record) do
|
||||||
self.include_root_in_json = false
|
# self.include_root_in_json = true
|
||||||
end
|
# end
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
SimpleNavigation::Configuration.run do |navigation|
|
SimpleNavigation::Configuration.run do |navigation|
|
||||||
|
|
||||||
# allow engines to add to the menu - https://gist.github.com/mjtko/4873ee0c112b6bd646f8
|
# allow engines to add to the menu - https://gist.github.com/mjtko/4873ee0c112b6bd646f8
|
||||||
engines = Rails.application.railties.engines.select { |e| e.respond_to?(:navigation) }
|
engines = Rails::Engine.subclasses.map(&:instance).select { |e| e.respond_to?(:navigation) }
|
||||||
# to include an engine but keep it from modifying the menu:
|
# to include an engine but keep it from modifying the menu:
|
||||||
#engines.reject! { |e| e.instance_of? FoodsoftMyplugin::Engine }
|
#engines.reject! { |e| e.instance_of? FoodsoftMyplugin::Engine }
|
||||||
|
|
||||||
|
|
|
@ -6,8 +6,7 @@ Foodsoft::Application.routes.draw do
|
||||||
|
|
||||||
get "sessions/new"
|
get "sessions/new"
|
||||||
|
|
||||||
root :to => 'sessions#redirect_to_foodcoop'
|
root :to => 'sessions#redirect_to_foodcoop', as: nil
|
||||||
|
|
||||||
|
|
||||||
scope '/:foodcoop' do
|
scope '/:foodcoop' do
|
||||||
|
|
||||||
|
@ -16,21 +15,21 @@ Foodsoft::Application.routes.draw do
|
||||||
|
|
||||||
########### Sessions
|
########### Sessions
|
||||||
|
|
||||||
match '/login' => 'sessions#new', :as => 'login'
|
get '/login' => 'sessions#new', :as => 'login'
|
||||||
match '/logout' => 'sessions#destroy', :as => 'logout'
|
get '/logout' => 'sessions#destroy', :as => 'logout'
|
||||||
get '/login/forgot_password' => 'login#forgot_password', as: :forgot_password
|
get '/login/forgot_password' => 'login#forgot_password', as: :forgot_password
|
||||||
post '/login/reset_password' => 'login#reset_password', as: :reset_password
|
post '/login/reset_password' => 'login#reset_password', as: :reset_password
|
||||||
get '/login/new_password' => 'login#new_password', as: :new_password
|
get '/login/new_password' => 'login#new_password', as: :new_password
|
||||||
put '/login/update_password' => 'login#update_password', as: :update_password
|
put '/login/update_password' => 'login#update_password', as: :update_password
|
||||||
match '/login/accept_invitation/:token' => 'login#accept_invitation', as: :accept_invitation
|
match '/login/accept_invitation/:token' => 'login#accept_invitation', as: :accept_invitation, via: [:get, :post]
|
||||||
resources :sessions, :only => [:new, :create, :destroy]
|
resources :sessions, :only => [:new, :create, :destroy]
|
||||||
|
|
||||||
########### User specific
|
########### User specific
|
||||||
|
|
||||||
match '/home/profile' => 'home#profile', :as => 'my_profile'
|
get '/home/profile', :as => 'my_profile'
|
||||||
put '/home/update_profile' => 'home#update_profile', :as => 'update_profile'
|
patch '/home/update_profile', :as => 'update_profile'
|
||||||
match '/home/ordergroup' => 'home#ordergroup', :as => 'my_ordergroup'
|
get '/home/ordergroup' => 'home#ordergroup', :as => 'my_ordergroup'
|
||||||
match '/home/cancel_membership' => 'home#cancel_membership', :as => 'cancel_membership'
|
post '/home/cancel_membership' => 'home#cancel_membership', :as => 'cancel_membership'
|
||||||
|
|
||||||
############ Orders, ordering
|
############ Orders, ordering
|
||||||
|
|
||||||
|
@ -149,8 +148,8 @@ Foodsoft::Application.routes.draw do
|
||||||
put :update_note
|
put :update_note
|
||||||
|
|
||||||
get :confirm
|
get :confirm
|
||||||
put :close
|
patch :close
|
||||||
put :close_direct
|
patch :close_direct
|
||||||
|
|
||||||
get :new_on_order_article_create
|
get :new_on_order_article_create
|
||||||
get :new_on_order_article_update
|
get :new_on_order_article_update
|
||||||
|
|
330
db/schema.rb
330
db/schema.rb
|
@ -9,151 +9,163 @@
|
||||||
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
|
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
|
||||||
# you'll amass, the slower it'll run and the greater likelihood for issues).
|
# you'll amass, the slower it'll run and the greater likelihood for issues).
|
||||||
#
|
#
|
||||||
# It's strongly recommended to check this file into your version control system.
|
# It's strongly recommended that you check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema.define(:version => 20140102170431) do
|
ActiveRecord::Schema.define(version: 20140102170431) do
|
||||||
|
|
||||||
create_table "article_categories", :force => true do |t|
|
create_table "article_categories", force: true do |t|
|
||||||
t.string "name", :default => "", :null => false
|
t.string "name", default: "", null: false
|
||||||
t.string "description"
|
t.string "description"
|
||||||
end
|
end
|
||||||
|
|
||||||
add_index "article_categories", ["name"], :name => "index_article_categories_on_name", :unique => true
|
add_index "article_categories", ["name"], name: "index_article_categories_on_name", unique: true, using: :btree
|
||||||
|
|
||||||
create_table "article_prices", :force => true do |t|
|
create_table "article_prices", force: true do |t|
|
||||||
t.integer "article_id"
|
t.integer "article_id"
|
||||||
t.decimal "price", :precision => 8, :scale => 2, :default => 0.0, :null => false
|
t.decimal "price", precision: 8, scale: 2, default: 0.0, null: false
|
||||||
t.decimal "tax", :precision => 8, :scale => 2, :default => 0.0, :null => false
|
t.decimal "tax", precision: 8, scale: 2, default: 0.0, null: false
|
||||||
t.decimal "deposit", :precision => 8, :scale => 2, :default => 0.0, :null => false
|
t.decimal "deposit", precision: 8, scale: 2, default: 0.0, null: false
|
||||||
t.integer "unit_quantity"
|
t.integer "unit_quantity"
|
||||||
t.datetime "created_at"
|
t.datetime "created_at"
|
||||||
end
|
end
|
||||||
|
|
||||||
add_index "article_prices", ["article_id"], :name => "index_article_prices_on_article_id"
|
add_index "article_prices", ["article_id"], name: "index_article_prices_on_article_id", using: :btree
|
||||||
|
|
||||||
create_table "articles", :force => true do |t|
|
create_table "articles", force: true do |t|
|
||||||
t.string "name", :default => "", :null => false
|
t.string "name", default: "", null: false
|
||||||
t.integer "supplier_id", :default => 0, :null => false
|
t.integer "supplier_id", default: 0, null: false
|
||||||
t.integer "article_category_id", :default => 0, :null => false
|
t.integer "article_category_id", default: 0, null: false
|
||||||
t.string "unit", :default => "", :null => false
|
t.string "unit", default: "", null: false
|
||||||
t.string "note"
|
t.string "note"
|
||||||
t.boolean "availability", :default => true, :null => false
|
t.boolean "availability", default: true, null: false
|
||||||
t.string "manufacturer"
|
t.string "manufacturer"
|
||||||
t.string "origin"
|
t.string "origin"
|
||||||
t.datetime "shared_updated_on"
|
t.datetime "shared_updated_on"
|
||||||
t.decimal "price", :precision => 8, :scale => 2
|
t.decimal "price", precision: 8, scale: 2
|
||||||
t.float "tax"
|
t.float "tax"
|
||||||
t.decimal "deposit", :precision => 8, :scale => 2, :default => 0.0
|
t.decimal "deposit", precision: 8, scale: 2, default: 0.0
|
||||||
t.integer "unit_quantity", :default => 1, :null => false
|
t.integer "unit_quantity", default: 1, null: false
|
||||||
t.string "order_number"
|
t.string "order_number"
|
||||||
t.datetime "created_at"
|
t.datetime "created_at"
|
||||||
t.datetime "updated_at"
|
t.datetime "updated_at"
|
||||||
t.datetime "deleted_at"
|
t.datetime "deleted_at"
|
||||||
t.string "type"
|
t.string "type"
|
||||||
t.integer "quantity", :default => 0
|
t.integer "quantity", default: 0
|
||||||
end
|
end
|
||||||
|
|
||||||
add_index "articles", ["article_category_id"], :name => "index_articles_on_article_category_id"
|
add_index "articles", ["article_category_id"], name: "index_articles_on_article_category_id", using: :btree
|
||||||
add_index "articles", ["name", "supplier_id"], :name => "index_articles_on_name_and_supplier_id"
|
add_index "articles", ["name", "supplier_id"], name: "index_articles_on_name_and_supplier_id", using: :btree
|
||||||
add_index "articles", ["supplier_id"], :name => "index_articles_on_supplier_id"
|
add_index "articles", ["supplier_id"], name: "index_articles_on_supplier_id", using: :btree
|
||||||
add_index "articles", ["type"], :name => "index_articles_on_type"
|
add_index "articles", ["type"], name: "index_articles_on_type", using: :btree
|
||||||
|
|
||||||
create_table "assignments", :force => true do |t|
|
create_table "assignments", force: true do |t|
|
||||||
t.integer "user_id", :default => 0, :null => false
|
t.integer "user_id", default: 0, null: false
|
||||||
t.integer "task_id", :default => 0, :null => false
|
t.integer "task_id", default: 0, null: false
|
||||||
t.boolean "accepted", :default => false
|
t.boolean "accepted", default: false
|
||||||
end
|
end
|
||||||
|
|
||||||
add_index "assignments", ["user_id", "task_id"], :name => "index_assignments_on_user_id_and_task_id", :unique => true
|
add_index "assignments", ["user_id", "task_id"], name: "index_assignments_on_user_id_and_task_id", unique: true, using: :btree
|
||||||
|
|
||||||
create_table "deliveries", :force => true do |t|
|
create_table "configurable_settings", force: true do |t|
|
||||||
|
t.integer "configurable_id"
|
||||||
|
t.string "configurable_type"
|
||||||
|
t.integer "targetable_id"
|
||||||
|
t.string "targetable_type"
|
||||||
|
t.string "name", default: "", null: false
|
||||||
|
t.string "value_type"
|
||||||
|
t.text "value"
|
||||||
|
end
|
||||||
|
|
||||||
|
add_index "configurable_settings", ["name"], name: "index_configurable_settings_on_name", using: :btree
|
||||||
|
|
||||||
|
create_table "deliveries", force: true do |t|
|
||||||
t.integer "supplier_id"
|
t.integer "supplier_id"
|
||||||
t.date "delivered_on"
|
t.date "delivered_on"
|
||||||
t.datetime "created_at"
|
t.datetime "created_at"
|
||||||
t.text "note"
|
t.text "note"
|
||||||
end
|
end
|
||||||
|
|
||||||
add_index "deliveries", ["supplier_id"], :name => "index_deliveries_on_supplier_id"
|
add_index "deliveries", ["supplier_id"], name: "index_deliveries_on_supplier_id", using: :btree
|
||||||
|
|
||||||
create_table "financial_transactions", :force => true do |t|
|
create_table "financial_transactions", force: true do |t|
|
||||||
t.integer "ordergroup_id", :default => 0, :null => false
|
t.integer "ordergroup_id", default: 0, null: false
|
||||||
t.decimal "amount", :precision => 8, :scale => 2, :default => 0.0, :null => false
|
t.decimal "amount", precision: 8, scale: 2, default: 0.0, null: false
|
||||||
t.text "note", :null => false
|
t.text "note", null: false
|
||||||
t.integer "user_id", :default => 0, :null => false
|
t.integer "user_id", default: 0, null: false
|
||||||
t.datetime "created_on", :null => false
|
t.datetime "created_on", null: false
|
||||||
end
|
end
|
||||||
|
|
||||||
add_index "financial_transactions", ["ordergroup_id"], :name => "index_financial_transactions_on_ordergroup_id"
|
add_index "financial_transactions", ["ordergroup_id"], name: "index_financial_transactions_on_ordergroup_id", using: :btree
|
||||||
|
|
||||||
create_table "group_order_article_quantities", :force => true do |t|
|
create_table "group_order_article_quantities", force: true do |t|
|
||||||
t.integer "group_order_article_id", :default => 0, :null => false
|
t.integer "group_order_article_id", default: 0, null: false
|
||||||
t.integer "quantity", :default => 0
|
t.integer "quantity", default: 0
|
||||||
t.integer "tolerance", :default => 0
|
t.integer "tolerance", default: 0
|
||||||
t.datetime "created_on", :null => false
|
t.datetime "created_on", null: false
|
||||||
end
|
end
|
||||||
|
|
||||||
add_index "group_order_article_quantities", ["group_order_article_id"], :name => "index_group_order_article_quantities_on_group_order_article_id"
|
add_index "group_order_article_quantities", ["group_order_article_id"], name: "index_group_order_article_quantities_on_group_order_article_id", using: :btree
|
||||||
|
|
||||||
create_table "group_order_articles", :force => true do |t|
|
create_table "group_order_articles", force: true do |t|
|
||||||
t.integer "group_order_id", :default => 0, :null => false
|
t.integer "group_order_id", default: 0, null: false
|
||||||
t.integer "order_article_id", :default => 0, :null => false
|
t.integer "order_article_id", default: 0, null: false
|
||||||
t.integer "quantity", :default => 0, :null => false
|
t.integer "quantity", default: 0, null: false
|
||||||
t.integer "tolerance", :default => 0, :null => false
|
t.integer "tolerance", default: 0, null: false
|
||||||
t.datetime "updated_on", :null => false
|
t.datetime "updated_on", null: false
|
||||||
t.decimal "result", :precision => 8, :scale => 3
|
t.decimal "result", precision: 8, scale: 3
|
||||||
t.decimal "result_computed", :precision => 8, :scale => 3
|
t.decimal "result_computed", precision: 8, scale: 3
|
||||||
end
|
end
|
||||||
|
|
||||||
add_index "group_order_articles", ["group_order_id", "order_article_id"], :name => "goa_index", :unique => true
|
add_index "group_order_articles", ["group_order_id", "order_article_id"], name: "goa_index", unique: true, using: :btree
|
||||||
add_index "group_order_articles", ["group_order_id"], :name => "index_group_order_articles_on_group_order_id"
|
add_index "group_order_articles", ["group_order_id"], name: "index_group_order_articles_on_group_order_id", using: :btree
|
||||||
add_index "group_order_articles", ["order_article_id"], :name => "index_group_order_articles_on_order_article_id"
|
add_index "group_order_articles", ["order_article_id"], name: "index_group_order_articles_on_order_article_id", using: :btree
|
||||||
|
|
||||||
create_table "group_orders", :force => true do |t|
|
create_table "group_orders", force: true do |t|
|
||||||
t.integer "ordergroup_id", :default => 0, :null => false
|
t.integer "ordergroup_id", default: 0, null: false
|
||||||
t.integer "order_id", :default => 0, :null => false
|
t.integer "order_id", default: 0, null: false
|
||||||
t.decimal "price", :precision => 8, :scale => 2, :default => 0.0, :null => false
|
t.decimal "price", precision: 8, scale: 2, default: 0.0, null: false
|
||||||
t.integer "lock_version", :default => 0, :null => false
|
t.integer "lock_version", default: 0, null: false
|
||||||
t.datetime "updated_on", :null => false
|
t.datetime "updated_on", null: false
|
||||||
t.integer "updated_by_user_id"
|
t.integer "updated_by_user_id"
|
||||||
end
|
end
|
||||||
|
|
||||||
add_index "group_orders", ["order_id"], :name => "index_group_orders_on_order_id"
|
add_index "group_orders", ["order_id"], name: "index_group_orders_on_order_id", using: :btree
|
||||||
add_index "group_orders", ["ordergroup_id", "order_id"], :name => "index_group_orders_on_ordergroup_id_and_order_id", :unique => true
|
add_index "group_orders", ["ordergroup_id", "order_id"], name: "index_group_orders_on_ordergroup_id_and_order_id", unique: true, using: :btree
|
||||||
add_index "group_orders", ["ordergroup_id"], :name => "index_group_orders_on_ordergroup_id"
|
add_index "group_orders", ["ordergroup_id"], name: "index_group_orders_on_ordergroup_id", using: :btree
|
||||||
|
|
||||||
create_table "groups", :force => true do |t|
|
create_table "groups", force: true do |t|
|
||||||
t.string "type", :default => "", :null => false
|
t.string "type", default: "", null: false
|
||||||
t.string "name", :default => "", :null => false
|
t.string "name", default: "", null: false
|
||||||
t.string "description"
|
t.string "description"
|
||||||
t.decimal "account_balance", :precision => 8, :scale => 2, :default => 0.0, :null => false
|
t.decimal "account_balance", precision: 8, scale: 2, default: 0.0, null: false
|
||||||
t.datetime "created_on", :null => false
|
t.datetime "created_on", null: false
|
||||||
t.boolean "role_admin", :default => false, :null => false
|
t.boolean "role_admin", default: false, null: false
|
||||||
t.boolean "role_suppliers", :default => false, :null => false
|
t.boolean "role_suppliers", default: false, null: false
|
||||||
t.boolean "role_article_meta", :default => false, :null => false
|
t.boolean "role_article_meta", default: false, null: false
|
||||||
t.boolean "role_finance", :default => false, :null => false
|
t.boolean "role_finance", default: false, null: false
|
||||||
t.boolean "role_orders", :default => false, :null => false
|
t.boolean "role_orders", default: false, null: false
|
||||||
t.datetime "deleted_at"
|
t.datetime "deleted_at"
|
||||||
t.string "contact_person"
|
t.string "contact_person"
|
||||||
t.string "contact_phone"
|
t.string "contact_phone"
|
||||||
t.string "contact_address"
|
t.string "contact_address"
|
||||||
t.text "stats"
|
t.text "stats"
|
||||||
t.integer "next_weekly_tasks_number", :default => 8
|
t.integer "next_weekly_tasks_number", default: 8
|
||||||
t.boolean "ignore_apple_restriction", :default => false
|
t.boolean "ignore_apple_restriction", default: false
|
||||||
end
|
end
|
||||||
|
|
||||||
add_index "groups", ["name"], :name => "index_groups_on_name", :unique => true
|
add_index "groups", ["name"], name: "index_groups_on_name", unique: true, using: :btree
|
||||||
|
|
||||||
create_table "invites", :force => true do |t|
|
create_table "invites", force: true do |t|
|
||||||
t.string "token", :default => "", :null => false
|
t.string "token", default: "", null: false
|
||||||
t.datetime "expires_at", :null => false
|
t.datetime "expires_at", null: false
|
||||||
t.integer "group_id", :default => 0, :null => false
|
t.integer "group_id", default: 0, null: false
|
||||||
t.integer "user_id", :default => 0, :null => false
|
t.integer "user_id", default: 0, null: false
|
||||||
t.string "email", :default => "", :null => false
|
t.string "email", default: "", null: false
|
||||||
end
|
end
|
||||||
|
|
||||||
add_index "invites", ["token"], :name => "index_invites_on_token"
|
add_index "invites", ["token"], name: "index_invites_on_token", using: :btree
|
||||||
|
|
||||||
create_table "invoices", :force => true do |t|
|
create_table "invoices", force: true do |t|
|
||||||
t.integer "supplier_id"
|
t.integer "supplier_id"
|
||||||
t.integer "delivery_id"
|
t.integer "delivery_id"
|
||||||
t.integer "order_id"
|
t.integer "order_id"
|
||||||
|
@ -161,72 +173,72 @@ ActiveRecord::Schema.define(:version => 20140102170431) do
|
||||||
t.date "date"
|
t.date "date"
|
||||||
t.date "paid_on"
|
t.date "paid_on"
|
||||||
t.text "note"
|
t.text "note"
|
||||||
t.decimal "amount", :precision => 8, :scale => 2, :default => 0.0, :null => false
|
t.decimal "amount", precision: 8, scale: 2, default: 0.0, null: false
|
||||||
t.decimal "deposit", :precision => 8, :scale => 2, :default => 0.0, :null => false
|
t.decimal "deposit", precision: 8, scale: 2, default: 0.0, null: false
|
||||||
t.decimal "deposit_credit", :precision => 8, :scale => 2, :default => 0.0, :null => false
|
t.decimal "deposit_credit", precision: 8, scale: 2, default: 0.0, null: false
|
||||||
t.datetime "created_at"
|
t.datetime "created_at"
|
||||||
t.datetime "updated_at"
|
t.datetime "updated_at"
|
||||||
end
|
end
|
||||||
|
|
||||||
add_index "invoices", ["delivery_id"], :name => "index_invoices_on_delivery_id"
|
add_index "invoices", ["delivery_id"], name: "index_invoices_on_delivery_id", using: :btree
|
||||||
add_index "invoices", ["supplier_id"], :name => "index_invoices_on_supplier_id"
|
add_index "invoices", ["supplier_id"], name: "index_invoices_on_supplier_id", using: :btree
|
||||||
|
|
||||||
create_table "memberships", :force => true do |t|
|
create_table "memberships", force: true do |t|
|
||||||
t.integer "group_id", :default => 0, :null => false
|
t.integer "group_id", default: 0, null: false
|
||||||
t.integer "user_id", :default => 0, :null => false
|
t.integer "user_id", default: 0, null: false
|
||||||
end
|
end
|
||||||
|
|
||||||
add_index "memberships", ["user_id", "group_id"], :name => "index_memberships_on_user_id_and_group_id", :unique => true
|
add_index "memberships", ["user_id", "group_id"], name: "index_memberships_on_user_id_and_group_id", unique: true, using: :btree
|
||||||
|
|
||||||
create_table "messages", :force => true do |t|
|
create_table "messages", force: true do |t|
|
||||||
t.integer "sender_id"
|
t.integer "sender_id"
|
||||||
t.text "recipients_ids"
|
t.text "recipients_ids"
|
||||||
t.string "subject", :null => false
|
t.string "subject", null: false
|
||||||
t.text "body"
|
t.text "body"
|
||||||
t.integer "email_state", :default => 0, :null => false
|
t.integer "email_state", default: 0, null: false
|
||||||
t.boolean "private", :default => false
|
t.boolean "private", default: false
|
||||||
t.datetime "created_at"
|
t.datetime "created_at"
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "order_articles", :force => true do |t|
|
create_table "order_articles", force: true do |t|
|
||||||
t.integer "order_id", :default => 0, :null => false
|
t.integer "order_id", default: 0, null: false
|
||||||
t.integer "article_id", :default => 0, :null => false
|
t.integer "article_id", default: 0, null: false
|
||||||
t.integer "quantity", :default => 0, :null => false
|
t.integer "quantity", default: 0, null: false
|
||||||
t.integer "tolerance", :default => 0, :null => false
|
t.integer "tolerance", default: 0, null: false
|
||||||
t.integer "units_to_order", :default => 0, :null => false
|
t.integer "units_to_order", default: 0, null: false
|
||||||
t.integer "lock_version", :default => 0, :null => false
|
t.integer "lock_version", default: 0, null: false
|
||||||
t.integer "article_price_id"
|
t.integer "article_price_id"
|
||||||
t.integer "units_billed"
|
t.integer "units_billed"
|
||||||
t.integer "units_received"
|
t.integer "units_received"
|
||||||
end
|
end
|
||||||
|
|
||||||
add_index "order_articles", ["order_id", "article_id"], :name => "index_order_articles_on_order_id_and_article_id", :unique => true
|
add_index "order_articles", ["order_id", "article_id"], name: "index_order_articles_on_order_id_and_article_id", unique: true, using: :btree
|
||||||
add_index "order_articles", ["order_id"], :name => "index_order_articles_on_order_id"
|
add_index "order_articles", ["order_id"], name: "index_order_articles_on_order_id", using: :btree
|
||||||
|
|
||||||
create_table "order_comments", :force => true do |t|
|
create_table "order_comments", force: true do |t|
|
||||||
t.integer "order_id"
|
t.integer "order_id"
|
||||||
t.integer "user_id"
|
t.integer "user_id"
|
||||||
t.text "text"
|
t.text "text"
|
||||||
t.datetime "created_at"
|
t.datetime "created_at"
|
||||||
end
|
end
|
||||||
|
|
||||||
add_index "order_comments", ["order_id"], :name => "index_order_comments_on_order_id"
|
add_index "order_comments", ["order_id"], name: "index_order_comments_on_order_id", using: :btree
|
||||||
|
|
||||||
create_table "orders", :force => true do |t|
|
create_table "orders", force: true do |t|
|
||||||
t.integer "supplier_id"
|
t.integer "supplier_id"
|
||||||
t.text "note"
|
t.text "note"
|
||||||
t.datetime "starts"
|
t.datetime "starts"
|
||||||
t.datetime "ends"
|
t.datetime "ends"
|
||||||
t.string "state", :default => "open"
|
t.string "state", default: "open"
|
||||||
t.integer "lock_version", :default => 0, :null => false
|
t.integer "lock_version", default: 0, null: false
|
||||||
t.integer "updated_by_user_id"
|
t.integer "updated_by_user_id"
|
||||||
t.decimal "foodcoop_result", :precision => 8, :scale => 2
|
t.decimal "foodcoop_result", precision: 8, scale: 2
|
||||||
t.integer "created_by_user_id"
|
t.integer "created_by_user_id"
|
||||||
end
|
end
|
||||||
|
|
||||||
add_index "orders", ["state"], :name => "index_orders_on_state"
|
add_index "orders", ["state"], name: "index_orders_on_state", using: :btree
|
||||||
|
|
||||||
create_table "page_versions", :force => true do |t|
|
create_table "page_versions", force: true do |t|
|
||||||
t.integer "page_id"
|
t.integer "page_id"
|
||||||
t.integer "lock_version"
|
t.integer "lock_version"
|
||||||
t.text "body"
|
t.text "body"
|
||||||
|
@ -236,13 +248,13 @@ ActiveRecord::Schema.define(:version => 20140102170431) do
|
||||||
t.datetime "updated_at"
|
t.datetime "updated_at"
|
||||||
end
|
end
|
||||||
|
|
||||||
add_index "page_versions", ["page_id"], :name => "index_page_versions_on_page_id"
|
add_index "page_versions", ["page_id"], name: "index_page_versions_on_page_id", using: :btree
|
||||||
|
|
||||||
create_table "pages", :force => true do |t|
|
create_table "pages", force: true do |t|
|
||||||
t.string "title"
|
t.string "title"
|
||||||
t.text "body"
|
t.text "body"
|
||||||
t.string "permalink"
|
t.string "permalink"
|
||||||
t.integer "lock_version", :default => 0
|
t.integer "lock_version", default: 0
|
||||||
t.integer "updated_by"
|
t.integer "updated_by"
|
||||||
t.integer "redirect"
|
t.integer "redirect"
|
||||||
t.integer "parent_id"
|
t.integer "parent_id"
|
||||||
|
@ -250,49 +262,49 @@ ActiveRecord::Schema.define(:version => 20140102170431) do
|
||||||
t.datetime "updated_at"
|
t.datetime "updated_at"
|
||||||
end
|
end
|
||||||
|
|
||||||
add_index "pages", ["permalink"], :name => "index_pages_on_permalink"
|
add_index "pages", ["permalink"], name: "index_pages_on_permalink", using: :btree
|
||||||
add_index "pages", ["title"], :name => "index_pages_on_title"
|
add_index "pages", ["title"], name: "index_pages_on_title", using: :btree
|
||||||
|
|
||||||
create_table "periodic_task_groups", :force => true do |t|
|
create_table "periodic_task_groups", force: true do |t|
|
||||||
t.date "next_task_date"
|
t.date "next_task_date"
|
||||||
t.datetime "created_at", :null => false
|
t.datetime "created_at", null: false
|
||||||
t.datetime "updated_at", :null => false
|
t.datetime "updated_at", null: false
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "settings", :force => true do |t|
|
create_table "settings", force: true do |t|
|
||||||
t.string "var", :null => false
|
t.string "var", null: false
|
||||||
t.text "value"
|
t.text "value"
|
||||||
t.integer "thing_id"
|
t.integer "thing_id"
|
||||||
t.string "thing_type", :limit => 30
|
t.string "thing_type", limit: 30
|
||||||
t.datetime "created_at", :null => false
|
t.datetime "created_at", null: false
|
||||||
t.datetime "updated_at", :null => false
|
t.datetime "updated_at", null: false
|
||||||
end
|
end
|
||||||
|
|
||||||
add_index "settings", ["thing_type", "thing_id", "var"], :name => "index_settings_on_thing_type_and_thing_id_and_var", :unique => true
|
add_index "settings", ["thing_type", "thing_id", "var"], name: "index_settings_on_thing_type_and_thing_id_and_var", unique: true, using: :btree
|
||||||
|
|
||||||
create_table "stock_changes", :force => true do |t|
|
create_table "stock_changes", force: true do |t|
|
||||||
t.integer "delivery_id"
|
t.integer "delivery_id"
|
||||||
t.integer "order_id"
|
t.integer "order_id"
|
||||||
t.integer "stock_article_id"
|
t.integer "stock_article_id"
|
||||||
t.integer "quantity", :default => 0
|
t.integer "quantity", default: 0
|
||||||
t.datetime "created_at"
|
t.datetime "created_at"
|
||||||
t.integer "stock_taking_id"
|
t.integer "stock_taking_id"
|
||||||
end
|
end
|
||||||
|
|
||||||
add_index "stock_changes", ["delivery_id"], :name => "index_stock_changes_on_delivery_id"
|
add_index "stock_changes", ["delivery_id"], name: "index_stock_changes_on_delivery_id", using: :btree
|
||||||
add_index "stock_changes", ["stock_article_id"], :name => "index_stock_changes_on_stock_article_id"
|
add_index "stock_changes", ["stock_article_id"], name: "index_stock_changes_on_stock_article_id", using: :btree
|
||||||
add_index "stock_changes", ["stock_taking_id"], :name => "index_stock_changes_on_stock_taking_id"
|
add_index "stock_changes", ["stock_taking_id"], name: "index_stock_changes_on_stock_taking_id", using: :btree
|
||||||
|
|
||||||
create_table "stock_takings", :force => true do |t|
|
create_table "stock_takings", force: true do |t|
|
||||||
t.date "date"
|
t.date "date"
|
||||||
t.text "note"
|
t.text "note"
|
||||||
t.datetime "created_at"
|
t.datetime "created_at"
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "suppliers", :force => true do |t|
|
create_table "suppliers", force: true do |t|
|
||||||
t.string "name", :default => "", :null => false
|
t.string "name", default: "", null: false
|
||||||
t.string "address", :default => "", :null => false
|
t.string "address", default: "", null: false
|
||||||
t.string "phone", :default => "", :null => false
|
t.string "phone", default: "", null: false
|
||||||
t.string "phone2"
|
t.string "phone2"
|
||||||
t.string "fax"
|
t.string "fax"
|
||||||
t.string "email"
|
t.string "email"
|
||||||
|
@ -307,40 +319,40 @@ ActiveRecord::Schema.define(:version => 20140102170431) do
|
||||||
t.datetime "deleted_at"
|
t.datetime "deleted_at"
|
||||||
end
|
end
|
||||||
|
|
||||||
add_index "suppliers", ["name"], :name => "index_suppliers_on_name", :unique => true
|
add_index "suppliers", ["name"], name: "index_suppliers_on_name", unique: true, using: :btree
|
||||||
|
|
||||||
create_table "tasks", :force => true do |t|
|
create_table "tasks", force: true do |t|
|
||||||
t.string "name", :default => "", :null => false
|
t.string "name", default: "", null: false
|
||||||
t.string "description"
|
t.string "description"
|
||||||
t.date "due_date"
|
t.date "due_date"
|
||||||
t.boolean "done", :default => false
|
t.boolean "done", default: false
|
||||||
t.integer "workgroup_id"
|
t.integer "workgroup_id"
|
||||||
t.datetime "created_on", :null => false
|
t.datetime "created_on", null: false
|
||||||
t.datetime "updated_on", :null => false
|
t.datetime "updated_on", null: false
|
||||||
t.integer "required_users", :default => 1
|
t.integer "required_users", default: 1
|
||||||
t.integer "duration", :default => 1
|
t.integer "duration", default: 1
|
||||||
t.integer "periodic_task_group_id"
|
t.integer "periodic_task_group_id"
|
||||||
end
|
end
|
||||||
|
|
||||||
add_index "tasks", ["due_date"], :name => "index_tasks_on_due_date"
|
add_index "tasks", ["due_date"], name: "index_tasks_on_due_date", using: :btree
|
||||||
add_index "tasks", ["name"], :name => "index_tasks_on_name"
|
add_index "tasks", ["name"], name: "index_tasks_on_name", using: :btree
|
||||||
add_index "tasks", ["workgroup_id"], :name => "index_tasks_on_workgroup_id"
|
add_index "tasks", ["workgroup_id"], name: "index_tasks_on_workgroup_id", using: :btree
|
||||||
|
|
||||||
create_table "users", :force => true do |t|
|
create_table "users", force: true do |t|
|
||||||
t.string "nick"
|
t.string "nick"
|
||||||
t.string "password_hash", :default => "", :null => false
|
t.string "password_hash", default: "", null: false
|
||||||
t.string "password_salt", :default => "", :null => false
|
t.string "password_salt", default: "", null: false
|
||||||
t.string "first_name", :default => "", :null => false
|
t.string "first_name", default: "", null: false
|
||||||
t.string "last_name", :default => "", :null => false
|
t.string "last_name", default: "", null: false
|
||||||
t.string "email", :default => "", :null => false
|
t.string "email", default: "", null: false
|
||||||
t.string "phone"
|
t.string "phone"
|
||||||
t.datetime "created_on", :null => false
|
t.datetime "created_on", null: false
|
||||||
t.string "reset_password_token"
|
t.string "reset_password_token"
|
||||||
t.datetime "reset_password_expires"
|
t.datetime "reset_password_expires"
|
||||||
t.datetime "last_login"
|
t.datetime "last_login"
|
||||||
end
|
end
|
||||||
|
|
||||||
add_index "users", ["email"], :name => "index_users_on_email", :unique => true
|
add_index "users", ["email"], name: "index_users_on_email", unique: true, using: :btree
|
||||||
add_index "users", ["nick"], :name => "index_users_on_nick", :unique => true
|
add_index "users", ["nick"], name: "index_users_on_nick", unique: true, using: :btree
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -17,8 +17,8 @@ class Page < ActiveRecord::Base
|
||||||
before_validation :update_permalink, :on => :update
|
before_validation :update_permalink, :on => :update
|
||||||
after_update :create_redirect
|
after_update :create_redirect
|
||||||
|
|
||||||
scope :non_redirected, :conditions => {:redirect => nil}
|
scope :non_redirected, -> { where(:redirect => nil) }
|
||||||
scope :no_parent, :conditions => {:parent_id => nil}
|
scope :no_parent, -> { where(:parent_id => nil) }
|
||||||
|
|
||||||
def self.permalink(title)
|
def self.permalink(title)
|
||||||
title.gsub(/[\/\.,;@\s]/, "_").gsub(/[\"\']/, "")
|
title.gsub(/[\/\.,;@\s]/, "_").gsub(/[\"\']/, "")
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
= simple_form_for @page do |f|
|
= simple_form_for @page do |f|
|
||||||
= f.hidden_field :lock_version
|
= f.hidden_field :lock_version
|
||||||
= f.input :title, input_html: {class: 'input-xxlarge'}
|
= f.input :title, input_html: {class: 'input-xxlarge'}
|
||||||
= f.input :body, input_html: {class: 'input-xxlarge'}
|
= f.input :body, input_html: {class: 'input-xxlarge', rows: 20}
|
||||||
= f.input :parent_id, as: :select, collection: parent_pages_to_select(@page)
|
= f.input :parent_id, as: :select, collection: parent_pages_to_select(@page)
|
||||||
.form-actions
|
.form-actions
|
||||||
= button_tag :name => 'preview', class: 'btn' do
|
= button_tag :name => 'preview', class: 'btn' do
|
||||||
|
|
|
@ -47,5 +47,5 @@
|
||||||
= link_to edit_page_path(@page), class: 'btn btn-primary' do
|
= link_to edit_page_path(@page), class: 'btn btn-primary' do
|
||||||
%i.icon-edit= t '.edit'
|
%i.icon-edit= t '.edit'
|
||||||
= link_to t('.delete'), @page, class: 'btn btn-danger', :method => :delete,
|
= link_to t('.delete'), @page, class: 'btn btn-danger', :method => :delete,
|
||||||
:confirm => t('.delete_confirm')
|
:data => {:confirm => t('.delete_confirm')}
|
||||||
!= '| ' + t('.last_updated', user: show_user(@page.user), when: format_datetime(@page.updated_at))
|
!= '| ' + t('.last_updated', user: show_user(@page.user), when: format_datetime(@page.updated_at))
|
||||||
|
|
|
@ -7,8 +7,8 @@ Rails.application.routes.draw do
|
||||||
get :version, :on => :member
|
get :version, :on => :member
|
||||||
get :revert, :on => :member
|
get :revert, :on => :member
|
||||||
end
|
end
|
||||||
match '/wiki/:permalink' => 'pages#show', :as => 'wiki_page' # , :constraints => {:permalink => /[^\s]+/}
|
get '/wiki/:permalink' => 'pages#show', :as => 'wiki_page' # , :constraints => {:permalink => /[^\s]+/}
|
||||||
match '/wiki' => 'pages#show', :defaults => {:permalink => 'Home'}, :as => 'wiki'
|
get '/wiki' => 'pages#show', :defaults => {:permalink => 'Home'}, :as => 'wiki'
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ Gem::Specification.new do |s|
|
||||||
s.files = Dir["{app,config,db,lib}/**/*"] + ["Rakefile", "README.md"]
|
s.files = Dir["{app,config,db,lib}/**/*"] + ["Rakefile", "README.md"]
|
||||||
s.test_files = Dir["test/**/*"]
|
s.test_files = Dir["test/**/*"]
|
||||||
|
|
||||||
s.add_dependency "rails", "~> 3.2.15"
|
s.add_dependency "rails"
|
||||||
s.add_dependency 'wikicloth'
|
s.add_dependency 'wikicloth'
|
||||||
s.add_dependency 'acts_as_versioned' # need git version, make sure that is included in foodsoft's Gemfile
|
s.add_dependency 'acts_as_versioned' # need git version, make sure that is included in foodsoft's Gemfile
|
||||||
s.add_dependency 'diffy'
|
s.add_dependency 'diffy'
|
||||||
|
|
|
@ -1,31 +0,0 @@
|
||||||
desc "Checks your app and gently warns you if you are using deprecated code."
|
|
||||||
task :deprecated => :environment do
|
|
||||||
deprecated = {
|
|
||||||
'@params' => 'Use params[] instead',
|
|
||||||
'@session' => 'Use session[] instead',
|
|
||||||
'@flash' => 'Use flash[] instead',
|
|
||||||
'@request' => 'Use request[] instead',
|
|
||||||
'@env' => 'Use env[] instead',
|
|
||||||
'find_all\([^_]\|$\)' => 'Use find(:all) instead',
|
|
||||||
'find_first' => 'Use find(:first) instead',
|
|
||||||
'render_partial' => 'Use render :partial instead',
|
|
||||||
'component' => 'Use of components are frowned upon',
|
|
||||||
'paginate' => 'The default paginator is slow. Writing your own may be faster',
|
|
||||||
'start_form_tag' => 'Use form_for instead',
|
|
||||||
'end_form_tag' => 'Use form_for instead',
|
|
||||||
':post => true' => 'Use :method => :post instead'
|
|
||||||
}
|
|
||||||
|
|
||||||
deprecated.each do |key, warning|
|
|
||||||
puts '--> ' + key
|
|
||||||
output = `cd '#{File.expand_path('app', RAILS_ROOT)}' && grep -n --exclude=*.svn* --exclude=.#* -r '#{key}' *`
|
|
||||||
unless output =~ /^$/
|
|
||||||
puts " !! " + warning + " !!"
|
|
||||||
puts ' ' + '.' * (warning.length + 6)
|
|
||||||
puts output
|
|
||||||
else
|
|
||||||
puts " Clean! Cheers for you!"
|
|
||||||
end
|
|
||||||
puts
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -36,12 +36,12 @@ describe Article do
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'keeps a price history' do
|
it 'keeps a price history' do
|
||||||
expect(article.article_prices.all.map(&:price)).to eq([article.price])
|
expect(article.article_prices.map(&:price)).to eq([article.price])
|
||||||
oldprice = article.price
|
oldprice = article.price
|
||||||
sleep 1 # so that the new price really has a later creation time
|
sleep 1 # so that the new price really has a later creation time
|
||||||
article.price += 1
|
article.price += 1
|
||||||
article.save!
|
article.save!
|
||||||
expect(article.article_prices.all.map(&:price)).to eq([article.price, oldprice])
|
expect(article.article_prices.reload.map(&:price)).to eq([article.price, oldprice])
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'is not in an open order by default' do
|
it 'is not in an open order by default' do
|
||||||
|
|
|
@ -23,7 +23,7 @@ describe Order do
|
||||||
it 'is not closed by default' do expect(order).to_not be_closed end
|
it 'is not closed by default' do expect(order).to_not be_closed end
|
||||||
|
|
||||||
it 'has valid order articles' do
|
it 'has valid order articles' do
|
||||||
order.order_articles.all.each {|oa| expect(oa).to be_valid }
|
order.order_articles.each {|oa| expect(oa).to be_valid }
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'can be finished' do
|
it 'can be finished' do
|
||||||
|
|
|
@ -10,7 +10,7 @@ describe Supplier do
|
||||||
|
|
||||||
it 'has valid articles' do
|
it 'has valid articles' do
|
||||||
supplier = create :supplier, article_count: true
|
supplier = create :supplier, article_count: true
|
||||||
supplier.articles.all.each {|a| expect(a).to be_valid }
|
supplier.articles.each {|a| expect(a).to be_valid }
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue