diff --git a/app/controllers/episode_media_controller.rb b/app/controllers/episode_media_controller.rb index e46ecdee7..fb33e151f 100644 --- a/app/controllers/episode_media_controller.rb +++ b/app/controllers/episode_media_controller.rb @@ -8,6 +8,12 @@ def show @episode.valid? end + # GET /episodes/1/media/status + def status + authorize @episode, :show? + render :status, layout: false + end + # PATCH/PUT /episodes/1/media def update authorize @episode, :update? diff --git a/app/helpers/episodes_helper.rb b/app/helpers/episodes_helper.rb index 3326846c3..63551fb44 100644 --- a/app/helpers/episodes_helper.rb +++ b/app/helpers/episodes_helper.rb @@ -20,28 +20,17 @@ def episode_status_class(episode) end end - def episode_media_badge(episode) + def episode_media_status(episode) all_media = episode.media.append(episode.uncut).compact - status = - if all_media.any? { |m| upload_problem?(m) } - "error" - elsif all_media.any? { |m| upload_processing?(m) } - "processing" - elsif episode.media_ready?(true) - "complete" - else - "incomplete" - end - - label = I18n.t("helpers.label.episode.media_statuses.#{status}") - - tag.span class: "badge rounded-pill prx-badge-#{status}" do - if status == "processing" - safe_concat(label + " " + tag.span(class: "spinner-border")) - else - label - end + if all_media.any? { |m| upload_problem?(m) } + "error" + elsif all_media.any? { |m| upload_processing?(m) } + "processing" + elsif episode.media_ready?(true) + "complete" + else + "incomplete" end end diff --git a/app/views/episode_media/_form_uncut.html.erb b/app/views/episode_media/_form_uncut.html.erb index bbd5476fc..524c027fd 100644 --- a/app/views/episode_media/_form_uncut.html.erb +++ b/app/views/episode_media/_form_uncut.html.erb @@ -6,7 +6,7 @@