A lot :)
This commit is contained in:
parent
aad67af0d1
commit
63fc206c27
153 changed files with 2043 additions and 646 deletions
|
|
@ -2,5 +2,8 @@ version: '3.8'
|
|||
services:
|
||||
# Update this to the name of the service you want to work with in your docker-compose.yml file
|
||||
app:
|
||||
environment:
|
||||
EDITOR: code
|
||||
SHELL: fish
|
||||
command: /bin/sh -c "while sleep 1000; do :; done"
|
||||
|
||||
|
|
|
|||
|
|
@ -40,3 +40,4 @@
|
|||
/docker-compose.yml
|
||||
|
||||
/.forgejo/
|
||||
/core*
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ jobs:
|
|||
path: repository
|
||||
key: ${{ runner.os }}-repository-${{ github.sha }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-repository-
|
||||
${{ runner.os }}-repository
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
|
|
|
|||
12
.github/dependabot.yml
vendored
12
.github/dependabot.yml
vendored
|
|
@ -1,12 +0,0 @@
|
|||
# To get started with Dependabot version updates, you'll need to specify which
|
||||
# package ecosystems to update and where the package manifests are located.
|
||||
# Please see the documentation for more information:
|
||||
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
|
||||
# https://containers.dev/guide/dependabot
|
||||
|
||||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: "devcontainers"
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: weekly
|
||||
|
|
@ -1,3 +1,6 @@
|
|||
inherit_gem:
|
||||
rubocop-rails-omakase: rubocop.yml
|
||||
|
||||
require:
|
||||
- rubocop-capybara
|
||||
- rubocop-rails
|
||||
|
|
|
|||
13
.vscode/launch.json
vendored
13
.vscode/launch.json
vendored
|
|
@ -10,18 +10,5 @@
|
|||
"request": "attach",
|
||||
"preLaunchTask": "dev"
|
||||
},
|
||||
{
|
||||
"type": "ruby_lsp",
|
||||
"name": "Debug script",
|
||||
"request": "launch",
|
||||
"program": "ruby ${file}"
|
||||
},
|
||||
{
|
||||
"type": "ruby_lsp",
|
||||
"name": "Debug test",
|
||||
"request": "launch",
|
||||
"program": "ruby -Itest ${relativeFile}"
|
||||
},
|
||||
|
||||
]
|
||||
}
|
||||
15
.vscode/tasks.json
vendored
15
.vscode/tasks.json
vendored
|
|
@ -2,10 +2,21 @@
|
|||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"type": "shell",
|
||||
"type": "process",
|
||||
"presentation": {
|
||||
"echo": true,
|
||||
"reveal": "silent",
|
||||
"focus": false,
|
||||
"panel": "dedicated",
|
||||
"showReuseMessage": true,
|
||||
"clear": false,
|
||||
"revealProblems": "always",
|
||||
"group": "dev",
|
||||
"close": true
|
||||
},
|
||||
"command": "dev",
|
||||
"label": "dev",
|
||||
"isBackground": true
|
||||
"isBackground": true,
|
||||
}
|
||||
]
|
||||
}
|
||||
156
Dockerfile
156
Dockerfile
|
|
@ -47,7 +47,7 @@ RUN \
|
|||
echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list && \
|
||||
apt-get update -yqq && \
|
||||
apt-get install -yqq --no-install-recommends \
|
||||
sqlite3 nodejs npm sassc yarn libvips fish ranger pandoc && \
|
||||
sqlite3 nodejs npm sassc yarn libvips fish ranger pandoc libjemalloc2 && \
|
||||
apt-get clean && \
|
||||
npm install tabby-agent && \
|
||||
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && \
|
||||
|
|
@ -55,26 +55,23 @@ RUN \
|
|||
gem update --system && \
|
||||
bundle config set app_config ${GEM_HOME}
|
||||
|
||||
ENV LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libjemalloc.so.2
|
||||
|
||||
USER ${NAME}
|
||||
|
||||
FROM development AS builder
|
||||
RUN mkdir -p ~/.config/fish && echo "set fish_greeting" >> ~/.config/fish/config.fish
|
||||
RUN \
|
||||
echo >> ~/.config/fish/config.fish &&\
|
||||
echo "function fish_prompt" >> ~/.config/fish/config.fish &&\
|
||||
echo " set -l last_status \$status" >> ~/.config/fish/config.fish &&\
|
||||
echo " set -l stat" >> ~/.config/fish/config.fish &&\
|
||||
echo " if test \$last_status -ne 0" >> ~/.config/fish/config.fish &&\
|
||||
echo " set stat (set_color red)\"[\$last_status]\"(set_color normal)" >> ~/.config/fish/config.fish &&\
|
||||
echo " end" >> ~/.config/fish/config.fish &&\
|
||||
echo " string join '' -- (set_color green) (prompt_pwd) (set_color normal) \$stat ' 🐳 '" >> ~/.config/fish/config.fish && \
|
||||
echo "end" >> ~/.config/fish/config.fish
|
||||
|
||||
USER root
|
||||
|
||||
COPY Gemfile Gemfile.lock package.json yarn.lock ./
|
||||
|
||||
RUN bundle install && yarn install
|
||||
|
||||
FROM builder AS assets
|
||||
|
||||
COPY . .
|
||||
|
||||
COPY --from=builder /app/.bundle /app/.bundle
|
||||
COPY --from=builder /app/node_modules /app/node_modules
|
||||
|
||||
RUN RAILS_ENV=production SECRET_KEY_BASE_DUMMY=1 rails assets:precompile
|
||||
|
||||
FROM ruby:${RUBY_VERSION}-slim AS production
|
||||
FROM ruby:${RUBY_VERSION}-alpine AS builder
|
||||
|
||||
ARG NAME
|
||||
ARG UID
|
||||
|
|
@ -84,50 +81,111 @@ ARG INSTALL_DIR
|
|||
|
||||
WORKDIR ${INSTALL_DIR}
|
||||
|
||||
ENV GEM_HOME=${INSTALL_DIR}/.bundle
|
||||
|
||||
ENV \
|
||||
LANG=C.UTF-8 \
|
||||
INSTALL_DIR=${INSTALL_DIR} \
|
||||
RAILS_ENV=production \
|
||||
RAILS_ENV=development \
|
||||
TZ=Europe/Zurich \
|
||||
PATH=${INSTALL_DIR}/bin:$GEM_HOME/bin:$GEM_HOME/gems/bin:$PATH
|
||||
PATH=${INSTALL_DIR}/bin:$GEM_HOME/bin:$GEM_HOME/gems/bin:$PATH \
|
||||
EDITOR=vim
|
||||
|
||||
ENV GEM_HOME=${INSTALL_DIR}/.bundle
|
||||
|
||||
RUN \
|
||||
ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && \
|
||||
echo $TZ > /etc/timezone && \
|
||||
addgroup --gid ${GID} ${NAME} && \
|
||||
adduser \
|
||||
--gecos GECOS \
|
||||
--home /home/${NAME} \
|
||||
--uid ${UID} \
|
||||
--gid ${GID} \
|
||||
--disabled-password \
|
||||
--disabled-login \
|
||||
--shell /bin/bash \
|
||||
${NAME} && \
|
||||
apt-get update -yqq && \
|
||||
apt-get install -yqq --no-install-recommends \
|
||||
sqlite3 libvips pandoc && \
|
||||
apt-get clean && \
|
||||
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && \
|
||||
RUN apk add --update --no-cache \
|
||||
binutils-gold \
|
||||
build-base \
|
||||
curl \
|
||||
file \
|
||||
g++ \
|
||||
gcc \
|
||||
git \
|
||||
less \
|
||||
libstdc++ \
|
||||
libffi-dev \
|
||||
libc-dev \
|
||||
linux-headers \
|
||||
libxml2-dev \
|
||||
libxslt-dev \
|
||||
libgcrypt-dev \
|
||||
make \
|
||||
netcat-openbsd \
|
||||
nodejs \
|
||||
openssl \
|
||||
pkgconfig \
|
||||
tzdata \
|
||||
yarn \
|
||||
sqlite \
|
||||
vips-dev \
|
||||
npm \
|
||||
sassc \
|
||||
jemalloc \
|
||||
pandoc-cli \
|
||||
sqlite-libs \
|
||||
build-base && \
|
||||
truncate -s 0 /var/log/*log && \
|
||||
gem update --system && \
|
||||
bundle config set app_config ${GEM_HOME}
|
||||
|
||||
EXPOSE 3000
|
||||
ENV LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libjemalloc.so.2
|
||||
|
||||
ENTRYPOINT [ "bin/entrypoint" ]
|
||||
USER ${NAME}
|
||||
|
||||
USER root
|
||||
|
||||
COPY Gemfile Gemfile.lock package.json yarn.lock ./
|
||||
|
||||
RUN bundle config without test development && bundle install && yarn install
|
||||
|
||||
FROM builder AS assets
|
||||
|
||||
COPY . .
|
||||
|
||||
COPY --from=builder /app/.bundle /app/.bundle
|
||||
COPY --from=assets /app/public/assets /app/public/assets
|
||||
COPY --from=builder ${INSTALL_DIR}/.bundle ${INSTALL_DIR}/.bundle
|
||||
COPY --from=builder ${INSTALL_DIR}/node_modules ${INSTALL_DIR}/node_modules
|
||||
|
||||
RUN chown -R app:app /app/tmp /app/log /app/storage
|
||||
RUN date +"%Y-%m-%d %H:%M:%S %Z" >> .build_version
|
||||
RUN RAILS_ENV=production SECRET_KEY_BASE_DUMMY=1 rails assets:precompile
|
||||
|
||||
FROM ruby:${RUBY_VERSION}-alpine AS production
|
||||
|
||||
ARG INSTALL_DIR
|
||||
ARG NAME
|
||||
|
||||
WORKDIR ${INSTALL_DIR}
|
||||
|
||||
ENV GEM_HOME=${INSTALL_DIR}/.bundle
|
||||
|
||||
ENV \
|
||||
RAILS_ENV=production \
|
||||
PATH=${INSTALL_DIR}/bin:$GEM_HOME/bin:$GEM_HOME/gems/bin:$PATH \
|
||||
TZ=Europe/Zurich
|
||||
|
||||
RUN \
|
||||
adduser ${NAME} --disabled-password --shell /bin/ash && \
|
||||
apk add --update --no-cache \
|
||||
tzdata \
|
||||
sqlite \
|
||||
vips-dev \
|
||||
jemalloc && \
|
||||
gem update --system && \
|
||||
bundle config set app_config ${GEM_HOME} && \
|
||||
bundle config set without development test && \
|
||||
apk add patchelf && \
|
||||
patchelf --add-needed libjemalloc.so.2 /usr/local/bin/ruby && \
|
||||
apk del patchelf && \
|
||||
truncate -s 0 /var/log/*log
|
||||
|
||||
EXPOSE 3000
|
||||
|
||||
COPY . .
|
||||
|
||||
COPY --from=builder ${INSTALL_DIR}/.bundle ${INSTALL_DIR}/.bundle
|
||||
COPY --from=assets ${INSTALL_DIR}/public/assets ${INSTALL_DIR}/public/assets
|
||||
|
||||
RUN chown -R ${NAME}:${NAME} ${INSTALL_DIR}/tmp ${INSTALL_DIR}/log ${INSTALL_DIR}/storage && \
|
||||
date +"%Y-%m-%d %H:%M:%S %Z" >> .build_version
|
||||
|
||||
USER ${NAME}
|
||||
|
||||
ENTRYPOINT [ "bin/entrypoint" ]
|
||||
|
||||
USER app
|
||||
# Using variables in command list is not possible:
|
||||
# https://stackoverflow.com/questions/40454470/how-can-i-use-a-variable-inside-a-dockerfile-cmd
|
||||
CMD [ "rails", "server", "--binding", "0.0.0.0", "--no-daemon", "--port" , "3000" ]
|
||||
|
|
|
|||
68
Gemfile
68
Gemfile
|
|
@ -1,35 +1,36 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
source 'https://rubygems.org'
|
||||
source "https://rubygems.org"
|
||||
|
||||
ruby '3.3.4'
|
||||
ruby "3.3.4"
|
||||
|
||||
# Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main"
|
||||
gem 'rails', '~> 7.1.3', '>= 7.1.3.4'
|
||||
gem "rails", "~> 7.2"
|
||||
|
||||
# The original asset pipeline for Rails [https://github.com/rails/sprockets-rails]
|
||||
gem 'sprockets-rails'
|
||||
gem "sprockets-rails"
|
||||
|
||||
# Use sqlite3 as the database for Active Record
|
||||
gem 'sqlite3', '~> 1.4'
|
||||
# gem "sqlite3", "~> 1.4"
|
||||
gem "sqlite3", ">= 2.0"
|
||||
|
||||
# Use the Puma web server [https://github.com/puma/puma]
|
||||
gem 'puma', '>= 5.0'
|
||||
gem "puma", ">= 5.0"
|
||||
|
||||
# Bundle and transpile JavaScript [https://github.com/rails/jsbundling-rails]
|
||||
gem 'jsbundling-rails'
|
||||
gem "jsbundling-rails"
|
||||
|
||||
# Hotwire's SPA-like page accelerator [https://turbo.hotwired.dev]
|
||||
gem 'turbo-rails'
|
||||
gem "turbo-rails"
|
||||
|
||||
# Hotwire's modest JavaScript framework [https://stimulus.hotwired.dev]
|
||||
gem 'stimulus-rails'
|
||||
gem "stimulus-rails"
|
||||
|
||||
# Bundle and process CSS [https://github.com/rails/cssbundling-rails]
|
||||
gem 'cssbundling-rails'
|
||||
gem "cssbundling-rails"
|
||||
|
||||
# Build JSON APIs with ease [https://github.com/rails/jbuilder]
|
||||
gem 'jbuilder'
|
||||
gem "jbuilder"
|
||||
|
||||
# Use Redis adapter to run Action Cable in production
|
||||
# gem "redis", ">= 4.0.1"
|
||||
|
|
@ -41,45 +42,50 @@ gem 'jbuilder'
|
|||
# gem "bcrypt", "~> 3.1.7"
|
||||
|
||||
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
|
||||
gem 'tzinfo-data', platforms: %i[windows jruby]
|
||||
gem "tzinfo-data", platforms: %i[windows jruby]
|
||||
|
||||
# Reduces boot times through caching; required in config/boot.rb
|
||||
gem 'bootsnap', require: false
|
||||
gem "bootsnap", require: false
|
||||
|
||||
# Use Active Storage variants [https://guides.rubyonrails.org/active_storage_overview.html#transforming-images]
|
||||
gem 'bootstrap_form'
|
||||
gem 'caxlsx'
|
||||
gem 'caxlsx_rails'
|
||||
gem 'image_processing', '~> 1.2'
|
||||
gem 'pagy', '~> 9.0'
|
||||
gem 'pandoc-ruby'
|
||||
gem 'prawn-markup'
|
||||
gem 'prawn-rails'
|
||||
gem 'sablon'
|
||||
gem "bootstrap_form"
|
||||
gem "caxlsx"
|
||||
gem "caxlsx_rails"
|
||||
gem "image_processing", "~> 1.2"
|
||||
gem "openxml-docx"
|
||||
gem "pagy", "~> 9.0"
|
||||
gem "pandoc-ruby"
|
||||
gem "prawn-markup"
|
||||
gem "prawn-rails"
|
||||
gem "sablon"
|
||||
gem "activerecord-enhancedsqlite3-adapter"
|
||||
gem "slim"
|
||||
|
||||
group :development, :test do
|
||||
# See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem
|
||||
gem 'debug', platforms: %i[mri windows]
|
||||
gem "debug", platforms: %i[mri windows]
|
||||
end
|
||||
|
||||
group :development do
|
||||
# Use console on exceptions pages [https://github.com/rails/web-console]
|
||||
gem 'web-console'
|
||||
gem "web-console"
|
||||
|
||||
# Add speed badges [https://github.com/MiniProfiler/rack-mini-profiler]
|
||||
# gem "rack-mini-profiler"
|
||||
|
||||
# Speed up commands on slow machines / big apps [https://github.com/rails/spring]
|
||||
# gem "spring"
|
||||
gem 'rubocop'
|
||||
gem 'rubocop-capybara'
|
||||
gem 'rubocop-rails'
|
||||
gem 'ruby-lsp'
|
||||
gem 'ruby-lsp-rails'
|
||||
gem "brakeman"
|
||||
gem "rubocop"
|
||||
gem "rubocop-capybara"
|
||||
gem "rubocop-rails"
|
||||
gem "rubocop-rails-omakase", require: false
|
||||
gem "ruby-lsp"
|
||||
gem "ruby-lsp-rails"
|
||||
end
|
||||
|
||||
group :test do
|
||||
# Use system testing [https://guides.rubyonrails.org/testing.html#system-testing]
|
||||
gem 'capybara'
|
||||
gem 'selenium-webdriver'
|
||||
gem "capybara"
|
||||
gem "selenium-webdriver"
|
||||
end
|
||||
|
|
|
|||
190
Gemfile.lock
190
Gemfile.lock
|
|
@ -1,80 +1,79 @@
|
|||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
actioncable (7.1.3.4)
|
||||
actionpack (= 7.1.3.4)
|
||||
activesupport (= 7.1.3.4)
|
||||
actioncable (7.2.0)
|
||||
actionpack (= 7.2.0)
|
||||
activesupport (= 7.2.0)
|
||||
nio4r (~> 2.0)
|
||||
websocket-driver (>= 0.6.1)
|
||||
zeitwerk (~> 2.6)
|
||||
actionmailbox (7.1.3.4)
|
||||
actionpack (= 7.1.3.4)
|
||||
activejob (= 7.1.3.4)
|
||||
activerecord (= 7.1.3.4)
|
||||
activestorage (= 7.1.3.4)
|
||||
activesupport (= 7.1.3.4)
|
||||
mail (>= 2.7.1)
|
||||
net-imap
|
||||
net-pop
|
||||
net-smtp
|
||||
actionmailer (7.1.3.4)
|
||||
actionpack (= 7.1.3.4)
|
||||
actionview (= 7.1.3.4)
|
||||
activejob (= 7.1.3.4)
|
||||
activesupport (= 7.1.3.4)
|
||||
mail (~> 2.5, >= 2.5.4)
|
||||
net-imap
|
||||
net-pop
|
||||
net-smtp
|
||||
actionmailbox (7.2.0)
|
||||
actionpack (= 7.2.0)
|
||||
activejob (= 7.2.0)
|
||||
activerecord (= 7.2.0)
|
||||
activestorage (= 7.2.0)
|
||||
activesupport (= 7.2.0)
|
||||
mail (>= 2.8.0)
|
||||
actionmailer (7.2.0)
|
||||
actionpack (= 7.2.0)
|
||||
actionview (= 7.2.0)
|
||||
activejob (= 7.2.0)
|
||||
activesupport (= 7.2.0)
|
||||
mail (>= 2.8.0)
|
||||
rails-dom-testing (~> 2.2)
|
||||
actionpack (7.1.3.4)
|
||||
actionview (= 7.1.3.4)
|
||||
activesupport (= 7.1.3.4)
|
||||
actionpack (7.2.0)
|
||||
actionview (= 7.2.0)
|
||||
activesupport (= 7.2.0)
|
||||
nokogiri (>= 1.8.5)
|
||||
racc
|
||||
rack (>= 2.2.4)
|
||||
rack (>= 2.2.4, < 3.2)
|
||||
rack-session (>= 1.0.1)
|
||||
rack-test (>= 0.6.3)
|
||||
rails-dom-testing (~> 2.2)
|
||||
rails-html-sanitizer (~> 1.6)
|
||||
actiontext (7.1.3.4)
|
||||
actionpack (= 7.1.3.4)
|
||||
activerecord (= 7.1.3.4)
|
||||
activestorage (= 7.1.3.4)
|
||||
activesupport (= 7.1.3.4)
|
||||
useragent (~> 0.16)
|
||||
actiontext (7.2.0)
|
||||
actionpack (= 7.2.0)
|
||||
activerecord (= 7.2.0)
|
||||
activestorage (= 7.2.0)
|
||||
activesupport (= 7.2.0)
|
||||
globalid (>= 0.6.0)
|
||||
nokogiri (>= 1.8.5)
|
||||
actionview (7.1.3.4)
|
||||
activesupport (= 7.1.3.4)
|
||||
actionview (7.2.0)
|
||||
activesupport (= 7.2.0)
|
||||
builder (~> 3.1)
|
||||
erubi (~> 1.11)
|
||||
rails-dom-testing (~> 2.2)
|
||||
rails-html-sanitizer (~> 1.6)
|
||||
activejob (7.1.3.4)
|
||||
activesupport (= 7.1.3.4)
|
||||
activejob (7.2.0)
|
||||
activesupport (= 7.2.0)
|
||||
globalid (>= 0.3.6)
|
||||
activemodel (7.1.3.4)
|
||||
activesupport (= 7.1.3.4)
|
||||
activerecord (7.1.3.4)
|
||||
activemodel (= 7.1.3.4)
|
||||
activesupport (= 7.1.3.4)
|
||||
activemodel (7.2.0)
|
||||
activesupport (= 7.2.0)
|
||||
activerecord (7.2.0)
|
||||
activemodel (= 7.2.0)
|
||||
activesupport (= 7.2.0)
|
||||
timeout (>= 0.4.0)
|
||||
activestorage (7.1.3.4)
|
||||
actionpack (= 7.1.3.4)
|
||||
activejob (= 7.1.3.4)
|
||||
activerecord (= 7.1.3.4)
|
||||
activesupport (= 7.1.3.4)
|
||||
activerecord-enhancedsqlite3-adapter (0.8.0)
|
||||
activerecord (>= 7.1)
|
||||
sqlite3 (>= 1.6)
|
||||
activestorage (7.2.0)
|
||||
actionpack (= 7.2.0)
|
||||
activejob (= 7.2.0)
|
||||
activerecord (= 7.2.0)
|
||||
activesupport (= 7.2.0)
|
||||
marcel (~> 1.0)
|
||||
activesupport (7.1.3.4)
|
||||
activesupport (7.2.0)
|
||||
base64
|
||||
bigdecimal
|
||||
concurrent-ruby (~> 1.0, >= 1.0.2)
|
||||
concurrent-ruby (~> 1.0, >= 1.3.1)
|
||||
connection_pool (>= 2.2.5)
|
||||
drb
|
||||
i18n (>= 1.6, < 2)
|
||||
logger (>= 1.4.2)
|
||||
minitest (>= 5.1)
|
||||
mutex_m
|
||||
tzinfo (~> 2.0)
|
||||
securerandom (>= 0.3)
|
||||
tzinfo (~> 2.0, >= 2.0.5)
|
||||
addressable (2.8.7)
|
||||
public_suffix (>= 2.0.2, < 7.0)
|
||||
ast (2.4.2)
|
||||
|
|
@ -86,6 +85,8 @@ GEM
|
|||
bootstrap_form (5.4.0)
|
||||
actionpack (>= 6.1)
|
||||
activemodel (>= 6.1)
|
||||
brakeman (6.1.2)
|
||||
racc
|
||||
builder (3.3.0)
|
||||
capybara (3.40.0)
|
||||
addressable
|
||||
|
|
@ -155,7 +156,6 @@ GEM
|
|||
mini_mime (1.1.5)
|
||||
minitest (5.24.1)
|
||||
msgpack (1.7.2)
|
||||
mutex_m (0.2.0)
|
||||
net-imap (0.4.14)
|
||||
date
|
||||
net-protocol
|
||||
|
|
@ -178,6 +178,19 @@ GEM
|
|||
racc (~> 1.4)
|
||||
nokogiri (1.16.6-x86_64-linux)
|
||||
racc (~> 1.4)
|
||||
openxml-docx (0.11.5)
|
||||
nokogiri
|
||||
openxml-drawingml
|
||||
openxml-package (>= 0.2.2)
|
||||
ox (~> 2.9)
|
||||
openxml-drawingml (0.3.1)
|
||||
nokogiri
|
||||
openxml-package (~> 0.3.2)
|
||||
openxml-package (0.3.4)
|
||||
nokogiri
|
||||
ox
|
||||
rubyzip
|
||||
ox (2.14.18)
|
||||
pagy (9.0.2)
|
||||
pandoc-ruby (2.1.10)
|
||||
parallel (1.25.1)
|
||||
|
|
@ -214,20 +227,20 @@ GEM
|
|||
rackup (2.1.0)
|
||||
rack (>= 3)
|
||||
webrick (~> 1.8)
|
||||
rails (7.1.3.4)
|
||||
actioncable (= 7.1.3.4)
|
||||
actionmailbox (= 7.1.3.4)
|
||||
actionmailer (= 7.1.3.4)
|
||||
actionpack (= 7.1.3.4)
|
||||
actiontext (= 7.1.3.4)
|
||||
actionview (= 7.1.3.4)
|
||||
activejob (= 7.1.3.4)
|
||||
activemodel (= 7.1.3.4)
|
||||
activerecord (= 7.1.3.4)
|
||||
activestorage (= 7.1.3.4)
|
||||
activesupport (= 7.1.3.4)
|
||||
rails (7.2.0)
|
||||
actioncable (= 7.2.0)
|
||||
actionmailbox (= 7.2.0)
|
||||
actionmailer (= 7.2.0)
|
||||
actionpack (= 7.2.0)
|
||||
actiontext (= 7.2.0)
|
||||
actionview (= 7.2.0)
|
||||
activejob (= 7.2.0)
|
||||
activemodel (= 7.2.0)
|
||||
activerecord (= 7.2.0)
|
||||
activestorage (= 7.2.0)
|
||||
activesupport (= 7.2.0)
|
||||
bundler (>= 1.15.0)
|
||||
railties (= 7.1.3.4)
|
||||
railties (= 7.2.0)
|
||||
rails-dom-testing (2.2.0)
|
||||
activesupport (>= 5.0.0)
|
||||
minitest
|
||||
|
|
@ -235,10 +248,10 @@ GEM
|
|||
rails-html-sanitizer (1.6.0)
|
||||
loofah (~> 2.21)
|
||||
nokogiri (~> 1.14)
|
||||
railties (7.1.3.4)
|
||||
actionpack (= 7.1.3.4)
|
||||
activesupport (= 7.1.3.4)
|
||||
irb
|
||||
railties (7.2.0)
|
||||
actionpack (= 7.2.0)
|
||||
activesupport (= 7.2.0)
|
||||
irb (~> 1.13)
|
||||
rackup (>= 1.0.0)
|
||||
rake (>= 12.2)
|
||||
thor (~> 1.0, >= 1.2.2)
|
||||
|
|
@ -252,7 +265,7 @@ GEM
|
|||
regexp_parser (2.9.2)
|
||||
reline (0.5.9)
|
||||
io-console (~> 0.5)
|
||||
rexml (3.3.1)
|
||||
rexml (3.3.2)
|
||||
strscan
|
||||
rubocop (1.65.0)
|
||||
json (~> 2.3)
|
||||
|
|
@ -269,11 +282,22 @@ GEM
|
|||
parser (>= 3.3.1.0)
|
||||
rubocop-capybara (2.21.0)
|
||||
rubocop (~> 1.41)
|
||||
rubocop-minitest (0.35.1)
|
||||
rubocop (>= 1.61, < 2.0)
|
||||
rubocop-ast (>= 1.31.1, < 2.0)
|
||||
rubocop-performance (1.21.1)
|
||||
rubocop (>= 1.48.1, < 2.0)
|
||||
rubocop-ast (>= 1.31.1, < 2.0)
|
||||
rubocop-rails (2.25.1)
|
||||
activesupport (>= 4.2.0)
|
||||
rack (>= 1.1)
|
||||
rubocop (>= 1.33.0, < 2.0)
|
||||
rubocop-ast (>= 1.31.1, < 2.0)
|
||||
rubocop-rails-omakase (1.0.0)
|
||||
rubocop
|
||||
rubocop-minitest
|
||||
rubocop-performance
|
||||
rubocop-rails
|
||||
ruby-lsp (0.17.7)
|
||||
language_server-protocol (~> 3.17.0)
|
||||
prism (>= 0.29.0, < 0.31)
|
||||
|
|
@ -288,12 +312,16 @@ GEM
|
|||
sablon (0.4.1)
|
||||
nokogiri (>= 1.8.5)
|
||||
rubyzip (>= 1.3.0)
|
||||
selenium-webdriver (4.22.0)
|
||||
securerandom (0.3.1)
|
||||
selenium-webdriver (4.23.0)
|
||||
base64 (~> 0.2)
|
||||
logger (~> 1.4)
|
||||
rexml (~> 3.2, >= 3.2.5)
|
||||
rubyzip (>= 1.2.2, < 3.0)
|
||||
websocket (~> 1.0)
|
||||
slim (5.2.1)
|
||||
temple (~> 0.10.0)
|
||||
tilt (>= 2.1.0)
|
||||
sorbet-runtime (0.5.11481)
|
||||
sprockets (4.2.1)
|
||||
concurrent-ruby (~> 1.0)
|
||||
|
|
@ -302,17 +330,19 @@ GEM
|
|||
actionpack (>= 6.1)
|
||||
activesupport (>= 6.1)
|
||||
sprockets (>= 3.0.0)
|
||||
sqlite3 (1.7.3-aarch64-linux)
|
||||
sqlite3 (1.7.3-arm-linux)
|
||||
sqlite3 (1.7.3-arm64-darwin)
|
||||
sqlite3 (1.7.3-x86-linux)
|
||||
sqlite3 (1.7.3-x86_64-darwin)
|
||||
sqlite3 (1.7.3-x86_64-linux)
|
||||
sqlite3 (2.0.3-aarch64-linux-gnu)
|
||||
sqlite3 (2.0.3-arm-linux-gnu)
|
||||
sqlite3 (2.0.3-arm64-darwin)
|
||||
sqlite3 (2.0.3-x86-linux-gnu)
|
||||
sqlite3 (2.0.3-x86_64-darwin)
|
||||
sqlite3 (2.0.3-x86_64-linux-gnu)
|
||||
stimulus-rails (1.3.3)
|
||||
railties (>= 6.0.0)
|
||||
stringio (3.1.1)
|
||||
strscan (3.1.0)
|
||||
temple (0.10.3)
|
||||
thor (1.3.1)
|
||||
tilt (2.4.0)
|
||||
timeout (0.4.1)
|
||||
ttfunk (1.8.0)
|
||||
bigdecimal (~> 3.1)
|
||||
|
|
@ -323,6 +353,7 @@ GEM
|
|||
tzinfo (2.0.6)
|
||||
concurrent-ruby (~> 1.0)
|
||||
unicode-display_width (2.5.0)
|
||||
useragent (0.16.10)
|
||||
web-console (4.2.1)
|
||||
actionview (>= 6.0.0)
|
||||
activemodel (>= 6.0.0)
|
||||
|
|
@ -346,8 +377,10 @@ PLATFORMS
|
|||
x86_64-linux
|
||||
|
||||
DEPENDENCIES
|
||||
activerecord-enhancedsqlite3-adapter
|
||||
bootsnap
|
||||
bootstrap_form
|
||||
brakeman
|
||||
capybara
|
||||
caxlsx
|
||||
caxlsx_rails
|
||||
|
|
@ -356,21 +389,24 @@ DEPENDENCIES
|
|||
image_processing (~> 1.2)
|
||||
jbuilder
|
||||
jsbundling-rails
|
||||
openxml-docx
|
||||
pagy (~> 9.0)
|
||||
pandoc-ruby
|
||||
prawn-markup
|
||||
prawn-rails
|
||||
puma (>= 5.0)
|
||||
rails (~> 7.1.3, >= 7.1.3.4)
|
||||
rails (~> 7.2)
|
||||
rubocop
|
||||
rubocop-capybara
|
||||
rubocop-rails
|
||||
rubocop-rails-omakase
|
||||
ruby-lsp
|
||||
ruby-lsp-rails
|
||||
sablon
|
||||
selenium-webdriver
|
||||
slim
|
||||
sprockets-rails
|
||||
sqlite3 (~> 1.4)
|
||||
sqlite3 (>= 2.0)
|
||||
stimulus-rails
|
||||
turbo-rails
|
||||
tzinfo-data
|
||||
|
|
|
|||
|
|
@ -115,6 +115,4 @@ $enable-rounded: false;
|
|||
overflow-y: auto;
|
||||
} */
|
||||
|
||||
|
||||
|
||||
@import "./layout";
|
||||
|
|
@ -1,8 +1,10 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module Admin
|
||||
class BackupsController < ApplicationController
|
||||
# GET /admin/backups/1
|
||||
def show
|
||||
send_file Backup.db_xlsx, filename: 'backup.xlsx', disposition: :attachment
|
||||
send_file Backup.db_xlsx, filename: "backup.xlsx", disposition: :attachment
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -3,20 +3,24 @@
|
|||
class ApplicationController < ActionController::Base
|
||||
include Pagy::Backend
|
||||
|
||||
# allow_browser versions: :modern
|
||||
|
||||
before_action :initialize_navbar
|
||||
|
||||
private
|
||||
|
||||
def initialize_navbar
|
||||
@nav_path = controller_name
|
||||
return unless request.get?
|
||||
|
||||
@navbar_items = [
|
||||
{ label: 'Dashboard', icon: :speedometer2, path: :root },
|
||||
{ label: Report.model_name.human(count: 2), icon: :'journal-text', path: :reports },
|
||||
{ label: Checklist.model_name.human(count: 2), icon: :'list-check', path: :checklists },
|
||||
{ label: Check.model_name.human(count: 2), icon: :check2, path: :checks },
|
||||
{ label: Link.model_name.human(count: 2), icon: :link, path: :links },
|
||||
{ label: LinkCategory.model_name.human(count: 2), icon: :"folder", path: :link_categories }
|
||||
{ label: "Dashboard", icon: :speedometer2, path: :root },
|
||||
{ label: Report.model_name.human(count: 2), icon: :'journal-text', path: :reports },
|
||||
{ label: Checklist.model_name.human(count: 2), icon: :'list-check', path: :checklists },
|
||||
{ label: Check.model_name.human(count: 2), icon: :check2, path: :checks },
|
||||
{ label: Link.model_name.human(count: 2), icon: :link, path: :links },
|
||||
{ label: LinkCategory.model_name.human(count: 2), icon: :folder, path: :link_categories }
|
||||
]
|
||||
@search_url = nil # root_url
|
||||
@nav_path = controller_name
|
||||
@search_url = nil
|
||||
end
|
||||
end
|
||||
|
|
|
|||
213
app/controllers/benchmarking_controller.rb
Normal file
213
app/controllers/benchmarking_controller.rb
Normal file
|
|
@ -0,0 +1,213 @@
|
|||
class BenchmarkingController < ApplicationController
|
||||
protect_from_forgery with: :null_session
|
||||
before_action :set_user_update_last_seen_at
|
||||
|
||||
# POST /benchmarking/read_heavy
|
||||
def read_heavy
|
||||
act_and_respond(
|
||||
link_create: 0.1,
|
||||
link_destroy: 0.1,
|
||||
link_show: 0.4,
|
||||
links_index: 0.4,
|
||||
)
|
||||
end
|
||||
|
||||
# POST /benchmarking/write_heavy
|
||||
def write_heavy
|
||||
act_and_respond(
|
||||
link_create: 0.4,
|
||||
link_destroy: 0.4,
|
||||
link_show: 0.1,
|
||||
links_index: 0.1,
|
||||
)
|
||||
end
|
||||
|
||||
# POST /benchmarking/balanced
|
||||
def balanced
|
||||
act_and_respond(
|
||||
link_create: 0.25,
|
||||
link_destroy: 0.25,
|
||||
link_show: 0.25,
|
||||
links_index: 0.25,
|
||||
)
|
||||
end
|
||||
|
||||
def link_create
|
||||
link = LinkCategory.create!(name: "Benchmark #{request.uuid}", description_html: "<pre>#{format(request:)}</pre>")
|
||||
redirect_to link
|
||||
end
|
||||
|
||||
def link_destroy
|
||||
link = LinkCategory.where("id >= ?", rand(LinkCategory.minimum(:id)..LinkCategory.maximum(:id))).limit(1).first
|
||||
link.destroy!
|
||||
redirect_to links_path
|
||||
end
|
||||
|
||||
def link_show
|
||||
@link_category = LinkCategory.where("id >= ?", rand(LinkCategory.minimum(:id)..LinkCategory.maximum(:id))).limit(1).first
|
||||
render "link_categories/show", status: :ok
|
||||
end
|
||||
|
||||
def links_index
|
||||
@link_categories = LinkCategory.where("id >= ?", rand(LinkCategory.minimum(:id)..LinkCategory.maximum(:id))).limit(100)
|
||||
render "link_categories/index", status: :ok
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def set_user_update_last_seen_at
|
||||
# @user = User.where("id >= ?", rand(User.minimum(:id)..User.maximum(:id))).limit(1).first
|
||||
# @user.update!(last_seen_at: Time.now)
|
||||
end
|
||||
|
||||
def act_and_respond(actions_with_weighted_distribution)
|
||||
action = actions_with_weighted_distribution.max_by { |_, weight| rand ** (1.0 / weight) }.first
|
||||
|
||||
send(action)
|
||||
end
|
||||
|
||||
def format(request:)
|
||||
request.headers.to_h.slice(
|
||||
"GATEWAY_INTERFACE",
|
||||
"HTTP_ACCEPT",
|
||||
"HTTP_HOST",
|
||||
"HTTP_USER_AGENT",
|
||||
"HTTP_VERSION",
|
||||
"ORIGINAL_FULLPATH",
|
||||
"ORIGINAL_SCRIPT_NAME",
|
||||
"PATH_INFO",
|
||||
"QUERY_STRING",
|
||||
"REMOTE_ADDR",
|
||||
"REQUEST_METHOD",
|
||||
"REQUEST_PATH",
|
||||
"REQUEST_URI",
|
||||
"SCRIPT_NAME",
|
||||
"SERVER_NAME",
|
||||
"SERVER_PORT",
|
||||
"SERVER_PROTOCOL",
|
||||
"SERVER_SOFTWARE",
|
||||
"action_dispatch.request_id",
|
||||
"puma.request_body_wait",
|
||||
).map { _1.join(": ") }.join("\n")
|
||||
end
|
||||
end
|
||||
|
||||
# class BenchmarkingController < ApplicationController
|
||||
# skip_before_action :verify_authenticity_token
|
||||
# skip_before_action :ensure_user_authenticated!
|
||||
# before_action :set_user_update_last_seen_at
|
||||
|
||||
# # POST /benchmarking/read_heavy
|
||||
# def read_heavy
|
||||
# act_and_respond(
|
||||
# link_create: 0.10,
|
||||
# comment_create: 0.10,
|
||||
# post_destroy: 0.02,
|
||||
# comment_destroy: 0.03,
|
||||
# post_show: 0.25,
|
||||
# posts_index: 0.25,
|
||||
# user_show: 0.25,
|
||||
# )
|
||||
# end
|
||||
|
||||
# # POST /benchmarking/write_heavy
|
||||
# def write_heavy
|
||||
# act_and_respond(
|
||||
# link_create: 0.25,
|
||||
# comment_create: 0.25,
|
||||
# post_destroy: 0.05,
|
||||
# comment_destroy: 0.20,
|
||||
# post_show: 0.05,
|
||||
# posts_index: 0.15,
|
||||
# user_show: 0.05,
|
||||
# )
|
||||
# end
|
||||
|
||||
# # POST /benchmarking/balanced
|
||||
# def balanced
|
||||
# act_and_respond(
|
||||
# link_create: 0.17,
|
||||
# comment_create: 0.17,
|
||||
# post_destroy: 0.05,
|
||||
# comment_destroy: 0.11,
|
||||
# post_show: 0.17,
|
||||
# posts_index: 0.17,
|
||||
# user_show: 0.16,
|
||||
# )
|
||||
# end
|
||||
|
||||
# def link_create
|
||||
# post = Post.create!(user: @user, title: "Post #{request.uuid}", description: format(request:))
|
||||
# redirect_to post
|
||||
# end
|
||||
|
||||
# def comment_create
|
||||
# post = Post.where("id >= ?", rand(Post.minimum(:id)..Post.maximum(:id))).limit(1).first
|
||||
# comment = Comment.create!(user: @user, post: post, body: "Comment #{request.uuid}")
|
||||
# redirect_to comment.post
|
||||
# end
|
||||
|
||||
# def post_destroy
|
||||
# post = Post.where("id >= ?", rand(Post.minimum(:id)..Post.maximum(:id))).limit(1).first
|
||||
# post.destroy!
|
||||
# redirect_to posts_path
|
||||
# end
|
||||
|
||||
# def comment_destroy
|
||||
# comment = Comment.where("id >= ?", rand(Comment.minimum(:id)..Comment.maximum(:id))).limit(1).first
|
||||
# comment.destroy!
|
||||
# redirect_to comment.post
|
||||
# end
|
||||
|
||||
# def post_show
|
||||
# @post = Post.where("id >= ?", rand(Post.minimum(:id)..Post.maximum(:id))).limit(1).first
|
||||
# render "posts/show", status: :ok
|
||||
# end
|
||||
|
||||
# def posts_index
|
||||
# @posts = Post.where("id >= ?", rand(Post.minimum(:id)..Post.maximum(:id))).limit(100)
|
||||
# render "posts/index", status: :ok
|
||||
# end
|
||||
|
||||
# def user_show
|
||||
# render "users/show", status: :ok
|
||||
# end
|
||||
|
||||
# private
|
||||
|
||||
# def set_user_update_last_seen_at
|
||||
# @user = User.where("id >= ?", rand(User.minimum(:id)..User.maximum(:id))).limit(1).first
|
||||
# @user.update!(last_seen_at: Time.now)
|
||||
# end
|
||||
|
||||
# def act_and_respond(actions_with_weighted_distribution)
|
||||
# action = actions_with_weighted_distribution.max_by { |_, weight| rand ** (1.0 / weight) }.first
|
||||
|
||||
# send(action)
|
||||
# end
|
||||
|
||||
# def format(request:)
|
||||
# request.headers.to_h.slice(
|
||||
# "GATEWAY_INTERFACE",
|
||||
# "HTTP_ACCEPT",
|
||||
# "HTTP_HOST",
|
||||
# "HTTP_USER_AGENT",
|
||||
# "HTTP_VERSION",
|
||||
# "ORIGINAL_FULLPATH",
|
||||
# "ORIGINAL_SCRIPT_NAME",
|
||||
# "PATH_INFO",
|
||||
# "QUERY_STRING",
|
||||
# "REMOTE_ADDR",
|
||||
# "REQUEST_METHOD",
|
||||
# "REQUEST_PATH",
|
||||
# "REQUEST_URI",
|
||||
# "SCRIPT_NAME",
|
||||
# "SERVER_NAME",
|
||||
# "SERVER_PORT",
|
||||
# "SERVER_PROTOCOL",
|
||||
# "SERVER_SOFTWARE",
|
||||
# "action_dispatch.request_id",
|
||||
# "puma.request_body_wait",
|
||||
# ).map { _1.join(": ") }.join("\n")
|
||||
# end
|
||||
# end
|
||||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class ChecklistEntriesController < ApplicationController
|
||||
before_action :set_checklist_entry, only: %i[show edit update destroy]
|
||||
|
||||
|
|
@ -7,8 +9,7 @@ class ChecklistEntriesController < ApplicationController
|
|||
end
|
||||
|
||||
# GET /checklist_entries/1
|
||||
def show
|
||||
end
|
||||
def show; end
|
||||
|
||||
# GET /checklist_entries/new
|
||||
def new
|
||||
|
|
@ -16,15 +17,14 @@ class ChecklistEntriesController < ApplicationController
|
|||
end
|
||||
|
||||
# GET /checklist_entries/1/edit
|
||||
def edit
|
||||
end
|
||||
def edit; end
|
||||
|
||||
# POST /checklist_entries
|
||||
def create
|
||||
@checklist_entry = ChecklistEntry.new(checklist_entry_params)
|
||||
|
||||
if @checklist_entry.save
|
||||
redirect_to @checklist_entry.checklist, notice: 'Checklist entry was successfully created.'
|
||||
redirect_to @checklist_entry.checklist, notice: "Checklist entry was successfully created."
|
||||
else
|
||||
render :new, status: :unprocessable_entity
|
||||
end
|
||||
|
|
@ -33,7 +33,7 @@ class ChecklistEntriesController < ApplicationController
|
|||
# PATCH/PUT /checklist_entries/1
|
||||
def update
|
||||
if @checklist_entry.update(checklist_entry_params)
|
||||
redirect_to @checklist_entry.checklist, notice: 'Checklist entry was successfully updated.',
|
||||
redirect_to @checklist_entry.checklist, notice: "Checklist entry was successfully updated.",
|
||||
status: :see_other
|
||||
else
|
||||
render :edit, status: :unprocessable_entity
|
||||
|
|
@ -45,7 +45,7 @@ class ChecklistEntriesController < ApplicationController
|
|||
@checklist_entry.destroy!
|
||||
respond_to do |format|
|
||||
format.html do
|
||||
redirect_to checklist_entries_url, notice: 'Checklist entry was successfully destroyed.', status: :see_other
|
||||
redirect_to checklist_entries_url, notice: "Checklist entry was successfully destroyed.", status: :see_other
|
||||
end
|
||||
format.turbo_stream
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class ChecklistsController < ApplicationController
|
||||
before_action :set_checklist, only: %i[show edit update destroy]
|
||||
|
||||
|
|
@ -7,8 +9,7 @@ class ChecklistsController < ApplicationController
|
|||
end
|
||||
|
||||
# GET /checklists/1
|
||||
def show
|
||||
end
|
||||
def show; end
|
||||
|
||||
# GET /checklists/new
|
||||
def new
|
||||
|
|
@ -16,15 +17,14 @@ class ChecklistsController < ApplicationController
|
|||
end
|
||||
|
||||
# GET /checklists/1/edit
|
||||
def edit
|
||||
end
|
||||
def edit; end
|
||||
|
||||
# POST /checklists
|
||||
def create
|
||||
@checklist = Checklist.new(checklist_params)
|
||||
|
||||
if @checklist.save
|
||||
redirect_to @checklist, notice: 'Checklist was successfully created.'
|
||||
redirect_to @checklist, notice: "Checklist was successfully created."
|
||||
else
|
||||
render :new, status: :unprocessable_entity
|
||||
end
|
||||
|
|
@ -33,7 +33,7 @@ class ChecklistsController < ApplicationController
|
|||
# PATCH/PUT /checklists/1
|
||||
def update
|
||||
if @checklist.update(checklist_params)
|
||||
redirect_to @checklist, notice: 'Checklist was successfully updated.', status: :see_other
|
||||
redirect_to @checklist, notice: "Checklist was successfully updated.", status: :see_other
|
||||
else
|
||||
render :edit, status: :unprocessable_entity
|
||||
end
|
||||
|
|
@ -42,7 +42,7 @@ class ChecklistsController < ApplicationController
|
|||
# DELETE /checklists/1
|
||||
def destroy
|
||||
@checklist.destroy!
|
||||
redirect_to checklists_url, notice: 'Checklist was successfully destroyed.', status: :see_other
|
||||
redirect_to checklists_url, notice: "Checklist was successfully destroyed.", status: :see_other
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
|||
|
|
@ -1,14 +1,19 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class ChecksController < ApplicationController
|
||||
before_action :set_check, only: %i[show edit update destroy]
|
||||
|
||||
# GET /checks or /checks.json
|
||||
def index
|
||||
@pagy, @checks = pagy(Check.search(filter_params[:s]))
|
||||
@pagy, @checks = if filter_params[:s]
|
||||
pagy(Check.search(filter_params[:s]).order(:conformity_level))
|
||||
else
|
||||
pagy(Check.all.order(:conformity_level))
|
||||
end
|
||||
end
|
||||
|
||||
# GET /checks/1 or /checks/1.json
|
||||
def show
|
||||
end
|
||||
def show; end
|
||||
|
||||
# GET /checks/new
|
||||
def new
|
||||
|
|
@ -16,8 +21,7 @@ class ChecksController < ApplicationController
|
|||
end
|
||||
|
||||
# GET /checks/1/edit
|
||||
def edit
|
||||
end
|
||||
def edit; end
|
||||
|
||||
# POST /checks or /checks.json
|
||||
def create
|
||||
|
|
@ -27,11 +31,11 @@ class ChecksController < ApplicationController
|
|||
if @check.save
|
||||
format.html do
|
||||
redirect_to check_url(@check),
|
||||
notice: t('scaffold.model_created_successfully', model: @check.model_name.human)
|
||||
notice: t("scaffold.model_created_successfully", model: @check.model_name.human)
|
||||
end
|
||||
format.json { render :show, status: :created, location: @check }
|
||||
else
|
||||
flash[:alert] = t('there_were_errors', count: @check.errors.size)
|
||||
flash[:alert] = t("there_were_errors", count: @check.errors.size)
|
||||
format.html { render :new, status: :unprocessable_entity }
|
||||
format.json { render json: @check.errors, status: :unprocessable_entity }
|
||||
end
|
||||
|
|
@ -44,7 +48,7 @@ class ChecksController < ApplicationController
|
|||
if @check.update(check_params)
|
||||
format.html do
|
||||
redirect_to check_url(@check),
|
||||
notice: t('scaffold.model_updated_successfully', model: @check.model_name.human)
|
||||
notice: t("scaffold.model_updated_successfully", model: @check.model_name.human)
|
||||
end
|
||||
format.json { render :show, status: :ok, location: @check }
|
||||
else
|
||||
|
|
@ -60,7 +64,7 @@ class ChecksController < ApplicationController
|
|||
|
||||
respond_to do |format|
|
||||
format.html do
|
||||
redirect_to checks_url, notice: t('scaffold.model_destroyed_successfully', model: @check.model_name.human)
|
||||
redirect_to checks_url, notice: t("scaffold.model_destroyed_successfully", model: @check.model_name.human)
|
||||
end
|
||||
format.json { head :no_content }
|
||||
end
|
||||
|
|
@ -79,6 +83,43 @@ class ChecksController < ApplicationController
|
|||
|
||||
# Only allow a list of trusted parameters through.
|
||||
def check_params
|
||||
params.require(:check).permit(:position, :name, :success_criterion, :success_criterion_html, :level)
|
||||
params.require(:check).permit(:principle_id,
|
||||
:number,
|
||||
:name_de,
|
||||
:name_en,
|
||||
:standard_id,
|
||||
:visual,
|
||||
:auditory,
|
||||
:physical,
|
||||
:cognitive,
|
||||
:applicable_to_app,
|
||||
:applicable_to_web,
|
||||
:external_number,
|
||||
:conformity_level,
|
||||
:conformity_notice_de,
|
||||
:conformity_notice_en,
|
||||
:priority,
|
||||
:quick_criterion_de,
|
||||
:quick_criterion_en,
|
||||
:quick_fail_de,
|
||||
:quick_fail_en,
|
||||
:quick_fix_de,
|
||||
:quick_fix_en,
|
||||
:criterion_de,
|
||||
:criterion_en,
|
||||
:criterion_details_de,
|
||||
:criterion_details_en,
|
||||
:example_de,
|
||||
:example_en,
|
||||
:exemption_details_de,
|
||||
:exemption_details_en,
|
||||
:standard_text_de,
|
||||
:standard_text_en,
|
||||
:test_instructions,
|
||||
:powerpoint_text_de,
|
||||
:powerpoint_text_en,
|
||||
:comment,
|
||||
link_ids: [],
|
||||
standard_ids: [])
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class ElementsController < ApplicationController
|
||||
before_action :set_element, only: %i[show edit update destroy]
|
||||
|
||||
|
|
@ -7,8 +9,7 @@ class ElementsController < ApplicationController
|
|||
end
|
||||
|
||||
# GET /elements/1
|
||||
def show
|
||||
end
|
||||
def show; end
|
||||
|
||||
# GET /elements/new
|
||||
def new
|
||||
|
|
@ -16,8 +17,7 @@ class ElementsController < ApplicationController
|
|||
end
|
||||
|
||||
# GET /elements/1/edit
|
||||
def edit
|
||||
end
|
||||
def edit; end
|
||||
|
||||
# POST /elements
|
||||
def create
|
||||
|
|
@ -28,11 +28,11 @@ class ElementsController < ApplicationController
|
|||
|
||||
if @element.save
|
||||
checklist.checks.each do |check|
|
||||
@element.success_criteria.create!(title: check.name, description_html: check.success_criterion_html,
|
||||
@element.success_criteria.create!(title: check.t_name, description_html: check.t_criterion,
|
||||
level: check.level)
|
||||
end
|
||||
respond_to do |format|
|
||||
format.html { redirect_to @element.report, notice: 'Element was successfully created.' }
|
||||
format.html { redirect_to @element.report, notice: "Element was successfully created." }
|
||||
format.turbo_stream
|
||||
end
|
||||
else
|
||||
|
|
@ -43,7 +43,7 @@ class ElementsController < ApplicationController
|
|||
# PATCH/PUT /elements/1
|
||||
def update
|
||||
if @element.update(element_params)
|
||||
redirect_to @element, notice: 'Element was successfully updated.', status: :see_other
|
||||
redirect_to @element, notice: "Element was successfully updated.", status: :see_other
|
||||
else
|
||||
render :edit, status: :unprocessable_entity
|
||||
end
|
||||
|
|
@ -52,7 +52,7 @@ class ElementsController < ApplicationController
|
|||
# DELETE /elements/1
|
||||
def destroy
|
||||
@element.destroy!
|
||||
redirect_to elements_url, notice: 'Element was successfully destroyed.', status: :see_other
|
||||
redirect_to elements_url, notice: "Element was successfully destroyed.", status: :see_other
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class HomeController < ApplicationController
|
||||
def show; end
|
||||
def show
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class LinkCategoriesController < ApplicationController
|
||||
before_action :set_link_category, only: %i[ show edit update destroy ]
|
||||
before_action :set_link_category, only: %i[show edit update destroy]
|
||||
|
||||
# GET /link_categories
|
||||
def index
|
||||
|
|
@ -7,8 +9,7 @@ class LinkCategoriesController < ApplicationController
|
|||
end
|
||||
|
||||
# GET /link_categories/1
|
||||
def show
|
||||
end
|
||||
def show; end
|
||||
|
||||
# GET /link_categories/new
|
||||
def new
|
||||
|
|
@ -16,8 +17,7 @@ class LinkCategoriesController < ApplicationController
|
|||
end
|
||||
|
||||
# GET /link_categories/1/edit
|
||||
def edit
|
||||
end
|
||||
def edit; end
|
||||
|
||||
# POST /link_categories
|
||||
def create
|
||||
|
|
@ -46,13 +46,14 @@ class LinkCategoriesController < ApplicationController
|
|||
end
|
||||
|
||||
private
|
||||
# Use callbacks to share common setup or constraints between actions.
|
||||
def set_link_category
|
||||
@link_category = LinkCategory.find(params[:id])
|
||||
end
|
||||
|
||||
# Only allow a list of trusted parameters through.
|
||||
def link_category_params
|
||||
params.require(:link_category).permit(:name, :description, :rich_text)
|
||||
end
|
||||
# Use callbacks to share common setup or constraints between actions.
|
||||
def set_link_category
|
||||
@link_category = LinkCategory.find(params[:id])
|
||||
end
|
||||
|
||||
# Only allow a list of trusted parameters through.
|
||||
def link_category_params
|
||||
params.require(:link_category).permit(:name, :description, :rich_text)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class LinksController < ApplicationController
|
||||
before_action :set_link, only: %i[show edit update destroy]
|
||||
|
||||
|
|
@ -7,8 +9,7 @@ class LinksController < ApplicationController
|
|||
end
|
||||
|
||||
# GET /links/1
|
||||
def show
|
||||
end
|
||||
def show; end
|
||||
|
||||
# GET /links/new
|
||||
def new
|
||||
|
|
@ -16,15 +17,14 @@ class LinksController < ApplicationController
|
|||
end
|
||||
|
||||
# GET /links/1/edit
|
||||
def edit
|
||||
end
|
||||
def edit; end
|
||||
|
||||
# POST /links
|
||||
def create
|
||||
@link = Link.new(link_params)
|
||||
|
||||
if @link.save
|
||||
redirect_to @link, notice: 'Link was successfully created.'
|
||||
redirect_to @link, notice: "Link was successfully created."
|
||||
else
|
||||
render :new, status: :unprocessable_entity
|
||||
end
|
||||
|
|
@ -33,7 +33,7 @@ class LinksController < ApplicationController
|
|||
# PATCH/PUT /links/1
|
||||
def update
|
||||
if @link.update(link_params)
|
||||
redirect_to @link, notice: 'Link was successfully updated.', status: :see_other
|
||||
redirect_to @link, notice: "Link was successfully updated.", status: :see_other
|
||||
else
|
||||
render :edit, status: :unprocessable_entity
|
||||
end
|
||||
|
|
@ -42,7 +42,7 @@ class LinksController < ApplicationController
|
|||
# DELETE /links/1
|
||||
def destroy
|
||||
@link.destroy!
|
||||
redirect_to links_url, notice: 'Link was successfully destroyed.', status: :see_other
|
||||
redirect_to links_url, notice: "Link was successfully destroyed.", status: :see_other
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class ReportsController < ApplicationController
|
||||
before_action :set_report, only: %i[show edit update destroy work]
|
||||
|
||||
|
|
@ -12,26 +14,56 @@ class ReportsController < ApplicationController
|
|||
format.html
|
||||
format.pdf
|
||||
format.xlsx do
|
||||
response.headers['Content-Disposition'] = %(attachment; filename="#{filename(@report, extension: 'xlsx')}")
|
||||
response.headers["Content-Disposition"] = %(attachment; filename="#{filename(@report, extension: 'xlsx')}")
|
||||
render
|
||||
end
|
||||
format.xml do
|
||||
response.headers['Content-Disposition'] = %(attachment; filename="#{filename(@report, extension: 'html')}")
|
||||
render formats: [:odt], layout: false
|
||||
response.headers["Content-Disposition"] = %(attachment; filename="#{filename(@report, extension: 'html')}")
|
||||
render formats: [ :odt ], layout: false
|
||||
end
|
||||
format.rtf do
|
||||
html = render_to_string(template: 'reports/show', formats: [:odt],
|
||||
html = render_to_string(template: "reports/show", formats: [ :odt ],
|
||||
layout: false)
|
||||
rtf = "{\\rtf1\n#{PandocRuby.html(html).to_rtf}}"
|
||||
send_data rtf, filename: filename(@report, extension: 'rtf')
|
||||
send_data rtf, filename: filename(@report, extension: "rtf")
|
||||
end
|
||||
format.odt do
|
||||
html = render_to_string(layout: false)
|
||||
odt = PandocRuby.html(html).to_odt
|
||||
send_data odt, filename: filename(@report, extension: 'odt')
|
||||
send_data odt, filename: filename(@report, extension: "odt")
|
||||
end
|
||||
format.docx do
|
||||
template = Sablon.template(Rails.root.join('lib/templates/docx/report.docx'))
|
||||
send_file(Docx::Document.new.generate do |document|
|
||||
document.heading1(@report.name)
|
||||
document.paragraph(@report.comment_html)
|
||||
# document.heading1("slfkj")
|
||||
# document.paragraph("sldkfj")
|
||||
@report.elements.each do |element|
|
||||
document.heading2(element.title)
|
||||
element.success_criteria.each do |sc|
|
||||
document.heading3(sc.title)
|
||||
document.paragraph(sc.description_html)
|
||||
end
|
||||
end
|
||||
end, filename: filename(@report, extension: "docx"),
|
||||
type: "application/vnd.openxmlformats-officedocument.wordprocessingml.document")
|
||||
|
||||
return
|
||||
|
||||
text = OpenXml::Docx::Elements::Text.new(@report.name)
|
||||
run = OpenXml::Docx::Elements::Run.new
|
||||
run.bold = true
|
||||
run << text
|
||||
paragraph = OpenXml::Docx::Elements::Paragraph.new
|
||||
paragraph << run
|
||||
|
||||
document = OpenXml::Docx::Package.new
|
||||
document.document << paragraph
|
||||
document.save(Rails.root.join("tmp", "output.docx"))
|
||||
send_file Rails.root.join("tmp", "output.docx")
|
||||
return
|
||||
|
||||
template = Sablon.template(Rails.root.join("lib/templates/docx/report.docx"))
|
||||
context = {
|
||||
person: OpenStruct.new(first_name: @report.name),
|
||||
skills: [],
|
||||
|
|
@ -40,10 +72,10 @@ class ReportsController < ApplicationController
|
|||
referees: []
|
||||
}
|
||||
|
||||
template.render_to_file(Rails.root.join('tmp/output.docx'), context)
|
||||
send_file Rails.root.join('tmp/output.docx'),
|
||||
filename: filename(@report, extension: 'docx'),
|
||||
type: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'
|
||||
template.render_to_file(Rails.root.join("tmp/output.docx"), context)
|
||||
send_file Rails.root.join("tmp/output.docx"),
|
||||
filename: filename(@report, extension: "docx"),
|
||||
type: "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -54,15 +86,14 @@ class ReportsController < ApplicationController
|
|||
end
|
||||
|
||||
# GET /reports/1/edit
|
||||
def edit
|
||||
end
|
||||
def edit; end
|
||||
|
||||
# POST /reports
|
||||
def create
|
||||
@report = Report.new(report_params)
|
||||
|
||||
if @report.save
|
||||
redirect_to @report, notice: 'Report was successfully created.'
|
||||
redirect_to @report, notice: "Report was successfully created."
|
||||
else
|
||||
render :new, status: :unprocessable_entity
|
||||
end
|
||||
|
|
@ -71,7 +102,7 @@ class ReportsController < ApplicationController
|
|||
# PATCH/PUT /reports/1
|
||||
def update
|
||||
if @report.update(report_params)
|
||||
redirect_to @report, notice: 'Report was successfully updated.', status: :see_other
|
||||
redirect_to @report, notice: "Report was successfully updated.", status: :see_other
|
||||
else
|
||||
render :edit, status: :unprocessable_entity
|
||||
end
|
||||
|
|
@ -80,7 +111,7 @@ class ReportsController < ApplicationController
|
|||
# DELETE /reports/1
|
||||
def destroy
|
||||
@report.destroy!
|
||||
redirect_to reports_url, notice: 'Report was successfully destroyed.', status: :see_other
|
||||
redirect_to reports_url, notice: "Report was successfully destroyed.", status: :see_other
|
||||
end
|
||||
|
||||
def work
|
||||
|
|
@ -99,7 +130,7 @@ class ReportsController < ApplicationController
|
|||
params.require(:report).permit(:name, :comment_html)
|
||||
end
|
||||
|
||||
def filename(report, extension: 'html')
|
||||
def filename(report, extension: "html")
|
||||
"#{report.name}-#{Time.current.strftime('%Y%m%d%H%M')}.#{extension}"
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class SuccessCriteriaController < ApplicationController
|
||||
before_action :set_success_criterion, only: %i[show edit update destroy]
|
||||
|
||||
|
|
@ -7,8 +9,7 @@ class SuccessCriteriaController < ApplicationController
|
|||
end
|
||||
|
||||
# GET /success_criteria/1
|
||||
def show
|
||||
end
|
||||
def show; end
|
||||
|
||||
# GET /success_criteria/new
|
||||
def new
|
||||
|
|
@ -16,15 +17,14 @@ class SuccessCriteriaController < ApplicationController
|
|||
end
|
||||
|
||||
# GET /success_criteria/1/edit
|
||||
def edit
|
||||
end
|
||||
def edit; end
|
||||
|
||||
# POST /success_criteria
|
||||
def create
|
||||
@success_criterion = SuccessCriterion.new(success_criterion_params)
|
||||
|
||||
if @success_criterion.save
|
||||
redirect_to @success_criterion, notice: 'Erfolgskriterium was successfully created.'
|
||||
redirect_to @success_criterion, notice: "Erfolgskriterium was successfully created."
|
||||
else
|
||||
render :new, status: :unprocessable_entity
|
||||
end
|
||||
|
|
@ -33,7 +33,7 @@ class SuccessCriteriaController < ApplicationController
|
|||
# PATCH/PUT /success_criteria/1
|
||||
def update
|
||||
if @success_criterion.update(success_criterion_params)
|
||||
redirect_to @success_criterion, notice: 'Erfolgskriterium was successfully updated.', status: :see_other
|
||||
redirect_to @success_criterion, notice: "Erfolgskriterium was successfully updated.", status: :see_other
|
||||
else
|
||||
render :edit, status: :unprocessable_entity
|
||||
end
|
||||
|
|
@ -44,7 +44,7 @@ class SuccessCriteriaController < ApplicationController
|
|||
@success_criterion.destroy!
|
||||
respond_to do |format|
|
||||
format.html do
|
||||
redirect_to success_criteria_url, notice: 'Erfolgskriterium was successfully destroyed.', status: :see_other
|
||||
redirect_to success_criteria_url, notice: "Erfolgskriterium was successfully destroyed.", status: :see_other
|
||||
end
|
||||
format.turbo_stream
|
||||
end
|
||||
|
|
|
|||
|
|
@ -4,4 +4,16 @@ module ApplicationHelper
|
|||
include Pagy::Frontend
|
||||
|
||||
delegate :filter_params, to: :controller
|
||||
|
||||
def multilang_form_field(form, attribute, as: :text_field)
|
||||
col_width = as == :rich_text_area ? 12 : 12 / I18n.available_locales.count
|
||||
tag.div(class: "row") do
|
||||
fields = I18n.available_locales.map { _1.to_s.split("-").first }.map do |lang|
|
||||
tag.div(class: "col-lg-#{col_width}") do
|
||||
form.send(as, "#{attribute}_#{lang}")
|
||||
end
|
||||
end
|
||||
safe_join(fields)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,2 +1,4 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module ChecklistEntriesHelper
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,2 +1,4 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module ChecklistsHelper
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,2 +1,4 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module ChecksHelper
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,2 +1,4 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module ElementsHelper
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,2 +1,4 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module LinkCategoriesHelper
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,2 +1,4 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module LinksHelper
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,17 +1,19 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module PdfHelper
|
||||
def prepare_rich_text(rich_text)
|
||||
return rich_text
|
||||
|
||||
{ del: 'strikethrough' }.each do |tag, replacement|
|
||||
{ del: "strikethrough" }.each do |tag, replacement|
|
||||
rich_text = rich_text.to_s.gsub("<#{tag}", "<#{replacement}")
|
||||
rich_text = rich_text.to_s.gsub("</#{tag}>", "</#{replacement}>")
|
||||
end
|
||||
|
||||
%w[div p del blockquote pre code].each do |tag|
|
||||
rich_text = rich_text.to_s.gsub(%r{<#{tag}.*?>|</#{tag}>}, '')
|
||||
rich_text = rich_text.to_s.gsub(%r{<#{tag}.*?>|</#{tag}>}, "")
|
||||
end
|
||||
rich_text.gsub!(/<h1.*?>/, '')
|
||||
rich_text.gsub!(%r{</h1>}, '<br><br>')
|
||||
rich_text.gsub!(/<h1.*?>/, "")
|
||||
rich_text.gsub!(%r{</h1>}, "<br><br>")
|
||||
rich_text
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,2 +1,4 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module ReportsHelper
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,13 +1,15 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module SuccessCriteriaHelper
|
||||
def success_criterion_result_icon_classes(sc)
|
||||
if sc.passed?
|
||||
'bi bi-check text-success'
|
||||
"bi bi-check text-success"
|
||||
elsif sc.failed?
|
||||
'bi bi-exclamation-lg text-danger'
|
||||
"bi bi-exclamation-lg text-danger"
|
||||
elsif sc.not_applicable?
|
||||
'bi bi-dash text-muted'
|
||||
"bi bi-dash text-muted"
|
||||
else
|
||||
'bi bi-question text-warning'
|
||||
"bi bi-question text-warning"
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -16,13 +18,13 @@ module SuccessCriteriaHelper
|
|||
if edit_mode
|
||||
success_criterion
|
||||
else
|
||||
[:edit,
|
||||
success_criterion]
|
||||
[ :edit,
|
||||
success_criterion ]
|
||||
end
|
||||
else
|
||||
else
|
||||
success_criterion.element
|
||||
end
|
||||
link_to tag.i(class: 'bi bi-pencil'),
|
||||
end
|
||||
link_to tag.i(class: "bi bi-pencil"),
|
||||
path,
|
||||
class: "btn btn-#{edit_mode ? 'link text-warning' : 'link text-secondary'}"
|
||||
end
|
||||
|
|
|
|||
|
|
@ -5,3 +5,4 @@ import * as bootstrap from "bootstrap"
|
|||
|
||||
import "trix"
|
||||
import "@rails/actiontext"
|
||||
|
||||
|
|
|
|||
|
|
@ -21,3 +21,4 @@ application.register("set-theme", SetThemeController)
|
|||
|
||||
import ThemeSwitcherController from "./theme_switcher_controller"
|
||||
application.register("theme-switcher", ThemeSwitcherController)
|
||||
|
||||
|
|
|
|||
133
app/lib/docx/document.rb
Normal file
133
app/lib/docx/document.rb
Normal file
|
|
@ -0,0 +1,133 @@
|
|||
module Docx
|
||||
class Document
|
||||
include OpenXml::Docx::Elements
|
||||
|
||||
def initialize
|
||||
end
|
||||
|
||||
def generate
|
||||
yield(self)
|
||||
|
||||
tmpfile = Tempfile.new("#{Time.current.to_f}.xlsx", Rails.root.join("tmp"))
|
||||
_document.save(tmpfile.path)
|
||||
tmpfile.path
|
||||
end
|
||||
|
||||
def heading1(text)
|
||||
paragraph = create_paragraph(text)
|
||||
paragraph.paragraph_style = "Heading 1"
|
||||
_document.document << paragraph
|
||||
end
|
||||
|
||||
def heading2(text)
|
||||
paragraph = create_paragraph(text)
|
||||
paragraph.paragraph_style = "Heading 2"
|
||||
_document.document << paragraph
|
||||
end
|
||||
|
||||
def heading3(text)
|
||||
paragraph = create_paragraph(text)
|
||||
paragraph.paragraph_style = "Heading 3"
|
||||
_document.document << paragraph
|
||||
end
|
||||
|
||||
def paragraph(text)
|
||||
html = Nokogiri::HTML5.fragment(text)
|
||||
html.search(".trix-content").each do |node|
|
||||
node.children.each do |child|
|
||||
Rails.logger.debug { "content kids: #{child.class}: #{child.name} (#{child.children.size}): #{child.text}" }
|
||||
case child
|
||||
when Nokogiri::XML::Text
|
||||
paragraph = create_paragraph(child.text)
|
||||
_document.document << paragraph
|
||||
when Nokogiri::XML::Element
|
||||
case child.name
|
||||
when "h1"
|
||||
paragraph = create_paragraph(child.text)
|
||||
paragraph.paragraph_style = "Heading 3"
|
||||
when "div"
|
||||
paragraph = Paragraph.new
|
||||
paragraph.paragraph_style = "Body Text"
|
||||
child.children.each do |node|
|
||||
Rails.logger.debug { "div kids: #{node.class}: #{node.name} (#{node.children.size}): #{node.text}" }
|
||||
case node.name
|
||||
when "strong"
|
||||
paragraph << create_run(node.text, bold: true)
|
||||
when "em"
|
||||
paragraph << create_run(node.text, italic: true)
|
||||
when "del"
|
||||
paragraph << create_run(node.text, strike_through: true)
|
||||
when "br"
|
||||
paragraph << create_run("\n")
|
||||
else
|
||||
paragraph << create_run(node.text)
|
||||
end
|
||||
end
|
||||
when "ul"
|
||||
# paragraph = Paragraph.new
|
||||
# paragraph.paragraph_style = "Body Text"
|
||||
# # Create an abstract numbering that describes a bulleted list:
|
||||
# abstract_numbering = AbstractNumbering.new(0)
|
||||
|
||||
# # Each numbering can have multiple levels. Define the first level as a bulleted list:
|
||||
# level_0 = Level.new
|
||||
# level_0.level = 0
|
||||
# level_0.start = 1
|
||||
# level_0.number_format = :bullet
|
||||
# # This is the default bullet Word uses
|
||||
# level_0.level_text = "\u00B7".encode("UTF-8")
|
||||
# level_0.alignment = :left
|
||||
# level_0.character_style.font.ascii = "Symbol"
|
||||
# level_0.character_style.font.high_ansi = "Symbol"
|
||||
# level_0.character_style.font.hint = :default
|
||||
# level_0.paragraph_style.indentation.left = 720
|
||||
# level_0.paragraph_style.indentation.hanging = 360
|
||||
# abstract_numbering << level_0
|
||||
|
||||
# _document.numbering << abstract_numbering
|
||||
when "ol"
|
||||
else
|
||||
paragraph = create_paragraph(child.text)
|
||||
paragraph.paragraph_style = "Body Text"
|
||||
end
|
||||
|
||||
_document.document << paragraph
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def create_run(content, bold: false, italic: false, strike_through: false)
|
||||
text = Text.new(content)
|
||||
text.space = :preserve
|
||||
run = Run.new
|
||||
run.bold = bold
|
||||
run.italics = italic
|
||||
run.strikethrough = strike_through
|
||||
run << text
|
||||
run
|
||||
end
|
||||
|
||||
def create_paragraph(content)
|
||||
text = case content
|
||||
when String
|
||||
Text.new(content)
|
||||
when ActionText::RichText
|
||||
Text.new(content.to_plain_text)
|
||||
else
|
||||
Text.new(content.to_s)
|
||||
end
|
||||
run = Run.new
|
||||
run << text
|
||||
paragraph = Paragraph.new
|
||||
paragraph << run
|
||||
paragraph
|
||||
end
|
||||
|
||||
def _document
|
||||
@_document ||= OpenXml::Docx::Package.new
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,7 +1,12 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module LinkChecker
|
||||
UA = "Mozilla/5.0 (Android 4.4; Mobile; rv:41.0) Gecko/41.0 Firefox/41.0"
|
||||
module_function def http(input)
|
||||
response = Net::HTTP.get_response(URI.parse(input), {"User-Agent": UA})
|
||||
|
||||
module_function
|
||||
|
||||
def http(input)
|
||||
response = Net::HTTP.get_response(URI.parse(input), { 'User-Agent': UA })
|
||||
# debugger
|
||||
case response
|
||||
when Net::HTTPSuccess
|
||||
|
|
@ -13,4 +18,3 @@ module LinkChecker
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class ApplicationMailer < ActionMailer::Base
|
||||
default from: 'from@example.com'
|
||||
layout 'mailer'
|
||||
default from: "from@example.com"
|
||||
layout "mailer"
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module ActionText
|
||||
class RichText < Record
|
||||
before_save do
|
||||
|
|
|
|||
|
|
@ -1,10 +1,12 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module Admin
|
||||
class Backup
|
||||
class << self
|
||||
def zip
|
||||
create_records_xlsx
|
||||
|
||||
ZipFileGenerator.new(Rails.root.join('storage')).write
|
||||
ZipFileGenerator.new(Rails.root.join("storage")).write
|
||||
end
|
||||
|
||||
def db_xlsx
|
||||
|
|
@ -21,7 +23,7 @@ module Admin
|
|||
end
|
||||
end
|
||||
end
|
||||
path = Rails.root.join('storage/data.xls')
|
||||
path = Rails.root.join("storage/data.xls")
|
||||
xlsx.serialize(path)
|
||||
path
|
||||
end
|
||||
|
|
@ -29,7 +31,7 @@ module Admin
|
|||
private
|
||||
|
||||
def file_path(name)
|
||||
Rails.root.join('storage', name)
|
||||
Rails.root.join("storage", name)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -53,9 +55,9 @@ module Admin
|
|||
# Zip the input directory.
|
||||
def write
|
||||
entries = Dir.entries(@input_dir) - %w[. ..]
|
||||
path = Rails.root.join('tmp', Time.now.to_i.to_s)
|
||||
path = Rails.root.join("tmp", Time.now.to_i.to_s)
|
||||
::Zip::File.open(path, create: true) do |zipfile|
|
||||
write_entries entries, '', zipfile
|
||||
write_entries entries, "", zipfile
|
||||
end
|
||||
path
|
||||
end
|
||||
|
|
@ -65,7 +67,7 @@ module Admin
|
|||
# A helper method to make the recursion work.
|
||||
def write_entries(entries, path, zipfile)
|
||||
entries.each do |e|
|
||||
zipfile_path = path == '' ? e : File.join(path, e)
|
||||
zipfile_path = path == "" ? e : File.join(path, e)
|
||||
disk_file_path = File.join(@input_dir, zipfile_path)
|
||||
|
||||
if File.directory? disk_file_path
|
||||
|
|
|
|||
|
|
@ -2,4 +2,17 @@
|
|||
|
||||
class ApplicationRecord < ActiveRecord::Base
|
||||
primary_abstract_class
|
||||
|
||||
class << self
|
||||
def translates_attributes(*attributes)
|
||||
attributes.each do |attribute|
|
||||
define_method("t_#{attribute}") do
|
||||
lang = I18n.locale.to_s.split("-").first
|
||||
send("#{attribute}_#{lang}")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
alias_method :translates_attribute, :translates_attributes
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,11 +1,67 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class Check < ApplicationRecord
|
||||
include RichTextTargetBlank
|
||||
|
||||
enum :level, %i[A AA AAA]
|
||||
belongs_to :principle
|
||||
|
||||
has_rich_text :success_criterion_html
|
||||
has_and_belongs_to_many :links
|
||||
has_and_belongs_to_many :standards
|
||||
|
||||
scope :search, lambda { |term|
|
||||
joins("INNER JOIN action_text_rich_texts ON action_text_rich_texts.record_id = checks.id AND record_type = 'Check'").where('checks.name LIKE :term OR action_text_rich_texts.body_text LIKE :term', term: "%#{term}%")
|
||||
}
|
||||
accepts_nested_attributes_for :links, allow_destroy: true
|
||||
|
||||
enum :conformity_level, %i[A AA AAA]
|
||||
enum :priority, %i[highest high normal low]
|
||||
|
||||
has_rich_text :conformity_notice_de
|
||||
has_rich_text :conformity_notice_en
|
||||
has_rich_text :quick_criterion_de
|
||||
has_rich_text :quick_criterion_en
|
||||
has_rich_text :quick_fail_de
|
||||
has_rich_text :quick_fail_en
|
||||
has_rich_text :quick_fix_de
|
||||
has_rich_text :quick_fix_en
|
||||
|
||||
has_rich_text :criterion_de
|
||||
has_rich_text :criterion_en
|
||||
has_rich_text :criterion_details_de
|
||||
has_rich_text :criterion_details_en
|
||||
has_rich_text :example_de
|
||||
has_rich_text :example_en
|
||||
has_rich_text :exemption_details_de
|
||||
has_rich_text :exemption_details_en
|
||||
has_rich_text :standard_text_de
|
||||
has_rich_text :standard_text_en
|
||||
|
||||
has_rich_text :test_instructions
|
||||
|
||||
has_rich_text :powerpoint_text_de
|
||||
has_rich_text :powerpoint_text_en
|
||||
|
||||
has_rich_text :comment
|
||||
|
||||
translates_attributes :name,
|
||||
:conformity_notice,
|
||||
:quick_criterion,
|
||||
:quick_fail,
|
||||
:quick_fix,
|
||||
:criterion,
|
||||
:criterion_details,
|
||||
:example,
|
||||
:exemption_details,
|
||||
:standard_text,
|
||||
:powerpoint_text
|
||||
|
||||
scope(:search, lambda do |term|
|
||||
# TODO: Search only fields for current locale.
|
||||
joins("INNER JOIN action_text_rich_texts ON action_text_rich_texts.record_id = checks.id AND record_type = 'Check'").where("checks.name_de LIKE :term OR checks.name_de LIKE :term OR action_text_rich_texts.body LIKE :term", term: "%#{term}%").distinct
|
||||
end)
|
||||
|
||||
def display_target_disabilities
|
||||
%i[visual auditory physical cognitive].select { |d| send(:"#{d}?") }.map { |d| I18n.t("disability.#{d}") }.map(&:first).join(", ")
|
||||
end
|
||||
|
||||
def display_applicabilities
|
||||
%i[applicable_to_app applicable_to_web].select { |a| send(:"#{a}?") }.map { |a| I18n.t("applicability.#{a}") }.map(&:first).join(", ")
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class Checklist < ApplicationRecord
|
||||
has_many :checklist_entries, -> { order(position: :asc) }, dependent: :destroy, inverse_of: :checklist
|
||||
has_many :checks, through: :checklist_entries
|
||||
|
|
|
|||
|
|
@ -1,12 +1,15 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class ChecklistEntry < ApplicationRecord
|
||||
belongs_to :checklist
|
||||
belongs_to :check
|
||||
|
||||
before_validation :set_position
|
||||
after_validation :normalize_positions
|
||||
before_create :update_positions
|
||||
before_update :update_positions, if: :position_changed?
|
||||
|
||||
def set_position
|
||||
self.position ||= checklist.checklist_entries.maximum(:position).to_i + 1
|
||||
self.position ||= (checklist.checklist_entries.pluck(:position).max || 0) + 1
|
||||
end
|
||||
|
||||
def normalize_positions
|
||||
|
|
@ -15,4 +18,11 @@ class ChecklistEntry < ApplicationRecord
|
|||
# entry.update_column(:position, index + 1) if entry.position != index + 1
|
||||
# end
|
||||
end
|
||||
|
||||
def update_positions
|
||||
if position_was
|
||||
checklist.checklist_entries.where("position > ?", position_was).update_all("position = position - 1")
|
||||
end
|
||||
checklist.checklist_entries.where(position: position..).update_all("position = position + 1")
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module RichTextTargetBlank
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
|
|
@ -11,7 +13,7 @@ module RichTextTargetBlank
|
|||
rich_text_attribute = send(name)
|
||||
if rich_text_attribute.present?
|
||||
doc = Nokogiri::HTML::DocumentFragment.parse(rich_text_attribute.body.to_html)
|
||||
doc.css('a').each { |a| a['target'] ||= '_blank' }
|
||||
doc.css("a").each { |a| a["target"] ||= "_blank" }
|
||||
rich_text_attribute.body = doc.to_html
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class Element < ApplicationRecord
|
||||
attr_accessor :checklist_id
|
||||
|
||||
|
|
@ -22,8 +24,8 @@ class Element < ApplicationRecord
|
|||
|
||||
return nil if possible_levels.empty?
|
||||
|
||||
puts possible_levels.inspect
|
||||
puts min_failed
|
||||
Rails.logger.debug possible_levels.inspect
|
||||
Rails.logger.debug min_failed
|
||||
possible_levels[possible_levels.find_index(min_failed) - 1]
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,11 @@
|
|||
require 'net/http'
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "net/http"
|
||||
|
||||
class Link < ApplicationRecord
|
||||
belongs_to :link_category
|
||||
has_and_belongs_to_many :checks
|
||||
|
||||
has_rich_text :description_html
|
||||
|
||||
validates :url, :text, presence: true
|
||||
|
|
@ -10,13 +14,21 @@ class Link < ApplicationRecord
|
|||
|
||||
before_validation :ensure_absolute_url
|
||||
|
||||
def t_text
|
||||
text
|
||||
end
|
||||
|
||||
def ok?
|
||||
fail_count == 0
|
||||
fail_count.zero?
|
||||
end
|
||||
|
||||
def to_s
|
||||
"#{text} (#{url})"
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
USER_AGENT = 'Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/115.0'
|
||||
USER_AGENT = "Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/115.0"
|
||||
|
||||
def check_url(input = url, add_error = true)
|
||||
response = begin
|
||||
|
|
|
|||
|
|
@ -1,5 +1,11 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class LinkCategory < ApplicationRecord
|
||||
has_many :links
|
||||
|
||||
has_rich_text :description_html
|
||||
has_rich_text :description
|
||||
|
||||
def t_name
|
||||
name
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module PdfDocuments
|
||||
class Base
|
||||
attr_reader :params
|
||||
|
|
@ -11,7 +13,7 @@ module PdfDocuments
|
|||
# exta_bold: 'vendor/assets/fonts/Lexend-ExtraBold.ttf',
|
||||
# italic: 'vendor/assets/fonts/Lexend-Regular.ttf'
|
||||
# })
|
||||
@prawn_document.font 'Helvetica', size: 12
|
||||
@prawn_document.font "Helvetica", size: 12
|
||||
@params = OpenStruct.new(params)
|
||||
end
|
||||
|
||||
|
|
@ -47,7 +49,7 @@ module PdfDocuments
|
|||
end
|
||||
|
||||
def hr
|
||||
@prawn_document.markup '<hr>'
|
||||
@prawn_document.markup "<hr>"
|
||||
end
|
||||
|
||||
def markup_options
|
||||
|
|
@ -63,12 +65,12 @@ module PdfDocuments
|
|||
end
|
||||
|
||||
def logo
|
||||
@prawn_document.image 'app/assets/images/logo-apfelschule.png', width: 150
|
||||
@prawn_document.image "app/assets/images/logo-apfelschule.png", width: 150
|
||||
@prawn_document.move_down 30
|
||||
end
|
||||
|
||||
def prepare_rich_text(rich_text)
|
||||
{ h1: 'h4' }.each do |tag, replacement|
|
||||
{ h1: "h4" }.each do |tag, replacement|
|
||||
rich_text = rich_text.to_s.gsub("<#{tag}", "<#{replacement}")
|
||||
rich_text = rich_text.to_s.gsub("</#{tag}>", "</#{replacement}>")
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,19 +1,21 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module PdfDocuments
|
||||
class CustomerReport < Base
|
||||
private
|
||||
|
||||
def generate
|
||||
logo
|
||||
@prawn_document.formatted_text_box [{
|
||||
@prawn_document.formatted_text_box [ {
|
||||
text: "Dieses Dokument wurd am #{Time.current.strftime('%d %B %Y')} um #{Time.current.strftime('%H:%M:%S')} erstellt.", size: 8, align: :right
|
||||
}], align: :right
|
||||
} ], align: :right
|
||||
|
||||
heading1 params.report.name
|
||||
rich_text params.report.comment_html
|
||||
|
||||
params.report.elements.each.with_index(1) do |element, element_index|
|
||||
heading2 "#{element_index} #{element.title}"
|
||||
formatted_text [{ text: element.path, styles: %i[bold italic underline] }]
|
||||
formatted_text [ { text: element.path, styles: %i[bold italic underline] } ]
|
||||
move_down(5)
|
||||
rich_text element.description_html
|
||||
|
||||
|
|
|
|||
3
app/models/principle.rb
Normal file
3
app/models/principle.rb
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
class Principle < ApplicationRecord
|
||||
translates_attribute :name
|
||||
end
|
||||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class Report < ApplicationRecord
|
||||
has_rich_text :comment_html
|
||||
|
||||
|
|
|
|||
5
app/models/standard.rb
Normal file
5
app/models/standard.rb
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
class Standard < ApplicationRecord
|
||||
has_and_belongs_to_many :checks
|
||||
|
||||
translates_attribute :name
|
||||
end
|
||||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class SuccessCriterion < ApplicationRecord
|
||||
enum :result, %i[passed failed not_applicable]
|
||||
enum :level, %i[A AA AAA]
|
||||
|
|
|
|||
|
|
@ -1,2 +1,4 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
json.extract! checklist_entry, :id, :checklist_id, :check_id, :position, :created_at, :updated_at
|
||||
json.url checklist_entry_url(checklist_entry, format: :json)
|
||||
|
|
|
|||
|
|
@ -1 +1,3 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
json.array! @checklist_entries, partial: "checklist_entries/checklist_entry", as: :checklist_entry
|
||||
|
|
|
|||
|
|
@ -1 +1,3 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
json.partial! "checklist_entries/checklist_entry", checklist_entry: @checklist_entry
|
||||
|
|
|
|||
|
|
@ -1,2 +1,4 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
json.extract! checklist, :id, :code, :name, :description_html, :created_at, :updated_at
|
||||
json.url checklist_url(checklist, format: :json)
|
||||
|
|
|
|||
|
|
@ -1 +1,3 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
json.array! @checklists, partial: "checklists/checklist", as: :checklist
|
||||
|
|
|
|||
|
|
@ -1 +1,3 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
json.partial! "checklists/checklist", checklist: @checklist
|
||||
|
|
|
|||
|
|
@ -1,22 +0,0 @@
|
|||
<div id="<%= dom_id check %>">
|
||||
<p>
|
||||
<strong><%= Check.human_attribute_name(:position) %>:</strong>
|
||||
<%= check.position %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong><%= Check.human_attribute_name(:name) %>:</strong>
|
||||
<%= check.name %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong><%= Check.human_attribute_name(:success_criterion_html) %>:</strong>
|
||||
<%= check.success_criterion_html %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong><%= Check.human_attribute_name(:level) %>:</strong>
|
||||
<%= check.level %>
|
||||
</p>
|
||||
|
||||
</div>
|
||||
68
app/views/checks/_check.html.slim
Normal file
68
app/views/checks/_check.html.slim
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
div id=dom_id(check)
|
||||
table.table
|
||||
tbody
|
||||
tr
|
||||
th = Check.human_attribute_name(:id)
|
||||
td = check.id
|
||||
tr
|
||||
th = Principle.model_name.human
|
||||
td = check.principle&.t_name
|
||||
tr
|
||||
th = Check.human_attribute_name(:number)
|
||||
td = check.number
|
||||
tr
|
||||
th = Check.human_attribute_name(:name)
|
||||
td = check.t_name
|
||||
tr
|
||||
th = Standard.model_name.human(count: check.standard_ids.size)
|
||||
td = check.standards.map(&:t_name).join(", ")
|
||||
tr
|
||||
th = Check.human_attribute_name(:target_disabilities)
|
||||
td = check.display_target_disabilities
|
||||
tr
|
||||
th = Check.human_attribute_name(:applicabilities)
|
||||
td = check.display_applicabilities
|
||||
tr
|
||||
th = Check.human_attribute_name(:external_number)
|
||||
td = check.external_number
|
||||
tr
|
||||
th = Check.human_attribute_name(:conformity_level)
|
||||
td = check.conformity_level
|
||||
tr
|
||||
th = Check.human_attribute_name(:conformity_notice_de)
|
||||
td = check.conformity_notice_de
|
||||
tr
|
||||
th = Check.human_attribute_name(:conformity_notice_en)
|
||||
td = check.conformity_notice_en
|
||||
tr
|
||||
th = Check.human_attribute_name(:priority)
|
||||
td = check.priority
|
||||
tr
|
||||
th = Check.human_attribute_name(:quick_criterion_de)
|
||||
td = check.quick_criterion_de
|
||||
tr
|
||||
th = Check.human_attribute_name(:quick_criterion_en)
|
||||
td = check.quick_criterion_en
|
||||
tr
|
||||
th = Check.human_attribute_name(:quick_fail_de)
|
||||
td = check.quick_fail_de
|
||||
tr
|
||||
th = Check.human_attribute_name(:quick_fail_en)
|
||||
td = check.quick_fail_en
|
||||
tr
|
||||
th = Check.human_attribute_name(:quick_fix_de)
|
||||
td = check.quick_fix_de
|
||||
tr
|
||||
th = Check.human_attribute_name(:quick_fix_en)
|
||||
td = check.quick_fix_en
|
||||
tr
|
||||
th = Link.model_name.human(count: check.links.size)
|
||||
td
|
||||
.row
|
||||
.col
|
||||
- check.links.map(&:link_category).uniq.each do |category|
|
||||
span = category.name
|
||||
ul
|
||||
- check.links.select{ _1.link_category == category }.map { |link| link_to link.text, link.url, target: :_blank }.each do |link|
|
||||
li = link
|
||||
|
||||
|
|
@ -1,2 +1,4 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
json.extract! check, :id, :position, :name, :success_criterion_html, :level, :created_at, :updated_at
|
||||
json.url check_url(check, format: :json)
|
||||
|
|
|
|||
|
|
@ -1,7 +0,0 @@
|
|||
<%= bootstrap_form_with(model: check, remote: true) do |form| %>
|
||||
<%= form.text_field :position %>
|
||||
<%= form.text_field :name %>
|
||||
<%= form.rich_text_area :success_criterion_html %>
|
||||
<%= form.select :level, Check.levels.keys, add_blank: !form.object.level.present? %>
|
||||
<%= form.submit %>
|
||||
<% end %>
|
||||
53
app/views/checks/_form.html.slim
Normal file
53
app/views/checks/_form.html.slim
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
= bootstrap_form_with(model: check, remote: true) do |form|
|
||||
h2 Details
|
||||
= form.collection_select :principle_id, Principle.all.sort_by(&:t_name), :id, :t_name
|
||||
= form.text_field :number
|
||||
= multilang_form_field(form, :name)
|
||||
= form.collection_check_boxes :standard_ids, Standard.all.sort_by(&:t_name), :id, :t_name, include_blank: true
|
||||
h2 Zugänglichkeit
|
||||
.row
|
||||
.col-md-3
|
||||
= form.check_box :visual, label: t("disability.visual").capitalize
|
||||
.col-md-3
|
||||
= form.check_box :auditory, label: t("disability.auditory").capitalize
|
||||
.col-md-3
|
||||
= form.check_box :physical, label: t("disability.physical").capitalize
|
||||
.col-md-3
|
||||
= form.check_box :cognitive, label: t("disability.cognitive").capitalize
|
||||
h2 Anwendbarkeit
|
||||
.row
|
||||
.col-md-6
|
||||
= form.check_box :applicable_to_web, label: t("applicability.applicable_to_web").capitalize
|
||||
.col-md-6
|
||||
= form.check_box :applicable_to_app, label: t("applicability.applicable_to_app").capitalize
|
||||
h2 Richtlinie
|
||||
= form.text_field :external_number
|
||||
= form.select :conformity_level, Check.conformity_levels.keys, include_blank: true
|
||||
= multilang_form_field(form, :conformity_notice, as: :rich_text_area)
|
||||
|
||||
= form.select :priority, Check.priorities.keys.map{ [t("priority.#{_1}"), _1] }, include_blank: true
|
||||
h2 Quick Infos
|
||||
= multilang_form_field(form, :quick_criterion, as: :rich_text_area)
|
||||
= multilang_form_field(form, :quick_fail, as: :rich_text_area)
|
||||
= multilang_form_field(form, :quick_fix, as: :rich_text_area)
|
||||
|
||||
h2 Regular-Kriterium
|
||||
= multilang_form_field(form, :criterion, as: :rich_text_area)
|
||||
= multilang_form_field(form, :criterion_details, as: :rich_text_area)
|
||||
= multilang_form_field(form, :example, as: :rich_text_area)
|
||||
= multilang_form_field(form, :exemption_details, as: :rich_text_area)
|
||||
= multilang_form_field(form, :standard_text, as: :rich_text_area)
|
||||
|
||||
h2 Intern
|
||||
= form.rich_text_area :test_instructions
|
||||
= multilang_form_field(form, :powerpoint_text, as: :rich_text_area)
|
||||
= form.rich_text_area :comment
|
||||
|
||||
h2 Links
|
||||
- LinkCategory.all.sort_by(&:t_name).each do |c|
|
||||
h3 = c.t_name
|
||||
= form.collection_check_boxes(:link_ids, c.links.sort_by(&:t_text), :id, :to_s, hide_label: true)
|
||||
/ = form.collection_check_boxes :link_ids, Link.all.sort_by(&:text), :id, :to_s
|
||||
|
||||
/ = form.rich_text_area :success_criterion_de
|
||||
= form.submit
|
||||
|
|
@ -15,18 +15,24 @@
|
|||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><%= Check.human_attribute_name(:id) %></th>
|
||||
<th><%= Check.human_attribute_name(:level) %></th>
|
||||
<th><%= Check.human_attribute_name(:number) %></th>
|
||||
<th><%= Check.human_attribute_name(:name) %></th>
|
||||
<th><%= Check.human_attribute_name(:success_criterion_html) %></th>
|
||||
<th><%= Check.human_attribute_name(:standards) %></th>
|
||||
<th><%= t("checks.target_disabilities") %></th>
|
||||
<th><%= t("checks.applicability") %></th>
|
||||
<th><%= Check.human_attribute_name(:external_number) %></th>
|
||||
<th><%= Check.human_attribute_name(:conformity_level) %></th>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @checks.each do |check| %>
|
||||
<tr>
|
||||
<td><%= check.id %></td>
|
||||
<td><%= check.level %></td>
|
||||
<td><%= link_to(check.name, url_for(check)) %></td>
|
||||
<td><%= link_to(truncate(strip_tags(check.success_criterion_html.to_s)), url_for(check)) %></td>
|
||||
<td><%= check.number %></td>
|
||||
<td><%= check.t_name %></td>
|
||||
<td><%= check.standards.map(&:t_name).join(", ") %></td>
|
||||
<td><%= check.display_target_disabilities %></td>
|
||||
<td><%= check.t_name %></td>
|
||||
<td><%= check.t_name %></td>
|
||||
<td><%= link_to(check.t_name, url_for(check)) %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
51
app/views/checks/index.html.slim
Normal file
51
app/views/checks/index.html.slim
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
h1
|
||||
= t("scaffold.pagetitle_index", model: Check.model_name.human(count: 2))
|
||||
= bootstrap_form_with(url: checks_path(page: params[:page]), method: :get, scope: :filter) do |form|
|
||||
= form.hidden_field :page, value: params[:page] if params[:page]
|
||||
.row
|
||||
.col-md-3
|
||||
= form.text_field(:s, placeholder: "suchen...", hide_label: true, value: filter_params[:s])
|
||||
.col
|
||||
= form.submit name: "", value: "Suchen"
|
||||
= link_to "Filter löschen", checks_path, class: "btn btn-outline-secondary ms-3" if filter_params[:s]
|
||||
table.table.table-striped
|
||||
thead
|
||||
tr
|
||||
th ID
|
||||
th
|
||||
= Check.human_attribute_name(:number)
|
||||
th
|
||||
= Check.human_attribute_name(:name)
|
||||
th
|
||||
= Check.human_attribute_name(:standard_ids)
|
||||
th
|
||||
= Check.human_attribute_name(:target_disability)
|
||||
th
|
||||
= Check.human_attribute_name(:applicability)
|
||||
th
|
||||
= Check.human_attribute_name(:external_number)
|
||||
th
|
||||
= Check.human_attribute_name(:conformity_level)
|
||||
tbody
|
||||
- @checks.each do |check|
|
||||
tr
|
||||
td = link_to check.id, check
|
||||
td
|
||||
= link_to(check.number, check)
|
||||
td
|
||||
= link_to check.t_name&.truncate(64), check
|
||||
td
|
||||
= link_to check.standards.map(&:t_name).join(", "), check
|
||||
td
|
||||
= link_to check.display_target_disabilities, check
|
||||
td
|
||||
= link_to check.display_applicabilities, check
|
||||
td
|
||||
= link_to check.external_number, check
|
||||
td
|
||||
= link_to check.conformity_level, check
|
||||
.my-3
|
||||
== pagy_info(@pagy)
|
||||
== pagy_bootstrap_nav(@pagy)
|
||||
.action-row
|
||||
= link_to t("scaffold.link_new", model: Check.model_name.human), new_check_path
|
||||
|
|
@ -1 +1,3 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
json.array! @checks, partial: "checks/check", as: :check
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
<h1><%= t("scaffold.pagetitle_show", model: @check.class.model_name.human) %></h1>
|
||||
<h1><%= @check.t_name %></h1>
|
||||
|
||||
<%= render @check %>
|
||||
|
||||
|
|
|
|||
|
|
@ -1 +1,3 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
json.partial! "checks/check", check: @check
|
||||
|
|
|
|||
|
|
@ -1,2 +1,4 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
json.extract! element, :id, :report_id, :path, :title, :description_html, :created_at, :updated_at
|
||||
json.url element_url(element, format: :json)
|
||||
|
|
|
|||
|
|
@ -1 +1,3 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
json.array! @elements, partial: "elements/element", as: :element
|
||||
|
|
|
|||
|
|
@ -1 +1,3 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
json.partial! "elements/element", element: @element
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<!doctype html>
|
||||
<html <%== cookies[:"modeTheme"] && "data-bs-theme=\"#{cookies[:"modeTheme"]}\"" %> data-controller="set-theme">
|
||||
<html data-bs-theme="<%= cookies[:"modeTheme"] || "light" %>" data-controller="set-theme">
|
||||
<head>
|
||||
<title>a11ydive</title>
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
<p>
|
||||
<strong>Description:</strong>
|
||||
<%= link_category.description_html %>
|
||||
<%= link_category.description %>
|
||||
</p>
|
||||
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,2 +1,4 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
json.extract! link_category, :id, :name, :description, :rich_text, :created_at, :updated_at
|
||||
json.url link_category_url(link_category, format: :json)
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
<td><%= link_to(link_category.name, url_for(link_category)) %></td>
|
||||
|
||||
<td><%= link_to(link_category.description, url_for(link_category)) %></td>
|
||||
<td><%= link_to(truncate(link_category.description.to_plain_text), url_for(link_category)) %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
|
|
|
|||
|
|
@ -1 +1,3 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
json.array! @link_categories, partial: "link_categories/link_category", as: :link_category
|
||||
|
|
|
|||
|
|
@ -1 +1,3 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
json.partial! "link_categories/link_category", link_category: @link_category
|
||||
|
|
|
|||
|
|
@ -1,3 +1,6 @@
|
|||
json.extract! link, :id, :url, :text, :description, :last_check_at, :fail_count, :link_category_id, :created_at, :updated_at
|
||||
# frozen_string_literal: true
|
||||
|
||||
json.extract! link, :id, :url, :text, :description, :last_check_at, :fail_count, :link_category_id, :created_at,
|
||||
:updated_at
|
||||
json.url link_url(link, format: :json)
|
||||
json.description link.description.to_s
|
||||
|
|
|
|||
|
|
@ -1 +1,3 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
json.array! @links, partial: "links/link", as: :link
|
||||
|
|
|
|||
|
|
@ -1 +1,3 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
json.partial! "links/link", link: @link
|
||||
|
|
|
|||
|
|
@ -1,2 +1,4 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
json.extract! report, :id, :name, :comment_html, :created_at, :updated_at
|
||||
json.url report_url(report, format: :json)
|
||||
|
|
|
|||
|
|
@ -1 +1,3 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
json.array! @reports, partial: "reports/report", as: :report
|
||||
|
|
|
|||
|
|
@ -1 +1,3 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
json.partial! "reports/report", report: @report
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
wb = xlsx_package.workbook
|
||||
wb.add_worksheet(name: "Erfolgskriterien") do |sheet|
|
||||
sheet.add_row SuccessCriterion.column_names
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
json.extract! success_criterion, :id, :element_id, :title, :description_html, :level, :result, :comment_html,
|
||||
:created_at, :updated_at
|
||||
json.url success_criterion_url(success_criterion, format: :json)
|
||||
|
|
|
|||
|
|
@ -1 +1,3 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
json.array! @success_criteria, partial: "success_criteria/success_criterion", as: :success_criterion
|
||||
|
|
|
|||
|
|
@ -1 +1,3 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
json.partial! "success_criteria/success_criterion", success_criterion: @success_criterion
|
||||
|
|
|
|||
9
bin/brakeman
Executable file
9
bin/brakeman
Executable file
|
|
@ -0,0 +1,9 @@
|
|||
#!/usr/bin/env ruby
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'rubygems'
|
||||
require 'bundler/setup'
|
||||
|
||||
ARGV.unshift('--ensure-latest')
|
||||
|
||||
load Gem.bin_path('brakeman', 'brakeman')
|
||||
|
|
@ -1,20 +1,23 @@
|
|||
#!/bin/bash
|
||||
#!/bin/ash
|
||||
|
||||
set -e
|
||||
|
||||
echo "1: ${1}"
|
||||
echo "2: ${2}"
|
||||
if [ -f tmp/pids/server.pid ]; then
|
||||
rm tmp/pids/server.pid
|
||||
fi
|
||||
|
||||
# Make the if statement match any invocation of the "rails server" command
|
||||
if [[ "${1}" == *rails ]] && ([ "${2}" == "server" ] || [ "${2}" == "s" ]); then
|
||||
echo "+ preparing database..."
|
||||
./bin/rails db:prepare
|
||||
echo "- preparing database done."
|
||||
|
||||
if [ ! -f /app/no_migrate ] && [ ! -v NO_MIGRATE ]; then
|
||||
echo "+ preparing database..."
|
||||
./bin/rails db:prepare
|
||||
echo "- preparing database done."
|
||||
if [ -n "$ASSETS_PATH" ]; then
|
||||
echo "+ copying assets..."
|
||||
cp -nr public/* $ASSETS_PATH
|
||||
echo "- copying assets done."
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
# Execute the given or default command:
|
||||
|
|
|
|||
10
bin/rubocop
Executable file
10
bin/rubocop
Executable file
|
|
@ -0,0 +1,10 @@
|
|||
#!/usr/bin/env ruby
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'rubygems'
|
||||
require 'bundler/setup'
|
||||
|
||||
# explicit rubocop config increases performance slightly while avoiding config confusion.
|
||||
ARGV.unshift('--config', File.expand_path('../.rubocop.yml', __dir__))
|
||||
|
||||
load Gem.bin_path('rubocop', 'rubocop')
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
#!/usr/bin/env ruby
|
||||
require "fileutils"
|
||||
|
||||
# path to your application root.
|
||||
APP_ROOT = File.expand_path("..", __dir__)
|
||||
APP_NAME = "a11yist"
|
||||
|
||||
def system!(*args)
|
||||
system(*args, exception: true)
|
||||
|
|
@ -17,9 +17,6 @@ FileUtils.chdir APP_ROOT do
|
|||
system! "gem install bundler --conservative"
|
||||
system("bundle check") || system!("bundle install")
|
||||
|
||||
# Install JavaScript dependencies
|
||||
system("yarn check --check-files") || system!("yarn install")
|
||||
|
||||
# puts "\n== Copying sample files =="
|
||||
# unless File.exist?("config/database.yml")
|
||||
# FileUtils.cp "config/database.yml.sample", "config/database.yml"
|
||||
|
|
@ -33,4 +30,8 @@ FileUtils.chdir APP_ROOT do
|
|||
|
||||
puts "\n== Restarting application server =="
|
||||
system! "bin/rails restart"
|
||||
|
||||
# puts "\n== Configuring puma-dev =="
|
||||
# system "ln -nfs #{APP_ROOT} ~/.puma-dev/#{APP_NAME}"
|
||||
# system "curl -Is https://#{APP_NAME}.test/up | head -n 1"
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
|
||||
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
|
||||
|
||||
require 'bundler/setup' # Set up gems listed in the Gemfile.
|
||||
require 'bootsnap/setup' # Speed up boot time by caching expensive operations.
|
||||
require "bundler/setup" # Set up gems listed in the Gemfile.
|
||||
require "bootsnap/setup" # Speed up boot time by caching expensive operations.
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ default: &default
|
|||
adapter: sqlite3
|
||||
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
|
||||
timeout: 5000
|
||||
default_transaction_mode: IMMEDIATE
|
||||
|
||||
development:
|
||||
<<: *default
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
require 'active_support/core_ext/integer/time'
|
||||
require "active_support/core_ext/integer/time"
|
||||
|
||||
Rails.application.configure do
|
||||
# Settings specified here will take precedence over those in config/application.rb.
|
||||
|
|
@ -14,19 +14,17 @@ Rails.application.configure do
|
|||
# Show full error reports.
|
||||
config.consider_all_requests_local = true
|
||||
|
||||
# Enable server timing
|
||||
# Enable server timing.
|
||||
config.server_timing = true
|
||||
|
||||
# Enable/disable caching. By default caching is disabled.
|
||||
# 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.enable_fragment_cache_logging = true
|
||||
|
||||
config.cache_store = :memory_store
|
||||
config.public_file_server.headers = {
|
||||
'Cache-Control' => "public, max-age=#{2.days.to_i}"
|
||||
}
|
||||
config.public_file_server.headers = { "Cache-Control" => "public, max-age=#{2.days.to_i}" }
|
||||
else
|
||||
config.action_controller.perform_caching = false
|
||||
|
||||
|
|
@ -39,8 +37,12 @@ Rails.application.configure do
|
|||
# Don't care if the mailer can't send.
|
||||
config.action_mailer.raise_delivery_errors = false
|
||||
|
||||
# Disable caching for Action Mailer templates even if Action Controller
|
||||
# caching is enabled.
|
||||
config.action_mailer.perform_caching = false
|
||||
|
||||
config.action_mailer.default_url_options = { host: "a11yist.localhost" }
|
||||
|
||||
# Print deprecation notices to the Rails logger.
|
||||
config.active_support.deprecation = :log
|
||||
|
||||
|
|
@ -66,13 +68,16 @@ Rails.application.configure do
|
|||
# config.i18n.raise_on_missing_translations = true
|
||||
|
||||
# Annotate rendered view with file names.
|
||||
# config.action_view.annotate_rendered_view_with_filenames = true
|
||||
config.action_view.annotate_rendered_view_with_filenames = true
|
||||
|
||||
# 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
|
||||
# Raise error when a before_action's only/except options reference missing actions.
|
||||
config.action_controller.raise_on_missing_callback_actions = true
|
||||
|
||||
config.web_console.permissions = ['192.168.0.0/16', '10.10.0.0/16']
|
||||
# Apply autocorrection by RuboCop to files generated by `bin/rails generate`.
|
||||
# config.generators.apply_rubocop_autocorrect_after_generate!
|
||||
#
|
||||
config.web_console.allowed_ips = ["10.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16", "127.0.0.0/8"]
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
require 'active_support/core_ext/integer/time'
|
||||
require "active_support/core_ext/integer/time"
|
||||
|
||||
Rails.application.configure do
|
||||
# Settings specified here will take precedence over those in config/application.rb.
|
||||
|
|
@ -21,7 +21,7 @@ Rails.application.configure do
|
|||
# config.require_master_key = true
|
||||
|
||||
# Disable serving static files from `public/`, relying on NGINX/Apache to do so instead.
|
||||
# config.public_file_server.enabled = false
|
||||
config.public_file_server.enabled = ENV.fetch("ASSETS_PATH") { nil }.nil?
|
||||
|
||||
# Compress CSS using a preprocessor.
|
||||
# config.assets.css_compressor = :sass
|
||||
|
|
@ -49,20 +49,25 @@ Rails.application.configure do
|
|||
# config.assume_ssl = true
|
||||
|
||||
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
||||
config.force_ssl = true
|
||||
config.force_ssl = false
|
||||
|
||||
# Skip http-to-https redirect for the default health check endpoint.
|
||||
# config.ssl_options = { redirect: { exclude: ->(request) { request.path == "/up" } } }
|
||||
|
||||
config.logger = ActiveSupport::TaggedLogging.new(ActiveSupport::Logger.new("log/#{Rails.env}.log"))
|
||||
|
||||
# Log to STDOUT by default
|
||||
config.logger = ActiveSupport::Logger.new(STDOUT)
|
||||
.tap { |logger| logger.formatter = ::Logger::Formatter.new }
|
||||
.then { |logger| ActiveSupport::TaggedLogging.new(logger) }
|
||||
# config.logger = ActiveSupport::Logger.new(STDOUT)
|
||||
# .tap { |logger| logger.formatter = ::Logger::Formatter.new }
|
||||
# .then { |logger| ActiveSupport::TaggedLogging.new(logger) }
|
||||
|
||||
# Prepend all log lines with the following tags.
|
||||
config.log_tags = [:request_id]
|
||||
config.log_tags = [ :request_id, :remote_ip ]
|
||||
|
||||
# "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')
|
||||
config.log_level = ENV.fetch("RAILS_LOG_LEVEL", "info")
|
||||
|
||||
# Use a different cache store in production.
|
||||
# config.cache_store = :mem_cache_store
|
||||
|
|
@ -71,6 +76,8 @@ Rails.application.configure do
|
|||
# config.active_job.queue_adapter = :resque
|
||||
# config.active_job.queue_name_prefix = "a11yist_production"
|
||||
|
||||
# Disable caching for Action Mailer templates even if Action Controller
|
||||
# caching is enabled.
|
||||
config.action_mailer.perform_caching = false
|
||||
|
||||
# Ignore bad email addresses and do not raise email delivery errors.
|
||||
|
|
@ -92,8 +99,6 @@ Rails.application.configure do
|
|||
# "example.com", # Allow requests from example.com
|
||||
# /.*\.example\.com/ # Allow requests from subdomains like `www.example.com`
|
||||
# ]
|
||||
config.hosts = ENV.fetch('APP_HOSTS', '').split(',')
|
||||
# Skip DNS rebinding protection for the default health check endpoint.
|
||||
# config.host_authorization = { exclude: ->(request) { request.path == "/up" } }
|
||||
config.active_record.sqlite3_production_warning=false
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
require 'active_support/core_ext/integer/time'
|
||||
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
|
||||
|
|
@ -15,13 +15,10 @@ Rails.application.configure do
|
|||
# this is usually not necessary, and can slow down your test suite. However, it's
|
||||
# recommended that you enable it in continuous integration systems to ensure eager
|
||||
# loading is working properly before deploying your code.
|
||||
config.eager_load = ENV['CI'].present?
|
||||
config.eager_load = ENV["CI"].present?
|
||||
|
||||
# Configure public file server for tests with Cache-Control for performance.
|
||||
config.public_file_server.enabled = true
|
||||
config.public_file_server.headers = {
|
||||
'Cache-Control' => "public, max-age=#{1.hour.to_i}"
|
||||
}
|
||||
config.public_file_server.headers = { "Cache-Control" => "public, max-age=#{1.hour.to_i}" }
|
||||
|
||||
# Show full error reports and disable caching.
|
||||
config.consider_all_requests_local = true
|
||||
|
|
@ -37,6 +34,8 @@ Rails.application.configure do
|
|||
# Store uploaded files on the local file system in a temporary directory.
|
||||
config.active_storage.service = :test
|
||||
|
||||
# Disable caching for Action Mailer templates even if Action Controller
|
||||
# caching is enabled.
|
||||
config.action_mailer.perform_caching = false
|
||||
|
||||
# Tell Action Mailer not to deliver emails to the real world.
|
||||
|
|
@ -44,6 +43,10 @@ Rails.application.configure do
|
|||
# ActionMailer::Base.deliveries array.
|
||||
config.action_mailer.delivery_method = :test
|
||||
|
||||
# Unlike controllers, the mailer instance doesn't have any context about the
|
||||
# incoming request so you'll need to provide the :host parameter yourself.
|
||||
config.action_mailer.default_url_options = { host: "www.example.com" }
|
||||
|
||||
# Print deprecation notices to the stderr.
|
||||
config.active_support.deprecation = :stderr
|
||||
|
||||
|
|
@ -59,6 +62,6 @@ Rails.application.configure do
|
|||
# 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
|
||||
# Raise error when a before_action's only/except options reference missing actions.
|
||||
config.action_controller.raise_on_missing_callback_actions = true
|
||||
end
|
||||
|
|
|
|||
|
|
@ -3,6 +3,6 @@
|
|||
# Configure parameters to be partially matched (e.g. passw matches password) and filtered from the log file.
|
||||
# Use this to limit dissemination of sensitive information.
|
||||
# See the ActiveSupport::ParameterFilter documentation for supported notations and behaviors.
|
||||
Rails.application.config.filter_parameters += %i[
|
||||
passw secret token _key crypt salt certificate otp ssn
|
||||
Rails.application.config.filter_parameters += [
|
||||
:passw, :email, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn
|
||||
]
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
# I18n.load_path += Dir[Rails.root.join('lib', 'locale', '*.{rb,yml}')]
|
||||
|
||||
# Permitted locales available for the application
|
||||
I18n.available_locales = [:"de-CH"]
|
||||
I18n.available_locales = [:"de-CH", :en]
|
||||
|
||||
# Set default locale to something other than :en
|
||||
I18n.default_locale = :"de-CH"
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue