Compare commits
8 commits
1279437ed5
...
4dd45b7b2f
| Author | SHA1 | Date | |
|---|---|---|---|
| 4dd45b7b2f | |||
| 91a38bc73b | |||
| 782194cd08 | |||
|
|
78da4feafe | ||
|
|
666e7934a6 | ||
|
|
82d4ff0284 | ||
|
|
c487f0368a | ||
| a7747c9e84 |
16 changed files with 38 additions and 17 deletions
|
|
@ -1,4 +1,4 @@
|
||||||
FROM ruby:2.6
|
FROM ruby:2.7
|
||||||
|
|
||||||
RUN supercronicUrl=https://github.com/aptible/supercronic/releases/download/v0.1.3/supercronic-linux-amd64 && \
|
RUN supercronicUrl=https://github.com/aptible/supercronic/releases/download/v0.1.3/supercronic-linux-amd64 && \
|
||||||
supercronicBin=/usr/local/bin/supercronic && \
|
supercronicBin=/usr/local/bin/supercronic && \
|
||||||
|
|
@ -15,13 +15,16 @@ ENV PORT=3000 \
|
||||||
|
|
||||||
WORKDIR /usr/src/app
|
WORKDIR /usr/src/app
|
||||||
|
|
||||||
COPY . ./
|
COPY Gemfile Gemfile.lock ./
|
||||||
|
COPY plugins/ ./plugins
|
||||||
|
COPY config/ ./config
|
||||||
|
|
||||||
# install dependencies and generate crontab
|
# install dependencies and generate crontab
|
||||||
RUN buildDeps='libmagic-dev' && \
|
RUN buildDeps='libmagic-dev' && \
|
||||||
apt-get update && \
|
apt-get update && \
|
||||||
apt-get install --no-install-recommends -y $buildDeps && \
|
apt-get install --no-install-recommends -y $buildDeps && \
|
||||||
echo 'gem: --no-document' >> ~/.gemrc && \
|
echo 'gem: --no-document' >> ~/.gemrc && \
|
||||||
|
gem install bundler && \
|
||||||
bundle config build.nokogiri "--use-system-libraries" && \
|
bundle config build.nokogiri "--use-system-libraries" && \
|
||||||
bundle install --deployment --without development test -j 4 && \
|
bundle install --deployment --without development test -j 4 && \
|
||||||
apt-get purge -y --auto-remove $buildDeps && \
|
apt-get purge -y --auto-remove $buildDeps && \
|
||||||
|
|
@ -29,6 +32,8 @@ RUN buildDeps='libmagic-dev' && \
|
||||||
\
|
\
|
||||||
bundle exec whenever >crontab
|
bundle exec whenever >crontab
|
||||||
|
|
||||||
|
COPY . ./
|
||||||
|
|
||||||
# compile assets with temporary mysql server
|
# compile assets with temporary mysql server
|
||||||
RUN export DATABASE_URL=mysql2://localhost/temp?encoding=utf8 && \
|
RUN export DATABASE_URL=mysql2://localhost/temp?encoding=utf8 && \
|
||||||
export SECRET_KEY_BASE=thisisnotimportantnow && \
|
export SECRET_KEY_BASE=thisisnotimportantnow && \
|
||||||
|
|
|
||||||
5
Gemfile
5
Gemfile
|
|
@ -7,7 +7,6 @@ gem 'mail', '~> 2.7.1' # bug with mail 2.8.0 https://github.com/mikel/mail/issue
|
||||||
|
|
||||||
gem 'sassc-rails'
|
gem 'sassc-rails'
|
||||||
gem 'less-rails'
|
gem 'less-rails'
|
||||||
gem 'uglifier'
|
|
||||||
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
|
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
|
||||||
gem 'therubyracer', platforms: :ruby
|
gem 'therubyracer', platforms: :ruby
|
||||||
|
|
||||||
|
|
@ -127,3 +126,7 @@ group :test do
|
||||||
gem 'rswag-specs'
|
gem 'rswag-specs'
|
||||||
gem 'hashie', '~> 3.4.6', require: false # https://github.com/westfieldlabs/apivore/issues/114
|
gem 'hashie', '~> 3.4.6', require: false # https://github.com/westfieldlabs/apivore/issues/114
|
||||||
end
|
end
|
||||||
|
|
||||||
|
gem "importmap-rails", "~> 1.1"
|
||||||
|
|
||||||
|
gem "terser", "~> 1.1"
|
||||||
|
|
|
||||||
12
Gemfile.lock
12
Gemfile.lock
|
|
@ -264,6 +264,9 @@ GEM
|
||||||
i18n-spec (0.6.0)
|
i18n-spec (0.6.0)
|
||||||
iso
|
iso
|
||||||
ice_cube (0.16.4)
|
ice_cube (0.16.4)
|
||||||
|
importmap-rails (1.1.5)
|
||||||
|
actionpack (>= 6.0.0)
|
||||||
|
railties (>= 6.0.0)
|
||||||
inherited_resources (1.13.1)
|
inherited_resources (1.13.1)
|
||||||
actionpack (>= 5.2, < 7.1)
|
actionpack (>= 5.2, < 7.1)
|
||||||
has_scope (~> 0.6)
|
has_scope (~> 0.6)
|
||||||
|
|
@ -553,6 +556,8 @@ GEM
|
||||||
sqlite3 (>= 1.3.3)
|
sqlite3 (>= 1.3.3)
|
||||||
table_print (1.5.7)
|
table_print (1.5.7)
|
||||||
temple (0.9.1)
|
temple (0.9.1)
|
||||||
|
terser (1.1.13)
|
||||||
|
execjs (>= 0.3.0, < 3)
|
||||||
therubyracer (0.12.3)
|
therubyracer (0.12.3)
|
||||||
libv8 (~> 3.16.14.15)
|
libv8 (~> 3.16.14.15)
|
||||||
ref
|
ref
|
||||||
|
|
@ -573,8 +578,6 @@ GEM
|
||||||
unf (~> 0.1.0)
|
unf (~> 0.1.0)
|
||||||
tzinfo (2.0.5)
|
tzinfo (2.0.5)
|
||||||
concurrent-ruby (~> 1.0)
|
concurrent-ruby (~> 1.0)
|
||||||
uglifier (4.2.0)
|
|
||||||
execjs (>= 0.3.0, < 3)
|
|
||||||
unf (0.1.4)
|
unf (0.1.4)
|
||||||
unf_ext
|
unf_ext
|
||||||
unf_ext (0.0.8.2)
|
unf_ext (0.0.8.2)
|
||||||
|
|
@ -638,6 +641,7 @@ DEPENDENCIES
|
||||||
i18n-js (~> 3.0.0.rc8)
|
i18n-js (~> 3.0.0.rc8)
|
||||||
i18n-spec
|
i18n-spec
|
||||||
ice_cube
|
ice_cube
|
||||||
|
importmap-rails (~> 1.1)
|
||||||
inherited_resources
|
inherited_resources
|
||||||
jquery-rails
|
jquery-rails
|
||||||
kaminari
|
kaminari
|
||||||
|
|
@ -689,11 +693,11 @@ DEPENDENCIES
|
||||||
sprockets (< 4)
|
sprockets (< 4)
|
||||||
sqlite3 (~> 1.3.6)
|
sqlite3 (~> 1.3.6)
|
||||||
table_print
|
table_print
|
||||||
|
terser (~> 1.1)
|
||||||
therubyracer
|
therubyracer
|
||||||
twitter-bootstrap-rails (~> 2.2.8)
|
twitter-bootstrap-rails (~> 2.2.8)
|
||||||
uglifier
|
|
||||||
web-console
|
web-console
|
||||||
whenever
|
whenever
|
||||||
|
|
||||||
BUNDLED WITH
|
BUNDLED WITH
|
||||||
2.4.2
|
2.4.5
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ class Finance::FinancialTransactionsController < ApplicationController
|
||||||
sort = "created_on DESC"
|
sort = "created_on DESC"
|
||||||
end
|
end
|
||||||
|
|
||||||
@q = FinancialTransaction.search(params[:q])
|
@q = FinancialTransaction.ransack(params[:q])
|
||||||
@financial_transactions_all = @q.result(distinct: true).includes(:user).order(sort)
|
@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.visible unless params[:show_hidden]
|
||||||
@financial_transactions_all = @financial_transactions_all.where(ordergroup_id: @ordergroup.id) if @ordergroup
|
@financial_transactions_all = @financial_transactions_all.where(ordergroup_id: @ordergroup.id) if @ordergroup
|
||||||
|
|
|
||||||
1
app/javascript/application.js
Normal file
1
app/javascript/application.js
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
// Configure your import map in config/importmap.rb. Read more: https://github.com/rails/importmap-rails
|
||||||
|
|
@ -32,8 +32,8 @@ class GroupOrder < ApplicationRecord
|
||||||
# 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
|
||||||
data = {}
|
data = {}
|
||||||
data[:account_balance] = ordergroup.nil? ? BigDecimal.new('+Infinity') : ordergroup.account_balance
|
data[:account_balance] = ordergroup.nil? ? BigDecimal('+Infinity') : ordergroup.account_balance
|
||||||
data[:available_funds] = ordergroup.nil? ? BigDecimal.new('+Infinity') : ordergroup.get_available_funds(self)
|
data[:available_funds] = ordergroup.nil? ? BigDecimal('+Infinity') : ordergroup.get_available_funds(self)
|
||||||
|
|
||||||
# load prices and other stuff....
|
# load prices and other stuff....
|
||||||
data[:order_articles] = {}
|
data[:order_articles] = {}
|
||||||
|
|
|
||||||
|
|
@ -8,10 +8,10 @@
|
||||||
= csrf_meta_tags
|
= csrf_meta_tags
|
||||||
= stylesheet_link_tag "application", :media => "all"
|
= stylesheet_link_tag "application", :media => "all"
|
||||||
//%link(href="images/favicon.ico" rel="shortcut icon")
|
//%link(href="images/favicon.ico" rel="shortcut icon")
|
||||||
|
|
||||||
= yield(:head)
|
= yield(:head)
|
||||||
= foodcoop_css_tag
|
= foodcoop_css_tag
|
||||||
|
|
||||||
|
|
||||||
%body
|
%body
|
||||||
= yield
|
= yield
|
||||||
|
|
||||||
|
|
@ -19,7 +19,9 @@
|
||||||
Javascripts
|
Javascripts
|
||||||
\==================================================
|
\==================================================
|
||||||
/ Placed at the end of the document so the pages load faster
|
/ Placed at the end of the document so the pages load faster
|
||||||
= javascript_include_tag "application"
|
= javascript_importmap_tags
|
||||||
|
= javascript_include_tag "application_legacy"
|
||||||
|
|
||||||
:javascript
|
:javascript
|
||||||
I18n.defaultLocale = "#{I18n.default_locale}";
|
I18n.defaultLocale = "#{I18n.default_locale}";
|
||||||
I18n.locale = "#{I18n.locale}";
|
I18n.locale = "#{I18n.locale}";
|
||||||
|
|
|
||||||
4
bin/importmap
Executable file
4
bin/importmap
Executable file
|
|
@ -0,0 +1,4 @@
|
||||||
|
#!/usr/bin/env ruby
|
||||||
|
|
||||||
|
require_relative "../config/application"
|
||||||
|
require "importmap/commands"
|
||||||
|
|
@ -29,7 +29,7 @@ Rails.application.configure do
|
||||||
config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
|
config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
|
||||||
|
|
||||||
# Compress JavaScripts and CSS.
|
# Compress JavaScripts and CSS.
|
||||||
config.assets.js_compressor = :uglifier
|
config.assets.js_compressor = :terser
|
||||||
config.assets.css_compressor = :sass
|
config.assets.css_compressor = :sass
|
||||||
|
|
||||||
# Do not fallback to assets pipeline if a precompiled asset is missed.
|
# Do not fallback to assets pipeline if a precompiled asset is missed.
|
||||||
|
|
|
||||||
2
config/importmap.rb
Normal file
2
config/importmap.rb
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
# Pin npm packages by running ./bin/importmap
|
||||||
|
pin "application", preload: true
|
||||||
|
|
@ -9,4 +9,4 @@ Rails.application.config.assets.version = '1.0'
|
||||||
# Precompile additional assets.
|
# Precompile additional assets.
|
||||||
# application.js, application.css, and all non-JS/CSS in the app/assets
|
# application.js, application.css, and all non-JS/CSS in the app/assets
|
||||||
# folder are already added.
|
# folder are already added.
|
||||||
# Rails.application.config.assets.precompile += %w( admin.js admin.css )
|
Rails.application.config.assets.precompile += %w( application_legacy.js jquery.min.js )
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ class String
|
||||||
# remove comma from decimal inputs
|
# remove comma from decimal inputs
|
||||||
def self.delocalized_decimal(string)
|
def self.delocalized_decimal(string)
|
||||||
if !string.blank? and string.is_a?(String)
|
if !string.blank? and string.is_a?(String)
|
||||||
BigDecimal.new(string.sub(',', '.'))
|
BigDecimal(string.sub(',', '.'))
|
||||||
else
|
else
|
||||||
string
|
string
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ services:
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: Dockerfile-dev
|
dockerfile: Dockerfile-dev
|
||||||
platform: linux/x86_64
|
platform: linux/x86_64
|
||||||
command: ./proc-start worker
|
command: ./proc-start worker
|
||||||
volumes:
|
volumes:
|
||||||
- bundle:/usr/local/bundle
|
- bundle:/usr/local/bundle
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ class CurrentOrders::ArticlesController < ApplicationController
|
||||||
else
|
else
|
||||||
@order_articles = OrderArticle.where(order_id: @current_orders.all.map(&:id))
|
@order_articles = OrderArticle.where(order_id: @current_orders.all.map(&:id))
|
||||||
end
|
end
|
||||||
@q = OrderArticle.search(params[:q])
|
@q = OrderArticle.ransack(params[:q])
|
||||||
@order_articles = @order_articles.ordered.merge(@q.result).includes(:article, :article_price)
|
@order_articles = @order_articles.ordered.merge(@q.result).includes(:article, :article_price)
|
||||||
@order_article = @order_articles.where(id: params[:id]).first
|
@order_article = @order_articles.where(id: params[:id]).first
|
||||||
end
|
end
|
||||||
|
|
|
||||||
0
vendor/javascript/.keep
vendored
Normal file
0
vendor/javascript/.keep
vendored
Normal file
Loading…
Add table
Add a link
Reference in a new issue