From 03807feff45c80dff614f976a3c9a2f2e7809bd5 Mon Sep 17 00:00:00 2001 From: Chris Colvard Date: Wed, 1 Nov 2023 15:17:03 -0400 Subject: [PATCH 1/2] Move administrative buttons to top of page and outside of scope of Ramp --- app/javascript/components/Ramp.jsx | 6 ------ .../media_objects/_administrative_links.html.erb | 2 +- app/views/media_objects/_item_view.html.erb | 14 +++++++++++--- app/views/media_objects/_thumbnail.html.erb | 2 +- 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/app/javascript/components/Ramp.jsx b/app/javascript/components/Ramp.jsx index 32e7df27c1..087c7f3328 100644 --- a/app/javascript/components/Ramp.jsx +++ b/app/javascript/components/Ramp.jsx @@ -34,11 +34,9 @@ const Ramp = ({ master_files_count, title, expand_structure, - admin_links, share, timeline, playlist, - thumbnail, in_progress, cdl }) => { @@ -94,10 +92,6 @@ const Ramp = ({ } - - { admin_links.canUpdate &&
} - { thumbnail.canCreate &&
} -
diff --git a/app/views/media_objects/_administrative_links.html.erb b/app/views/media_objects/_administrative_links.html.erb index 5d2db4bef7..4429461e8c 100644 --- a/app/views/media_objects/_administrative_links.html.erb +++ b/app/views/media_objects/_administrative_links.html.erb @@ -14,7 +14,7 @@ Unless required by applicable law or agreed to in writing, software distributed --- END LICENSE_HEADER BLOCK --- %> <% if can? :update, @media_object %> -
+
<%= link_to 'Edit', edit_media_object_path(@media_object), class: 'btn btn-primary' %> <% if @media_object.published? %> diff --git a/app/views/media_objects/_item_view.html.erb b/app/views/media_objects/_item_view.html.erb index f0e5ae7d99..49ccb91a60 100644 --- a/app/views/media_objects/_item_view.html.erb +++ b/app/views/media_objects/_item_view.html.erb @@ -25,9 +25,19 @@ Unless required by applicable law or agreed to in writing, software distributed <% in_progress = show_progress?(@masterFiles) %>
-
+
<%= render 'workflow_progress' %>
+
+ <%= render 'administrative_links' %> + <% if current_ability.can? :edit, @media_object %> + <% if lending_enabled?(@media_object) %> + <%= render 'thumbnail' if can_stream %> + <% else %> + <%= render 'thumbnail' %> + <% end %> + <% end %> +
<%= react_component("Ramp", { @@ -36,10 +46,8 @@ Unless required by applicable law or agreed to in writing, software distributed master_files_count: @media_object.master_files.size, title: { content: render('title') }, expand_structure: { content: render('expand_structure') }, - admin_links: { canUpdate: (current_ability.can? :update, @media_object), content: render('administrative_links') }, share: { canShare: (will_partial_list_render? :share), content: lending_enabled?(@media_object) ? (render('share') if can_stream) : render('share') }, timeline: { canCreate: (current_ability.can? :create, Timeline), content: lending_enabled?(@media_object) ? (render('timeline') if can_stream) : render('timeline') }, - thumbnail: { canCreate: (current_ability.can? :edit, @media_object), content: lending_enabled?(@media_object) ? (render('thumbnail') if can_stream) : render('thumbnail') }, playlist: { canCreate: (current_ability.can? :create, Playlist), tab: render('add_to_playlist') }, in_progress: in_progress, cdl: { enabled: lending_enabled?(@media_object), can_stream: can_stream, embed: render('embed_checkout'), destroy: render('destroy_checkout') } diff --git a/app/views/media_objects/_thumbnail.html.erb b/app/views/media_objects/_thumbnail.html.erb index 7f67cff375..f8f2753e2c 100644 --- a/app/views/media_objects/_thumbnail.html.erb +++ b/app/views/media_objects/_thumbnail.html.erb @@ -14,7 +14,7 @@ Unless required by applicable law or agreed to in writing, software distributed --- END LICENSE_HEADER BLOCK --- %> -
+
From c6d5baab7de4c3fc44bbc748755e5c957f6b53ab Mon Sep 17 00:00:00 2001 From: Chris Colvard Date: Fri, 3 Nov 2023 08:49:12 -0400 Subject: [PATCH 2/2] Use bootstrap classes instead of inline style --- app/views/media_objects/_administrative_links.html.erb | 2 +- app/views/media_objects/_item_view.html.erb | 2 +- app/views/media_objects/_thumbnail.html.erb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/views/media_objects/_administrative_links.html.erb b/app/views/media_objects/_administrative_links.html.erb index 4429461e8c..bc733bb6c1 100644 --- a/app/views/media_objects/_administrative_links.html.erb +++ b/app/views/media_objects/_administrative_links.html.erb @@ -14,7 +14,7 @@ Unless required by applicable law or agreed to in writing, software distributed --- END LICENSE_HEADER BLOCK --- %> <% if can? :update, @media_object %> -
+
<%= link_to 'Edit', edit_media_object_path(@media_object), class: 'btn btn-primary' %> <% if @media_object.published? %> diff --git a/app/views/media_objects/_item_view.html.erb b/app/views/media_objects/_item_view.html.erb index 49ccb91a60..53530bbf3a 100644 --- a/app/views/media_objects/_item_view.html.erb +++ b/app/views/media_objects/_item_view.html.erb @@ -28,7 +28,7 @@ Unless required by applicable law or agreed to in writing, software distributed
<%= render 'workflow_progress' %>
-
+
<%= render 'administrative_links' %> <% if current_ability.can? :edit, @media_object %> <% if lending_enabled?(@media_object) %> diff --git a/app/views/media_objects/_thumbnail.html.erb b/app/views/media_objects/_thumbnail.html.erb index f8f2753e2c..29656a7180 100644 --- a/app/views/media_objects/_thumbnail.html.erb +++ b/app/views/media_objects/_thumbnail.html.erb @@ -14,7 +14,7 @@ Unless required by applicable law or agreed to in writing, software distributed --- END LICENSE_HEADER BLOCK --- %> -
+