Compare commits

...

6 Commits

Author SHA1 Message Date
Petko Bordjukov 6992ed5271 Dockerise clarion 2024-04-13 22:17:15 +03:00
Petko Bordjukov 4c96ba1e9c Migrate from Refile and Carrierwave to ActiveStorage 2024-04-13 22:17:15 +03:00
Petko Bordjukov 281b69e66d Rails 7.1.3 Upgrade 2024-04-13 22:17:15 +03:00
Petko Bordjukov fdd75603f7 Rails 7.0.8 Upgrade 2024-04-13 22:17:15 +03:00
Petko Bordjukov 2ab307bede Rails 6.1.7.6 Upgrade 2024-04-13 22:17:15 +03:00
Petko Bordjukov 5628650e5b Rails 6.0.6.1 upgrade 2024-04-13 22:17:15 +03:00
62 changed files with 1383 additions and 586 deletions

4
.docker-ignore Normal file
View File

@ -0,0 +1,4 @@
.git
*.tar.gz
*.sql
node_modules

37
.dockerignore Normal file
View File

@ -0,0 +1,37 @@
# See https://docs.docker.com/engine/reference/builder/#dockerignore-file for more about ignoring files.
# Ignore git directory.
/.git/
# Ignore bundler config.
/.bundle
# Ignore all environment files (except templates).
/.env*
!/.env*.erb
# Ignore all default key files.
/config/master.key
/config/credentials/*.key
# Ignore all logfiles and tempfiles.
/log/*
/tmp/*
!/log/.keep
!/tmp/.keep
# Ignore pidfiles, but keep the directory.
/tmp/pids/*
!/tmp/pids/.keep
# Ignore storage (uploaded files in development and any SQLite databases).
/storage/*
!/storage/.keep
/tmp/storage/*
!/tmp/storage/.keep
# Ignore assets.
/node_modules/
/app/assets/builds/*
!/app/assets/builds/.keep
/public/assets

1
.gitignore vendored
View File

@ -23,3 +23,4 @@
.sass-cache/ .sass-cache/
/coverage/ /coverage/
/db/structure.sql /db/structure.sql
/storage/

View File

@ -1 +1 @@
2.6.3 3.3.0

62
Dockerfile Normal file
View File

@ -0,0 +1,62 @@
# syntax = docker/dockerfile:1
# Make sure RUBY_VERSION matches the Ruby version in .ruby-version and Gemfile
ARG RUBY_VERSION=3.3.0
FROM registry.docker.com/library/ruby:$RUBY_VERSION-slim as base
# Rails app lives here
WORKDIR /rails
# Set production environment
ENV RAILS_ENV="production" \
BUNDLE_DEPLOYMENT="1" \
BUNDLE_PATH="/usr/local/bundle" \
BUNDLE_WITHOUT="development"
# Throw-away build stage to reduce size of final image
FROM base as build
# Install packages needed to build gems
RUN apt-get update -qq && \
apt-get install --no-install-recommends -y build-essential git libvips pkg-config libpq-dev libsqlite3-dev nodejs yarn
# Install application gems
COPY Gemfile Gemfile.lock ./
RUN bundle install && \
rm -rf ~/.bundle/ "${BUNDLE_PATH}"/ruby/*/cache "${BUNDLE_PATH}"/ruby/*/bundler/gems/*/.git && \
bundle exec bootsnap precompile --gemfile
# Copy application code
COPY . .
# Precompile bootsnap code for faster boot times
RUN bundle exec bootsnap precompile app/ lib/
# Precompiling assets for production without requiring secret RAILS_MASTER_KEY
RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile
# Final stage for app image
FROM base
# Install packages needed for deployment
RUN apt-get update -qq && \
apt-get install --no-install-recommends -y curl libsqlite3-0 nodejs libpq5 libvips && \
rm -rf /var/lib/apt/lists /var/cache/apt/archives
# Copy built artifacts: gems, application
COPY --from=build /usr/local/bundle /usr/local/bundle
COPY --from=build /rails /rails
# Run and own only the runtime files as a non-root user for security
RUN useradd rails --create-home --shell /bin/bash && \
chown -R rails:rails db log storage tmp
USER rails:rails
# Entrypoint prepares the database.
ENTRYPOINT ["/rails/bin/docker-entrypoint"]
# Start the server by default, this can be overwritten at runtime
EXPOSE 3000
CMD ["./bin/rails", "server"]

24
Gemfile
View File

@ -1,8 +1,8 @@
source "https://rubygems.org" source "https://rubygems.org"
gem "rails", "~> 5.2.7" gem "rails", "~> 7.1.0"
gem "bootsnap" gem "bootsnap"
gem "sprockets", "< 4" gem "sprockets"
gem "sqlite3" gem "sqlite3"
gem "pg" gem "pg"
@ -11,7 +11,6 @@ gem "sass-rails"
gem "uglifier" gem "uglifier"
gem "coffee-rails" gem "coffee-rails"
gem "mini_racer", platforms: :ruby
gem "jquery-rails" gem "jquery-rails"
gem "slim-rails" gem "slim-rails"
@ -24,18 +23,9 @@ gem "devise-i18n"
gem "simple_form" gem "simple_form"
# Phone validation # Phone validation
gem "phony", "~> 2.15.11" gem "phony"
gem "phony_rails" gem "phony_rails"
# Picture uploads
gem "carrierwave"
# gem 'rmagick'
gem "mini_magick"
gem "refile", git: "https://github.com/refile/refile", require: ["refile/rails", "refile/simple_form"]
gem "refile-mini_magick"
gem "image_processing"
gem "puma", group: :production gem "puma", group: :production
gem "globalize" gem "globalize"
@ -50,7 +40,7 @@ gem "font-awesome-sass", "~> 4.6.2"
gem "nested_form" gem "nested_form"
gem "jquery-datatables-rails" gem "jquery-datatables-rails"
gem "morrisjs-rails" # gem "morrisjs-rails"
gem "raphael-rails" gem "raphael-rails"
gem "copy_carrierwave_file" gem "copy_carrierwave_file"
@ -75,17 +65,12 @@ group :development do
gem "pry-rails" gem "pry-rails"
# gem 'hirb' # gem 'hirb'
gem "awesome_print" gem "awesome_print"
gem "capistrano"
gem "capistrano-rails"
gem 'capistrano-rvm'
gem "capistrano3-puma"
gem "better_errors" gem "better_errors"
gem "binding_of_caller" gem "binding_of_caller"
end end
group :development, :test do group :development, :test do
gem "rspec-rails" gem "rspec-rails"
gem "factory_bot_rails"
gem "faker" gem "faker"
gem "capybara" gem "capybara"
gem "selenium-webdriver" gem "selenium-webdriver"
@ -101,4 +86,5 @@ end
group :test do group :test do
gem "database_cleaner" gem "database_cleaner"
gem "factory_bot_rails"
end end

View File

