-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
69 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
class EpisodeMediaController < ApplicationController | ||
before_action :set_episode | ||
|
||
# GET /episodes/1/media | ||
def show | ||
authorize @episode, :show? | ||
@episode.assign_attributes(episode_params) | ||
@episode.valid? | ||
end | ||
|
||
# PATCH/PUT /episodes/1/media | ||
def update | ||
authorize @episode, :update? | ||
@episode.assign_attributes(episode_params) | ||
|
||
respond_to do |format| | ||
if @episode.save | ||
format.html { redirect_to episode_media_path(@episode), notice: t(".notice") } | ||
else | ||
flash.now[:error] = t(".error") | ||
format.html { render :show, status: :unprocessable_entity } | ||
end | ||
end | ||
end | ||
|
||
private | ||
|
||
def set_episode | ||
@episode = Episode.find_by_guid!(params[:episode_id]) | ||
@episode.strict_validations = true | ||
@podcast = @episode.podcast | ||
end | ||
|
||
def episode_params | ||
nilify params.fetch(:episode, {}).permit( | ||
:medium, | ||
:ad_breaks, | ||
contents_attributes: %i[id position original_url file_size _destroy _retry], | ||
uncut_attributes: %i[id original_url file_size _destroy _retry] | ||
) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<% content_for :title, "#{@episode.title} - #{t(".title")}" %> | ||
<%= render "episodes/tabs" %> | ||
|
||
<div class="row my-4 mx-2"> | ||
<div class="col-lg-8"> | ||
<div class="row"> | ||
episode media todo | ||
</div> | ||
</div> | ||
<div class="col-lg-4 d-grid align-content-start gap-3"> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,14 @@ | ||
<% content_for :tabs do %> | ||
<div class="list-group d-flex col"> | ||
<% if @episode.persisted? %> | ||
<%= tab_link_to "Metadata", edit_episode_path(@episode), active: episode_metadata_active? %> | ||
<%= tab_link_to t(".edit"), edit_episode_path(@episode), active: episode_metadata_active? %> | ||
<%= tab_link_to t(".media"), episode_media_path(@episode) %> | ||
<% if @episode.medium_uncut? %> | ||
<%= tab_link_to "Audio Segmenter", episode_segmenter_path(@episode) %> | ||
<%= tab_link_to t(".segmenter"), episode_segmenter_path(@episode) %> | ||
<% end %> | ||
<%= tab_link_to "Embeddable Player", episode_player_path(@episode) %> | ||
<%= tab_link_to t(".player"), episode_player_path(@episode) %> | ||
<% else %> | ||
<%= tab_link_to "Metadata", new_podcast_episode_path(@podcast), active: true %> | ||
<%= tab_link_to t(".edit"), new_podcast_episode_path(@podcast), active: true %> | ||
<% end %> | ||
</div> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters