Improve UI

This commit is contained in:
Roscoe 2025-09-10 04:19:01 +01:00
commit 5fc6913551
Signed by: RoscoeDaWah
SSH key fingerprint: SHA256:Hqn452XQ1ETzUt/FthJu6+OFkS4NBxCv5VQSEvuk7CE
5 changed files with 88 additions and 34 deletions

View file

@ -1,23 +0,0 @@
<%= form_with model: clip do |form| %>
<table border="1">
<tr>
<td valign="top"><b><%= form.label :title %></b></td>
<td valign="top"><%= form.text_field :title %></td>
</tr>
<tr>
<td valign="top"><b><%= form.label :video %></b></td>
<td valign="top"><%= form.file_field :video, :accept => 'video/quicktime,video/mp4' %></td>
</tr>
<tr>
<td valign="top"><b><%= form.label :category %></b></td>
<td valign="top"><%= form.select :category_id, Category.all.collect{ |t| [ t.name, t.id ] }%></td>
</tr>
<tr>
<td valign="top"><b><%= form.label :tag %></b></td>
<td valign="top"><%= collection_select(:clip, :tag_ids, Tag.all, :id, :name, {}, { :multiple => true } )%></td>
</tr>
<tr>
<td colspan="2"><%= form.submit %></td>
</tr>
</table>
<% end %>

View file

@ -1,4 +1,26 @@
<h1>Edit clip</h1> <h1>Edit clip</h1>
<%= render "form", clip: @clip %> <%= form_with model: @clip do |form| %>
<table border="1">
<tr>
<td valign="top"><b><%= form.label :title %></b></td>
<td valign="top"><%= form.text_field :title %></td>
</tr>
<tr>
<td valign="top"><b>Replace <%= form.label :video %></b></td>
<td valign="top"><%= form.file_field :video, :accept => 'video/quicktime,video/mp4' %></td>
</tr>
<tr>
<td valign="top"><b><%= form.label :category %></b></td>
<td valign="top"><%= form.select :category_id, Category.all.collect{ |t| [ t.name, t.id ] }%></td>
</tr>
<tr>
<td valign="top"><b><%= form.label :tag %></b></td>
<td valign="top"><%= collection_select(:clip, :tag_ids, Tag.all, :id, :name, {}, { :multiple => true } )%></td>
</tr>
<tr>
<td colspan="2"><%= form.submit %></td>
</tr>
</table>
<% end %>
<%= link_to "Cancel", @clip %> <%= link_to "Cancel", @clip %>

View file

@ -1,4 +1,26 @@
<h1>New Clip</h1> <h1>New Clip</h1>
<%= render "form", clip: @clip %> <%= form_with model: @clip do |form| %>
<table border="1">
<tr>
<td valign="top"><b><%= form.label :title %></b></td>
<td valign="top"><%= form.text_field :title %></td>
</tr>
<tr>
<td valign="top"><b><%= form.label :video %></b></td>
<td valign="top"><%= form.file_field :video, :accept => 'video/quicktime,video/mp4' %></td>
</tr>
<tr>
<td valign="top"><b><%= form.label :category %></b></td>
<td valign="top"><%= form.select :category_id, Category.all.collect{ |t| [ t.name, t.id ] }%></td>
</tr>
<tr>
<td valign="top"><b><%= form.label :tag %></b></td>
<td valign="top"><%= collection_select(:clip, :tag_ids, Tag.all, :id, :name, {}, { :multiple => true } )%></td>
</tr>
<tr>
<td colspan="2"><%= form.submit %></td>
</tr>
</table>
<% end %>
<%= link_to "Cancel", clips_path %> <%= link_to "Cancel", clips_path %>

View file

@ -1,12 +1,44 @@
<% cache @clip do %> <% cache @clip do %>
<h1><%= @clip.title %></h1> <h1><%= @clip.title %></h1>
<% end %> <% end %>
<% if @clip.video.attached? %> <table>
<%= video_tag @clip.video, :controls => true%><br> <tr>
<% end %> <% if @clip.video.attached? %>
<b>Category:</b> <%= link_to @clip.category.name, @clip.category %><br> <td>
<b>Tags:</b> <%= @clip.tags.map(&:name).join(', ') %><br> <%= video_tag @clip.video, :controls => true%>
<% if authenticated? %> </td>
<%= button_to "Edit", edit_clip_path(@clip), :method => "get" %> <% end %>
<%= button_to "Delete", @clip, method: :delete, data: { turbo_confirm: "Are you sure?" } %> <td valign="top">
<% end %> <table border="1">
<tr>
<td valign="top"><b>Category:</b></td>
<td><%= link_to @clip.category.name, @clip.category %></td>
</tr>
<tr>
<td valign="top"><b>Tags:</b></td>
<td><%= @clip.tags.map(&:name).join(', ') %></td>
</tr>
<tr>
<td valign="top"><b>Length:</b></td>
<td><%= seconds_to_time(@clip.video.metadata["duration"]) %></td>
</tr>
<tr>
<td valign="top"><b>Last Updated:</b></td>
<td><%= @clip.updated_at %></td>
</tr>
<tr>
<td valign="top"><b>Created:</b></td>
<td><%= @clip.created_at %></td>
</tr>
<tr>
<td colspan="2">
<% if authenticated? %>
<%= button_to "Edit", edit_clip_path(@clip), :method => "get" %>
<%= button_to "Delete", @clip, method: :delete, data: { turbo_confirm: "Are you sure?" } %>
<% end %>
</td>
</tr>
</table>
</td>
</tr>
</table>

View file

@ -28,6 +28,7 @@
</head> </head>
<body> <body>
<h1>Misadventure</h1>
<nav> <nav>
<%= link_to "Home", root_path %> <%= link_to "Home", root_path %>
<%= button_to "Log out", session_path, method: :delete if authenticated? %> <%= button_to "Log out", session_path, method: :delete if authenticated? %>