@ -1,120 +1,133 @@
GIT
remote: https://github.com/refile/refile
revision: c4ac577c6fdad92bc079a62a0e82888319daedc8
specs:
refile (0.7.0)
mime-types
sinatra (>= 2.0.0, <= 3.0.0)
GEM GEM
remote: https://rubygems.org/ remote: https://rubygems.org/
specs: specs:
actioncable (5.2.7) actioncable (7.1.3)
actionpack (= 5.2.7) actionpack (= 7.1.3)
activesupport (= 7.1.3)
nio4r (~> 2.0) nio4r (~> 2.0)
websocket-driver (>= 0.6.1) websocket-driver (>= 0.6.1)
actionmailer (5.2.7) zeitwerk (~> 2.6)
actionpack (= 5.2.7) actionmailbox (7.1.3)
actionview (= 5.2.7) actionpack (= 7.1.3)
activejob (= 5.2.7) activejob (= 7.1.3)
activerecord (= 7.1.3)
activestorage (= 7.1.3)
activesupport (= 7.1.3)
mail (>= 2.7.1)
net-imap
net-pop
net-smtp
actionmailer (7.1.3)
actionpack (= 7.1.3)
actionview (= 7.1.3)
activejob (= 7.1.3)
activesupport (= 7.1.3)
mail (~> 2.5, >= 2.5.4) mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 2.0) net-imap
actionpack (5.2.7) net-pop
actionview (= 5.2.7) net-smtp
activesupport (= 5.2.7) rails-dom-testing (~> 2.2)
rack (~> 2.0, >= 2.0.8) actionpack (7.1.3)
actionview (= 7.1.3)
activesupport (= 7.1.3)
nokogiri (>= 1.8.5)
racc
rack (>= 2.2.4)
rack-session (>= 1.0.1)
rack-test (>= 0.6.3) rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0) rails-dom-testing (~> 2.2)
rails-html-sanitizer (~> 1.0, >= 1.0.2) rails-html-sanitizer (~> 1.6)
actionview (5.2.7) actiontext (7.1.3)
activesupport (= 5.2.7) actionpack (= 7.1.3)
activerecord (= 7.1.3)
activestorage (= 7.1.3)
activesupport (= 7.1.3)
globalid (>= 0.6.0)
nokogiri (>= 1.8.5)
actionview (7.1.3)
activesupport (= 7.1.3)
builder (~> 3.1) builder (~> 3.1)
erubi (~> 1.4) erubi (~> 1.11)
rails-dom-testing (~> 2.0) rails-dom-testing (~> 2.2)
rails-html-sanitizer (~> 1.0, >= 1.0.3) rails-html-sanitizer (~> 1.6)
activejob (5.2.7) activejob (7.1.3)
activesupport (= 5.2.7) activesupport (= 7.1.3)
globalid (>= 0.3.6) globalid (>= 0.3.6)
activemodel (5.2.7) activemodel (7.1.3)
activesupport (= 5.2.7) activesupport (= 7.1.3)
activemodel-serializers-xml (1.0.2) activemodel-serializers-xml (1.0.2)
activemodel (> 5.x) activemodel (> 5.x)
activesupport (> 5.x) activesupport (> 5.x)
builder (~> 3.1) builder (~> 3.1)
activerecord (5.2.7) activerecord (7.1.3)
activemodel (= 5.2.7) activemodel (= 7.1.3)
activesupport (= 5.2.7) activesupport (= 7.1.3)
arel (>= 9.0) timeout (>= 0.4.0)
activestorage (5.2.7) activestorage (7.1.3)
actionpack (= 5.2.7) actionpack (= 7.1.3)
activerecord (= 5.2.7) activejob (= 7.1.3)
marcel (~> 1.0.0) activerecord (= 7.1.3)
activesupport (5.2.7) activesupport (= 7.1.3)
marcel (~> 1.0)
activesupport (7.1.3)
base64
bigdecimal
concurrent-ruby (~> 1.0, >= 1.0.2) concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2) connection_pool (>= 2.2.5)
minitest (~> 5.1) drb
tzinfo (~> 1.1) i18n (>= 1.6, < 2)
addressable (2.8.0) minitest (>= 5.1)
public_suffix (>= 2.0.2, < 5.0) mutex_m
airbrussh (1.3.4) tzinfo (~> 2.0)
sshkit (>= 1.6.1, != 1.7.0) addressable (2.8.6)
arel (9.0.0) public_suffix (>= 2.0.2, < 6.0)
ast (2.4.2) ast (2.4.2)
autoprefixer-rails (9.6.1.1) autoprefixer-rails (10.4.16.0)
execjs execjs (~> 2)
awesome_print (1.8.0) awesome_print (1.9.2)
bcrypt (3.1.13) base64 (0.2.0)
better_errors (2.9.1) bcrypt (3.1.20)
coderay (>= 1.0.0) better_errors (2.10.1)
erubi (>= 1.0.0) erubi (>= 1.0.0)
rack (>= 0.9.0) rack (>= 0.9.0)
binding_of_caller (0.8.0) rouge (>= 1.0.0)
better_html (2.0.2)
actionview (>= 6.0)
activesupport (>= 6.0)
ast (~> 2.0)
erubi (~> 1.4)
parser (>= 2.4)
smart_properties
bigdecimal (3.1.6)
binding_of_caller (1.0.0)
debug_inspector (>= 0.0.1) debug_inspector (>= 0.0.1)
bootsnap (1.4.5) bootsnap (1.18.3)
msgpack (~> 1.0) msgpack (~> 1.2)
bootstrap-sass (3.4.1) bootstrap-sass (3.4.1)
autoprefixer-rails (>= 5.2.1) autoprefixer-rails (>= 5.2.1)
sassc (>= 2.0.0) sassc (>= 2.0.0)
bootstrap-sass-extras (0.0.7) bootstrap-sass-extras (0.1.0)
rails (>= 3.1.0) rails (>= 3.1.0)
bootswatch-rails (3.3.5) bootswatch-rails (3.3.5)
railties (>= 3.1) railties (>= 3.1)
builder (3.2.4) builder (3.2.4)
byebug (11.0.1) byebug (11.1.3)
capistrano (3.11.2) capybara (3.40.0)
airbrussh (>= 1.0.0)
i18n
rake (>= 10.0.0)
sshkit (>= 1.9.0)
capistrano-bundler (1.6.0)
capistrano (~> 3.1)
capistrano-rails (1.4.0)
capistrano (~> 3.1)
capistrano-bundler (~> 1.1)
capistrano-rvm (0.1.2)
capistrano (~> 3.0)
sshkit (~> 1.2)
capistrano3-puma (4.0.0)
capistrano (~> 3.7)
capistrano-bundler
puma (~> 4.0)
capybara (3.29.0)
addressable addressable
matrix
mini_mime (>= 0.1.3) mini_mime (>= 0.1.3)
nokogiri (~> 1.8) nokogiri (~> 1.11)
rack (>= 1.6.0) rack (>= 1.6.0)
rack-test (>= 0.6.3) rack-test (>= 0.6.3)
regexp_parser (~> 1.5) regexp_parser (>= 1.5, < 3.0)
xpath (~> 3.2) xpath (~> 3.2)
carrierwave (2.2.2) carrierwave (3.0.5)
activemodel (>= 5.0.0) activemodel (>= 6.0.0)
activesupport (>= 5.0.0) activesupport (>= 6.0.0)
addressable (~> 2.6) addressable (~> 2.6)
image_processing (~> 1.1) image_processing (~> 1.1)
marcel (~> 1.0.0) marcel (~> 1.0.0)
mini_mime (>= 0.1.3)
ssrf_filter (~> 1.0) ssrf_filter (~> 1.0)
childprocess (3.0.0)
choice (0.2.0) choice (0.2.0)
chronic (0.10.2) chronic (0.10.2)
chunky_png (1.4.0) chunky_png (1.4.0)
@ -126,58 +139,70 @@ GEM
coffee-script-source coffee-script-source
execjs execjs
coffee-script-source (1.12.2) coffee-script-source (1.12.2)
concurrent-ruby (1.1.10) concurrent-ruby (1.2.3)
connection_pool (2.4.1)
copy_carrierwave_file (1.3.0) copy_carrierwave_file (1.3.0)
carrierwave (>= 0.9) carrierwave (>= 0.9)
crass (1.0.6) crass (1.0.6)
database_cleaner (1.7.0) database_cleaner (2.0.2)
debug_inspector (0.0.3) database_cleaner-active_record (>= 2, < 3)
database_cleaner-active_record (2.1.0)
activerecord (>= 5.a)
database_cleaner-core (~> 2.0.0)
database_cleaner-core (2.0.1)
date (3.3.4)
debug_inspector (1.2.0)
delorean (2.1.0) delorean (2.1.0)
chronic chronic
devise (4.7.1) devise (4.9.3)
bcrypt (~> 3.0) bcrypt (~> 3.0)
orm_adapter (~> 0.1) orm_adapter (~> 0.1)
railties (>= 4.1.0) railties (>= 4.1.0)
responders responders
warden (~> 1.2.3) warden (~> 1.2.3)
devise-i18n (1.8.2) devise-i18n (1.12.0)
devise (>= 4.6) devise (>= 4.9.0)
diff-lcs (1.3) diff-lcs (1.5.1)
docile (1.3.2) docile (1.4.0)
draper (3.1.0) draper (4.0.2)
actionpack (>= 5.0) actionpack (>= 5.0)
activemodel (>= 5.0) activemodel (>= 5.0)
activemodel-serializers-xml (>= 1.0) activemodel-serializers-xml (>= 1.0)
activesupport (>= 5.0) activesupport (>= 5.0)
request_store (>= 1.0) request_store (>= 1.0)
erubi (1.10.0) ruby2_keywords
execjs (2.7.0) drb (2.2.0)
factory_bot (5.1.1) ruby2_keywords
activesupport (>= 4.2.0) erubi (1.12.0)
factory_bot_rails (5.1.1) execjs (2.9.1)
factory_bot (~> 5.1.0) factory_bot (6.4.6)
railties (>= 4.2.0) activesupport (>= 5.0.0)
faker (2.5.0) factory_bot_rails (6.4.3)
i18n (~> 1.6.0) factory_bot (~> 6.4)
faraday (0.16.2) railties (>= 5.0.0)
multipart-post (>= 1.2, < 3) faker (3.2.3)
ffi (1.15.5) i18n (>= 1.8.11, < 2)
faraday (2.9.0)
faraday-net_http (>= 2.0, < 3.2)
faraday-net_http (3.1.0)
net-http
ffi (1.16.3)
font-awesome-sass (4.6.2) font-awesome-sass (4.6.2)
sass (>= 3.2) sass (>= 3.2)
formatador (0.2.5) formatador (1.1.0)
globalid (1.0.0) globalid (1.2.1)
activesupport (>= 5.0) activesupport (>= 6.1)
globalize (5.3.0) globalize (6.3.0)
activemodel (>= 4.2, < 6.1) activemodel (>= 4.2, < 7.2)
activerecord (>= 4.2, < 6.1) activerecord (>= 4.2, < 7.2)
request_store (~> 1.0) request_store (~> 1.0)
guard (2.15.1) guard (2.18.1)
formatador (>= 0.2.4) formatador (>= 0.2.4)
listen (>= 2.7, < 4.0) listen (>= 2.7, < 4.0)
lumberjack (>= 1.0.12, < 2.0) lumberjack (>= 1.0.12, < 2.0)
nenv (~> 0.1) nenv (~> 0.1)
notiffany (~> 0.0) notiffany (~> 0.0)
pry (>= 0.9.12) pry (>= 0.13.0)
shellany (~> 0.0) shellany (~> 0.0)
thor (>= 0.18.1) thor (>= 0.18.1)
guard-compat (1.2.1) guard-compat (1.2.1)
@ -185,185 +210,218 @@ GEM
guard (~> 2.1) guard (~> 2.1)
guard-compat (~> 1.1) guard-compat (~> 1.1)
rspec (>= 2.99.0, < 4.0) rspec (>= 2.99.0, < 4.0)
highline (2.0.3) highline (3.0.1)
i18n (1.6.0) i18n (1.14.1)
concurrent-ruby (~> 1.0) concurrent-ruby (~> 1.0)
i18n-tasks (0.9.37) i18n-tasks (1.0.13)
activesupport (>= 4.0.2) activesupport (>= 4.0.2)
ast (>= 2.1.0) ast (>= 2.1.0)
better_html (>= 1.0, < 3.0)
erubi erubi
highline (>= 2.0.0) highline (>= 2.0.0)
i18n i18n
parser (>= 2.2.3.0) parser (>= 3.2.2.1)
rails-i18n rails-i18n
rainbow (>= 2.2.2, < 4.0) rainbow (>= 2.2.2, < 4.0)
terminal-table (>= 1.5.1) terminal-table (>= 1.5.1)
icalendar (2.5.3) icalendar (2.10.1)
ice_cube (~> 0.16) ice_cube (~> 0.16)
ice_cube (0.16.3) ice_cube (0.16.4)
image_processing (1.12.2) image_processing (1.12.2)
mini_magick (>= 4.9.5, < 5) mini_magick (>= 4.9.5, < 5)
ruby-vips (>= 2.0.17, < 3) ruby-vips (>= 2.0.17, < 3)
jaro_winkler (1.5.3) io-console (0.7.2)
jbuilder (2.9.1) irb (1.11.2)
activesupport (>= 4.2.0) rdoc
reline (>= 0.4.2)
jbuilder (2.11.5)
actionview (>= 5.0.0)
activesupport (>= 5.0.0)
jquery-datatables-rails (3.4.0) jquery-datatables-rails (3.4.0)
actionpack (>= 3.1) actionpack (>= 3.1)
jquery-rails jquery-rails
railties (>= 3.1) railties (>= 3.1)
sass-rails sass-rails
jquery-rails (4.3.5) jquery-rails (4.6.0)
rails-dom-testing (>= 1, < 3) rails-dom-testing (>= 1, < 3)
railties (>= 4.2.0) railties (>= 4.2.0)
thor (>= 0.14, < 2.0) thor (>= 0.14, < 2.0)
json (2.2.0) json (2.7.1)
libv8 (7.3.492.27.1) language_server-protocol (3.17.0.3)
listen (3.7.1) lint_roller (1.1.0)
listen (3.8.0)
rb-fsevent (~> 0.10, >= 0.10.3) rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10) rb-inotify (~> 0.9, >= 0.9.10)
loofah (2.15.0) loofah (2.22.0)
crass (~> 1.0.2) crass (~> 1.0.2)
nokogiri (>= 1.5.9) nokogiri (>= 1.12.0)
lumberjack (1.0.13) lumberjack (1.2.10)
mail (2.7.1) mail (2.8.1)
mini_mime (>= 0.1.1) mini_mime (>= 0.1.1)
net-imap
net-pop
net-smtp
marcel (1.0.2) marcel (1.0.2)
method_source (0.9.2) matrix (0.4.2)
mime-types (3.3) method_source (1.0.0)
mime-types-data (~> 3.2015) mini_magick (4.12.0)
mime-types-data (3.2019.0904) mini_mime (1.1.5)
mini_magick (4.11.0) mini_portile2 (2.8.5)
mini_mime (1.1.2) minitest (5.22.2)
mini_portile2 (2.8.0) msgpack (1.7.2)
mini_racer (0.2.6) mutex_m (0.2.0)
libv8 (>= 6.9.411)
minitest (5.15.0)
morrisjs-rails (0.5.1.2)
railties (> 3.1, < 6)
msgpack (1.3.1)
multipart-post (2.1.1)
mustermann (1.0.3)
nenv (0.3.0) nenv (0.3.0)
nested_form (0.3.2) nested_form (0.3.2)
net-scp (2.0.0) net-http (0.4.1)
net-ssh (>= 2.6.5, < 6.0.0) uri
net-ssh (5.2.0) net-imap (0.4.10)
nio4r (2.5.8) date
nokogiri (1.13.3) net-protocol
mini_portile2 (~> 2.8.0) net-pop (0.1.2)
net-protocol
net-protocol (0.2.2)
timeout
net-smtp (0.4.0.1)
net-protocol
nio4r (2.7.0)
nokogiri (1.16.2)
mini_portile2 (~> 2.8.2)
racc (~> 1.4) racc (~> 1.4)
notiffany (0.1.3) notiffany (0.1.3)
nenv (~> 0.1) nenv (~> 0.1)
shellany (~> 0.0) shellany (~> 0.0)
orm_adapter (0.5.0) orm_adapter (0.5.0)
parallel (1.17.0) parallel (1.24.0)
parser (3.1.1.0) parser (3.3.0.5)
ast (~> 2.4.1) ast (~> 2.4.1)
pg (1.1.4) racc
phony (2.15.49) pg (1.5.5)
phony_rails (0.14.13) phony (2.20.12)
phony_rails (0.15.0)
activesupport (>= 3.0) activesupport (>= 3.0)
phony (> 2.15) phony (>= 2.18.12)
pry (0.12.2) pry (0.14.2)
coderay (~> 1.1.0) coderay (~> 1.1)
method_source (~> 0.9.0) method_source (~> 1.0)
pry-rails (0.3.9) pry-rails (0.3.9)
pry (>= 0.10.4) pry (>= 0.10.4)
public_suffix (4.0.6) psych (5.1.2)
puma (4.3.11) stringio
public_suffix (5.0.4)
puma (6.4.2)
nio4r (~> 2.0) nio4r (~> 2.0)
racc (1.6.0) racc (1.7.3)
rack (2.2.3) rack (3.0.9)
rack-protection (2.0.7) rack-session (2.0.0)
rack rack (>= 3.0.0)
rack-test (1.1.0) rack-test (2.1.0)
rack (>= 1.0, < 3) rack (>= 1.3)
rails (5.2.7) rackup (2.1.0)
actioncable (= 5.2.7) rack (>= 3)
actionmailer (= 5.2.7) webrick (~> 1.8)
actionpack (= 5.2.7) rails (7.1.3)
actionview (= 5.2.7) actioncable (= 7.1.3)
activejob (= 5.2.7) actionmailbox (= 7.1.3)
activemodel (= 5.2.7) actionmailer (= 7.1.3)
activerecord (= 5.2.7) actionpack (= 7.1.3)
activestorage (= 5.2.7) actiontext (= 7.1.3)
activesupport (= 5.2.7) actionview (= 7.1.3)
bundler (>= 1.3.0) activejob (= 7.1.3)
railties (= 5.2.7) activemodel (= 7.1.3)
sprockets-rails (>= 2.0.0) activerecord (= 7.1.3)
rails-dom-testing (2.0.3) activestorage (= 7.1.3)
activesupport (>= 4.2.0) activesupport (= 7.1.3)
bundler (>= 1.15.0)
railties (= 7.1.3)
rails-dom-testing (2.2.0)
activesupport (>= 5.0.0)
minitest
nokogiri (>= 1.6) nokogiri (>= 1.6)
rails-erd (1.6.0) rails-erd (1.7.2)
activerecord (>= 4.2) activerecord (>= 4.2)
activesupport (>= 4.2) activesupport (>= 4.2)
choice (~> 0.2.0) choice (~> 0.2.0)
ruby-graphviz (~> 1.2) ruby-graphviz (~> 1.2)
rails-html-sanitizer (1.4.2) rails-html-sanitizer (1.6.0)
loofah (~> 2.3) loofah (~> 2.21)
rails-i18n (5.1.3) nokogiri (~> 1.14)
rails-i18n (7.0.8)
i18n (>= 0.7, < 2) i18n (>= 0.7, < 2)
railties (>= 5.0, < 6) railties (>= 6.0.0, < 8)
railties (5.2.7) railties (7.1.3)
actionpack (= 5.2.7) actionpack (= 7.1.3)
activesupport (= 5.2.7) activesupport (= 7.1.3)
method_source irb
rake (>= 0.8.7) rackup (>= 1.0.0)
thor (>= 0.19.0, < 2.0) rake (>= 12.2)
thor (~> 1.0, >= 1.2.2)
zeitwerk (~> 2.6)
rainbow (3.1.1) rainbow (3.1.1)
rake (13.0.6) rake (13.1.0)
raphael-rails (2.1.2) raphael-rails (2.1.2)
rb-fsevent (0.11.1) rb-fsevent (0.11.2)
rb-inotify (0.10.1) rb-inotify (0.10.1)
ffi (~> 1.0) ffi (~> 1.0)
refile-mini_magick (0.2.0) rdoc (6.6.2)
mini_magick (~> 4.0) psych (>= 4.0.0)
refile (~> 0.5) regexp_parser (2.9.0)
regexp_parser (1.6.0) reline (0.4.2)
request_store (1.4.1) io-console (~> 0.5)
request_store (1.6.0)
rack (>= 1.4) rack (>= 1.4)
responders (3.0.0) responders (3.1.1)
actionpack (>= 5.0) actionpack (>= 5.2)
railties (>= 5.0) railties (>= 5.2)
rqrcode (2.1.1) rexml (3.2.6)
rouge (4.2.0)
rqrcode (2.2.0)
chunky_png (~> 1.0) chunky_png (~> 1.0)
rqrcode_core (~> 1.0) rqrcode_core (~> 1.0)
rqrcode_core (1.2.0) rqrcode_core (1.2.0)
rspec (3.8.0) rspec (3.13.0)
rspec-core (~> 3.8.0) rspec-core (~> 3.13.0)
rspec-expectations (~> 3.8.0) rspec-expectations (~> 3.13.0)
rspec-mocks (~> 3.8.0) rspec-mocks (~> 3.13.0)
rspec-core (3.8.2) rspec-core (3.13.0)
rspec-support (~> 3.8.0) rspec-support (~> 3.13.0)
rspec-expectations (3.8.5) rspec-expectations (3.13.0)
diff-lcs (>= 1.2.0, < 2.0) diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.8.0) rspec-support (~> 3.13.0)
rspec-mocks (3.8.2) rspec-mocks (3.13.0)
diff-lcs (>= 1.2.0, < 2.0) diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.8.0) rspec-support (~> 3.13.0)
rspec-rails (3.8.2) rspec-rails (6.1.1)
actionpack (>= 3.0) actionpack (>= 6.1)
activesupport (>= 3.0) activesupport (>= 6.1)
railties (>= 3.0) railties (>= 6.1)
rspec-core (~> 3.8.0) rspec-core (~> 3.12)
rspec-expectations (~> 3.8.0) rspec-expectations (~> 3.12)
rspec-mocks (~> 3.8.0) rspec-mocks (~> 3.12)
rspec-support (~> 3.8.0) rspec-support (~> 3.12)
rspec-support (3.8.3) rspec-support (3.13.0)
rubocop (0.72.0) rubocop (1.60.2)
jaro_winkler (~> 1.5.1) json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10) parallel (~> 1.10)
parser (>= 2.6) parser (>= 3.3.0.2)
rainbow (>= 2.2.2, < 4.0) rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml (>= 3.2.5, < 4.0)
rubocop-ast (>= 1.30.0, < 2.0)
ruby-progressbar (~> 1.7) ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 1.7) unicode-display_width (>= 2.4.0, < 3.0)
rubocop-performance (1.4.1) rubocop-ast (1.30.0)
rubocop (>= 0.71.0) parser (>= 3.2.1.0)
ruby-graphviz (1.2.4) rubocop-performance (1.20.2)
ruby-progressbar (1.10.1) rubocop (>= 1.48.1, < 2.0)
ruby-vips (2.1.4) rubocop-ast (>= 1.30.0, < 2.0)
ruby-graphviz (1.2.5)
rexml
ruby-progressbar (1.13.0)
ruby-vips (2.2.0)
ffi (~> 1.12) ffi (~> 1.12)
rubyzip (2.0.0) ruby2_keywords (0.0.5)
rubyzip (2.3.2)
sass (3.7.4) sass (3.7.4)
sass-listen (~> 4.0.0) sass-listen (~> 4.0.0)
sass-listen (4.0.0) sass-listen (4.0.0)
@ -371,7 +429,7 @@ GEM
rb-inotify (~> 0.9, >= 0.9.7) rb-inotify (~> 0.9, >= 0.9.7)
sass-rails (6.0.0) sass-rails (6.0.0)
sassc-rails (~> 2.1, >= 2.1.1) sassc-rails (~> 2.1, >= 2.1.1)
sassc (2.2.1) sassc (2.4.0)
ffi (~> 1.9) ffi (~> 1.9)
sassc-rails (2.1.2) sassc-rails (2.1.2)
railties (>= 4.0.0) railties (>= 4.0.0)
@ -379,63 +437,73 @@ GEM
sprockets (> 3.0) sprockets (> 3.0)
sprockets-rails sprockets-rails
tilt tilt
search_object (1.2.2) search_object (1.2.5)
selenium-webdriver (3.142.6) selenium-webdriver (4.18.1)
childprocess (>= 0.5, < 4.0) base64 (~> 0.2)
rubyzip (>= 1.2.2) rexml (~> 3.2, >= 3.2.5)
rubyzip (>= 1.2.2, < 3.0)
websocket (~> 1.0)
shellany (0.0.1) shellany (0.0.1)
simple_form (5.0.0) simple_form (5.3.0)
actionpack (>= 5.0) actionpack (>= 5.2)
activemodel (>= 5.0) activemodel (>= 5.2)
simplecov (0.17.1) simplecov (0.22.0)
docile (~> 1.1) docile (~> 1.1)
json (>= 1.8, < 3) simplecov-html (~> 0.11)
simplecov-html (~> 0.10.0) simplecov_json_formatter (~> 0.1)
simplecov-html (0.10.2) simplecov-html (0.12.3)
sinatra (2.0.7) simplecov_json_formatter (0.1.4)
mustermann (~> 1.0) slim (5.2.1)
rack (~> 2.0) temple (~> 0.10.0)
rack-protection (= 2.0.7) tilt (>= 2.1.0)
tilt (~> 2.0) slim-rails (3.6.3)
slim (4.0.1)
temple (>= 0.7.6, < 0.9)
tilt (>= 2.0.6, < 2.1)
slim-rails (3.2.0)
actionpack (>= 3.1) actionpack (>= 3.1)
railties (>= 3.1) railties (>= 3.1)
slim (>= 3.0, < 5.0) slim (>= 3.0, < 6.0, != 5.0.0)
spring (2.1.0) smart_properties (1.17.0)
spring (4.1.3)
spring-commands-rspec (1.0.4) spring-commands-rspec (1.0.4)
spring (>= 0.9.1) spring (>= 0.9.1)
sprockets (3.7.2) sprockets (4.2.1)
concurrent-ruby (~> 1.0) concurrent-ruby (~> 1.0)
rack (> 1, < 3) rack (>= 2.2.4, < 4)
sprockets-rails (3.4.2) sprockets-rails (3.4.2)
actionpack (>= 5.2) actionpack (>= 5.2)
activesupport (>= 5.2) activesupport (>= 5.2)
sprockets (>= 3.0.0) sprockets (>= 3.0.0)
sqlite3 (1.4.1) sqlite3 (1.7.2)
sshkit (1.20.0) mini_portile2 (~> 2.8.0)
net-scp (>= 1.1.2) ssrf_filter (1.1.2)
net-ssh (>= 2.8.0) standard (1.34.0)
ssrf_filter (1.0.7) language_server-protocol (~> 3.17.0.2)
standard (0.1.4) lint_roller (~> 1.0)
rubocop (~> 0.72.0) rubocop (~> 1.60)
rubocop-performance (~> 1.4.0) standard-custom (~> 1.0.0)
temple (0.8.2) standard-performance (~> 1.3)
standard-custom (1.0.2)
lint_roller (~> 1.0)
rubocop (~> 1.50)
standard-performance (1.3.1)
lint_roller (~> 1.1)
rubocop-performance (~> 1.20.2)
stringio (3.1.0)
temple (0.10.3)
terminal-table (3.0.2) terminal-table (3.0.2)
unicode-display_width (>= 1.1.1, < 3) unicode-display_width (>= 1.1.1, < 3)
thor (1.2.1) thor (1.3.0)
thread_safe (0.3.6) tilt (2.3.0)
tilt (2.0.10) timeout (0.4.1)
tzinfo (1.2.9) tzinfo (2.0.6)
thread_safe (~> 0.1) concurrent-ruby (~> 1.0)
uglifier (4.2.0) uglifier (4.2.0)
execjs (>= 0.3.0, < 3) execjs (>= 0.3.0, < 3)
unicode-display_width (1.6.1) unicode-display_width (2.5.0)
warden (1.2.8) uri (0.13.0)
rack (>= 2.0.6) warden (1.2.9)
websocket-driver (0.7.5) rack (>= 2.0.9)
webrick (1.8.1)
websocket (1.2.10)
websocket-driver (0.7.6)
websocket-extensions (>= 0.1.0) websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.5) websocket-extensions (0.1.5)
xpath (3.2.0) xpath (3.2.0)
@ -443,6 +511,7 @@ GEM
yaml_db (0.7.0) yaml_db (0.7.0)
rails (>= 3.0) rails (>= 3.0)
rake (>= 0.8.7) rake (>= 0.8.7)
zeitwerk (2.6.13)
PLATFORMS PLATFORMS
ruby ruby
@ -457,12 +526,7 @@ DEPENDENCIES
bootstrap-sass-extras bootstrap-sass-extras
bootswatch-rails bootswatch-rails
byebug byebug
capistrano
capistrano-rails
capistrano-rvm
capistrano3-puma
capybara capybara
carrierwave
coffee-rails coffee-rails
copy_carrierwave_file copy_carrierwave_file
database_cleaner database_cleaner
@ -478,25 +542,19 @@ DEPENDENCIES
guard-rspec guard-rspec
i18n-tasks i18n-tasks
icalendar icalendar
image_processing
jbuilder jbuilder
jquery-datatables-rails jquery-datatables-rails
jquery-rails jquery-rails
mini_magick
mini_racer
morrisjs-rails
nested_form nested_form
pg pg
phony (~> 2.15.11) phony
phony_rails phony_rails
pry-rails pry-rails
puma puma
rails (~> 5.2.7) rails (~> 7.1.0)
rails-erd rails-erd
rails-i18n rails-i18n
raphael-rails raphael-rails
refile!
refile-mini_magick
rqrcode rqrcode
rspec-rails rspec-rails
sass-rails sass-rails
@ -507,11 +565,11 @@ DEPENDENCIES
slim-rails slim-rails
spring spring
spring-commands-rspec spring-commands-rspec
sprockets (< 4) sprockets
sqlite3 sqlite3
standard standard
uglifier uglifier
yaml_db yaml_db
BUNDLED WITH BUNDLED WITH
1.17.3 2.5.6

View File

@ -0,0 +1,6 @@
//= link_tree ../images
//= link_tree ../../../lib/initfest/assets/images
//= link_directory ../javascripts .js
//= link_directory ../stylesheets .css
//= link initfest/application.css
//= link initfest/application.js

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

@ -3,6 +3,5 @@
//= require jquery_nested_form //= require jquery_nested_form
//= require bootstrap-sprockets //= require bootstrap-sprockets
//= require raphael //= require raphael
//= require morris
//= require chroma-js/chroma //= require chroma-js/chroma
//= require_directory . //= require_directory .

View File

@ -6,7 +6,7 @@
@import "bootstrap"; @import "bootstrap";
@import "bootswatch/simplex/bootswatch"; @import "bootswatch/simplex/bootswatch";
@import "morris"; /* @import "morris"; */
@import "users"; @import "users";
@import "colors"; @import "colors";

View File

@ -53,7 +53,7 @@ module Management
@conference = find_conference @conference = find_conference
@profile = find_profile @profile = find_profile
if @profile.update_attributes(profile_params) if @profile.update(profile_params)
redirect_to [:management, @conference, @profile] redirect_to [:management, @conference, @profile]
else else
render action: "edit" render action: "edit"

View File

@ -20,7 +20,7 @@ module Public
def update def update
@profile = current_user.personal_profile(current_conference) @profile = current_user.personal_profile(current_conference)
if @profile.update_attributes(profile_params) if @profile.update(profile_params)
flash[:notice] = t("views.personal_profiles.successfully_updated") flash[:notice] = t("views.personal_profiles.successfully_updated")
redirect_to root_path redirect_to root_path
else else

