Skip to content

Commit

Permalink
Add remaining forms
Browse files Browse the repository at this point in the history
  • Loading branch information
cavis committed Apr 25, 2024
1 parent e4c605c commit da57a34
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 0 deletions.
3 changes: 3 additions & 0 deletions app/controllers/feeds_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ def update
end
end
end
rescue ActiveRecord::StaleObjectError
render :show, status: :conflict
end

# DELETE /feeds/1
Expand Down Expand Up @@ -103,6 +105,7 @@ def feed_params

def nilified_feed_params
nilify params.fetch(:feed, {}).permit(
:lock_version,
:file_name,
:title,
:subtitle,
Expand Down
3 changes: 3 additions & 0 deletions app/controllers/podcast_engagement_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ def update
format.html { render :show, status: :unprocessable_entity }
end
end
rescue ActiveRecord::StaleObjectError
render :show, status: :conflict
end

private
Expand All @@ -32,6 +34,7 @@ def set_podcast
### TODO include params for socmed and podcast apps
def podcast_engagement_params
nilify params.fetch(:podcast, {}).permit(
:lock_version,
:donation_url,
:payment_pointer
)
Expand Down
3 changes: 3 additions & 0 deletions app/controllers/podcasts_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ def update
format.html { render :edit, status: :unprocessable_entity }
end
end
rescue ActiveRecord::StaleObjectError
render :edit, status: :conflict
end

# DELETE /podcasts/1
Expand Down Expand Up @@ -107,6 +109,7 @@ def published_episodes(date_range)

def podcast_params
nilify params.fetch(:podcast, {}).permit(
:lock_version,
:title,
:prx_account_uri,
:link,
Expand Down
2 changes: 2 additions & 0 deletions app/views/feeds/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,6 @@
</div>

<%= render "confirm_destroy", podcast: podcast, feed: feed %>
<%= render "layouts/stale_record_modal", form: form, discard_path: podcast_feed_path(podcast, feed) %>
<% end %>
3 changes: 3 additions & 0 deletions app/views/feeds/_form_status.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
<div class="card-header-primary">
<h2 class="card-title h5"><%= t(".title") %></h2>
</div>

<%= render "layouts/stale_record_field", form: form %>

<div class="card-footer d-flex align-items-center">
<% if feed.persisted? %>
<p class="status-text flex-grow-1"><strong><%= t(".updated_at_hint") %></strong> <br><%= local_time_ago(feed.updated_at) %></p>
Expand Down
1 change: 1 addition & 0 deletions app/views/podcast_engagement/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@
</div>
</div>

<%= render "layouts/stale_record_modal", form: form, discard_path: podcast_engagement_path(podcast) %>
<% end %>
3 changes: 3 additions & 0 deletions app/views/podcast_engagement/_form_status.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
<div class="card-header-primary">
<h2 class="card-title h5"><%= t(".title") %></h2>
</div>

<%= render "layouts/stale_record_field", form: form %>

<div class="card-footer d-flex align-items-center">

<p class="status-text flex-grow-1"><strong><%= t(".updated_at_hint") %></strong> <br><%= local_time_ago(podcast.updated_at) %></p>
Expand Down
2 changes: 2 additions & 0 deletions app/views/podcasts/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,6 @@
</div>

<%= render "confirm_destroy", podcast: podcast %>
<%= render "layouts/stale_record_modal", form: form, discard_path: edit_podcast_path(podcast) %>
<% end %>
3 changes: 3 additions & 0 deletions app/views/podcasts/_form_status.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
<div class="card-header-primary">
<h2 class="card-title h5"><%= t(".title") %></h2>
</div>

<%= render "layouts/stale_record_field", form: form %>

<div class="card-footer d-flex align-items-center">
<% if podcast.persisted? %>
<p class="status-text flex-grow-1"><strong><%= t(".updated_at_hint") %></strong> <br><%= local_time_ago(podcast.updated_at) %></p>
Expand Down

0 comments on commit da57a34

Please sign in to comment.