diff --git a/Dockerfile b/Dockerfile index 95479ce2..c999b3d4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM ruby:2.7 +FROM ruby:2.6 RUN supercronicUrl=https://github.com/aptible/supercronic/releases/download/v0.1.3/supercronic-linux-amd64 && \ supercronicBin=/usr/local/bin/supercronic && \ @@ -15,16 +15,13 @@ ENV PORT=3000 \ WORKDIR /usr/src/app -COPY Gemfile Gemfile.lock ./ -COPY plugins/ ./plugins -COPY config/ ./config +COPY . ./ # install dependencies and generate crontab RUN buildDeps='libmagic-dev' && \ apt-get update && \ apt-get install --no-install-recommends -y $buildDeps && \ echo 'gem: --no-document' >> ~/.gemrc && \ - gem install bundler && \ bundle config build.nokogiri "--use-system-libraries" && \ bundle install --deployment --without development test -j 4 && \ apt-get purge -y --auto-remove $buildDeps && \ @@ -32,8 +29,6 @@ RUN buildDeps='libmagic-dev' && \ \ bundle exec whenever >crontab -COPY . ./ - # compile assets with temporary mysql server RUN export DATABASE_URL=mysql2://localhost/temp?encoding=utf8 && \ export SECRET_KEY_BASE=thisisnotimportantnow && \ diff --git a/Gemfile b/Gemfile index 75a515cb..948ef685 100644 --- a/Gemfile +++ b/Gemfile @@ -7,6 +7,7 @@ gem 'mail', '~> 2.7.1' # bug with mail 2.8.0 https://github.com/mikel/mail/issue gem 'sassc-rails' gem 'less-rails' +gem 'uglifier' # See https://github.com/sstephenson/execjs#readme for more supported runtimes gem 'therubyracer', platforms: :ruby @@ -126,7 +127,3 @@ group :test do gem 'rswag-specs' gem 'hashie', '~> 3.4.6', require: false # https://github.com/westfieldlabs/apivore/issues/114 end - -gem "importmap-rails", "~> 1.1" - -gem "terser", "~> 1.1" diff --git a/Gemfile.lock b/Gemfile.lock index ad8f2c0f..0c9eaf3d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -264,9 +264,6 @@ GEM i18n-spec (0.6.0) iso ice_cube (0.16.4) - importmap-rails (1.1.5) - actionpack (>= 6.0.0) - railties (>= 6.0.0) inherited_resources (1.13.1) actionpack (>= 5.2, < 7.1) has_scope (~> 0.6) @@ -556,8 +553,6 @@ GEM sqlite3 (>= 1.3.3) table_print (1.5.7) temple (0.9.1) - terser (1.1.13) - execjs (>= 0.3.0, < 3) therubyracer (0.12.3) libv8 (~> 3.16.14.15) ref @@ -578,6 +573,8 @@ GEM unf (~> 0.1.0) tzinfo (2.0.5) concurrent-ruby (~> 1.0) + uglifier (4.2.0) + execjs (>= 0.3.0, < 3) unf (0.1.4) unf_ext unf_ext (0.0.8.2) @@ -641,7 +638,6 @@ DEPENDENCIES i18n-js (~> 3.0.0.rc8) i18n-spec ice_cube - importmap-rails (~> 1.1) inherited_resources jquery-rails kaminari @@ -693,11 +689,11 @@ DEPENDENCIES sprockets (< 4) sqlite3 (~> 1.3.6) table_print - terser (~> 1.1) therubyracer twitter-bootstrap-rails (~> 2.2.8) + uglifier web-console whenever BUNDLED WITH - 2.4.5 + 2.4.2 diff --git a/app/assets/javascripts/application_legacy.js b/app/assets/javascripts/application.js similarity index 100% rename from app/assets/javascripts/application_legacy.js rename to app/assets/javascripts/application.js diff --git a/app/controllers/finance/financial_transactions_controller.rb b/app/controllers/finance/financial_transactions_controller.rb index e0c53e19..930acebe 100644 --- a/app/controllers/finance/financial_transactions_controller.rb +++ b/app/controllers/finance/financial_transactions_controller.rb @@ -18,7 +18,7 @@ class Finance::FinancialTransactionsController < ApplicationController sort = "created_on DESC" end - @q = FinancialTransaction.ransack(params[:q]) + @q = FinancialTransaction.search(params[:q]) @financial_transactions_all = @q.result(distinct: true).includes(:user).order(sort) @financial_transactions_all = @financial_transactions_all.visible unless params[:show_hidden] @financial_transactions_all = @financial_transactions_all.where(ordergroup_id: @ordergroup.id) if @ordergroup diff --git a/app/javascript/application.js b/app/javascript/application.js deleted file mode 100644 index beff742e..00000000 --- a/app/javascript/application.js +++ /dev/null @@ -1 +0,0 @@ -// Configure your import map in config/importmap.rb. Read more: https://github.com/rails/importmap-rails diff --git a/app/models/group_order.rb b/app/models/group_order.rb index f3153c44..c789ef4e 100644 --- a/app/models/group_order.rb +++ b/app/models/group_order.rb @@ -32,8 +32,8 @@ class GroupOrder < ApplicationRecord # Generate some data for the javascript methods in ordering view def load_data data = {} - data[:account_balance] = ordergroup.nil? ? BigDecimal('+Infinity') : ordergroup.account_balance - data[:available_funds] = ordergroup.nil? ? BigDecimal('+Infinity') : ordergroup.get_available_funds(self) + data[:account_balance] = ordergroup.nil? ? BigDecimal.new('+Infinity') : ordergroup.account_balance + data[:available_funds] = ordergroup.nil? ? BigDecimal.new('+Infinity') : ordergroup.get_available_funds(self) # load prices and other stuff.... data[:order_articles] = {} diff --git a/app/views/layouts/_header.html.haml b/app/views/layouts/_header.html.haml index 66e14355..974ce8f2 100644 --- a/app/views/layouts/_header.html.haml +++ b/app/views/layouts/_header.html.haml @@ -8,10 +8,10 @@ = csrf_meta_tags = stylesheet_link_tag "application", :media => "all" //%link(href="images/favicon.ico" rel="shortcut icon") + = yield(:head) = foodcoop_css_tag - %body = yield @@ -19,9 +19,7 @@ Javascripts \================================================== / Placed at the end of the document so the pages load faster - = javascript_importmap_tags - = javascript_include_tag "application_legacy" - + = javascript_include_tag "application" :javascript I18n.defaultLocale = "#{I18n.default_locale}"; I18n.locale = "#{I18n.locale}"; diff --git a/bin/importmap b/bin/importmap deleted file mode 100755 index 36502ab1..00000000 --- a/bin/importmap +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env ruby - -require_relative "../config/application" -require "importmap/commands" diff --git a/config/environments/production.rb b/config/environments/production.rb index d08234e5..d0f06b95 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -29,7 +29,7 @@ Rails.application.configure do config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present? # Compress JavaScripts and CSS. - config.assets.js_compressor = :terser + config.assets.js_compressor = :uglifier config.assets.css_compressor = :sass # Do not fallback to assets pipeline if a precompiled asset is missed. diff --git a/config/importmap.rb b/config/importmap.rb deleted file mode 100644 index 050818ab..00000000 --- a/config/importmap.rb +++ /dev/null @@ -1,2 +0,0 @@ -# Pin npm packages by running ./bin/importmap -pin "application", preload: true \ No newline at end of file diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb index e1c4d5fa..fe48fc34 100644 --- a/config/initializers/assets.rb +++ b/config/initializers/assets.rb @@ -9,4 +9,4 @@ Rails.application.config.assets.version = '1.0' # Precompile additional assets. # application.js, application.css, and all non-JS/CSS in the app/assets # folder are already added. -Rails.application.config.assets.precompile += %w( application_legacy.js jquery.min.js ) +# Rails.application.config.assets.precompile += %w( admin.js admin.css ) diff --git a/config/initializers/extensions.rb b/config/initializers/extensions.rb index 68c7c8f4..799f52e6 100644 --- a/config/initializers/extensions.rb +++ b/config/initializers/extensions.rb @@ -3,7 +3,7 @@ class String # remove comma from decimal inputs def self.delocalized_decimal(string) if !string.blank? and string.is_a?(String) - BigDecimal(string.sub(',', '.')) + BigDecimal.new(string.sub(',', '.')) else string end diff --git a/docker-compose-dev.yml b/docker-compose-dev.yml index b0a325db..5358430a 100644 --- a/docker-compose-dev.yml +++ b/docker-compose-dev.yml @@ -11,7 +11,7 @@ services: build: context: . dockerfile: Dockerfile-dev - platform: linux/x86_64 + platform: linux/x86_64 command: ./proc-start worker volumes: - bundle:/usr/local/bundle diff --git a/plugins/current_orders/app/controllers/current_orders/articles_controller.rb b/plugins/current_orders/app/controllers/current_orders/articles_controller.rb index ef23f332..0e4b7dd9 100644 --- a/plugins/current_orders/app/controllers/current_orders/articles_controller.rb +++ b/plugins/current_orders/app/controllers/current_orders/articles_controller.rb @@ -32,7 +32,7 @@ class CurrentOrders::ArticlesController < ApplicationController else @order_articles = OrderArticle.where(order_id: @current_orders.all.map(&:id)) end - @q = OrderArticle.ransack(params[:q]) + @q = OrderArticle.search(params[:q]) @order_articles = @order_articles.ordered.merge(@q.result).includes(:article, :article_price) @order_article = @order_articles.where(id: params[:id]).first end diff --git a/vendor/javascript/.keep b/vendor/javascript/.keep deleted file mode 100644 index e69de29b..00000000