View File

@ -13,7 +13,7 @@ class PersonalProfile < ActiveRecord::Base
phony_normalize :mobile_phone, default_country_code: "BG", add_plus: false phony_normalize :mobile_phone, default_country_code: "BG", add_plus: false
mount_uploader :picture, PictureUploader has_one_attached :picture
accepts_nested_attributes_for :user accepts_nested_attributes_for :user

View File

@ -38,7 +38,7 @@ class User < ActiveRecord::Base
def build_personal_profile(conference, params = {}) def build_personal_profile(conference, params = {})
if personal_profiles.last.present? if personal_profiles.last.present?
new_personal_profile = personal_profiles.last.try(:dup) new_personal_profile = personal_profiles.last.try(:dup)
CopyCarrierwaveFile::CopyFileService.new(personal_profiles.last, new_personal_profile, :picture).set_file new_personal_profile.picture.attach(personal_profiles.last.picture.blob)
else else
new_personal_profile = personal_profiles.build new_personal_profile = personal_profiles.build
end end

View File

@ -3,7 +3,7 @@ class Volunteer < ActiveRecord::Base
TSHIRT_CUTS = [:unisex, :female] TSHIRT_CUTS = [:unisex, :female]
FOOD_PREFERENCES = [:none, :vegetarian, :vegan] FOOD_PREFERENCES = [:none, :vegetarian, :vegan]
attachment :picture, type: :image has_one_attached :picture
validates :name, :language, :tshirt_size, :tshirt_cut, :food_preferences, presence: true validates :name, :language, :tshirt_size, :tshirt_cut, :food_preferences, presence: true
validates :tshirt_size, inclusion: {in: TSHIRT_SIZES.map(&:to_s)} validates :tshirt_size, inclusion: {in: TSHIRT_SIZES.map(&:to_s)}

View File

@ -1,53 +0,0 @@
class PictureUploader < CarrierWave::Uploader::Base
# Include RMagick or MiniMagick support:
# include CarrierWave::RMagick
include CarrierWave::MiniMagick
# Choose what kind of storage to use for this uploader:
storage :file
# storage :fog
# Override the directory where uploaded files will be stored.
# This is a sensible default for uploaders that are meant to be mounted:
def store_dir
"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
end
# Provide a default URL as a default if there hasn't been a file uploaded:
def default_url
ActionController::Base.helpers.asset_path("fallback/profile_picture/" + [version_name, "default.png"].compact.join("_"))
end
# Process files as they are uploaded:
# process :scale => [200, 300]
#
# def scale(width, height)
# # do something
# end
# Create different versions of your uploaded files:
version :medium do
process resize_to_fit: [171, 180]
end
version :thumb do
process resize_to_fit: [50, 50]
end
version :schedule do
process resize_to_fill: [100, 100]
end
# Add a white list of extensions which are allowed to be uploaded.
# For images you might use something like this:
def extension_white_list
%w[jpg jpeg png]
end
# Override the filename of the uploaded files:
# Avoid using model.id or version_name here, see uploader/store.rb for details.
# def filename
# "something.jpg" if original_filename
# end
end

View File

@ -5,7 +5,7 @@
.panel.panel-default .panel.panel-default
- if personal_profile.present? - if personal_profile.present?
.panel-image .panel-image
= image_tag personal_profile.picture.url = image_tag personal_profile.picture
.panel-body .panel-body
.media .media
.media-body .media-body

View File

@ -10,9 +10,9 @@
.panel-body .panel-body
.row .row
.col-lg-12 .col-lg-12
- if f.object.picture.present? - if f.object.picture.attached?
.col-sm-offset-3.col-sm-9 .col-sm-offset-3.col-sm-9
= image_tag f.object.picture.medium.url, class: 'img-thumbnail' = image_tag f.object.picture.variant(resize_to_limit: [150, 150]), class: 'img-thumbnail'
= f.input :picture, wrapper: :horizontal_file_input = f.input :picture, wrapper: :horizontal_file_input

View File

@ -27,10 +27,9 @@
.media .media
.media-left .media-left
- if profile.present? - if profile.present?
= image_tag(profile.picture.thumb.url) = image_tag(profile.picture.variant(resize_to_fill: [50, 50]))
- else - else
= image_tag(PictureUploader.new.thumb.url) = image_tag('avatar-placeholder')
.media-body .media-body
h4.media-heading h4.media-heading
- if profile.try(:name).present? - if profile.try(:name).present?

View File

@ -9,7 +9,7 @@
.col-sm-5.col-md-4 .col-sm-5.col-md-4
.panel.panel-default .panel.panel-default
.panel-image .panel-image
= image_tag @profile.picture.url = image_tag @profile.picture
.panel-body .panel-body
.media .media
.media-body .media-body

View File

@ -5,9 +5,9 @@
.col-lg-12 .col-lg-12
- if f.object.picture.present? - if f.object.picture.present?
.col-sm-offset-3.col-sm-9 .col-sm-offset-3.col-sm-9
= attachment_image_tag(@volunteer, :picture, :fill, 150, 150) if @volunteer.picture.present? = @volunteer.picture.variant(resize_to_limit: [150, 150]) if @volunteer.picture.attached?
= f.input :picture, as: :attachment, wrapper: :horizontal_file_input, direct: true = f.input :picture, as: :file, wrapper: :horizontal_file_input, direct: true
= f.input :name, autofocus: true = f.input :name, autofocus: true
= f.input :email = f.input :email

View File

@ -41,9 +41,9 @@
.media .media
.media-left .media-left
- if volunteer.picture.present? - if volunteer.picture.present?
= attachment_image_tag(volunteer, :picture, :fill, 50, 50) = image_tag volunteer.picture.variant(resize_to_limit: [50, 50])
- else - else
= image_tag(PictureUploader.new.thumb.url) = image_tag('avatar-placeholder.png')
.media-body .media-body
h4.media-heading h4.media-heading
= volunteer.name = volunteer.name

View File

@ -10,17 +10,18 @@
.panel-body .panel-body
.media .media
.media-left.hidden-sm.hidden-xs .media-left.hidden-sm.hidden-xs
- if @volunteer.picture.present? - if @volunteer.picture.attached?
= attachment_image_tag(@volunteer, :picture, :fill, 150, 150) = image_tag @volunteer.picture.variant(resize_to_limit: [150, 150])
- else - else
= image_tag(PictureUploader.new.medium.url) = image_tag('avatar-placeholder.png')
.media-body .media-body
.text-center.visible-sm.visible-xs .text-center.visible-sm.visible-xs
- if @volunteer.picture.present? - if @volunteer.picture.attached?
= attachment_image_tag(@volunteer, :picture, :fill, 150, 150) = image_tag @volunteer.picture.variant(resize_to_limit: [150, 150])
- else - else
= image_tag(PictureUploader.new.medium.url) = image_tag('avatar-placeholder.png')
h4.media-heading h4.media-heading
= @volunteer.name = @volunteer.name
hr hr

View File

@ -4,7 +4,6 @@
Екипи: <%= @volunteer.volunteer_teams.map(&:name).join(', ') %> Екипи: <%= @volunteer.volunteer_teams.map(&:name).join(', ') %>
Снимка: <%= attachment_url(@volunteer, :picture, host: "https://#{@volunteer.conference.host_name}/") %>
Език: <%= @volunteer.language %> Език: <%= @volunteer.language %>
Телефон: <%= @volunteer.phone %> Телефон: <%= @volunteer.phone %>
Размер на тениска: <%= @volunteer.tshirt_size %> Размер на тениска: <%= @volunteer.tshirt_size %>

9
bin/docker-entrypoint Executable file
View File

@ -0,0 +1,9 @@
#!/bin/bash -e
# If running the rails server then create or migrate existing database
if [ "${1}" == "./bin/rails" ] && [ "${2}" == "server" ]; then
#./bin/rails db:prepare
./bin/rails db:migrate
fi
exec "${@}"

View File

@ -1,9 +1,4 @@
#!/usr/bin/env ruby #!/usr/bin/env ruby
begin APP_PATH = File.expand_path("../config/application", __dir__)
load File.expand_path('../spring', __FILE__) require_relative "../config/boot"
rescue LoadError => e require "rails/commands"
raise unless e.message.include?('spring')
end
APP_PATH = File.expand_path('../config/application', __dir__)
require_relative '../config/boot'
require 'rails/commands'

View File

@ -1,9 +1,4 @@
#!/usr/bin/env ruby #!/usr/bin/env ruby
begin require_relative "../config/boot"
load File.expand_path('../spring', __FILE__) require "rake"
rescue LoadError => e
raise unless e.message.include?('spring')
end
require_relative '../config/boot'
require 'rake'
Rake.application.run Rake.application.run

View File

@ -1,36 +1,33 @@
#!/usr/bin/env ruby #!/usr/bin/env ruby
require 'fileutils' require "fileutils"
include FileUtils
# path to your application root. # path to your application root.
APP_ROOT = File.expand_path('..', __dir__) APP_ROOT = File.expand_path("..", __dir__)
def system!(*args) def system!(*args)
system(*args) || abort("\n== Command #{args} failed ==") system(*args, exception: true)
end end
chdir APP_ROOT do FileUtils.chdir APP_ROOT do
# This script is a starting point to setup your application. # This script is a way to set up or update your development environment automatically.
# This script is idempotent, so that you can run it at any time and get an expectable outcome.
# Add necessary setup steps to this file. # Add necessary setup steps to this file.
puts '== Installing dependencies ==' puts "== Installing dependencies =="
system! 'gem install bundler --conservative' system! "gem install bundler --conservative"
system('bundle check') || system!('bundle install') system("bundle check") || system!("bundle install")
# Install JavaScript dependencies if using Yarn
# system('bin/yarn')
# puts "\n== Copying sample files ==" # puts "\n== Copying sample files =="
# unless File.exist?('config/database.yml') # unless File.exist?("config/database.yml")
# cp 'config/database.yml.sample', 'config/database.yml' # FileUtils.cp "config/database.yml.sample", "config/database.yml"
# end # end
puts "\n== Preparing database ==" puts "\n== Preparing database =="
system! 'bin/rails db:setup' system! "bin/rails db:prepare"
puts "\n== Removing old logs and tempfiles ==" puts "\n== Removing old logs and tempfiles =="
system! 'bin/rails log:clear tmp:clear' system! "bin/rails log:clear tmp:clear"
puts "\n== Restarting application server ==" puts "\n== Restarting application server =="
system! 'bin/rails restart' system! "bin/rails restart"
end end

View File

@ -1,17 +0,0 @@
#!/usr/bin/env ruby
# This file loads spring without using Bundler, in order to be fast.
# It gets overwritten when you run the `spring binstub` command.
unless defined?(Spring)
require 'rubygems'
require 'bundler'
lockfile = Bundler::LockfileParser.new(Bundler.default_lockfile.read)
spring = lockfile.specs.detect { |spec| spec.name == "spring" }
if spring
Gem.use_paths Gem.dir, Bundler.bundle_path.to_s, *Gem.path
gem 'spring', spring.version
require 'spring/binstub'
end
end

