diff --git a/.travis.yml b/.travis.yml index 78539279..baecba08 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,6 @@ language: ruby rvm: - - 2.0.0 + - 2.1 services: - redis-server env: COVERALLS=1 diff --git a/Gemfile b/Gemfile index 27005957..a193308e 100644 --- a/Gemfile +++ b/Gemfile @@ -1,12 +1,11 @@ # A sample Gemfile source "https://rubygems.org" -ruby "2.0.0" -gem "rails", '~> 4.0.0' +gem "rails", '~> 4.1' -gem 'sass-rails', '~> 4.0.0' -gem 'coffee-rails', '~> 4.0.0' +gem 'sass-rails', '>= 4.0' # version to avoid bundle getting confused +gem 'coffee-rails' gem 'less-rails' gem 'uglifier', '>= 1.0.3' # See https://github.com/sstephenson/execjs#readme for more supported runtimes @@ -27,12 +26,10 @@ gem 'prawn-table' gem 'haml-rails' gem 'kaminari' gem 'simple_form' -gem 'client_side_validations', git: 'git://github.com/bcardarella/client_side_validations.git', branch: '4-0-beta' -gem 'client_side_validations-simple_form', git: 'git://github.com/saveritemedical/client_side_validations-simple_form.git' gem 'inherited_resources' gem 'localize_input', git: "git://github.com/bennibu/localize_input.git" gem 'daemons' -gem 'twitter-bootstrap-rails' +gem 'twitter-bootstrap-rails', '~> 2.2.8' gem 'simple-navigation' gem 'simple-navigation-bootstrap' gem 'ransack' @@ -56,6 +53,10 @@ end group :development do gem 'sqlite3' gem 'mailcatcher' + + # allow to use `debugger` https://github.com/conradirwin/pry-rescue + gem 'pry-rescue' + gem 'pry-stack_explorer' # Better error output gem 'better_errors' @@ -85,7 +86,7 @@ end group :test do gem 'rspec-rails' - gem 'factory_girl_rails', '~> 4.0' + gem 'factory_girl_rails' gem 'faker' gem 'capybara' # webkit and poltergeist don't seem to work yet diff --git a/Gemfile.lock b/Gemfile.lock index c38fe4c7..0c435cf8 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,24 +1,9 @@ -GIT - remote: git://github.com/bcardarella/client_side_validations.git - revision: 9461cb92e1dfb64895d590c6d435cdf48fcede45 - branch: 4-0-beta - specs: - client_side_validations (3.2.2) - GIT remote: git://github.com/bennibu/localize_input.git revision: 5eb188d2525a073d09e142cf8b0b04e6ace6e7b0 specs: localize_input (0.1.0) -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 remote: git://github.com/technoweenie/acts_as_versioned.git revision: 63b1fc8529d028fae632fe80ec0cb25df56cd76b @@ -46,33 +31,35 @@ PATH GEM remote: https://rubygems.org/ specs: - actionmailer (4.0.10) - actionpack (= 4.0.10) + actionmailer (4.1.8) + actionpack (= 4.1.8) + actionview (= 4.1.8) mail (~> 2.5, >= 2.5.4) - actionpack (4.0.10) - activesupport (= 4.0.10) - builder (~> 3.1.0) - erubis (~> 2.7.0) + actionpack (4.1.8) + actionview (= 4.1.8) + activesupport (= 4.1.8) rack (~> 1.5.2) rack-test (~> 0.6.2) - activemodel (4.0.10) - activesupport (= 4.0.10) - builder (~> 3.1.0) - activerecord (4.0.10) - activemodel (= 4.0.10) - activerecord-deprecated_finders (~> 1.0.2) - activesupport (= 4.0.10) - arel (~> 4.0.0) - activerecord-deprecated_finders (1.0.3) - activesupport (4.0.10) + actionview (4.1.8) + activesupport (= 4.1.8) + builder (~> 3.1) + erubis (~> 2.7.0) + activemodel (4.1.8) + activesupport (= 4.1.8) + builder (~> 3.1) + activerecord (4.1.8) + activemodel (= 4.1.8) + activesupport (= 4.1.8) + arel (~> 5.0.0) + activesupport (4.1.8) i18n (~> 0.6, >= 0.6.9) - minitest (~> 4.2) - multi_json (~> 1.3) + json (~> 1.7, >= 1.7.7) + minitest (~> 5.1) thread_safe (~> 0.1) - tzinfo (~> 0.3.37) + tzinfo (~> 1.1) acts_as_tree (2.1.0) activerecord (>= 3.0.0) - arel (4.0.2) + arel (5.0.1.20140414130214) attribute_normalizer (1.2.0) better_errors (2.0.0) coderay (>= 1.0.0) @@ -82,7 +69,7 @@ GEM debug_inspector (>= 0.0.1) bootstrap-datepicker-rails (1.3.0.2) railties (>= 3.0) - builder (3.1.4) + builder (3.2.2) bullet (4.14.0) activesupport (>= 3.0.0) uniform_notifier (>= 1.6.0) @@ -110,7 +97,7 @@ GEM ffi (~> 1.0, >= 1.0.11) chronic (0.10.2) coderay (1.1.0) - coffee-rails (4.0.1) + coffee-rails (4.1.0) coffee-script (>= 2.2.0) railties (>= 4.0.0, < 5.0) coffee-script (2.3.0) @@ -119,7 +106,7 @@ GEM coffee-script-source (1.8.0) colorize (0.7.3) commonjs (0.2.7) - connection_pool (2.0.0) + connection_pool (2.1.0) content_for_in_controllers (0.0.2) coveralls (0.7.1) multi_json (~> 1.3) @@ -147,10 +134,10 @@ GEM activesupport (>= 3.0.4) execjs (2.2.2) expression_parser (0.9.0) - factory_girl (4.4.0) + factory_girl (4.5.0) activesupport (>= 3.0.0) - factory_girl_rails (4.4.1) - factory_girl (~> 4.4.0) + factory_girl_rails (4.5.0) + factory_girl (~> 4.5.0) railties (>= 3.0.0) faker (1.4.3) i18n (~> 0.5) @@ -167,13 +154,16 @@ GEM activesupport (>= 3.2, < 5) hike (1.2.3) i18n (0.6.11) - i18n-js (3.0.0.rc6) + i18n-js (3.0.0.rc7) i18n (~> 0.6) - i18n-spec (0.5.2) + i18n-spec (0.6.0) iso - inherited_resources (1.5.0) + inherited_resources (1.5.1) + actionpack (>= 3.2, < 4.2) has_scope (~> 0.6.0.rc) + railties (>= 3.2, < 4.2) responders (~> 1.0) + interception (0.5) iso (0.2.1) i18n jquery-rails (3.1.2) @@ -183,13 +173,13 @@ GEM kaminari (0.16.1) actionpack (>= 3.0.0) activesupport (>= 3.0.0) - less (2.5.1) + less (2.6.0) commonjs (~> 0.2.7) - less-rails (2.5.0) + less-rails (2.6.0) actionpack (>= 3.1) - less (~> 2.5.0) + less (~> 2.6.0) libv8 (3.16.14.7) - mail (2.6.1) + mail (2.6.3) mime-types (>= 1.16, < 3) mailcatcher (0.2.4) eventmachine @@ -205,18 +195,19 @@ GEM callsite (~> 0.0, >= 0.0.11) rack-contrib (~> 1.1) railties (>= 3.0.0, < 5.0.0) - mime-types (2.4.2) - mini_portile (0.6.0) - minitest (4.7.5) + method_source (0.8.2) + mime-types (2.4.3) + mini_portile (0.6.1) + minitest (5.4.3) mono_logger (1.1.0) multi_json (1.10.1) - mysql2 (0.3.16) + mysql2 (0.3.17) net-scp (1.2.1) net-ssh (>= 2.6.5) net-ssh (2.9.1) netrc (0.8.0) - nokogiri (1.6.3.1) - mini_portile (= 0.6.0) + nokogiri (1.6.4.1) + mini_portile (~> 0.6.0) pdf-core (0.4.0) polyamorous (1.1.0) activerecord (>= 3.0) @@ -224,25 +215,37 @@ GEM prawn (1.3.0) pdf-core (~> 0.4.0) ttfunk (~> 1.4.0) - prawn-table (0.2.0) + prawn-table (0.2.1) protected_attributes (1.0.8) activemodel (>= 4.0.1, < 5.0) + pry (0.10.1) + coderay (~> 1.1.0) + method_source (~> 0.8.1) + slop (~> 3.4) + pry-rescue (1.4.1) + interception (>= 0.5) + pry + pry-stack_explorer (0.4.9.1) + binding_of_caller (>= 0.7) + pry (>= 0.9.11) quiet_assets (1.0.3) railties (>= 3.1, < 5.0) rack (1.5.2) - rack-contrib (1.1.0) + rack-contrib (1.2.0) rack (>= 0.9.1) rack-protection (1.5.3) rack rack-test (0.6.2) rack (>= 1.0) - rails (4.0.10) - actionmailer (= 4.0.10) - actionpack (= 4.0.10) - activerecord (= 4.0.10) - activesupport (= 4.0.10) + rails (4.1.8) + actionmailer (= 4.1.8) + actionpack (= 4.1.8) + actionview (= 4.1.8) + activemodel (= 4.1.8) + activerecord (= 4.1.8) + activesupport (= 4.1.8) bundler (>= 1.3.0, < 2.0) - railties (= 4.0.10) + railties (= 4.1.8) sprockets-rails (~> 2.0) rails-assets-listjs (0.2.0.beta.4) railties (>= 3.1) @@ -251,13 +254,13 @@ GEM railties (~> 4.0) rails-settings-cached (0.4.1) rails (>= 4.0.0) - railties (4.0.10) - actionpack (= 4.0.10) - activesupport (= 4.0.10) + railties (4.1.8) + actionpack (= 4.1.8) + activesupport (= 4.1.8) rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) rake (10.3.2) - ransack (1.4.1) + ransack (1.5.1) actionpack (>= 3.0) activerecord (>= 3.0) activesupport (>= 3.0) @@ -267,7 +270,7 @@ GEM redis-namespace (1.5.1) redis (~> 3.0, >= 3.0.4) ref (1.0.5) - responders (1.1.1) + responders (1.1.2) railties (>= 3.2, < 4.2) resque (1.25.2) mono_logger (~> 1.0) @@ -283,7 +286,7 @@ GEM rspec-core (~> 2.99.0) rspec-expectations (~> 2.99.0) rspec-mocks (~> 2.99.0) - rspec-collection_matchers (1.0.0) + rspec-collection_matchers (1.1.2) rspec-expectations (>= 2.99.0.beta1) rspec-core (2.99.2) rspec-expectations (2.99.2) @@ -300,18 +303,18 @@ GEM rspec-mocks (~> 2.99.0) rspec-rerun (0.2.0) rspec (>= 2.11.0, < 3) - ruby-prof (0.15.1) + ruby-prof (0.15.2) ruby-units (1.4.5) rubyzip (1.1.6) sass (3.2.19) - sass-rails (4.0.3) + sass-rails (4.0.4) railties (>= 4.0.0, < 5.0) - sass (~> 3.2.0) - sprockets (~> 2.8, <= 2.11.0) + sass (~> 3.2.2) + sprockets (~> 2.8, < 2.12) sprockets-rails (~> 2.0) select2-rails (3.5.9.1) thor (~> 0.14) - selenium-webdriver (2.43.0) + selenium-webdriver (2.44.0) childprocess (~> 0.5) multi_json (~> 1.0) rubyzip (~> 1.0) @@ -336,7 +339,8 @@ GEM skinny (0.2.3) eventmachine (~> 1.0.0) thin (~> 1.5.0) - sprockets (2.11.0) + slop (3.6.0) + sprockets (2.11.3) hike (~> 1.2) multi_json (~> 1.0) rack (~> 1.0) @@ -345,7 +349,7 @@ GEM actionpack (>= 3.0) activesupport (>= 3.0) sprockets (>= 2.8, < 4.0) - sqlite3 (1.3.9) + sqlite3 (1.3.10) sqlite3-ruby (1.3.3) sqlite3 (>= 1.3.3) sshkit (1.5.1) @@ -371,7 +375,8 @@ GEM execjs rails (>= 3.1) railties (>= 3.1) - tzinfo (0.3.41) + tzinfo (1.2.2) + thread_safe (~> 0.1) uglifier (2.5.3) execjs (>= 0.3.0) json (>= 1.8.0) @@ -379,7 +384,7 @@ GEM vegas (0.1.11) rack (>= 1.0.0) websocket (1.2.1) - whenever (0.9.3) + whenever (0.9.4) chronic (>= 0.6.3) wikicloth (0.8.1) builder @@ -404,16 +409,14 @@ DEPENDENCIES capistrano-rails capistrano-rvm capybara - client_side_validations! - client_side_validations-simple_form! - coffee-rails (~> 4.0.0) + coffee-rails connection_pool coveralls daemons database_cleaner date_time_attribute exception_notification - factory_girl_rails (~> 4.0) + factory_girl_rails faker foodsoft_messages! foodsoft_wiki! @@ -431,8 +434,10 @@ DEPENDENCIES prawn prawn-table protected_attributes + pry-rescue + pry-stack_explorer quiet_assets - rails (~> 4.0.0) + rails (~> 4.1) rails-assets-listjs (= 0.2.0.beta.4) rails-i18n rails-settings-cached @@ -443,7 +448,7 @@ DEPENDENCIES rspec-rerun ruby-prof ruby-units - sass-rails (~> 4.0.0) + sass-rails (>= 4.0) select2-rails selenium-webdriver simple-navigation @@ -453,6 +458,6 @@ DEPENDENCIES sqlite3 therubyracer thin - twitter-bootstrap-rails + twitter-bootstrap-rails (~> 2.2.8) uglifier (>= 1.0.3) whenever diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index d43b1cb2..d3d5555e 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -11,8 +11,6 @@ //= require list.unlist //= require list.delay //= require list.reset -//= require rails.validations -//= require rails.validations.simple_form //= require i18n //= require i18n/translations //= require_self diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 967bc9e2..f960a07e 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -174,8 +174,8 @@ module ApplicationHelper def bootstrap_flash_patched flash_messages = [] flash.each do |type, message| - type = :success if type == :notice - type = :error if type == :alert + type = :success if type == 'notice' + type = :error if type == 'alert' text = content_tag(:div, content_tag(:button, I18n.t('ui.marks.close').html_safe, :class => "close", "data-dismiss" => "alert") + message, :class => "alert fade in alert-#{type}") diff --git a/app/helpers/deliveries_helper.rb b/app/helpers/deliveries_helper.rb index 3e2909d1..f8a4c370 100644 --- a/app/helpers/deliveries_helper.rb +++ b/app/helpers/deliveries_helper.rb @@ -12,7 +12,7 @@ module DeliveriesHelper def articles_for_select2(articles, except = [], &block) articles = articles.reorder('articles.name ASC') - articles.reject! {|a| not except.index(a.id).nil? } if except + articles = articles.reject {|a| not except.index(a.id).nil? } if except block_given? or block = Proc.new {|a| "#{a.name} (#{number_to_currency a.price}/#{a.unit})" } articles.map do |a| {:id => a.id, :text => block.call(a)} diff --git a/app/models/user.rb b/app/models/user.rb index 47725636..3ab99d85 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -47,7 +47,6 @@ class User < ActiveRecord::Base end after_save do - return if settings_attributes.nil? settings_attributes.each do |key, value| value.each do |k, v| case v @@ -58,7 +57,7 @@ class User < ActiveRecord::Base end end self.settings.merge!(key, value) - end + end if settings_attributes end # sorted by display name diff --git a/config/application.rb b/config/application.rb index 403ae8c5..c2d2ca87 100644 --- a/config/application.rb +++ b/config/application.rb @@ -2,10 +2,6 @@ require File.expand_path('../boot', __FILE__) require 'rails/all' -# need to include this before requiring some other gems -# http://stackoverflow.com/questions/20361428 -I18n.enforce_available_locales = true - # Require the gems listed in Gemfile, including any gems # you've limited to :test, :development, or :production. Bundler.require(:default, Rails.env) diff --git a/config/initializers/client_side_validations.rb b/config/initializers/client_side_validations.rb deleted file mode 100644 index 8e7f76e2..00000000 --- a/config/initializers/client_side_validations.rb +++ /dev/null @@ -1,23 +0,0 @@ -# ClientSideValidations Initializer - -# DISABLED FOR RAILS4 -# Uncomment to disable uniqueness validator, possible security issue -# Disabled because of possible security issue and because of bug -# https://github.com/bcardarella/client_side_validations/pull/532 -#ClientSideValidations::Config.disabled_validators = [:uniqueness] - -# Uncomment to validate number format with current I18n locale -# Foodsoft is currently using localize_input which is activated on certain -# fields only, meaning we can't globally turn this on. The non-i18n number -# format is still supported - so for now keep false. -# ClientSideValidations::Config.number_format_with_locale = true - -# Uncomment the following block if you want each input field to have the validation messages attached. -# ActionView::Base.field_error_proc = Proc.new do |html_tag, instance| -# unless html_tag =~ /^