diff --git a/app/controllers/feeds_controller.rb b/app/controllers/feeds_controller.rb index c40119b28..4407ca953 100644 --- a/app/controllers/feeds_controller.rb +++ b/app/controllers/feeds_controller.rb @@ -18,6 +18,7 @@ def new @feed = @podcast.feeds.new(private: false, slug: "") authorize @feed + @feed.assign_attributes(feed_params) @feed.clear_attribute_changes(%i[file_name podcast_id private slug]) end @@ -106,6 +107,10 @@ def nilified_feed_params :title, :subtitle, :description, + :itunes_category, + :itunes_subcategory, + :include_donation_url, + :include_podcast_value, :private, :url, :new_feed_url, @@ -122,8 +127,6 @@ def nilified_feed_params :house, :paid, :sonic_id, - :include_donation_url, - :include_podcast_value, include_tags: [], feed_tokens_attributes: %i[id label token _destroy], feed_images_attributes: %i[id original_url size alt_text caption credit _destroy _retry], diff --git a/app/views/feeds/_form_overrides.html.erb b/app/views/feeds/_form_overrides.html.erb index a2357b025..14bfab1a2 100644 --- a/app/views/feeds/_form_overrides.html.erb +++ b/app/views/feeds/_form_overrides.html.erb @@ -6,6 +6,46 @@
+
+
+ <%= form.text_field :subtitle %> + <%= form.label :subtitle %> + <%= field_help_text t(".help.subtitle") %> +
+
+ +
+
+ <%= form.trix_editor :description %> + <%= form.label :description %> + <%= field_help_text t(".help.description") %> +
+
+ +
+
+ <%# HACK: display nested validation errors %> + <% nested_errors = feed.errors.full_messages_for("itunes_categories.name").join(", ") %> + <% klass = nested_errors.present? ? "is-invalid form-select" : "form-select" %> + <%= form.select :itunes_category, itunes_category_options, {include_blank: true}, class: klass, data: {action: "dynamic-form#change"} %> + <% if nested_errors.present? %>
<%= nested_errors %>
<% end %> + <%= form.label :itunes_category %> + <%= field_help_text t(".help.itunes_category") %> + <%# update subcategory turbo-frame when category changes %> + +
+
+ +
+ <%= turbo_frame_tag "itunes-subcategory" do %> +
+ <% opts = itunes_subcategory_options(feed.itunes_category) %> + <%= form.select :itunes_subcategory, opts, {include_blank: true}, disabled: opts.blank? %> + <%= form.label :itunes_subcategory %> +
+ <% end %> +
+
<%= form.check_box :include_donation_url %> @@ -26,22 +66,6 @@
- -
-
- <%= form.text_field :subtitle %> - <%= form.label :subtitle %> - <%= field_help_text t(".help.subtitle") %> -
-
- -
-
- <%= form.trix_editor :description %> - <%= form.label :description %> - <%= field_help_text t(".help.description") %> -
-