View File

@ -1,9 +1,15 @@
#!/usr/bin/env ruby #!/usr/bin/env ruby
APP_ROOT = File.expand_path('..', __dir__) APP_ROOT = File.expand_path('..', __dir__)
Dir.chdir(APP_ROOT) do Dir.chdir(APP_ROOT) do
begin yarn = ENV["PATH"].split(File::PATH_SEPARATOR).
exec "yarnpkg", *ARGV select { |dir| File.expand_path(dir) != __dir__ }.
rescue Errno::ENOENT product(["yarn", "yarn.cmd", "yarn.ps1"]).
map { |dir, file| File.expand_path(file, dir) }.
find { |file| File.executable?(file) }
if yarn
exec yarn, *ARGV
else
$stderr.puts "Yarn executable was not detected in the system." $stderr.puts "Yarn executable was not detected in the system."
$stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install" $stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install"
exit 1 exit 1

View File

@ -1,4 +1,6 @@
# This file is used by Rack-based servers to start the application. # This file is used by Rack-based servers to start the application.
require ::File.expand_path("../config/environment", __FILE__) require_relative "config/environment"
run Rails.application run Rails.application
Rails.application.load_server

View File

@ -9,30 +9,33 @@ Bundler.require(*Rails.groups)
module Clarion module Clarion
class Application < Rails::Application class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails version. # Initialize configuration defaults for originally generated Rails version.
config.load_defaults 5.2 config.load_defaults 7.1
# Settings in config/environments/* take precedence over those specified here. # Please, add to the `ignore` list any other `lib` subdirectories that do
# Application configuration can go into files in config/initializers # not contain `.rb` files, or that should not be reloaded or eager loaded.
# -- all .rb files in that directory are automatically loaded after loading # Common ones are `templates`, `generators`, or `middleware`, for example.
# the framework and any gems in your application. config.autoload_lib(ignore: %w(assets tasks))
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. # Configuration for the application, engines, and railties goes here.
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. #
# These settings can be overridden in specific environments using the files
# in config/environments, which are processed later.
#
config.time_zone = "Sofia" config.time_zone = "Sofia"
# config.eager_load_paths << Rails.root.join("extras")
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
config.i18n.available_locales = [:bg, :en] config.i18n.available_locales = [:bg, :en]
config.i18n.default_locale = :bg config.i18n.default_locale = :bg
config.active_record.schema_format = :sql config.active_record.schema_format = :sql
config.generators do |g| config.generators do |g|
g.test_framework :rspec, fixtures: true, g.test_framework :rspec,
view_specs: false, fixtures: true,
helper_specs: false, view_specs: false,
routing_specs: false, helper_specs: false,
request_specs: false routing_specs: false,
request_specs: false
g.fixture_replacement :factory_bot, dir: "spec/factories" g.fixture_replacement :factory_bot, dir: "spec/factories"
end end

View File

@ -2,7 +2,7 @@ development:
adapter: async adapter: async
test: test:
adapter: async adapter: test
production: production:
adapter: redis adapter: redis

View File

@ -1,10 +1,12 @@
require "active_support/core_ext/integer/time"
Rails.application.configure do Rails.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 any time
# every request. This slows down response time but is perfect for development # it changes. 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.enable_reloading = true
# Do not eager load code on boot. # Do not eager load code on boot.
config.eager_load = false config.eager_load = false
@ -12,14 +14,18 @@ Rails.application.configure do
# Show full error reports. # Show full error reports.
config.consider_all_requests_local = true config.consider_all_requests_local = true
# Enable server timing
config.server_timing = true
# Enable/disable caching. By default caching is disabled. # Enable/disable caching. By default caching is disabled.
# Run rails dev:cache to toggle caching. # Run rails dev:cache to toggle caching.
if Rails.root.join("tmp", "caching-dev.txt").exist? if Rails.root.join("tmp/caching-dev.txt").exist?
config.action_controller.perform_caching = true config.action_controller.perform_caching = true
config.action_controller.enable_fragment_cache_logging = true
config.cache_store = :memory_store config.cache_store = :memory_store
config.public_file_server.headers = { config.public_file_server.headers = {
"Cache-Control" => "public, max-age=#{2.days.to_i}", "Cache-Control" => "public, max-age=#{2.days.to_i}"
} }
else else
config.action_controller.perform_caching = false config.action_controller.perform_caching = false
@ -27,7 +33,7 @@ Rails.application.configure do
config.cache_store = :null_store config.cache_store = :null_store
end end
# Store uploaded files on the local file system (see config/storage.yml for options) # Store uploaded files on the local file system (see config/storage.yml for options).
config.active_storage.service = :local config.active_storage.service = :local
# Don't care if the mailer can't send. # Don't care if the mailer can't send.
@ -41,24 +47,35 @@ Rails.application.configure do
# Print deprecation notices to the Rails logger. # Print deprecation notices to the Rails logger.
config.active_support.deprecation = :log config.active_support.deprecation = :log
# Raise exceptions for disallowed deprecations.
config.active_support.disallowed_deprecation = :raise
# Tell Active Support which deprecation messages to disallow.
config.active_support.disallowed_deprecation_warnings = []
# Raise an error on page load if there are pending migrations. # Raise an error on page load if there are pending migrations.
config.active_record.migration_error = :page_load config.active_record.migration_error = :page_load
# Highlight code that triggered database queries in logs. # Highlight code that triggered database queries in logs.
config.active_record.verbose_query_logs = true config.active_record.verbose_query_logs = true
# Debug mode disables concatenation and preprocessing of assets. # Highlight code that enqueued background job in logs.
# This option may cause significant delays in view rendering with a large config.active_job.verbose_enqueue_logs = true
# number of complex assets.
config.assets.debug = true
# Suppress logger output for asset requests. # Suppress logger output for asset requests.
config.assets.quiet = true config.assets.quiet = true
# Raises error for missing translations # Raises error for missing translations.
# config.action_view.raise_on_missing_translations = true # config.i18n.raise_on_missing_translations = true
# Use an evented file watcher to asynchronously detect changes in source code, # Annotate rendered view with file names.
# routes, locales, etc. This feature depends on the listen gem. # config.action_view.annotate_rendered_view_with_filenames = true
config.file_watcher = ActiveSupport::EventedFileUpdateChecker
# Uncomment if you wish to allow Action Cable access from any origin.
# config.action_cable.disable_request_forgery_protection = true
# Raise error when a before_action's only/except options reference missing actions
config.action_controller.raise_on_missing_callback_actions = true
config.hosts << "dev.openfest.org:3000"
end end

View File

@ -1,8 +1,10 @@
require "active_support/core_ext/integer/time"
Rails.application.configure do Rails.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.enable_reloading = false
# Eager load code on boot. This eager loads most of Rails and # Eager load code on boot. This eager loads most of Rails and
# your application in memory, allowing both threaded web servers # your application in memory, allowing both threaded web servers
@ -11,47 +13,48 @@ Rails.application.configure do
config.eager_load = true config.eager_load = true
# Full error reports are disabled and caching is turned on. # 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
# Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"] # Ensures that a master key has been made available in ENV["RAILS_MASTER_KEY"], config/master.key, or an environment
# or in config/master.key. This key is used to decrypt credentials (and other encrypted files). # key such as config/credentials/production.key. This key is used to decrypt credentials (and other encrypted files).
# config.require_master_key = true # config.require_master_key = true
# Disable serving static files from the `/public` folder by default since # Disable serving static files from `public/`, relying on NGINX/Apache to do so instead.
# Apache or NGINX already handles this. # config.public_file_server.enabled = false
config.public_file_server.enabled = ENV["RAILS_SERVE_STATIC_FILES"].present?
# Compress JavaScripts and CSS. # Compress CSS using a preprocessor.
config.assets.js_compressor = :uglifier
# config.assets.css_compressor = :sass # config.assets.css_compressor = :sass
# Do not fallback to assets pipeline if a precompiled asset is missed. # Do not fall back to assets pipeline if a precompiled asset is missed.
config.assets.compile = false config.assets.compile = false
# `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
# 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.asset_host = "http://assets.example.com"
# 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
# Store uploaded files on the local file system (see config/storage.yml for options) # Store uploaded files on the local file system (see config/storage.yml for options).
config.active_storage.service = :local config.active_storage.service = :local
# Mount Action Cable outside main process or domain # Mount Action Cable outside main process or domain.
# config.action_cable.mount_path = nil # config.action_cable.mount_path = nil
# config.action_cable.url = 'wss://example.com/cable' # config.action_cable.url = "wss://example.com/cable"
# config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ] # config.action_cable.allowed_request_origins = [ "http://example.com", /http:\/\/example.*/ ]
# Assume all access to the app is happening through a SSL-terminating reverse proxy.
# Can be used together with config.force_ssl for Strict-Transport-Security and secure cookies.
# config.assume_ssl = true
# 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
# Use the lowest log level to ensure availability of diagnostic information # Log to STDOUT by default
# when problems arise. config.logger = ActiveSupport::Logger.new(STDOUT)
config.log_level = :debug .tap { |logger| logger.formatter = ::Logger::Formatter.new }
.then { |logger| ActiveSupport::TaggedLogging.new(logger) }
# Prepend all log lines with the following tags. # Prepend all log lines with the following tags.
config.log_tags = [ config.log_tags = [
@ -65,12 +68,17 @@ Rails.application.configure do
} }
] ]
# "info" includes generic and useful information about system operation, but avoids logging too much
# information to avoid inadvertent exposure of personally identifiable information (PII). If you
# want to log everything, set the level to "debug".
config.log_level = ENV.fetch("RAILS_LOG_LEVEL", "info")
# 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
# Use a real queuing backend for Active Job (and separate queues per environment) # Use a real queuing backend for Active Job (and separate queues per environment).
# config.active_job.queue_adapter = :resque # config.active_job.queue_adapter = :resque
# config.active_job.queue_name_prefix = "clarion_#{Rails.env}" # config.active_job.queue_name_prefix = "clarion_production"
config.action_mailer.perform_caching = false config.action_mailer.perform_caching = false
@ -86,22 +94,17 @@ Rails.application.configure do
# the I18n.default_locale when a translation cannot be found). # the I18n.default_locale when a translation cannot be found).
config.i18n.fallbacks = true config.i18n.fallbacks = true
# Send deprecation notices to registered listeners. # Don't log any deprecations.
config.active_support.deprecation = :notify config.active_support.report_deprecations = false
# Use default logging formatter so that PID and timestamp are not suppressed.
config.log_formatter = ::Logger::Formatter.new
# Use a different logger for distributed setups.
# require 'syslog/logger'
# config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')
if ENV["RAILS_LOG_TO_STDOUT"].present?
logger = ActiveSupport::Logger.new(STDOUT)
logger.formatter = config.log_formatter
config.logger = ActiveSupport::TaggedLogging.new(logger)
end
# Do not dump schema after migrations. # Do not dump schema after migrations.
config.active_record.dump_schema_after_migration = false config.active_record.dump_schema_after_migration = false
# Enable DNS rebinding protection and other `Host` header attacks.
# config.hosts = [
# "example.com", # Allow requests from example.com
# /.*\.example\.com/ # Allow requests from subdomains like `www.example.com`
# ]
# Skip DNS rebinding protection for the default health check endpoint.
# config.host_authorization = { exclude: ->(request) { request.path == "/up" } }
end end

View File

