Added channel and video edit pages; added link back to channel from video view page

This commit is contained in:
2023-03-04 08:47:07 -05:00
parent ef1813f16e
commit 5ed1771b18
5 changed files with 147 additions and 1 deletions

43
views/video/edit.erb Normal file
View File

@ -0,0 +1,43 @@
<div class="row">
<div class="twelve columns">
<h1>Editing: <%= video.name %></h1>
</div>
</div>
<div class="row">
<div class="twelve columns">
<form action="/video/<%= video.id %>/edit" method="POST" class="u-full-width">
<div class="row">
<div class="columns twelve">
<label for="video_name">Video name:</label>
<input class="u-full-width" type="text" placeholder="My new video" id="video_name" name="video_name" required value="<%= video.name %>">
</div>
</div>
<div class="row">
<div class="columns three">
<label for="video_serial">Video serial:</label>
<input class="u-full-width" type="number" placeholder="0001" id="video_serial" name="video_serial" required value="<%= video.serial %>">
</div>
<div class="columns nine">
<label for="video_channel">Associated channel:</label>
<select class="u-full-width" id="video_channel" name="video_channel" required>
<% channels.each do |c| %>
<option value="<%= c.id %>"<% if c.id == video.channel_id %> selected<% end %>><%= c.name %></option>
<% end %>
</select>
</div>
</div>
<div class="row">
<div class="twelve columns">
<label for="video_description">Video description:</label>
<textarea class="u-full-width" type="text" placeholder="Description of the video" id="video_description" name="video_description"><%= video.description %></textarea>
</div>
</div>
<input class="button-primary u-full-width" type="submit" value="Submit">
</form>
</div>
</div>

View File

@ -15,7 +15,7 @@
<a href="/video/<%= video.id %>/delete">Delete <i class="fa-solid fa-trash"></i></a></span>
</div>
<div class="video-channel">
<p>Channel: <span><%= video.channel.name %></span></p>
<p>Channel: <a href="/channel/<%= video.channel.id %>"><span><%= video.channel.name %></span></a></p>
</div>
<div class="video-serial">
<p>Serial: <span><%= serialize(video.serial) %></span></p>