diff --git a/Gemfile b/Gemfile index 9a2975a..0af2f9e 100644 --- a/Gemfile +++ b/Gemfile @@ -60,9 +60,9 @@ end gem 'dotenv-rails' # Trestle admin framework -gem 'trestle', github: 'TrestleAdmin/trestle' -gem 'trestle-auth', github: 'TrestleAdmin/trestle-auth' -gem 'trestle-search', github: 'TrestleAdmin/trestle-search' +gem 'trestle', '~> 0.10.0.pre' +gem 'trestle-auth', '~> 0.5.0.pre' +gem 'trestle-search', '~> 0.5.0.pre' # Model search gem 'pg_search' diff --git a/Gemfile.lock b/Gemfile.lock index 92cfd93..95cc2f8 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,92 +1,67 @@ -GIT - remote: https://github.com/TrestleAdmin/trestle-auth.git - revision: 6750252e2ec6f8c2e89d7f67426bddb0633768b0 - specs: - trestle-auth (0.4.4) - bcrypt (~> 3.1.7) - trestle (~> 0.9.0, >= 0.9.3) - -GIT - remote: https://github.com/TrestleAdmin/trestle-search.git - revision: 026f36eec8ef0d794fc829ce9545b5e9d6dd1e57 - specs: - trestle-search (0.4.3) - trestle (~> 0.9.0, >= 0.9.3) - -GIT - remote: https://github.com/TrestleAdmin/trestle.git - revision: 27e731c5980cf62a86800ea71d9f7d646ebbd724 - specs: - trestle (0.9.9) - activemodel (>= 5.2.0) - kaminari (>= 1.1.0) - railties (>= 5.2.0) - sprockets-rails (>= 2.0.0) - GEM remote: https://rubygems.org/ specs: - actioncable (7.0.8.3) - actionpack (= 7.0.8.3) - activesupport (= 7.0.8.3) + actioncable (7.0.8.4) + actionpack (= 7.0.8.4) + activesupport (= 7.0.8.4) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailbox (7.0.8.3) - actionpack (= 7.0.8.3) - activejob (= 7.0.8.3) - activerecord (= 7.0.8.3) - activestorage (= 7.0.8.3) - activesupport (= 7.0.8.3) + actionmailbox (7.0.8.4) + actionpack (= 7.0.8.4) + activejob (= 7.0.8.4) + activerecord (= 7.0.8.4) + activestorage (= 7.0.8.4) + activesupport (= 7.0.8.4) mail (>= 2.7.1) net-imap net-pop net-smtp - actionmailer (7.0.8.3) - actionpack (= 7.0.8.3) - actionview (= 7.0.8.3) - activejob (= 7.0.8.3) - activesupport (= 7.0.8.3) + actionmailer (7.0.8.4) + actionpack (= 7.0.8.4) + actionview (= 7.0.8.4) + activejob (= 7.0.8.4) + activesupport (= 7.0.8.4) mail (~> 2.5, >= 2.5.4) net-imap net-pop net-smtp rails-dom-testing (~> 2.0) - actionpack (7.0.8.3) - actionview (= 7.0.8.3) - activesupport (= 7.0.8.3) + actionpack (7.0.8.4) + actionview (= 7.0.8.4) + activesupport (= 7.0.8.4) rack (~> 2.0, >= 2.2.4) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.2.0) - actiontext (7.0.8.3) - actionpack (= 7.0.8.3) - activerecord (= 7.0.8.3) - activestorage (= 7.0.8.3) - activesupport (= 7.0.8.3) + actiontext (7.0.8.4) + actionpack (= 7.0.8.4) + activerecord (= 7.0.8.4) + activestorage (= 7.0.8.4) + activesupport (= 7.0.8.4) globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (7.0.8.3) - activesupport (= 7.0.8.3) + actionview (7.0.8.4) + activesupport (= 7.0.8.4) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.1, >= 1.2.0) - activejob (7.0.8.3) - activesupport (= 7.0.8.3) + activejob (7.0.8.4) + activesupport (= 7.0.8.4) globalid (>= 0.3.6) - activemodel (7.0.8.3) - activesupport (= 7.0.8.3) - activerecord (7.0.8.3) - activemodel (= 7.0.8.3) - activesupport (= 7.0.8.3) - activestorage (7.0.8.3) - actionpack (= 7.0.8.3) - activejob (= 7.0.8.3) - activerecord (= 7.0.8.3) - activesupport (= 7.0.8.3) + activemodel (7.0.8.4) + activesupport (= 7.0.8.4) + activerecord (7.0.8.4) + activemodel (= 7.0.8.4) + activesupport (= 7.0.8.4) + activestorage (7.0.8.4) + actionpack (= 7.0.8.4) + activejob (= 7.0.8.4) + activerecord (= 7.0.8.4) + activesupport (= 7.0.8.4) marcel (~> 1.0) mini_mime (>= 1.1.0) - activesupport (7.0.8.3) + activesupport (7.0.8.4) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 1.6, < 2) minitest (>= 5.1) @@ -95,8 +70,8 @@ GEM bindex (0.8.1) bootsnap (1.18.3) msgpack (~> 1.2) - builder (3.2.4) - concurrent-ruby (1.2.3) + builder (3.3.0) + concurrent-ruby (1.3.3) crass (1.0.6) date (3.3.4) debug (1.9.2) @@ -107,18 +82,20 @@ GEM dotenv-rails (3.1.2) dotenv (= 3.1.2) railties (>= 6.1) - erubi (1.12.0) + erubi (1.13.0) execjs (2.9.1) - ffi (1.16.3) + ffi (1.17.0-arm64-darwin) + ffi (1.17.0-x86_64-darwin) + ffi (1.17.0-x86_64-linux-gnu) globalid (1.2.1) activesupport (>= 6.1) http-accept (1.7.0) - http-cookie (1.0.5) + http-cookie (1.0.6) domain_name (~> 0.5) i18n (1.14.5) concurrent-ruby (~> 1.0) io-console (0.7.2) - irb (1.13.1) + irb (1.13.2) rdoc (>= 4.0.0) reline (>= 0.4.2) jsbundling-rails (1.3.0) @@ -147,11 +124,11 @@ GEM method_source (1.1.0) mime-types (3.5.2) mime-types-data (~> 3.2015) - mime-types-data (3.2024.0507) + mime-types-data (3.2024.0604) mini_mime (1.1.5) - minitest (5.23.1) + minitest (5.24.1) msgpack (1.7.2) - net-imap (0.4.11) + net-imap (0.4.14) date net-protocol net-pop (0.1.2) @@ -162,11 +139,11 @@ GEM net-protocol netrc (0.11.0) nio4r (2.7.3) - nokogiri (1.16.5-arm64-darwin) + nokogiri (1.16.6-arm64-darwin) racc (~> 1.4) - nokogiri (1.16.5-x86_64-darwin) + nokogiri (1.16.6-x86_64-darwin) racc (~> 1.4) - nokogiri (1.16.5-x86_64-linux) + nokogiri (1.16.6-x86_64-linux) racc (~> 1.4) pg (1.5.6) pg_search (2.3.6) @@ -180,20 +157,20 @@ GEM rack (2.2.9) rack-test (2.1.0) rack (>= 1.3) - rails (7.0.8.3) - actioncable (= 7.0.8.3) - actionmailbox (= 7.0.8.3) - actionmailer (= 7.0.8.3) - actionpack (= 7.0.8.3) - actiontext (= 7.0.8.3) - actionview (= 7.0.8.3) - activejob (= 7.0.8.3) - activemodel (= 7.0.8.3) - activerecord (= 7.0.8.3) - activestorage (= 7.0.8.3) - activesupport (= 7.0.8.3) + rails (7.0.8.4) + actioncable (= 7.0.8.4) + actionmailbox (= 7.0.8.4) + actionmailer (= 7.0.8.4) + actionpack (= 7.0.8.4) + actiontext (= 7.0.8.4) + actionview (= 7.0.8.4) + activejob (= 7.0.8.4) + activemodel (= 7.0.8.4) + activerecord (= 7.0.8.4) + activestorage (= 7.0.8.4) + activesupport (= 7.0.8.4) bundler (>= 1.15.0) - railties (= 7.0.8.3) + railties (= 7.0.8.4) rails-dom-testing (2.2.0) activesupport (>= 5.0.0) minitest @@ -201,17 +178,17 @@ GEM rails-html-sanitizer (1.6.0) loofah (~> 2.21) nokogiri (~> 1.14) - railties (7.0.8.3) - actionpack (= 7.0.8.3) - activesupport (= 7.0.8.3) + railties (7.0.8.4) + actionpack (= 7.0.8.4) + activesupport (= 7.0.8.4) method_source rake (>= 12.2) thor (~> 1.0) zeitwerk (~> 2.5) rake (13.2.1) - rdoc (6.6.3.1) + rdoc (6.7.0) psych (>= 4.0.0) - reline (0.5.7) + reline (0.5.9) io-console (~> 0.5) rest-client (2.1.0) http-accept (>= 1.7.0, < 2.0) @@ -229,16 +206,25 @@ GEM sprockets (4.2.1) concurrent-ruby (~> 1.0) rack (>= 2.2.4, < 4) - sprockets-rails (3.4.2) - actionpack (>= 5.2) - activesupport (>= 5.2) + sprockets-rails (3.5.1) + actionpack (>= 6.1) + activesupport (>= 6.1) sprockets (>= 3.0.0) - stringio (3.1.0) + stringio (3.1.1) themoviedb-api (1.4.1) rest-client (~> 2.1) thor (1.3.1) - tilt (2.3.0) + tilt (2.4.0) timeout (0.4.1) + trestle (0.10.0.pre) + activemodel (>= 5.2.0) + kaminari (>= 1.1.0) + railties (>= 5.2.0) + trestle-auth (0.5.0.pre) + bcrypt (~> 3.1.7) + trestle (~> 0.10.0.pre) + trestle-search (0.5.0.pre) + trestle (~> 0.10.0.pre) turbo-rails (2.0.5) actionpack (>= 6.0.0) activejob (>= 6.0.0) @@ -255,7 +241,7 @@ GEM websocket-driver (0.7.6) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) - zeitwerk (2.6.14) + zeitwerk (2.6.16) PLATFORMS arm64-darwin-22 @@ -275,9 +261,9 @@ DEPENDENCIES sassc-rails (~> 2.1) sprockets-rails themoviedb-api - trestle! - trestle-auth! - trestle-search! + trestle (~> 0.10.0.pre) + trestle-auth (~> 0.5.0.pre) + trestle-search (~> 0.5.0.pre) turbo-rails uglifier (>= 1.3.0) web-console diff --git a/app/admin/acting_credits_admin.rb b/app/admin/acting_credits_admin.rb index a191a5f..64ddbfe 100644 --- a/app/admin/acting_credits_admin.rb +++ b/app/admin/acting_credits_admin.rb @@ -1,9 +1,9 @@ Trestle.resource(:acting_credits) do - form dialog: true do |credit| + form modal: true do |credit| row do col(sm: 4) do form_group :profile, label: false do - link_to image_tag(credit.profile_url), credit.profile_url, data: { behavior: "zoom" } + link_to image_tag(credit.profile_url), credit.profile_url, data: { controller: "lightbox" } end if credit.profile? end diff --git a/app/admin/crew_credits_admin.rb b/app/admin/crew_credits_admin.rb index aefaf09..343b3d8 100644 --- a/app/admin/crew_credits_admin.rb +++ b/app/admin/crew_credits_admin.rb @@ -1,9 +1,9 @@ Trestle.resource(:crew_credits) do - form dialog: true do |credit| + form modal: true do |credit| row do col(sm: 4) do form_group :profile, label: false do - link_to image_tag(credit.profile_url), credit.profile_url, data: { behavior: "zoom" } + link_to image_tag(credit.profile_url), credit.profile_url, data: { controller: "lightbox" } end if credit.profile? end diff --git a/app/admin/genres_admin.rb b/app/admin/genres_admin.rb index ff94241..2c47834 100644 --- a/app/admin/genres_admin.rb +++ b/app/admin/genres_admin.rb @@ -18,7 +18,7 @@ actions end - form dialog: true do |genre| + form modal: true do |genre| select :type, { "Movie" => "Movie::Genre", "TV Show" => "TVShow::Genre" } text_field :name end diff --git a/app/admin/movies_admin.rb b/app/admin/movies_admin.rb index 212e211..f44e5d7 100644 --- a/app/admin/movies_admin.rb +++ b/app/admin/movies_admin.rb @@ -73,7 +73,7 @@ sidebar do form_group :poster, label: false do - link_to image_tag(movie.poster_url("w500")), movie.poster_url, data: { behavior: "zoom" } + link_to image_tag(movie.poster_url("w500")), movie.poster_url, data: { controller: "lightbox" } end if movie.poster? static_field :tmdb, label: "TheMovieDB.org" do diff --git a/app/admin/people_admin.rb b/app/admin/people_admin.rb index a264643..9d09899 100644 --- a/app/admin/people_admin.rb +++ b/app/admin/people_admin.rb @@ -18,7 +18,7 @@ end sort_column(:credits_count) do |collection, order| - collection.reorder("credits_count #{order}") + collection.reorder(credits_count: order) end table do @@ -33,11 +33,11 @@ actions end - form dialog: true do |actor| + form modal: true do |actor| row do col(sm: 4) do form_group :profile, label: false do - link_to image_tag(actor.profile_url), actor.profile_url, data: { behavior: "zoom" } + link_to image_tag(actor.profile_url), actor.profile_url, data: { controller: "lightbox" } end if actor.profile? end diff --git a/app/admin/tv_show/seasons_admin.rb b/app/admin/tv_show/seasons_admin.rb index 84776e7..fb6048c 100644 --- a/app/admin/tv_show/seasons_admin.rb +++ b/app/admin/tv_show/seasons_admin.rb @@ -1,24 +1,19 @@ Trestle.resource(:seasons, scope: TVShow) do table do - row do - { data: { dialog_class: "modal-lg" } } - end - column :poster, header: nil, align: :center, class: "poster-column" do |season| - admin_link_to(image_tag(season.poster_url("h100"), class: "poster"), season, data: { dialog_class: "modal-lg" }) if season.poster? - end - column :name, link: true, truncate: false do |season| - admin_link_to season.name, season, data: { dialog_class: "modal-lg" } + column :poster, header: nil, align: :center, class: "poster-column", blank: "" do |season| + image_tag(season.poster_url("h100"), class: "poster") if season.poster? end + column :name, link: true, truncate: false column :episode_count, align: :center, header: "Episodes" column :air_date, align: :center actions end - form dialog: true do |season| + form modal: { class: "modal-lg" } do |season| row do col(sm: 4) do form_group :poster, label: false do - link_to image_tag(season.poster_url("w500")), season.poster_url, data: { behavior: "zoom" } + link_to image_tag(season.poster_url("w500")), season.poster_url, data: { controller: "lightbox" } end if season.poster? end diff --git a/app/admin/tv_shows_admin.rb b/app/admin/tv_shows_admin.rb index 6335624..2a0045d 100644 --- a/app/admin/tv_shows_admin.rb +++ b/app/admin/tv_shows_admin.rb @@ -69,7 +69,7 @@ sidebar do form_group :poster, label: false do - link_to image_tag(tv_show.poster_url("w500")), tv_show.poster_url, data: { behavior: "zoom" } + link_to image_tag(tv_show.poster_url("w500")), tv_show.poster_url, data: { controller: "lightbox" } end if tv_show.poster? static_field :tmdb, label: "TheMovieDB.org" do diff --git a/app/assets/javascripts/trestle/custom.js b/app/assets/javascripts/trestle/custom.js index 6baa5a6..590021a 100644 --- a/app/assets/javascripts/trestle/custom.js +++ b/app/assets/javascripts/trestle/custom.js @@ -1,4 +1,2 @@ // This file may be used for providing additional customizations to the Trestle // admin. It will be automatically included within all admin pages. -// -//= require "trestle/custom/videos" diff --git a/app/assets/javascripts/trestle/custom/videos.js b/app/assets/javascripts/trestle/custom/videos.js deleted file mode 100644 index 14a98d6..0000000 --- a/app/assets/javascripts/trestle/custom/videos.js +++ /dev/null @@ -1,16 +0,0 @@ -Trestle.init(function(e, root) { - $(root).find('[data-behavior~="video-gallery"]').magnificPopup({ - delegate: 'a', - type: 'iframe', - closeOnContentClick: false, - closeBtnInside: false, - mainClass: 'mfp-with-zoom mfp-img-mobile', - gallery: { - enabled: true - }, - zoom: { - enabled: true, - duration: 150 - } - }); -}); diff --git a/app/controllers/movies_controller.rb b/app/controllers/movies_controller.rb index c820ad2..0e02399 100644 --- a/app/controllers/movies_controller.rb +++ b/app/controllers/movies_controller.rb @@ -1,4 +1,7 @@ class MoviesController < MediaController + include Trestle::Auth::Controller::Authentication + before_action :require_authenticated_user + def index @movies = paginate(Movie) end diff --git a/app/models/acting_credit.rb b/app/models/acting_credit.rb index 2ab5cfe..d7247f6 100644 --- a/app/models/acting_credit.rb +++ b/app/models/acting_credit.rb @@ -1,7 +1,7 @@ class ActingCredit < Credit alias_attribute :character, :role - def self.top_billing - includes(:person).first(5) + def self.top_billing(n=5) + includes(:person).first(n) end end diff --git a/app/models/movie/genre.rb b/app/models/movie/genre.rb index 308c2eb..2b141e6 100644 --- a/app/models/movie/genre.rb +++ b/app/models/movie/genre.rb @@ -1,4 +1,6 @@ class Movie::Genre < Genre + has_and_belongs_to_many :movies + def media "Movie" end diff --git a/app/views/admin/shared/_media.html.erb b/app/views/admin/shared/_media.html.erb index 1387dfe..b90988c 100644 --- a/app/views/admin/shared/_media.html.erb +++ b/app/views/admin/shared/_media.html.erb @@ -1,42 +1,46 @@

Videos

-