@ -1,34 +1,40 @@
require "active_support/core_ext/integer/time"
# The test environment is used exclusively to run your application's
# 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
# and recreated between test runs. Don't rely on the data there!
Rails.application.configure do Rails.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 # While tests run files are not watched, reloading is not necessary.
# test suite. You never need to work with it otherwise. Remember that config.enable_reloading = false
# 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!
config.cache_classes = true
# Do not eager load code on boot. This avoids loading your whole application # Eager loading loads your entire application. When running a single test locally,
# just for the purpose of running a single test. If you are using a tool that # this is usually not necessary, and can slow down your test suite. However, it's
# preloads Rails for running tests, you may have to set it to true. # recommended that you enable it in continuous integration systems to ensure eager
config.eager_load = false # loading is working properly before deploying your code.
config.eager_load = ENV["CI"].present?
# Configure public file server for tests with Cache-Control for performance. # Configure public file server for tests with Cache-Control for performance.
config.public_file_server.enabled = true config.public_file_server.enabled = true
config.public_file_server.headers = { config.public_file_server.headers = {
"Cache-Control" => "public, max-age=#{1.hour.to_i}", "Cache-Control" => "public, max-age=#{1.hour.to_i}"
} }
# 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
config.cache_store = :null_store
# Raise exceptions instead of rendering exception templates. # Render exception templates for rescuable exceptions and raise for other exceptions.
config.action_dispatch.show_exceptions = false config.action_dispatch.show_exceptions = :rescuable
# 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
# Store uploaded files on the local file system in a temporary directory # Store uploaded files on the local file system in a temporary directory.
config.active_storage.service = :test config.active_storage.service = :test
config.action_mailer.perform_caching = false config.action_mailer.perform_caching = false
@ -44,6 +50,18 @@ Rails.application.configure do
# Print deprecation notices to the stderr. # Print deprecation notices to the stderr.
config.active_support.deprecation = :stderr config.active_support.deprecation = :stderr
# Raises error for missing translations # Raise exceptions for disallowed deprecations.
# config.action_view.raise_on_missing_translations = true config.active_support.disallowed_deprecation = :raise
# Tell Active Support which deprecation messages to disallow.
config.active_support.disallowed_deprecation_warnings = []
# Raises error for missing translations.
# config.i18n.raise_on_missing_translations = true
# Annotate rendered view with file names.
# config.action_view.annotate_rendered_view_with_filenames = true
# Raise error when a before_action's only/except options reference missing actions
config.action_controller.raise_on_missing_callback_actions = true
end end

View File

@ -5,13 +5,11 @@ Rails.application.config.assets.version = "1.0"
# Add additional assets to the asset load path. # Add additional assets to the asset load path.
# Rails.application.config.assets.paths << Emoji.images_path # Rails.application.config.assets.paths << Emoji.images_path
# Add Yarn node_modules folder to the asset load path.
Rails.application.config.assets.paths << Rails.root.join("node_modules")
Rails.application.config.assets.paths << "lib/initfest/assets/images" Rails.application.config.assets.paths << "lib/initfest/assets/images"
Rails.application.config.assets.paths << "lib/initfest/assets/javascripts" Rails.application.config.assets.paths << "lib/initfest/assets/javascripts"
Rails.application.config.assets.paths << "lib/initfest/assets/stylesheets" Rails.application.config.assets.paths << "lib/initfest/assets/stylesheets"
Rails.application.config.assets.precompile << /\.(?:png|jpg|jpeg|gif)\z/ #Rails.application.config.assets.precompile << /\.(?:png|jpg|jpeg|gif)\z/
# 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

View File

@ -1,7 +1,8 @@
# Be sure to restart your server when you modify this file. # Be sure to restart your server when you modify this file.
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } # Rails.backtrace_cleaner.add_silencer { |line| /my_noisy_library/.match?(line) }
# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code. # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code
# Rails.backtrace_cleaner.remove_silencers! # by setting BACKTRACE=1 before calling your invocation, like "BACKTRACE=1 ./bin/rails runner 'MyClass.perform'".
Rails.backtrace_cleaner.remove_silencers! if ENV["BACKTRACE"]

View File

@ -1,25 +1,25 @@
# Be sure to restart your server when you modify this file. # Be sure to restart your server when you modify this file.
# Define an application-wide content security policy # Define an application-wide content security policy.
# For further information see the following documentation # See the Securing Rails Applications Guide for more information:
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy # https://guides.rubyonrails.org/security.html#content-security-policy-header
# Rails.application.config.content_security_policy do |policy| # Rails.application.configure do
# policy.default_src :self, :https # config.content_security_policy do |policy|
# policy.font_src :self, :https, :data # policy.default_src :self, :https
# policy.img_src :self, :https, :data # policy.font_src :self, :https, :data
# policy.object_src :none # policy.img_src :self, :https, :data
# policy.script_src :self, :https # policy.object_src :none
# policy.style_src :self, :https # policy.script_src :self, :https
# policy.style_src :self, :https
# # Specify URI for violation reports # # Specify URI for violation reports
# # policy.report_uri "/csp-violation-report-endpoint" # # policy.report_uri "/csp-violation-report-endpoint"
# end
#
# # Generate session nonces for permitted importmap, inline scripts, and inline styles.
# config.content_security_policy_nonce_generator = ->(request) { request.session.id.to_s }
# config.content_security_policy_nonce_directives = %w(script-src style-src)
#
# # Report violations without enforcing the policy.
# # config.content_security_policy_report_only = true
# end # end
# If you are using UJS then enable automatic nonce generation
# Rails.application.config.content_security_policy_nonce_generator = -> request { SecureRandom.base64(16) }
# Report CSP violations to a specified URI
# For further information see the following documentation:
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only
# Rails.application.config.content_security_policy_report_only = true

View File

@ -1,4 +1,8 @@
# Be sure to restart your server when you modify this file. # Be sure to restart your server when you modify this file.
# Configure sensitive parameters which will be filtered from the log file. # Configure parameters to be partially matched (e.g. passw matches password) and filtered from the log file.
Rails.application.config.filter_parameters += [:password] # Use this to limit dissemination of sensitive information.
# See the ActiveSupport::ParameterFilter documentation for supported notations and behaviors.
Rails.application.config.filter_parameters += [
:passw, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn
]

View File

@ -4,13 +4,13 @@
# are locale specific, and you may define rules for as many different # are locale specific, and you may define rules for as many different
# locales as you wish. All of these examples are active by default: # locales as you wish. All of these examples are active by default:
# ActiveSupport::Inflector.inflections(:en) do |inflect| # 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(:en) do |inflect| # ActiveSupport::Inflector.inflections(:en) do |inflect|
# inflect.acronym 'RESTful' # inflect.acronym "RESTful"
# end # end

View File

@ -0,0 +1,45 @@
# Be sure to restart your server when you modify this file.
#
# This file contains migration options to ease your Rails 6.0 upgrade.
#
# Once upgraded flip defaults one by one to migrate to the new default.
#
# Read the Guide for Upgrading Ruby on Rails for more info on each option.
# Don't force requests from old versions of IE to be UTF-8 encoded.
# Rails.application.config.action_view.default_enforce_utf8 = false
# Embed purpose and expiry metadata inside signed and encrypted
# cookies for increased security.
#
# This option is not backwards compatible with earlier Rails versions.
# It's best enabled when your entire app is migrated and stable on 6.0.
# Rails.application.config.action_dispatch.use_cookies_with_metadata = true
# Change the return value of `ActionDispatch::Response#content_type` to Content-Type header without modification.
# Rails.application.config.action_dispatch.return_only_media_type_on_content_type = false
# Return false instead of self when enqueuing is aborted from a callback.
# Rails.application.config.active_job.return_false_on_aborted_enqueue = true
# Send Active Storage analysis and purge jobs to dedicated queues.
# Rails.application.config.active_storage.queues.analysis = :active_storage_analysis
# Rails.application.config.active_storage.queues.purge = :active_storage_purge
# When assigning to a collection of attachments declared via `has_many_attached`, replace existing
# attachments instead of appending. Use #attach to add new attachments without replacing existing ones.
# Rails.application.config.active_storage.replace_on_assign_to_many = true
# Use ActionMailer::MailDeliveryJob for sending parameterized and normal mail.
#
# The default delivery jobs (ActionMailer::Parameterized::DeliveryJob, ActionMailer::DeliveryJob),
# will be removed in Rails 6.1. This setting is not backwards compatible with earlier Rails versions.
# If you send mail in the background, job workers need to have a copy of
# MailDeliveryJob to ensure all delivery jobs are processed properly.
# Make sure your entire app is migrated and stable on 6.0 before using this setting.
# Rails.application.config.action_mailer.delivery_job = "ActionMailer::MailDeliveryJob"
# Enable the same cache key to be reused when the object being cached of type
# `ActiveRecord::Relation` changes by moving the volatile information (max updated at and count)
# of the relation's cache key into the cache version to support recycling cache key.
# Rails.application.config.active_record.collection_cache_versioning = true

View File

@ -0,0 +1,67 @@
# Be sure to restart your server when you modify this file.
#
# This file contains migration options to ease your Rails 6.1 upgrade.
#
# Once upgraded flip defaults one by one to migrate to the new default.
#
# Read the Guide for Upgrading Ruby on Rails for more info on each option.
# Support for inversing belongs_to -> has_many Active Record associations.
# Rails.application.config.active_record.has_many_inversing = true
# Track Active Storage variants in the database.
# Rails.application.config.active_storage.track_variants = true
# Apply random variation to the delay when retrying failed jobs.
# Rails.application.config.active_job.retry_jitter = 0.15
# Stop executing `after_enqueue`/`after_perform` callbacks if
# `before_enqueue`/`before_perform` respectively halts with `throw :abort`.
# Rails.application.config.active_job.skip_after_callbacks_if_terminated = true
# Specify cookies SameSite protection level: either :none, :lax, or :strict.
#
# This change is not backwards compatible with earlier Rails versions.
# It's best enabled when your entire app is migrated and stable on 6.1.
# Rails.application.config.action_dispatch.cookies_same_site_protection = :lax
# Generate CSRF tokens that are encoded in URL-safe Base64.
#
# This change is not backwards compatible with earlier Rails versions.
# It's best enabled when your entire app is migrated and stable on 6.1.
# Rails.application.config.action_controller.urlsafe_csrf_tokens = true
# Specify whether `ActiveSupport::TimeZone.utc_to_local` returns a time with an
# UTC offset or a UTC time.
# ActiveSupport.utc_to_local_returns_utc_offset_times = true
# Change the default HTTP status code to `308` when redirecting non-GET/HEAD
# requests to HTTPS in `ActionDispatch::SSL` middleware.
# Rails.application.config.action_dispatch.ssl_default_redirect_status = 308
# Use new connection handling API. For most applications this won't have any
# effect. For applications using multiple databases, this new API provides
# support for granular connection swapping.
# Rails.application.config.active_record.legacy_connection_handling = false
# Make `form_with` generate non-remote forms by default.
# Rails.application.config.action_view.form_with_generates_remote_forms = false
# Set the default queue name for the analysis job to the queue adapter default.
# Rails.application.config.active_storage.queues.analysis = nil
# Set the default queue name for the purge job to the queue adapter default.
# Rails.application.config.active_storage.queues.purge = nil
# Set the default queue name for the incineration job to the queue adapter default.
# Rails.application.config.action_mailbox.queues.incineration = nil
# Set the default queue name for the routing job to the queue adapter default.
# Rails.application.config.action_mailbox.queues.routing = nil
# Set the default queue name for the mail deliver job to the queue adapter default.
# Rails.application.config.action_mailer.deliver_later_queue_name = nil
# Generate a `Link` header that gives a hint to modern browsers about
# preloading assets when using `javascript_include_tag` and `stylesheet_link_tag`.
# Rails.application.config.action_view.preload_links_header = true

View File

