Tapes are now Clips, also they have categories
This commit is contained in:
parent
86c489be72
commit
c8732b6332
41 changed files with 347 additions and 148 deletions
12
app/views/clips/_form.html.erb
Normal file
12
app/views/clips/_form.html.erb
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
<%= form_with model: clip do |form| %>
|
||||
<div>
|
||||
<%= form.label :title %>
|
||||
<%= form.text_field :title %>
|
||||
<%= form.file_field :video, :accept => 'video/quicktime,video/mp4' %>
|
||||
<%= form.select :category_id, Category.all.collect{ |t| [ t.name, t.id ] }%>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<%= form.submit %>
|
||||
</div>
|
||||
<% end %>
|
||||
4
app/views/clips/edit.html.erb
Normal file
4
app/views/clips/edit.html.erb
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
<h1>Edit clip</h1>
|
||||
|
||||
<%= render "form", clip: @clip %>
|
||||
<%= link_to "Cancel", @clip %>
|
||||
36
app/views/clips/index.html.erb
Normal file
36
app/views/clips/index.html.erb
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
<h1>Clips</h1>
|
||||
|
||||
<%= link_to "New clip", new_clip_path if authenticated? %>
|
||||
|
||||
<table id="clips" border="1">
|
||||
<tr>
|
||||
<th>Preview</th>
|
||||
<th>Title</th>
|
||||
<th>Duration</th>
|
||||
<th>Category</th>
|
||||
<th>Updated at</th>
|
||||
<th>Created at</th>
|
||||
</tr>
|
||||
<% @clips.each do |clip| %>
|
||||
<tr>
|
||||
<td>
|
||||
<%= link_to (image_tag url_for(clip.video.preview(resize_to_limit: [160, 120]).processed)), clip %>
|
||||
</td>
|
||||
<td>
|
||||
<%= link_to clip.title, clip %>
|
||||
</td>
|
||||
<td>
|
||||
<%= seconds_to_time(clip.video.metadata["duration"]) %>
|
||||
</td>
|
||||
<td>
|
||||
<%= clip.category.name %>
|
||||
</td>
|
||||
<td>
|
||||
<%= clip.updated_at %>
|
||||
</td>
|
||||
<td>
|
||||
<%= clip.created_at %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</table>
|
||||
4
app/views/clips/new.html.erb
Normal file
4
app/views/clips/new.html.erb
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
<h1>New Clip</h1>
|
||||
|
||||
<%= render "form", clip: @clip %>
|
||||
<%= link_to "Cancel", clips_path %>
|
||||
12
app/views/clips/show.html.erb
Normal file
12
app/views/clips/show.html.erb
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
<% cache @clip do %>
|
||||
<h1><%= @clip.title %></h1>
|
||||
<% end %>
|
||||
<b>Category:</b> <%= link_to @clip.category.name, @clip.category %><br>
|
||||
<% if @clip.video.attached? %>
|
||||
<%= video_tag @clip.video, :controls => true%>
|
||||
<% end %>
|
||||
<%= link_to "Back", clips_path%>
|
||||
<% if authenticated? %>
|
||||
<%= link_to "Edit", edit_clip_path(@clip) %>
|
||||
<%= button_to "Delete", @clip, method: :delete, data: { turbo_confirm: "Are you sure?" } %>
|
||||
<% end %>
|
||||
Loading…
Add table
Add a link
Reference in a new issue