diff --git a/apps/api/app/admin/softwares.rb b/apps/api/app/admin/softwares.rb index eecbf3a..606946c 100644 --- a/apps/api/app/admin/softwares.rb +++ b/apps/api/app/admin/softwares.rb @@ -30,7 +30,7 @@ ActiveAdmin.register Software do filter :name filter :title filter :author - filter :platform, as: :select, collection: %w[tic80 ebitengine love] + filter :platform, as: :select, collection: %w[tic80 ebitengine love c64] filter :status, as: :select, collection: %w[development demo released archived] filter :highlighted @@ -40,7 +40,7 @@ ActiveAdmin.register Software do f.input :name f.input :title f.input :author - f.input :platform, as: :select, collection: %w[tic80 ebitengine love] + f.input :platform, as: :select, collection: %w[tic80 ebitengine love c64] f.input :status, as: :select, collection: %w[development demo released archived] f.input :highlighted f.input :license @@ -78,7 +78,7 @@ ActiveAdmin.register Software do f.input :name f.input :title f.input :author - f.input :platform, as: :select, collection: %w[tic80 ebitengine love] + f.input :platform, as: :select, collection: %w[tic80 ebitengine love c64] f.input :status, as: :select, collection: %w[development demo released archived] f.input :highlighted f.input :license diff --git a/apps/api/app/models/release.rb b/apps/api/app/models/release.rb index 5a02f90..95a92ec 100644 --- a/apps/api/app/models/release.rb +++ b/apps/api/app/models/release.rb @@ -5,6 +5,16 @@ class Release < ApplicationRecord default_scope { where(deleted_at: nil) } + validate :c64_cannot_be_web_playable + + def c64_cannot_be_web_playable + return unless software&.platform == "c64" + + if html_folder_path.present? || web_playable? + errors.add(:base, "C64 releases cannot be web playable (download only)") + end + end + def self.ransackable_attributes(auth_object = nil) %w[cartridge_path created_at deleted_at docs_folder_path html_folder_path id software_id source_path updated_at version web_playable] end