@ -0,0 +1,143 @@
# Be sure to restart your server when you modify this file.
#
# This file eases your Rails 7.0 framework defaults upgrade.
#
# Uncomment each configuration one by one to switch to the new default.
# Once your application is ready to run with all new defaults, you can remove
# this file and set the `config.load_defaults` to `7.0`.
#
# Read the Guide for Upgrading Ruby on Rails for more info on each option.
# https://guides.rubyonrails.org/upgrading_ruby_on_rails.html
# `button_to` view helper will render `<button>` element, regardless of whether
# or not the content is passed as the first argument or as a block.
# Rails.application.config.action_view.button_to_generates_button_tag = true
# `stylesheet_link_tag` view helper will not render the media attribute by default.
# Rails.application.config.action_view.apply_stylesheet_media_default = false
# Change the digest class for the key generators to `OpenSSL::Digest::SHA256`.
# Changing this default means invalidate all encrypted messages generated by
# your application and, all the encrypted cookies. Only change this after you
# rotated all the messages using the key rotator.
#
# See upgrading guide for more information on how to build a rotator.
# https://guides.rubyonrails.org/v7.0/upgrading_ruby_on_rails.html
# Rails.application.config.active_support.key_generator_hash_digest_class = OpenSSL::Digest::SHA256
# Change the digest class for ActiveSupport::Digest.
# Changing this default means that for example Etags change and
# various cache keys leading to cache invalidation.
# Rails.application.config.active_support.hash_digest_class = OpenSSL::Digest::SHA256
# Don't override ActiveSupport::TimeWithZone.name and use the default Ruby
# implementation.
# Rails.application.config.active_support.remove_deprecated_time_with_zone_name = true
# Calls `Rails.application.executor.wrap` around test cases.
# This makes test cases behave closer to an actual request or job.
# Several features that are normally disabled in test, such as Active Record query cache
# and asynchronous queries will then be enabled.
# Rails.application.config.active_support.executor_around_test_case = true
# Set both the `:open_timeout` and `:read_timeout` values for `:smtp` delivery method.
# Rails.application.config.action_mailer.smtp_timeout = 5
# The ActiveStorage video previewer will now use scene change detection to generate
# better preview images (rather than the previous default of using the first frame
# of the video).
# Rails.application.config.active_storage.video_preview_arguments =
# "-vf 'select=eq(n\\,0)+eq(key\\,1)+gt(scene\\,0.015),loop=loop=-1:size=2,trim=start_frame=1' -frames:v 1 -f image2"
# Automatically infer `inverse_of` for associations with a scope.
# Rails.application.config.active_record.automatic_scope_inversing = true
# Raise when running tests if fixtures contained foreign key violations
# Rails.application.config.active_record.verify_foreign_keys_for_fixtures = true
# Disable partial inserts.
# This default means that all columns will be referenced in INSERT queries
# regardless of whether they have a default or not.
# Rails.application.config.active_record.partial_inserts = false
# Protect from open redirect attacks in `redirect_back_or_to` and `redirect_to`.
# Rails.application.config.action_controller.raise_on_open_redirects = true
# Change the variant processor for Active Storage.
# Changing this default means updating all places in your code that
# generate variants to use image processing macros and ruby-vips
# operations. See the upgrading guide for detail on the changes required.
# The `:mini_magick` option is not deprecated; it's fine to keep using it.
# Rails.application.config.active_storage.variant_processor = :vips
# Enable parameter wrapping for JSON.
# Previously this was set in an initializer. It's fine to keep using that initializer if you've customized it.
# To disable parameter wrapping entirely, set this config to `false`.
# Rails.application.config.action_controller.wrap_parameters_by_default = true
# Specifies whether generated namespaced UUIDs follow the RFC 4122 standard for namespace IDs provided as a
# `String` to `Digest::UUID.uuid_v3` or `Digest::UUID.uuid_v5` method calls.
#
# See https://guides.rubyonrails.org/configuring.html#config-active-support-use-rfc4122-namespaced-uuids for
# more information.
# Rails.application.config.active_support.use_rfc4122_namespaced_uuids = true
# Change the default headers to disable browsers' flawed legacy XSS protection.
# Rails.application.config.action_dispatch.default_headers = {
# "X-Frame-Options" => "SAMEORIGIN",
# "X-XSS-Protection" => "0",
# "X-Content-Type-Options" => "nosniff",
# "X-Download-Options" => "noopen",
# "X-Permitted-Cross-Domain-Policies" => "none",
# "Referrer-Policy" => "strict-origin-when-cross-origin"
# }
# ** Please read carefully, this must be configured in config/application.rb **
# Change the format of the cache entry.
# Changing this default means that all new cache entries added to the cache
# will have a different format that is not supported by Rails 6.1 applications.
# Only change this value after your application is fully deployed to Rails 7.0
# and you have no plans to rollback.
# When you're ready to change format, add this to `config/application.rb` (NOT this file):
# config.active_support.cache_format_version = 7.0
# Cookie serializer: 2 options
#
# If you're upgrading and haven't set `cookies_serializer` previously, your cookie serializer
# is `:marshal`. The default for new apps is `:json`.
#
# Rails.application.config.action_dispatch.cookies_serializer = :json
#
#
# To migrate an existing application to the `:json` serializer, use the `:hybrid` option.
#
# Rails transparently deserializes existing (Marshal-serialized) cookies on read and
# re-writes them in the JSON format.
#
# It is fine to use `:hybrid` long term; you should do that until you're confident *all* your cookies
# have been converted to JSON. To keep using `:hybrid` long term, move this config to its own
# initializer or to `config/application.rb`.
#
# Rails.application.config.action_dispatch.cookies_serializer = :hybrid
#
#
# If your cookies can't yet be serialized to JSON, keep using `:marshal` for backward-compatibility.
#
# If you have configured the serializer elsewhere, you can remove this section of the file.
#
# See https://guides.rubyonrails.org/action_controller_overview.html#cookies for more information.
# Change the return value of `ActionDispatch::Request#content_type` to the Content-Type header without modification.
# Rails.application.config.action_dispatch.return_only_request_media_type_on_content_type = false
# Active Storage `has_many_attached` relationships will default to replacing the current collection instead of appending to it.
# Thus, to support submitting an empty collection, the `file_field` helper will render an hidden field `include_hidden` by default when `multiple_file_field_include_hidden` is set to `true`.
# See https://guides.rubyonrails.org/configuring.html#config-active-storage-multiple-file-field-include-hidden for more information.
# Rails.application.config.active_storage.multiple_file_field_include_hidden = true
# ** Please read carefully, this must be configured in config/application.rb (NOT this file) **
# Disables the deprecated #to_s override in some Ruby core classes
# See https://guides.rubyonrails.org/configuring.html#config-active-support-disable-to-s-conversion for more information.
# config.active_support.disable_to_s_conversion = true

View File

@ -0,0 +1,284 @@
# Be sure to restart your server when you modify this file.
#
# This file eases your Rails 7.1 framework defaults upgrade.
#
# Uncomment each configuration one by one to switch to the new default.
# Once your application is ready to run with all new defaults, you can remove
# this file and set the `config.load_defaults` to `7.1`.
#
# Read the Guide for Upgrading Ruby on Rails for more info on each option.
# https://guides.rubyonrails.org/upgrading_ruby_on_rails.html
###
# No longer add autoloaded paths into `$LOAD_PATH`. This means that you won't be able
# to manually require files that are managed by the autoloader, which you shouldn't do anyway.
#
# This will reduce the size of the load path, making `require` faster if you don't use bootsnap, or reduce the size
# of the bootsnap cache if you use it.
#
# To set this configuration, add the following line to `config/application.rb` (NOT this file):
# config.add_autoload_paths_to_load_path = false
###
# Remove the default X-Download-Options headers since it is used only by Internet Explorer.
# If you need to support Internet Explorer, add back `"X-Download-Options" => "noopen"`.
#++
# Rails.application.config.action_dispatch.default_headers = {
# "X-Frame-Options" => "SAMEORIGIN",
# "X-XSS-Protection" => "0",
# "X-Content-Type-Options" => "nosniff",
# "X-Permitted-Cross-Domain-Policies" => "none",
# "Referrer-Policy" => "strict-origin-when-cross-origin"
# }
###
# Do not treat an `ActionController::Parameters` instance
# as equal to an equivalent `Hash` by default.
#++
# Rails.application.config.action_controller.allow_deprecated_parameters_hash_equality = false
###
# Active Record Encryption now uses SHA-256 as its hash digest algorithm.
#
# There are 3 scenarios to consider.
#
# 1. If you have data encrypted with previous Rails versions, and you have
# +config.active_support.key_generator_hash_digest_class+ configured as SHA1 (the default
# before Rails 7.0), you need to configure SHA-1 for Active Record Encryption too:
#++
# Rails.application.config.active_record.encryption.hash_digest_class = OpenSSL::Digest::SHA1
#
# 2. If you have +config.active_support.key_generator_hash_digest_class+ configured as SHA256 (the new default
# in 7.0), then you need to configure SHA-256 for Active Record Encryption:
#++
# Rails.application.config.active_record.encryption.hash_digest_class = OpenSSL::Digest::SHA256
#
# 3. If you don't currently have data encrypted with Active Record encryption, you can disable this setting to
# configure the default behavior starting 7.1+:
#++
# Rails.application.config.active_record.encryption.support_sha1_for_non_deterministic_encryption = false
###
# No longer run after_commit callbacks on the first of multiple Active Record
# instances to save changes to the same database row within a transaction.
# Instead, run these callbacks on the instance most likely to have internal
# state which matches what was committed to the database, typically the last
# instance to save.
#++
# Rails.application.config.active_record.run_commit_callbacks_on_first_saved_instances_in_transaction = false
###
# Configures SQLite with a strict strings mode, which disables double-quoted string literals.
#
# SQLite has some quirks around double-quoted string literals.
# It first tries to consider double-quoted strings as identifier names, but if they don't exist
# it then considers them as string literals. Because of this, typos can silently go unnoticed.
# For example, it is possible to create an index for a non existing column.
# See https://www.sqlite.org/quirks.html#double_quoted_string_literals_are_accepted for more details.
#++
# Rails.application.config.active_record.sqlite3_adapter_strict_strings_by_default = true
###
# Disable deprecated singular associations names.
#++
# Rails.application.config.active_record.allow_deprecated_singular_associations_name = false
###
# Enable the Active Job `BigDecimal` argument serializer, which guarantees
# roundtripping. Without this serializer, some queue adapters may serialize
# `BigDecimal` arguments as simple (non-roundtrippable) strings.
#
# When deploying an application with multiple replicas, old (pre-Rails 7.1)
# replicas will not be able to deserialize `BigDecimal` arguments from this
# serializer. Therefore, this setting should only be enabled after all replicas
# have been successfully upgraded to Rails 7.1.
#++
# Rails.application.config.active_job.use_big_decimal_serializer = true
###
# Specify if an `ArgumentError` should be raised if `Rails.cache` `fetch` or
# `write` are given an invalid `expires_at` or `expires_in` time.
# Options are `true`, and `false`. If `false`, the exception will be reported
# as `handled` and logged instead.
#++
# Rails.application.config.active_support.raise_on_invalid_cache_expiration_time = true
###
# Specify whether Query Logs will format tags using the SQLCommenter format
# (https://open-telemetry.github.io/opentelemetry-sqlcommenter/), or using the legacy format.
# Options are `:legacy` and `:sqlcommenter`.
#++
# Rails.application.config.active_record.query_log_tags_format = :sqlcommenter
###
# Specify the default serializer used by `MessageEncryptor` and `MessageVerifier`
# instances.
#
# The legacy default is `:marshal`, which is a potential vector for
# deserialization attacks in cases where a message signing secret has been
# leaked.
#
# In Rails 7.1, the new default is `:json_allow_marshal` which serializes and
# deserializes with `ActiveSupport::JSON`, but can fall back to deserializing
# with `Marshal` so that legacy messages can still be read.
#
# In Rails 7.2, the default will become `:json` which serializes and
# deserializes with `ActiveSupport::JSON` only.
#
# Alternatively, you can choose `:message_pack` or `:message_pack_allow_marshal`,
# which serialize with `ActiveSupport::MessagePack`. `ActiveSupport::MessagePack`
# can roundtrip some Ruby types that are not supported by JSON, and may provide
# improved performance, but it requires the `msgpack` gem.
#
# For more information, see
# https://guides.rubyonrails.org/v7.1/configuring.html#config-active-support-message-serializer
#
# If you are performing a rolling deploy of a Rails 7.1 upgrade, wherein servers
# that have not yet been upgraded must be able to read messages from upgraded
# servers, first deploy without changing the serializer, then set the serializer
# in a subsequent deploy.
#++
# Rails.application.config.active_support.message_serializer = :json_allow_marshal
###
# Enable a performance optimization that serializes message data and metadata
# together. This changes the message format, so messages serialized this way
# cannot be read by older versions of Rails. However, messages that use the old
# format can still be read, regardless of whether this optimization is enabled.
#
# To perform a rolling deploy of a Rails 7.1 upgrade, wherein servers that have
# not yet been upgraded must be able to read messages from upgraded servers,
# leave this optimization off on the first deploy, then enable it on a
# subsequent deploy.
#++
# Rails.application.config.active_support.use_message_serializer_for_metadata = true
###
# Set the maximum size for Rails log files.
#
# `config.load_defaults 7.1` does not set this value for environments other than
# development and test.
#++
# if Rails.env.local?
# Rails.application.config.log_file_size = 100 * 1024 * 1024
# end
###
# Enable raising on assignment to attr_readonly attributes. The previous
# behavior would allow assignment but silently not persist changes to the
# database.
#++
# Rails.application.config.active_record.raise_on_assign_to_attr_readonly = true
###
# Enable validating only parent-related columns for presence when the parent is mandatory.
# The previous behavior was to validate the presence of the parent record, which performed an extra query
# to get the parent every time the child record was updated, even when parent has not changed.
#++
# Rails.application.config.active_record.belongs_to_required_validates_foreign_key = false
###
# Enable precompilation of `config.filter_parameters`. Precompilation can
# improve filtering performance, depending on the quantity and types of filters.
#++
# Rails.application.config.precompile_filter_parameters = true
###
# Enable before_committed! callbacks on all enrolled records in a transaction.
# The previous behavior was to only run the callbacks on the first copy of a record
# if there were multiple copies of the same record enrolled in the transaction.
#++
# Rails.application.config.active_record.before_committed_on_all_records = true
###
# Disable automatic column serialization into YAML.
# To keep the historic behavior, you can set it to `YAML`, however it is
# recommended to explicitly define the serialization method for each column
# rather than to rely on a global default.
#++
# Rails.application.config.active_record.default_column_serializer = nil
###
# Enable a performance optimization that serializes Active Record models
# in a faster and more compact way.
#
# To perform a rolling deploy of a Rails 7.1 upgrade, wherein servers that have
# not yet been upgraded must be able to read caches from upgraded servers,
# leave this optimization off on the first deploy, then enable it on a
# subsequent deploy.
#++
# Rails.application.config.active_record.marshalling_format_version = 7.1
###
# Run `after_commit` and `after_*_commit` callbacks in the order they are defined in a model.
# This matches the behaviour of all other callbacks.
# In previous versions of Rails, they ran in the inverse order.
#++
# Rails.application.config.active_record.run_after_transaction_callbacks_in_order_defined = true
###
# Whether a `transaction` block is committed or rolled back when exited via `return`, `break` or `throw`.
#++
# Rails.application.config.active_record.commit_transaction_on_non_local_return = true
###
# Controls when to generate a value for <tt>has_secure_token</tt> declarations.
#++
# Rails.application.config.active_record.generate_secure_token_on = :initialize
###
# ** Please read carefully, this must be configured in config/application.rb **
#
# Change the format of the cache entry.
#
# Changing this default means that all new cache entries added to the cache
# will have a different format that is not supported by Rails 7.0
# applications.
#
# Only change this value after your application is fully deployed to Rails 7.1
# and you have no plans to rollback.
# When you're ready to change format, add this to `config/application.rb` (NOT
# this file):
# config.active_support.cache_format_version = 7.1
###
# Configure Action View to use HTML5 standards-compliant sanitizers when they are supported on your
# platform.
#
# `Rails::HTML::Sanitizer.best_supported_vendor` will cause Action View to use HTML5-compliant
# sanitizers if they are supported, else fall back to HTML4 sanitizers.
#
# In previous versions of Rails, Action View always used `Rails::HTML4::Sanitizer` as its vendor.
#++
# Rails.application.config.action_view.sanitizer_vendor = Rails::HTML::Sanitizer.best_supported_vendor
###
# Configure Action Text to use an HTML5 standards-compliant sanitizer when it is supported on your
# platform.
#
# `Rails::HTML::Sanitizer.best_supported_vendor` will cause Action Text to use HTML5-compliant
# sanitizers if they are supported, else fall back to HTML4 sanitizers.
#
# In previous versions of Rails, Action Text always used `Rails::HTML4::Sanitizer` as its vendor.
#++
# Rails.application.config.action_text.sanitizer_vendor = Rails::HTML::Sanitizer.best_supported_vendor
###
# Configure the log level used by the DebugExceptions middleware when logging
# uncaught exceptions during requests.
#++
# Rails.application.config.action_dispatch.debug_exception_log_level = :error
###
# Configure the test helpers in Action View, Action Dispatch, and rails-dom-testing to use HTML5
# parsers.
#
# Nokogiri::HTML5 isn't supported on JRuby, so JRuby applications must set this to :html4.
#
# In previous versions of Rails, these test helpers always used an HTML4 parser.
#++
# Rails.application.config.dom_testing_default_html_version = :html5

