From 61f6de5ff32da678b80f68a962a6b7ad46be6a9a Mon Sep 17 00:00:00 2001 From: evazion Date: Sun, 9 Dec 2018 00:01:26 -0600 Subject: [PATCH] artist versions: rearrange layout to better fit small screens. * Move group name beneath the artist name. * Replace 'Active' column with '(deleted)' notice next to artist name. * Combine updater, updated at, and ip address fields in single column. * Combine templates for standard listing and revert listing (only difference is presense of 'Revert to' column). --- app/helpers/artist_versions_helper.rb | 4 ++ .../artist_versions/_revert_listing.html.erb | 54 ------------------- .../_standard_listing.html.erb | 54 ++++++++++--------- app/views/artist_versions/index.html.erb | 7 +-- 4 files changed, 35 insertions(+), 84 deletions(-) delete mode 100644 app/views/artist_versions/_revert_listing.html.erb diff --git a/app/helpers/artist_versions_helper.rb b/app/helpers/artist_versions_helper.rb index 1f55b471e..87ed000c1 100644 --- a/app/helpers/artist_versions_helper.rb +++ b/app/helpers/artist_versions_helper.rb @@ -1,4 +1,8 @@ module ArtistVersionsHelper + def artist_versions_listing_type + params.dig(:search, :artist_id).present? && CurrentUser.is_member? ? :revert : :standard + end + def artist_version_other_names_diff(artist_version) new_names = artist_version.other_names old_names = artist_version.previous.try(:other_names) diff --git a/app/views/artist_versions/_revert_listing.html.erb b/app/views/artist_versions/_revert_listing.html.erb deleted file mode 100644 index b73fb7112..000000000 --- a/app/views/artist_versions/_revert_listing.html.erb +++ /dev/null @@ -1,54 +0,0 @@ -
- - - - - - - - - <% if CurrentUser.is_moderator? %> - - <% end %> - - - <% if CurrentUser.is_member? %> - - <% end %> - - - - <% @artist_versions.each do |artist_version| %> - - <% if artist_version.visible? %> - - - - <% else %> - - - - <% end %> - - - <% if CurrentUser.is_moderator? %> - - <% end %> - - <% if artist_version.visible? %> - - <% else %> - - <% end %> - <% if CurrentUser.is_member? %> - - <% end %> - - <% end %> - -
NameOther NamesGroupUpdatedUpdated byIP AddressActiveURLs
<%= link_to artist_version.name, artist_path(artist_version.artist_id) %><%= artist_version_other_names_diff(artist_version) %><%= artist_version.group_name %><%= compact_time artist_version.created_at %><%= link_to_user artist_version.updater %> - <%= link_to_ip artist_version.updater_ip_addr %> - <%= artist_version.is_active? %><%= artist_version_urls_diff(artist_version) %> - <%= link_to "Revert to", revert_artist_path(artist_version.artist_id, :version_id => artist_version.id), :method => :put, :data => {:confirm => "Are you sure you want to revert to this version?"} %> -
-
diff --git a/app/views/artist_versions/_standard_listing.html.erb b/app/views/artist_versions/_standard_listing.html.erb index 7e71b6bd4..3773d0715 100644 --- a/app/views/artist_versions/_standard_listing.html.erb +++ b/app/views/artist_versions/_standard_listing.html.erb @@ -1,17 +1,14 @@ -
+
- - - + + + - - <% if CurrentUser.is_moderator? %> - + <% if artist_versions_listing_type == :revert %> + <% end %> - - @@ -21,26 +18,35 @@ - - + <% else %> - <% end %> - - - <% if CurrentUser.is_moderator? %> - - <% end %> - - <% if artist_version.visible? %> - - <% else %> - + + + <% if artist_versions_listing_type == :revert %> + <% end %> <% end %> diff --git a/app/views/artist_versions/index.html.erb b/app/views/artist_versions/index.html.erb index 7dbfd0d1d..824d16685 100644 --- a/app/views/artist_versions/index.html.erb +++ b/app/views/artist_versions/index.html.erb @@ -2,12 +2,7 @@

Artist History

- <% if params.dig(:search, :artist_id).present? %> - <%= render "revert_listing" %> - <% else %> - <%= render "standard_listing" %> - <% end %> - + <%= render "standard_listing" %> <%= numbered_paginator(@artist_versions, :search_count => params[:search]) %>
NameOther NamesGroupNameOther NamesURLs UpdatedUpdated byIP AddressActiveURLs
<%= link_to artist_version.name, artist_path(artist_version.artist_id) %> <%= link_to "»", artist_versions_path(search: {artist_id: artist_version.artist_id}) %> + + <% if !artist_version.is_active? %> + (deleted) + <% end %> + + <% if artist_version.group_name.present? %> +

(group: <%= artist_version.group_name %>)

+ <% end %>
<%= artist_version_other_names_diff(artist_version) %><%= artist_version.group_name %><%= artist_version_other_names_diff(artist_version) %> <%= compact_time artist_version.created_at %><%= link_to_user artist_version.updater %> - <%= link_to_ip artist_version.updater_ip_addr %> - <%= artist_version.is_active? %><%= artist_version_urls_diff(artist_version) %> + <%= artist_version_urls_diff(artist_version) if artist_version.visible? %> + + <%= link_to_user artist_version.updater %> + <%= link_to "»", artist_versions_path(search: { updater_name: artist_version.updater_name }) %> +

+ <%= compact_time(artist_version.updated_at) %> + <% if CurrentUser.is_moderator? %> + (<%= link_to_ip artist_version.updater_ip_addr %>) + <% end %> +

+
<%= link_to "Revert to", revert_artist_path(artist_version.artist_id, version_id: artist_version.id), method: :put, "data-confirm": "Are you sure you want to revert to this version?" %>