From 5fc69135519e13582de5ddab29ee4fbf01ba0330 Mon Sep 17 00:00:00 2001 From: Roscoe Date: Wed, 10 Sep 2025 04:19:01 +0100 Subject: [PATCH] Improve UI --- app/views/clips/_form.html.erb | 23 ------------ app/views/clips/edit.html.erb | 24 ++++++++++++- app/views/clips/new.html.erb | 24 ++++++++++++- app/views/clips/show.html.erb | 50 +++++++++++++++++++++----- app/views/layouts/application.html.erb | 1 + 5 files changed, 88 insertions(+), 34 deletions(-) delete mode 100644 app/views/clips/_form.html.erb diff --git a/app/views/clips/_form.html.erb b/app/views/clips/_form.html.erb deleted file mode 100644 index c0fa7cb..0000000 --- a/app/views/clips/_form.html.erb +++ /dev/null @@ -1,23 +0,0 @@ -<%= form_with model: clip do |form| %> - - - - - - - - - - - - - - - - - - - - -
<%= form.label :title %><%= form.text_field :title %>
<%= form.label :video %><%= form.file_field :video, :accept => 'video/quicktime,video/mp4' %>
<%= form.label :category %><%= form.select :category_id, Category.all.collect{ |t| [ t.name, t.id ] }%>
<%= form.label :tag %><%= collection_select(:clip, :tag_ids, Tag.all, :id, :name, {}, { :multiple => true } )%>
<%= form.submit %>
-<% end %> \ No newline at end of file diff --git a/app/views/clips/edit.html.erb b/app/views/clips/edit.html.erb index 2ec8eb0..e8d62a1 100644 --- a/app/views/clips/edit.html.erb +++ b/app/views/clips/edit.html.erb @@ -1,4 +1,26 @@

Edit clip

-<%= render "form", clip: @clip %> +<%= form_with model: @clip do |form| %> + + + + + + + + + + + + + + + + + + + + +
<%= form.label :title %><%= form.text_field :title %>
Replace <%= form.label :video %><%= form.file_field :video, :accept => 'video/quicktime,video/mp4' %>
<%= form.label :category %><%= form.select :category_id, Category.all.collect{ |t| [ t.name, t.id ] }%>
<%= form.label :tag %><%= collection_select(:clip, :tag_ids, Tag.all, :id, :name, {}, { :multiple => true } )%>
<%= form.submit %>
+<% end %> <%= link_to "Cancel", @clip %> \ No newline at end of file diff --git a/app/views/clips/new.html.erb b/app/views/clips/new.html.erb index 1d5b7b4..2859576 100644 --- a/app/views/clips/new.html.erb +++ b/app/views/clips/new.html.erb @@ -1,4 +1,26 @@

New Clip

-<%= render "form", clip: @clip %> +<%= form_with model: @clip do |form| %> + + + + + + + + + + + + + + + + + + + + +
<%= form.label :title %><%= form.text_field :title %>
<%= form.label :video %><%= form.file_field :video, :accept => 'video/quicktime,video/mp4' %>
<%= form.label :category %><%= form.select :category_id, Category.all.collect{ |t| [ t.name, t.id ] }%>
<%= form.label :tag %><%= collection_select(:clip, :tag_ids, Tag.all, :id, :name, {}, { :multiple => true } )%>
<%= form.submit %>
+<% end %> <%= link_to "Cancel", clips_path %> \ No newline at end of file diff --git a/app/views/clips/show.html.erb b/app/views/clips/show.html.erb index daeb28c..0d28ad3 100644 --- a/app/views/clips/show.html.erb +++ b/app/views/clips/show.html.erb @@ -1,12 +1,44 @@ <% cache @clip do %>

<%= @clip.title %>

<% end %> -<% if @clip.video.attached? %> -<%= video_tag @clip.video, :controls => true%>
-<% end %> -Category: <%= link_to @clip.category.name, @clip.category %>
-Tags: <%= @clip.tags.map(&:name).join(', ') %>
-<% if authenticated? %> - <%= button_to "Edit", edit_clip_path(@clip), :method => "get" %> - <%= button_to "Delete", @clip, method: :delete, data: { turbo_confirm: "Are you sure?" } %> -<% end %> \ No newline at end of file + + + <% if @clip.video.attached? %> + + <% end %> + + +
+ <%= video_tag @clip.video, :controls => true%> + + + + + + + + + + + + + + + + + + + + + + + + + +
Category:<%= link_to @clip.category.name, @clip.category %>
Tags:<%= @clip.tags.map(&:name).join(', ') %>
Length:<%= seconds_to_time(@clip.video.metadata["duration"]) %>
Last Updated:<%= @clip.updated_at %>
Created:<%= @clip.created_at %>
+ <% if authenticated? %> + <%= button_to "Edit", edit_clip_path(@clip), :method => "get" %> + <%= button_to "Delete", @clip, method: :delete, data: { turbo_confirm: "Are you sure?" } %> + <% end %> +
+
diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index b6ce16f..b0d9ddc 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -28,6 +28,7 @@ +

Misadventure