View File

@ -0,0 +1,13 @@
# Be sure to restart your server when you modify this file.
# Define an application-wide HTTP permissions policy. For further
# information see: https://developers.google.com/web/updates/2018/06/feature-policy
# Rails.application.config.permissions_policy do |policy|
# policy.camera :none
# policy.gyroscope :none
# policy.microphone :none
# policy.usb :none
# policy.fullscreen :self
# policy.payment :self, "https://secure.example.com"
# end

View File

@ -34,6 +34,8 @@ bg:
no_comments_received: Все още няма коментари. no_comments_received: Все още няма коментари.
private_email: Личен e-mail private_email: Личен e-mail
events: events:
update:
event_successfully_updated: Събитието беше обновено успешно
show: show:
average_grade: Средна оценка average_grade: Средна оценка
total_feedback_grades: total_feedback_grades:

View File

@ -1,6 +1,6 @@
%w[ Spring.watch(
.ruby-version ".ruby-version",
.rbenv-vars ".rbenv-vars",
tmp/restart.txt "tmp/restart.txt",
tmp/caching-dev.txt "tmp/caching-dev.txt"
].each { |path| Spring.watch(path) } )

View File

@ -0,0 +1,10 @@
# This migration comes from active_storage (originally 20180723000244)
class AddForeignKeyConstraintToActiveStorageAttachmentsForBlobId < ActiveRecord::Migration[6.0]
def up
return if foreign_key_exists?(:active_storage_attachments, column: :blob_id)
if table_exists?(:active_storage_blobs)
add_foreign_key :active_storage_attachments, :active_storage_blobs, column: :blob_id
end
end
end

View File

@ -0,0 +1,22 @@
# This migration comes from active_storage (originally 20190112182829)
class AddServiceNameToActiveStorageBlobs < ActiveRecord::Migration[6.0]
def up
return unless table_exists?(:active_storage_blobs)
unless column_exists?(:active_storage_blobs, :service_name)
add_column :active_storage_blobs, :service_name, :string
if configured_service = ActiveStorage::Blob.service.name
ActiveStorage::Blob.unscoped.update_all(service_name: configured_service)
end
change_column :active_storage_blobs, :service_name, :string, null: false
end
end
def down
return unless table_exists?(:active_storage_blobs)
remove_column :active_storage_blobs, :service_name
end
end

View File

@ -0,0 +1,27 @@
# This migration comes from active_storage (originally 20191206030411)
class CreateActiveStorageVariantRecords < ActiveRecord::Migration[6.0]
def change
return unless table_exists?(:active_storage_blobs)
# Use Active Record's configured type for primary key
create_table :active_storage_variant_records, id: primary_key_type, if_not_exists: true do |t|
t.belongs_to :blob, null: false, index: false, type: blobs_primary_key_type
t.string :variation_digest, null: false
t.index %i[ blob_id variation_digest ], name: "index_active_storage_variant_records_uniqueness", unique: true
t.foreign_key :active_storage_blobs, column: :blob_id
end
end
private
def primary_key_type
config = Rails.configuration.generators
config.options[config.orm][:primary_key_type] || :primary_key
end
def blobs_primary_key_type
pkey_name = connection.primary_key(:active_storage_blobs)
pkey_column = connection.columns(:active_storage_blobs).find { |c| c.name == pkey_name }
pkey_column.bigint? ? :bigint : pkey_column.type
end
end

View File

@ -0,0 +1,57 @@
# This migration comes from active_storage (originally 20170806125915)
class CreateActiveStorageTables < ActiveRecord::Migration[7.0]
def change
# Use Active Record's configured type for primary and foreign keys
primary_key_type, foreign_key_type = primary_and_foreign_key_types
create_table :active_storage_blobs, id: primary_key_type do |t|
t.string :key, null: false
t.string :filename, null: false
t.string :content_type
t.text :metadata
t.string :service_name, null: false
t.bigint :byte_size, null: false
t.string :checksum
if connection.supports_datetime_with_precision?
t.datetime :created_at, precision: 6, null: false
else
t.datetime :created_at, null: false
end
t.index [ :key ], unique: true
end
create_table :active_storage_attachments, id: primary_key_type do |t|
t.string :name, null: false
t.references :record, null: false, polymorphic: true, index: false, type: foreign_key_type
t.references :blob, null: false, type: foreign_key_type
if connection.supports_datetime_with_precision?
t.datetime :created_at, precision: 6, null: false
else
t.datetime :created_at, null: false
end
t.index [ :record_type, :record_id, :name, :blob_id ], name: :index_active_storage_attachments_uniqueness, unique: true
t.foreign_key :active_storage_blobs, column: :blob_id
end
create_table :active_storage_variant_records, id: primary_key_type do |t|
t.belongs_to :blob, null: false, index: false, type: foreign_key_type
t.string :variation_digest, null: false
t.index [ :blob_id, :variation_digest ], name: :index_active_storage_variant_records_uniqueness, unique: true
t.foreign_key :active_storage_blobs, column: :blob_id
end
end
private
def primary_and_foreign_key_types
config = Rails.configuration.generators
setting = config.options[config.orm][:primary_key_type]
primary_key_type = setting || :primary_key
foreign_key_type = setting || :bigint
[primary_key_type, foreign_key_type]
end
end

View File

@ -5,8 +5,10 @@
# #
# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }]) # cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
# Mayor.create(name: 'Emanuel', city: cities.first # Mayor.create(name: 'Emanuel', city: cities.first
User.create(email: "foo@example.com", User.create(
password: "123qweASD", email: "foo@example.com",
password_confirmation: "123qweASD", password: "123qweASD",
confirmed_at: Time.current, password_confirmation: "123qweASD",
admin: true) confirmed_at: Time.current,
admin: true
)

View File

@ -13,3 +13,4 @@
//= require jquery //= require jquery
//= require jquery_ujs //= require jquery_ujs
//= require_tree . //= require_tree .
//= require activestorage

View File

@ -3,10 +3,9 @@
.form-inputs .form-inputs
.input .input
= image_tag(@profile.picture.medium.url) if @profile.picture? = image_tag(@profile.picture.variant(resize_to_limit: [150, 150])) if @profile.picture.attached?
= f.input :picture, as: :file, required: true, wrapper: false = f.hidden_field :picture, value: @profile.picture.signed_id if @profile.picture.attached?
= f.input :picture, as: :file, required: true, wrapper: false, input_html: {direct_upload: true}
= f.hidden_field :picture_cache, class: 'image_preview', wrapper: false
= f.input :first_name, autofocus: true = f.input :first_name, autofocus: true
= f.input :last_name = f.input :last_name
= f.input :public_email = f.input :public_email

View File

@ -5,8 +5,8 @@
.form-inputs .form-inputs
.input .input
= attachment_image_tag(@volunteer, :picture, :fill, 150, 150) if @volunteer.picture.present? = image_tag @volunteer.picture.variant(resize_to_limit: [150, 150]) if @volunteer.picture.attached?
= f.input :picture, as: :attachment, direct: true, wrapper: false = f.input :picture, as: :file, direct: true, wrapper: false
= f.input :name, autofocus: true = f.input :name, autofocus: true
= f.input :email = f.input :email
= f.input :phone, input_html: {value: @volunteer.phone.try(:phony_formatted, format: :international)} = f.input :phone, input_html: {value: @volunteer.phone.try(:phony_formatted, format: :international)}

View File

View File

@ -1,5 +0,0 @@
require "rails_helper"
RSpec.describe Volunteership, type: :model do
pending "add some examples to (or delete) #{__FILE__}"
end

View File

@ -103,7 +103,7 @@ module FeatureHelpers
attach_file PersonalProfile.human_attribute_name(:picture), Rails.root.join("spec", "support", "picture.jpg") attach_file PersonalProfile.human_attribute_name(:picture), Rails.root.join("spec", "support", "picture.jpg")
fill_in PersonalProfile.human_attribute_name(:first_name), with: "Foo" fill_in PersonalProfile.human_attribute_name(:first_name), with: "Foo"
fill_in PersonalProfile.human_attribute_name(:last_name), with: "Bar" fill_in PersonalProfile.human_attribute_name(:last_name), with: "Bar"
fill_in PersonalProfile.human_attribute_name(:mobile_phone), with: "+359666666" fill_in PersonalProfile.human_attribute_name(:mobile_phone), with: "+359883123456"
fill_in PersonalProfile.human_attribute_name(:biography), with: "Lorem" fill_in PersonalProfile.human_attribute_name(:biography), with: "Lorem"
click_on I18n.t("helpers.submit.create", model: PersonalProfile.model_name.human) click_on I18n.t("helpers.submit.create", model: PersonalProfile.model_name.human)

View File

@ -1,6 +1,6 @@
RSpec::Matchers.define :have_error_on do |expected| RSpec::Matchers.define :have_error_on do |expected|
match do |actual| match do |actual|
expect(actual).to_not be_valid expect(actual).to_not be_valid
expect(actual.errors.keys).to include expected expect(actual.errors).to have_key expected
end end
end end