Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warn producers when new draft episodes exist #999

Merged
merged 2 commits into from
Apr 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading