diff --git a/.DS_Store b/.DS_Store index da07aa6..185b899 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/.ruby-version b/.ruby-version deleted file mode 100644 index 03463f3..0000000 --- a/.ruby-version +++ /dev/null @@ -1 +0,0 @@ -ruby-3.3.0 diff --git a/.tool-versions b/.tool-versions new file mode 100644 index 0000000..041df9a --- /dev/null +++ b/.tool-versions @@ -0,0 +1 @@ +ruby 3.4.1 diff --git a/Gemfile b/Gemfile index 0c360a8..4c7ef53 100644 --- a/Gemfile +++ b/Gemfile @@ -1,11 +1,11 @@ source "https://rubygems.org" -ruby "3.3.0" +ruby "3.4.1" gem 'dotenv-rails' # Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main" -gem "rails", "~> 7.1.3", ">= 7.1.3.2" +gem "rails", "~> 8.0.2" # The original asset pipeline for Rails [https://github.com/rails/sprockets-rails] # gem "sprockets-rails" diff --git a/Gemfile.lock b/Gemfile.lock index 44493c2..5b587a0 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,81 +1,78 @@ GEM remote: https://rubygems.org/ specs: - actioncable (7.1.4) - actionpack (= 7.1.4) - activesupport (= 7.1.4) + actioncable (8.0.2) + actionpack (= 8.0.2) + activesupport (= 8.0.2) nio4r (~> 2.0) websocket-driver (>= 0.6.1) zeitwerk (~> 2.6) - actionmailbox (7.1.4) - actionpack (= 7.1.4) - activejob (= 7.1.4) - activerecord (= 7.1.4) - activestorage (= 7.1.4) - activesupport (= 7.1.4) - mail (>= 2.7.1) - net-imap - net-pop - net-smtp - actionmailer (7.1.4) - actionpack (= 7.1.4) - actionview (= 7.1.4) - activejob (= 7.1.4) - activesupport (= 7.1.4) - mail (~> 2.5, >= 2.5.4) - net-imap - net-pop - net-smtp + actionmailbox (8.0.2) + actionpack (= 8.0.2) + activejob (= 8.0.2) + activerecord (= 8.0.2) + activestorage (= 8.0.2) + activesupport (= 8.0.2) + mail (>= 2.8.0) + actionmailer (8.0.2) + actionpack (= 8.0.2) + actionview (= 8.0.2) + activejob (= 8.0.2) + activesupport (= 8.0.2) + mail (>= 2.8.0) rails-dom-testing (~> 2.2) - actionpack (7.1.4) - actionview (= 7.1.4) - activesupport (= 7.1.4) + actionpack (8.0.2) + actionview (= 8.0.2) + activesupport (= 8.0.2) nokogiri (>= 1.8.5) - racc rack (>= 2.2.4) rack-session (>= 1.0.1) rack-test (>= 0.6.3) rails-dom-testing (~> 2.2) rails-html-sanitizer (~> 1.6) - actiontext (7.1.4) - actionpack (= 7.1.4) - activerecord (= 7.1.4) - activestorage (= 7.1.4) - activesupport (= 7.1.4) + useragent (~> 0.16) + actiontext (8.0.2) + actionpack (= 8.0.2) + activerecord (= 8.0.2) + activestorage (= 8.0.2) + activesupport (= 8.0.2) globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (7.1.4) - activesupport (= 7.1.4) + actionview (8.0.2) + activesupport (= 8.0.2) builder (~> 3.1) erubi (~> 1.11) rails-dom-testing (~> 2.2) rails-html-sanitizer (~> 1.6) - activejob (7.1.4) - activesupport (= 7.1.4) + activejob (8.0.2) + activesupport (= 8.0.2) globalid (>= 0.3.6) - activemodel (7.1.4) - activesupport (= 7.1.4) - activerecord (7.1.4) - activemodel (= 7.1.4) - activesupport (= 7.1.4) + activemodel (8.0.2) + activesupport (= 8.0.2) + activerecord (8.0.2) + activemodel (= 8.0.2) + activesupport (= 8.0.2) timeout (>= 0.4.0) - activestorage (7.1.4) - actionpack (= 7.1.4) - activejob (= 7.1.4) - activerecord (= 7.1.4) - activesupport (= 7.1.4) + activestorage (8.0.2) + actionpack (= 8.0.2) + activejob (= 8.0.2) + activerecord (= 8.0.2) + activesupport (= 8.0.2) marcel (~> 1.0) - activesupport (7.1.4) + activesupport (8.0.2) base64 + benchmark (>= 0.3) 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) - acts_as_list (1.2.2) + securerandom (>= 0.3) + tzinfo (~> 2.0, >= 2.0.5) + uri (>= 0.13.1) + acts_as_list (1.2.4) activerecord (>= 6.1) activesupport (>= 6.1) addressable (2.8.7) @@ -84,52 +81,55 @@ GEM activerecord (>= 5.2.6) base64 (0.2.0) bcrypt (3.1.20) - bigdecimal (3.1.8) + benchmark (0.4.0) + bigdecimal (3.1.9) bindex (0.8.1) bootsnap (1.18.4) msgpack (~> 1.2) builder (3.3.0) - concurrent-ruby (1.3.4) - connection_pool (2.4.1) + concurrent-ruby (1.3.5) + connection_pool (2.5.2) crass (1.0.6) - css_parser (1.19.0) + css_parser (1.21.1) addressable - date (3.3.4) + date (3.4.1) date_validator (0.12.0) activemodel (>= 3) activesupport (>= 3) dkim (1.1.0) - dotenv (3.1.2) - dotenv-rails (3.1.2) - dotenv (= 3.1.2) + dotenv (3.1.8) + dotenv-rails (3.1.8) + dotenv (= 3.1.8) railties (>= 6.1) drb (2.2.1) - erubi (1.13.0) - ffi (1.17.0-aarch64-linux-gnu) - ffi (1.17.0-arm-linux-gnu) - ffi (1.17.0-arm64-darwin) - ffi (1.17.0-x86-linux-gnu) - ffi (1.17.0-x86_64-darwin) - ffi (1.17.0-x86_64-linux-gnu) + erubi (1.13.1) + ffi (1.17.2-aarch64-linux-gnu) + ffi (1.17.2-arm-linux-gnu) + ffi (1.17.2-arm64-darwin) + ffi (1.17.2-x86-linux-gnu) + ffi (1.17.2-x86_64-darwin) + ffi (1.17.2-x86_64-linux-gnu) globalid (1.2.1) activesupport (>= 6.1) htmlentities (4.3.4) - i18n (1.14.6) + i18n (1.14.7) concurrent-ruby (~> 1.0) - image_processing (1.13.0) - mini_magick (>= 4.9.5, < 5) + image_processing (1.14.0) + mini_magick (>= 4.9.5, < 6) ruby-vips (>= 2.0.17, < 3) - importmap-rails (2.0.1) + importmap-rails (2.1.0) actionpack (>= 6.0.0) activesupport (>= 6.0.0) railties (>= 6.0.0) - io-console (0.7.2) - irb (1.14.0) + io-console (0.8.0) + irb (1.15.2) + pp (>= 0.6.0) rdoc (>= 4.0.0) reline (>= 0.4.2) jbuilder (2.13.0) actionview (>= 5.0.0) activesupport (>= 5.0.0) + json (2.11.3) kaminari (1.2.2) activesupport (>= 4.1.0) kaminari-actionview (= 1.2.2) @@ -142,8 +142,8 @@ GEM activerecord kaminari-core (= 1.2.2) kaminari-core (1.2.2) - logger (1.6.1) - loofah (2.22.0) + logger (1.7.0) + loofah (2.24.0) crass (~> 1.0.2) nokogiri (>= 1.12.0) mail (2.8.1) @@ -152,40 +152,45 @@ GEM net-pop net-smtp marcel (1.0.4) - mini_magick (4.13.2) + mini_magick (5.2.0) + benchmark + logger mini_mime (1.1.5) - minitest (5.25.1) - mobility (1.3.0.rc3) + mini_portile2 (2.8.8) + minitest (5.25.5) + mobility (1.3.2) i18n (>= 0.6.10, < 2) request_store (~> 1.0) - msgpack (1.7.2) - mutex_m (0.2.0) - net-imap (0.4.16) + msgpack (1.8.0) + net-imap (0.5.7) date net-protocol net-pop (0.1.2) net-protocol net-protocol (0.2.2) timeout - net-smtp (0.5.0) + net-smtp (0.5.1) net-protocol - nio4r (2.7.3) - nokogiri (1.16.7-aarch64-linux) + nio4r (2.7.4) + nokogiri (1.18.8) + mini_portile2 (~> 2.8.2) racc (~> 1.4) - nokogiri (1.16.7-arm-linux) + nokogiri (1.18.8-aarch64-linux-gnu) racc (~> 1.4) - nokogiri (1.16.7-arm64-darwin) + nokogiri (1.18.8-arm-linux-gnu) racc (~> 1.4) - nokogiri (1.16.7-x86-linux) + nokogiri (1.18.8-arm64-darwin) racc (~> 1.4) - nokogiri (1.16.7-x86_64-darwin) + nokogiri (1.18.8-x86_64-darwin) racc (~> 1.4) - nokogiri (1.16.7-x86_64-linux) + nokogiri (1.18.8-x86_64-linux-gnu) racc (~> 1.4) - pg (1.5.8) + pg (1.5.9) pg_search (2.3.7) activerecord (>= 6.1) activesupport (>= 6.1) + pp (0.6.2) + prettyprint premailer (1.27.0) addressable css_parser (>= 1.19.0) @@ -194,95 +199,99 @@ GEM actionmailer (>= 3) net-smtp premailer (~> 1.7, >= 1.7.9) - propshaft (1.0.0) + prettyprint (0.2.0) + propshaft (1.1.0) actionpack (>= 7.0.0) activesupport (>= 7.0.0) rack railties (>= 7.0.0) - psych (5.1.2) + psych (5.2.3) + date stringio public_suffix (6.0.1) - puma (6.4.2) + puma (6.6.0) nio4r (~> 2.0) racc (1.8.1) - rack (3.1.7) - rack-session (2.0.0) + rack (3.1.13) + rack-session (2.1.0) + base64 (>= 0.1.0) rack (>= 3.0.0) - rack-test (2.1.0) + rack-test (2.2.0) rack (>= 1.3) - rackup (2.1.0) + rackup (2.2.1) rack (>= 3) - webrick (~> 1.8) - rails (7.1.4) - actioncable (= 7.1.4) - actionmailbox (= 7.1.4) - actionmailer (= 7.1.4) - actionpack (= 7.1.4) - actiontext (= 7.1.4) - actionview (= 7.1.4) - activejob (= 7.1.4) - activemodel (= 7.1.4) - activerecord (= 7.1.4) - activestorage (= 7.1.4) - activesupport (= 7.1.4) + rails (8.0.2) + actioncable (= 8.0.2) + actionmailbox (= 8.0.2) + actionmailer (= 8.0.2) + actionpack (= 8.0.2) + actiontext (= 8.0.2) + actionview (= 8.0.2) + activejob (= 8.0.2) + activemodel (= 8.0.2) + activerecord (= 8.0.2) + activestorage (= 8.0.2) + activesupport (= 8.0.2) bundler (>= 1.15.0) - railties (= 7.1.4) + railties (= 8.0.2) rails-dom-testing (2.2.0) activesupport (>= 5.0.0) minitest nokogiri (>= 1.6) - rails-html-sanitizer (1.6.0) + rails-html-sanitizer (1.6.2) loofah (~> 2.21) - nokogiri (~> 1.14) - railties (7.1.4) - actionpack (= 7.1.4) - activesupport (= 7.1.4) - irb + nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0) + railties (8.0.2) + actionpack (= 8.0.2) + activesupport (= 8.0.2) + irb (~> 1.13) rackup (>= 1.0.0) rake (>= 12.2) thor (~> 1.0, >= 1.2.2) zeitwerk (~> 2.6) rake (13.2.1) - rdoc (6.7.0) + rdoc (6.13.1) psych (>= 4.0.0) - redis (5.3.0) + redis (5.4.0) redis-client (>= 0.22.0) - redis-client (0.22.2) + redis-client (0.24.0) connection_pool - reline (0.5.10) + reline (0.6.1) io-console (~> 0.5) request_store (1.7.0) rack (>= 1.4) - ruby-vips (2.2.2) + ruby-vips (2.2.3) ffi (~> 1.12) logger - sidekiq (7.3.2) - concurrent-ruby (< 2) - connection_pool (>= 2.3.0) - logger - rack (>= 2.2.4) - redis-client (>= 0.22.2) + securerandom (0.4.1) + sidekiq (8.0.3) + connection_pool (>= 2.5.0) + json (>= 2.9.0) + logger (>= 1.6.2) + rack (>= 3.1.0) + redis-client (>= 0.23.2) stimulus-rails (1.3.4) railties (>= 6.0.0) - stringio (3.1.1) + stringio (3.1.7) thor (1.3.2) - timeout (0.4.1) - turbo-rails (2.0.7) - actionpack (>= 6.0.0) - activejob (>= 6.0.0) - railties (>= 6.0.0) + timeout (0.4.3) + turbo-rails (2.0.13) + actionpack (>= 7.1.0) + railties (>= 7.1.0) tzinfo (2.0.6) concurrent-ruby (~> 1.0) + uri (1.0.3) + useragent (0.16.11) web-console (4.2.1) actionview (>= 6.0.0) activemodel (>= 6.0.0) bindex (>= 0.4.0) railties (>= 6.0.0) - webrick (1.8.1) - websocket-driver (0.7.6) + websocket-driver (0.7.7) + base64 websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) - zeitwerk (2.6.18) + zeitwerk (2.7.2) PLATFORMS aarch64-linux @@ -310,7 +319,7 @@ DEPENDENCIES premailer-rails propshaft puma (>= 5.0) - rails (~> 7.1.3, >= 7.1.3.2) + rails (~> 8.0.2) redis (>= 4.0.1) sidekiq stimulus-rails @@ -318,7 +327,7 @@ DEPENDENCIES web-console RUBY VERSION - ruby 3.3.0p0 + ruby 3.4.1p0 BUNDLED WITH 2.5.17 diff --git a/README DB.txt b/README DB.txt index 168fd7f..87c26a4 100644 --- a/README DB.txt +++ b/README DB.txt @@ -2,27 +2,27 @@ Development -------------------- Local -dropdb -U mattias ikea_foundtation_week_2024 -createdb ikea_foundtation_week_2024 -pg_restore -Fc --create --dbname=ikea_foundtation_week_2024 --username=mattias db20150901.bak +dropdb -U mattias ikea_foundtation_week_2025 +createdb ikea_foundtation_week_2025 +pg_restore -Fc --create --dbname=ikea_foundtation_week_2025 --username=mattias db20150901.bak DB ------------------- sudo -u postgres createuser --interactive ikea_foundation -sudo -u postgres createdb -O ikea_foundation ikea_foundtation_week_2024 +sudo -u postgres createdb -O ikea_foundation ikea_foundtation_week_2025 -dropdb -U ikea_foundation ikea_foundtation_week_2024 +dropdb -U ikea_foundation ikea_foundtation_week_2025 RAILS_ENV=production rails db:migrate rake db:create:all CREATE EXTENSION hstore; -sudo -u postgres psql -d ikea_foundtation_week_2024 +sudo -u postgres psql -d ikea_foundtation_week_2025 -pg_dump -U ikea_foundation -Fc ikea_foundtation_week_2024 > db20140909.bak +pg_dump -U ikea_foundation -Fc ikea_foundtation_week_2025 > db20140909.bak sudo -i -u postgres @@ -30,8 +30,8 @@ psql Dump DEV ------------------- -pg_dump -U mattias -Fc ikea_foundtation_week_2024 > db20140909.bak -pg_dump -U mattias ikea_foundtation_week_2024 > db20140909.sql +pg_dump -U mattias -Fc ikea_foundtation_week_2025 > db20140909.bak +pg_dump -U mattias ikea_foundtation_week_2025 > db20140909.sql -pg_restore -Fc --dbname=ikea_foundtation_week_2024 --username=ikea_foundation dumps/db20230209.bak -pg_restore -Fc --create --dbname=ikea_foundtation_week_2024 --username=ikea_foundation db20150901.bak \ No newline at end of file +pg_restore -Fc --dbname=ikea_foundtation_week_2025 --username=ikea_foundation dumps/db20230209.bak +pg_restore -Fc --create --dbname=ikea_foundtation_week_2025 --username=ikea_foundation db20150901.bak \ No newline at end of file diff --git a/README.txt b/README.txt index 4049244..24886c3 100644 --- a/README.txt +++ b/README.txt @@ -16,8 +16,7 @@ EDITOR=vi rails credentials:edit SSL ------------------- -sudo certbot certonly --webroot -w /home/ikea_foundation/week_2024/public -d ikea-foundation-week-2024.onc.dk -sudo certbot certonly --webroot -w /home/ikea_foundation/week_2024/public -d spotlinks.ikeafoundation.org +sudo certbot certonly --webroot -w /home/ikea_foundation/week_2025/public -d ikea-foundation-week-2025.onc.dk Gem diff --git a/app/assets/fonts/NotoIKEALatin-Bold.ttf b/app/assets/fonts/NotoIKEALatin-Bold.ttf old mode 100755 new mode 100644 diff --git a/app/assets/fonts/NotoIKEALatin-BoldItalic.ttf b/app/assets/fonts/NotoIKEALatin-BoldItalic.ttf old mode 100755 new mode 100644 diff --git a/app/assets/fonts/NotoIKEALatin-Italic.ttf b/app/assets/fonts/NotoIKEALatin-Italic.ttf old mode 100755 new mode 100644 diff --git a/app/assets/fonts/NotoIKEALatin-Regular.ttf b/app/assets/fonts/NotoIKEALatin-Regular.ttf old mode 100755 new mode 100644 diff --git a/app/assets/images/windmill.png b/app/assets/images/windmill.png old mode 100755 new mode 100644 diff --git a/app/assets/stylesheets/assets.css b/app/assets/stylesheets/assets.css index 9ce584d..acda684 100644 --- a/app/assets/stylesheets/assets.css +++ b/app/assets/stylesheets/assets.css @@ -74,10 +74,24 @@ position: relative; padding: 10px 10px 40px 10px; border: 2px solid transparent; + border-radius: 10px; + + &.loading { + display: flex; + align-items: center; + justify-content: center; + font-size: 1.2rem; + border-color: var(--clr-grey-200); + + & .progress::after { + content: ' %'; + } + + } &:hover { border-color: var(--clr-grey-200); - border-radius: 10px; + & .asset-ctrls { bottom: 6px; position: absolute; diff --git a/app/controllers/admin/assets_controller.rb b/app/controllers/admin/assets_controller.rb index 269dc4c..8078a01 100644 --- a/app/controllers/admin/assets_controller.rb +++ b/app/controllers/admin/assets_controller.rb @@ -11,7 +11,7 @@ class Admin::AssetsController < Admin::AdminController .simple_search(params[:q]) .page(params[:page] || 1) - render (params[:node_id] || params[:newsletter_id]) ? 'explore' : 'index' + render (params[:screen_id] || params[:node_id]) ? 'explore' : 'index' end @@ -75,8 +75,7 @@ private # Only allow a list of trusted parameters through. def asset_params params.require(:asset).permit( - :title, - tags: [] + :title ) end diff --git a/app/javascript/application.js b/app/javascript/application.js index 354ea1f..e69de29 100644 --- a/app/javascript/application.js +++ b/app/javascript/application.js @@ -1,230 +0,0 @@ -import "@hotwired/turbo-rails" - -var input_range -const max_value = 180 -const speed = 12 - -var curr_value -var raf_id -var random_salt = Math.random() - - -function rand_in_range(from, to) { - - const rand = Math.floor(Math.random() * (to - from + 1)) + from - const is_neg = Math.random() < 0.5 - - return is_neg ? -rand : rand -} - - -function shuffle_cards() { - - const cards = document.querySelectorAll('.card__container') - const card_ids = Array.from(cards).map(card => card.getAttribute('data-id')) - let shown_cards = JSON.parse(localStorage.getItem('shown_cards')) || []; - - let cards_not_shown = card_ids.filter(id => !shown_cards.includes(id)); - - if (cards_not_shown.length <= 0) { - cards_not_shown = card_ids - shown_cards = [] - } - const random_id = cards_not_shown[Math.floor(Math.random() * cards_not_shown.length)]; - - cards.forEach((card) => { - if (card.getAttribute('data-id') == random_id) { - card.style.zIndex = '1' - card.style.transform = '' - card.classList.add('active') - } else { - card.classList.remove('active') - card.style.zIndex = 'auto' - card.style.transform = `rotate(${rand_in_range(2,5)}deg) translate(${rand_in_range(2,5)}px, ${rand_in_range(2,5)}px)` - } - }) - - shown_cards.push(random_id); - localStorage.setItem('shown_cards', JSON.stringify(shown_cards)); -} - -document.addEventListener("turbo:load", ()=> { - init() - -}) - -document.addEventListener("turbo:visit", (event) => { - plausible('pageview', { u: event.detail.url }); -}) - -document.addEventListener("turbo:before-cache", () => { - if (input_range) { - input_range.value = 0; - input_range.closest('.reveal__container').style.setProperty('--opacity', 1); - updateRotation(input_range.value) - } - - let images = document.querySelectorAll("img.fade-in.loaded") - images.forEach(image => { - image.classList.remove("loaded") - }) - - -}) - -function init() { - - random_salt = Math.random() - - document.querySelectorAll('.button_shuffle_cards').forEach((item, index) => { - item.addEventListener('click', (e) => { - shuffle_cards() - }) - if (index == 0) - shuffle_cards() - }) - - document.querySelectorAll('#language_select').forEach((language_select) => { - language_select.addEventListener('change', (e) => { - document.documentElement.lang = language_select.value - }) - }) - - // Choose language confirmation button - document.querySelectorAll('#confirm_btn').forEach((confirm_btn) => { - confirm_btn.addEventListener('click', (e) => { - // window.location.href = '/' + document.getElementById('language_select').value - Turbo.visit('/' + document.getElementById('language_select').value, {advance: 'advance'}) - }) - }) - - - // Copy link to clipboard - document.querySelectorAll('[data-share-title]').forEach((share_btn) => { - share_btn.addEventListener('click', (e) => { - - if (navigator.share) { - navigator.share({ - title: e.currentTarget.getAttribute('data-share-title'), - text: e.currentTarget.getAttribute('data-share-text'), - url: window.location.href - }).then(() => { - console.log('Thanks for sharing!'); - }) - .catch(console.error); - } else { - navigator.clipboard.writeText(window.location.href) - alert('URL copied to clipboard!') - } - - - }) - }) - - document.querySelectorAll('.card__stack a').forEach((card_link) => { - card_link.addEventListener('click', (e) => { - e.preventDefault() - }) - }) - - - // Open all external links in ny tab - for (const link of document.links) { - if (link.hostname.replace(/^www\./i, "") != window.location.hostname.replace(/^www\./i, "") && (link.protocol == 'https:' || link.protocol == 'http:')) - link.target = '_blank' - } - - input_range = document.getElementsByClassName('reveal')[0] - - if (input_range) { - input_range.min = 0; - input_range.max = max_value; - } - - if (input_range) { - input_range.addEventListener('mousedown', unlockStartHandler, false) - input_range.addEventListener('touchstart', unlockStartHandler, false) - input_range.addEventListener('mouseup', unlockEndHandler, false) - input_range.addEventListener('touchend', unlockEndHandler, false) - - input_range.addEventListener("input", (e) => { - e.currentTarget.closest('.reveal__container').style.setProperty('--opacity', 1 - (e.currentTarget.value/e.currentTarget.max)) - - updateRotation(e.currentTarget.value) - }) - } - - let images = document.querySelectorAll("img.fade-in") - - images.forEach(image => { - image.addEventListener("load", () => { - image.classList.add("loaded") - }) - - // For cached images that may already be loaded - if (image.complete) { - window.requestAnimationFrame(() => { - image.classList.add("loaded") - }) - } - }) -} - - -function unlockStartHandler() { - window.cancelAnimationFrame(raf_id); - curr_value = +this.value; -} - - -function unlockEndHandler() { - curr_value = +this.value; - - if (curr_value >= this.max) { - - const card = document.querySelector('.card__container.active') - //window.location.href = card.parentNode.getAttribute('href') - Turbo.visit(card.parentNode.getAttribute('href'), { action: 'advance'} ) - - } else { - raf_id = window.requestAnimationFrame(animateHandler); - } -} - - -// handle range animation -function animateHandler() { - - input_range.value = curr_value; - input_range.closest('.reveal__container').style.setProperty('--opacity', 1 - (input_range.value/input_range.max)); - updateRotation(input_range.value) - - // continue? - if (curr_value > -1) { - window.requestAnimationFrame(animateHandler); - } - - // decrement - curr_value = curr_value - speed; -} - - -function updateRotation(angle) { - document.documentElement.style.setProperty('--flip-deg', angle + 'deg') - document.documentElement.style.setProperty('--flip-scale', calculateScaleFactor(angle)) - document.documentElement.style.setProperty('--flip-rotate', calculateRotateFactor(angle) + 'deg') -} - - -function calculateScaleFactor(angle) { - const radians = angle * (Math.PI / 180) - return 1 + (0.1 * Math.sin(radians)) - // return 1 + (0.2 * (angle / 180)) -} - - -function calculateRotateFactor(angle) { - const radians = angle * (Math.PI / 180) - return (4 * Math.sin(radians)) + (random_salt * 2) - -} \ No newline at end of file diff --git a/app/javascript/controllers/upload_controller.js b/app/javascript/controllers/upload_controller.js index ec02658..bcee3ba 100644 --- a/app/javascript/controllers/upload_controller.js +++ b/app/javascript/controllers/upload_controller.js @@ -27,15 +27,17 @@ export default class extends Controller { const uid = 'new_' + Date.now() + '_' + index const target_div = document.createElement('div') target_div.setAttribute('id', uid) + target_div.classList.add('asset', 'loading') + target_div.innerHTML = '0' - if (this.targetValue == 'attachments') { - target_div.classList.add('attachment', 'loading') - target_div.innerHTML = '0' - } else if (this.targetValue == 'tree-nodes') { - target_div.classList.add('row') - target_div.innerHTML = '
0
' - } - container.append(target_div) + // if (this.targetValue == 'attachments') { + // target_div.classList.add('attachment', 'loading') + // target_div.innerHTML = '0' + // } else if (this.targetValue == 'tree-nodes') { + // target_div.classList.add('row') + // target_div.innerHTML = '
0
' + // } + container.prepend(target_div) new Uploader(this, file, uid).start() }); diff --git a/app/models/node.rb b/app/models/node.rb index 9cda44b..7780e9b 100644 --- a/app/models/node.rb +++ b/app/models/node.rb @@ -26,9 +26,9 @@ class Node < ApplicationRecord NODE_TEMPLATES = %w"tmpl_article tmpl_index tmpl_list" - enum status: { status_published: 0, status_draft: 1, status_archived: 2 } + enum :status, { status_published: 0, status_draft: 1, status_archived: 2 } - enum template: { tmpl_index: 0, + enum :template, { tmpl_index: 0, tmpl_article: 1, tmpl_list: 2 } diff --git a/app/models/user.rb b/app/models/user.rb index 19c9e2c..d244176 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -1,6 +1,6 @@ class User < ApplicationRecord - enum role: { user: 'user', admin: 'admin' }, _suffix: true + enum :role, { user: 'user', admin: 'admin' }, suffix: true include PgSearch::Model pg_search_scope :pg_search, against: [:lastname, :firstname, :email, :phone, :title], diff --git a/app/views/admin/assets/_asset.html.erb b/app/views/admin/assets/_asset.html.erb index 6be1dfd..0b0700b 100644 --- a/app/views/admin/assets/_asset.html.erb +++ b/app/views/admin/assets/_asset.html.erb @@ -1,7 +1,7 @@ <%= tag.div class: 'asset', id: dom_id(asset) do %>
-
<%= image_tag rails_storage_proxy_path(asset.file.representation(resize_to_limit: [320,320])) if asset.file.representable? %>
+
<%= image_tag rails_storage_proxy_path(asset.file.representation(resize_to_limit: [320,320], format: :jpg)) if asset.file.representable? %>
<%= tag.div asset.title, class: 'asset__title' %> @@ -23,11 +23,10 @@
<%= link_to 'edit', edit_admin_asset_path(asset), data: {turbo_frame: 'main', turbo_action: 'advance'}, title: t('ui.edit') %> - <%= link_to 'download', rails_storage_proxy_path(asset.file, disposition: "attachment", locale: nil), title: t('ui.download') %> + <%= link_to 'download', rails_blob_path(asset.file, disposition: "attachment"), title: t('ui.download') %>
<%= link_to 'delete_forever', admin_asset_path(asset), data: { turbo_confirm: t(:'ui.are_you_sure'), turbo_method: :delete }, title: t('ui.delete') %>
- - + <% end %> \ No newline at end of file diff --git a/app/views/admin/assets/_form.html.erb b/app/views/admin/assets/_form.html.erb index d04473e..f28ac90 100644 --- a/app/views/admin/assets/_form.html.erb +++ b/app/views/admin/assets/_form.html.erb @@ -1,19 +1,9 @@ <%= form_with(model: [ :admin, asset ], class: 'form-plain has--key-ctrls') do |form| %> -
<%= render partial: 'material/text_field', locals: { f: form, attr: :title } %> - - <%= render partial: 'material/tom_select_field', - locals: { - f: form, - attr: :tags, - choices: [Asset::STICKER], - multiple: true - } %>
-
<%= link_to t(:'ui.cancel'), url_for(controller: 'assets', action: 'index'), data: {turbo_action: 'advance'} %> <%= form.submit t(:'ui.save') %> diff --git a/app/views/admin/assets/_list.html.erb b/app/views/admin/assets/_list.html.erb index be40fba..75d334a 100644 --- a/app/views/admin/assets/_list.html.erb +++ b/app/views/admin/assets/_list.html.erb @@ -2,7 +2,7 @@

<%= link_to yield(:title), params.permit(:sort, :reverse), class: 'list-title-link' %>

- <%= render partial: 'material/search', locals: (params[:node_id] ? {turbo_stream: true} : nil) %> + <%= render partial: 'material/search', locals: (params[:screen_id] ? {turbo_stream: true} : nil) %> <%= tag.form do %> <%= tag.label class: "dropzone dropzone--small", diff --git a/app/views/admin/assets/explore.turbo_stream.erb b/app/views/admin/assets/explore.turbo_stream.erb index 9643dd0..833b224 100644 --- a/app/views/admin/assets/explore.turbo_stream.erb +++ b/app/views/admin/assets/explore.turbo_stream.erb @@ -4,7 +4,7 @@