Skip to content

Commit

Permalink
Merge pull request #999 from PRX/feat/992-warn-about-drafts
Browse files Browse the repository at this point in the history
Warn producers when new draft episodes exist
  • Loading branch information
brandonhundt committed Apr 17, 2024
2 parents 8cc1e56 + ef39bf1 commit e74851a
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
19 changes: 19 additions & 0 deletions app/views/episodes/_existing_drafts.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<div class="modal hide" id="existing-drafts" tabindex="-1" aria-labelledby="existing-drafts-title" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content">
<div class="modal-header">
<h5 class="fw-bold modal-title" id="existing-drafts-title"><%= t(".title") %></h5>
</div>
<div class="modal-body">
<p><%= t(".message").html_safe %></p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" data-bs-dismiss="modal"><%= t(".dismiss") %></button>
<%= link_to t(".episodes"), podcast_episodes_path(podcast), class: "btn btn-success" %>
</div>
</div>
</div>
</div>

<%# click hidden button to immediately show modal %>
<button type="button" class="d-none" data-bs-toggle="modal" data-bs-target="#existing-drafts" data-controller="click" data-click-immediate-value="true"></button>
2 changes: 2 additions & 0 deletions app/views/episodes/new.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@
<% if action_name == "new" && !@podcast.complete && @podcast.episodes.after(Time.now).none? %>
<%= render "missing_drafts", podcast: @podcast %>
<% elsif action_name == "new" && @podcast.episodes.after(Time.now).before(3.days.from_now).any? %>
<%= render "existing_drafts", podcast: @podcast %>
<% end %>
5 changes: 5 additions & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,11 @@ en:
asc: A-Z
calendar: Calendar
recent: Recent Activity
existing_drafts:
episodes: Back to Episodes
dismiss: Proceed with a new draft
message: Please consider using the draft that already exists on this published date as there may be an ad targeted specifically to the scheduled episode draft.
title: An episode draft for this date already exists
form:
confirm: Discard unsaved changes?
form_distribution:
Expand Down

0 comments on commit e74851a

Please sign in to comment.