diff --git a/apps/api/app/admin/softwares.rb b/apps/api/app/admin/softwares.rb index 1517bf3..eecbf3a 100644 --- a/apps/api/app/admin/softwares.rb +++ b/apps/api/app/admin/softwares.rb @@ -2,7 +2,7 @@ ActiveAdmin.register Software do permit_params :name, :title, :author, :desc, :story, :license, :platform, :status, :highlighted, :image_id, external_links_attributes: [ :id, :label, :url, :_destroy ], - releases_attributes: [ :id, :_destroy ] + releases_attributes: [ :id, :version, :html_folder_path, :cartridge_path, :source_path, :docs_folder_path, :web_playable, :_destroy ] menu priority: 2 @@ -58,18 +58,18 @@ ActiveAdmin.register Software do end end - f.actions - end - - panel "Releases" do - table_for resource.releases.order(created_at: :desc) do - column :version - column :html_folder_path - column :cartridge_path - column :source_path - column :docs_folder_path - column :created_at + f.inputs "Releases" do + f.has_many :releases, allow_destroy: true, new_record: true do |r| + r.input :version + r.input :html_folder_path + r.input :cartridge_path + r.input :source_path + r.input :docs_folder_path + r.input :web_playable + end end + + f.actions end end @@ -96,6 +96,17 @@ ActiveAdmin.register Software do end end + f.inputs "Releases" do + f.has_many :releases, allow_destroy: true, new_record: true do |r| + r.input :version + r.input :html_folder_path + r.input :cartridge_path + r.input :source_path + r.input :docs_folder_path + r.input :web_playable + end + end + f.actions end end diff --git a/apps/api/app/models/software.rb b/apps/api/app/models/software.rb index 4b609ed..def66d7 100644 --- a/apps/api/app/models/software.rb +++ b/apps/api/app/models/software.rb @@ -7,6 +7,7 @@ class Software < ApplicationRecord has_many :external_links, foreign_key: :software_id accepts_nested_attributes_for :external_links, allow_destroy: true + accepts_nested_attributes_for :releases, allow_destroy: true default_scope { where(deleted_at: nil) }