From 613beee3757fc04381ca91839b654ea3bf99a86a Mon Sep 17 00:00:00 2001 From: BrokenEagle Date: Mon, 1 Jan 2018 18:45:46 -0800 Subject: [PATCH] Differentiate version views with reversion links --- .../_revert_listing.html.erb | 50 +++++++++++++++ .../_standard_listing.html.erb | 44 +++++++++++++ .../artist_commentary_versions/index.html.erb | 59 ++---------------- .../artist_versions/_revert_listing.html.erb | 54 ++++++++++++++++ .../_standard_listing.html.erb | 49 +++++++++++++++ app/views/artist_versions/index.html.erb | 59 ++---------------- .../note_versions/_revert_listing.html.erb | 62 +++++++++++++++++++ .../note_versions/_standard_listing.html.erb | 50 +++++++++++++++ app/views/note_versions/index.html.erb | 58 ++--------------- .../pool_versions/_revert_listing.html.erb | 42 +++++++++++++ .../pool_versions/_standard_listing.html.erb | 34 ++++++++++ app/views/pool_versions/index.html.erb | 45 ++------------ ...ting.html.erb => _revert_listing.html.erb} | 6 +- .../post_versions/_standard_listing.html.erb | 54 ++++++++++++++++ app/views/post_versions/index.html.erb | 6 +- 15 files changed, 467 insertions(+), 205 deletions(-) create mode 100644 app/views/artist_commentary_versions/_revert_listing.html.erb create mode 100644 app/views/artist_commentary_versions/_standard_listing.html.erb create mode 100644 app/views/artist_versions/_revert_listing.html.erb create mode 100644 app/views/artist_versions/_standard_listing.html.erb create mode 100644 app/views/note_versions/_revert_listing.html.erb create mode 100644 app/views/note_versions/_standard_listing.html.erb create mode 100644 app/views/pool_versions/_revert_listing.html.erb create mode 100644 app/views/pool_versions/_standard_listing.html.erb rename app/views/post_versions/{_listing.html.erb => _revert_listing.html.erb} (94%) create mode 100644 app/views/post_versions/_standard_listing.html.erb diff --git a/app/views/artist_commentary_versions/_revert_listing.html.erb b/app/views/artist_commentary_versions/_revert_listing.html.erb new file mode 100644 index 000000000..226cac309 --- /dev/null +++ b/app/views/artist_commentary_versions/_revert_listing.html.erb @@ -0,0 +1,50 @@ +
+ + + + + + + <% if CurrentUser.is_moderator? %> + + <% end %> + + + <% if CurrentUser.is_member? %> + + <% end %> + + + + <% @commentary_versions.each do |commentary_version| %> + + + + + <% if CurrentUser.is_moderator? %> + + <% end %> + + + <% if CurrentUser.is_member? %> + + <% end %> + + <% end %> + +
PostOriginalTranslatedIP AddressEdited ByDate
<%= link_to commentary_version.post_id, post_path(commentary_version.post_id) %> +

<%= h(commentary_version.original_title) %>

+
+ <%= format_text(commentary_version.original_description, :disable_mentions => true) %> +
+
+

<%= h(commentary_version.translated_title) %>

+
+ <%= format_text(commentary_version.translated_description, :disable_mentions => true) %> +
+
+ <%= link_to_ip commentary_version.updater_ip_addr %> + <%= link_to_user commentary_version.updater %><%= compact_time commentary_version.updated_at %> + <%= link_to "Revert to", revert_artist_commentary_path(commentary_version.post_id, :version_id => commentary_version.id), :remote => true, :method => :put, :data => {:confirm => "Are you sure you want to revert to this version?"} %> +
+
diff --git a/app/views/artist_commentary_versions/_standard_listing.html.erb b/app/views/artist_commentary_versions/_standard_listing.html.erb new file mode 100644 index 000000000..08c0b4575 --- /dev/null +++ b/app/views/artist_commentary_versions/_standard_listing.html.erb @@ -0,0 +1,44 @@ +
+ + + + + + + + <% if CurrentUser.is_moderator? %> + + <% end %> + + + + + + <% @commentary_versions.each do |commentary_version| %> + + + + + + <% if CurrentUser.is_moderator? %> + + <% end %> + + + + <% end %> + +
PostVersionOriginalTranslatedIP AddressEdited ByDate
<%= PostPresenter.preview(commentary_version.post, :tags => "status:any") %><%= link_to "#{commentary_version.post_id}.#{commentary_version.id}»", artist_commentary_versions_path(search: {post_id: commentary_version.post_id}) %> +

<%= h(commentary_version.original_title) %>

+
+ <%= format_text(commentary_version.original_description, :disable_mentions => true) %> +
+
+

<%= h(commentary_version.translated_title) %>

+
+ <%= format_text(commentary_version.translated_description, :disable_mentions => true) %> +
+
+ <%= link_to_ip commentary_version.updater_ip_addr %> + <%= link_to_user commentary_version.updater %><%= compact_time commentary_version.updated_at %>
+
diff --git a/app/views/artist_commentary_versions/index.html.erb b/app/views/artist_commentary_versions/index.html.erb index 9b7db227c..97929c326 100644 --- a/app/views/artist_commentary_versions/index.html.erb +++ b/app/views/artist_commentary_versions/index.html.erb @@ -4,60 +4,11 @@ <%= render "posts/partials/common/inline_blacklist" %> - - - - - - - <% if CurrentUser.is_moderator? %> - - <% end %> - - - <% if CurrentUser.is_member? %> - - <% end %> - - - - <% @commentary_versions.each do |commentary_version| %> - - - - - <% if CurrentUser.is_moderator? %> - - <% end %> - - - <% if CurrentUser.is_member? %> - - <% end %> - - <% end %> - -
PostOriginalTranslatedIP AddressEdited ByDate
- <% if params.dig(:search, :post_id).present? %> - <%= link_to commentary_version.post_id, post_path(commentary_version.post_id) %> - <% else %> - <%= PostPresenter.preview(commentary_version.post, :tags => "status:any") %> - <% end %> - -

<%= h(commentary_version.original_title) %>

-
- <%= format_text(commentary_version.original_description, :disable_mentions => true) %> -
-
-

<%= h(commentary_version.translated_title) %>

-
- <%= format_text(commentary_version.translated_description, :disable_mentions => true) %> -
-
- <%= link_to_ip commentary_version.updater_ip_addr %> - <%= link_to_user commentary_version.updater %><%= compact_time commentary_version.updated_at %> - <%= link_to "Revert to", revert_artist_commentary_path(commentary_version.post_id, :version_id => commentary_version.id), :remote => true, :method => :put, :data => {:confirm => "Are you sure you want to revert to this version?"} %> -
+ <% if params.dig(:search, :post_id).present? %> + <%= render "revert_listing" %> + <% else %> + <%= render "standard_listing" %> + <% end %> <%= numbered_paginator(@commentary_versions) %> diff --git a/app/views/artist_versions/_revert_listing.html.erb b/app/views/artist_versions/_revert_listing.html.erb new file mode 100644 index 000000000..a3d38dcd7 --- /dev/null +++ b/app/views/artist_versions/_revert_listing.html.erb @@ -0,0 +1,54 @@ +
+ + + + + + + + + <% 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 new file mode 100644 index 000000000..80ccb5934 --- /dev/null +++ b/app/views/artist_versions/_standard_listing.html.erb @@ -0,0 +1,49 @@ +
+ + + + + + + + + <% if CurrentUser.is_moderator? %> + + <% end %> + + + + + + <% @artist_versions.each do |artist_version| %> + + <% if artist_version.visible? %> + + + + <% else %> + + + + <% end %> + + + <% if CurrentUser.is_moderator? %> + + <% end %> + + <% if artist_version.visible? %> + + <% else %> + + <% end %> + + <% end %> + +
NameOther NamesGroupUpdatedUpdated 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}) %> + <%= 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) %>
+
diff --git a/app/views/artist_versions/index.html.erb b/app/views/artist_versions/index.html.erb index 9b47309c0..7dbfd0d1d 100644 --- a/app/views/artist_versions/index.html.erb +++ b/app/views/artist_versions/index.html.erb @@ -2,60 +2,11 @@

Artist History

-
- - - - - - - - - <% 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?"} %> -
-
+ <% if params.dig(:search, :artist_id).present? %> + <%= render "revert_listing" %> + <% else %> + <%= render "standard_listing" %> + <% end %> <%= numbered_paginator(@artist_versions, :search_count => params[:search]) %>
diff --git a/app/views/note_versions/_revert_listing.html.erb b/app/views/note_versions/_revert_listing.html.erb new file mode 100644 index 000000000..98933e463 --- /dev/null +++ b/app/views/note_versions/_revert_listing.html.erb @@ -0,0 +1,62 @@ +
+ + + + + + + + + <% if CurrentUser.is_moderator? %> + + <% end %> + + + <% if CurrentUser.is_member? %> + + <% end %> + + + + <% @note_versions.each do |note_version| %> + + + + + + + <% if CurrentUser.is_moderator? %> + + <% end %> + + + <% if CurrentUser.is_member? %> + + <% end %> + + <% end %> + +
PostNoteBodyPositionIP AddressEdited ByDate
+ <%= link_to note_version.post_id, post_path(note_version.post_id) %> + <% if params.dig(:search, :note_id).present? %> + <%= link_to "»", note_versions_path(search: {post_id: note_version.post_id}) %> + <% end %> + + <%= link_to "#{note_version.note_id}.#{note_version.version}", post_path(note_version.post_id, anchor: "note-#{note_version.note_id}") %> + <% if params.dig(:search, :post_id).present? %> + <%= link_to "»", note_versions_path(search: {note_id: note_version.note_id}) %> + <% end %> + + <%= h(note_version.body) %> + <% unless note_version.is_active? %> + (deleted) + <% end %> + <%= note_version_body_diff_info(note_version) %> + + <%= note_version_position_diff(note_version) %> + + <%= link_to_ip note_version.updater_ip_addr %> + <%= link_to_user note_version.updater %><%= compact_time note_version.updated_at %> + <%= link_to "Revert to", revert_note_path(note_version.note_id, :version_id => note_version.id), :remote => true, :method => :put, :data => {:confirm => "Are you sure you want to revert to this version?"} %> +
+
diff --git a/app/views/note_versions/_standard_listing.html.erb b/app/views/note_versions/_standard_listing.html.erb new file mode 100644 index 000000000..33cc9a770 --- /dev/null +++ b/app/views/note_versions/_standard_listing.html.erb @@ -0,0 +1,50 @@ +
+ + + + + + + + + <% if CurrentUser.is_moderator? %> + + <% end %> + + + + + + <% @note_versions.each do |note_version| %> + + + + + + + <% if CurrentUser.is_moderator? %> + + <% end %> + + + + <% end %> + +
PostNoteBodyPositionIP AddressEdited ByDate
+ <%= link_to note_version.post_id, post_path(note_version.post_id) %> + <%= link_to "»", note_versions_path(search: {post_id: note_version.post_id}) %> + + <%= link_to "#{note_version.note_id}.#{note_version.version}", post_path(note_version.post_id, anchor: "note-#{note_version.note_id}") %> + <%= link_to "»", note_versions_path(search: {note_id: note_version.note_id}) %> + + <%= h(note_version.body) %> + <% unless note_version.is_active? %> + (deleted) + <% end %> + <%= note_version_body_diff_info(note_version) %> + + <%= note_version_position_diff(note_version) %> + + <%= link_to_ip note_version.updater_ip_addr %> + <%= link_to_user note_version.updater %><%= compact_time note_version.updated_at %>
+
diff --git a/app/views/note_versions/index.html.erb b/app/views/note_versions/index.html.erb index 2d5513774..a4ec4f0b7 100644 --- a/app/views/note_versions/index.html.erb +++ b/app/views/note_versions/index.html.erb @@ -2,59 +2,11 @@

Note Changes

- - - - - - - - - <% if CurrentUser.is_moderator? %> - - <% end %> - - - <% if CurrentUser.is_member? %> - - <% end %> - - - - <% @note_versions.each do |note_version| %> - - - - - - - <% if CurrentUser.is_moderator? %> - - <% end %> - - - <% if CurrentUser.is_member? %> - - <% end %> - - <% end %> - -
PostNoteBodyPositionIP AddressEdited ByDate
<%= link_to note_version.post_id, post_path(note_version.post_id) %> - <%= link_to "#{note_version.note_id}.#{note_version.version}", post_path(note_version.post_id, anchor: "note-#{note_version.note_id}") %> - <%= link_to "»", note_versions_path(search: {note_id: note_version.note_id}) %> - - <%= h(note_version.body) %> - <% unless note_version.is_active? %> - (deleted) - <% end %> - <%= note_version_body_diff_info(note_version) %> - - <%= note_version_position_diff(note_version) %> - - <%= link_to_ip note_version.updater_ip_addr %> - <%= link_to_user note_version.updater %><%= compact_time note_version.updated_at %> - <%= link_to "Revert to", revert_note_path(note_version.note_id, :version_id => note_version.id), :remote => true, :method => :put, :data => {:confirm => "Are you sure you want to revert to this version?"} %> -
+ <% if params.dig(:search, :post_id).present? || params.dig(:search, :note_id).present? %> + <%= render "revert_listing" %> + <% else %> + <%= render "standard_listing" %> + <% end %> <%= numbered_paginator(@note_versions) %> diff --git a/app/views/pool_versions/_revert_listing.html.erb b/app/views/pool_versions/_revert_listing.html.erb new file mode 100644 index 000000000..8a2115729 --- /dev/null +++ b/app/views/pool_versions/_revert_listing.html.erb @@ -0,0 +1,42 @@ +
+ + + + + + + + + <% if CurrentUser.is_moderator? %> + + <% end %> + + <% if CurrentUser.is_member? %> + + <% end %> + + + + <% @pool_versions.each do |pool_version| %> + + + + + + + <% if CurrentUser.is_moderator? %> + + <% end %> + + <% if CurrentUser.is_member? %> + + <% end %> + + <% end %> + +
PoolPost CountChangesDesc ChgUpdaterIP AddressDate
<%= link_to pool_version.pretty_name, pool_path(pool_version.pool_id), :class => "pool-category-#{pool_version.pool.category}" %><%= link_to pool_version.post_ids.size, pool_versions_path(:search => {:pool_id => pool_version.pool_id}) %><%= pool_version_diff(pool_version) %><%= link_to_if pool_version.description_changed, pool_version.description_changed, diff_pool_version_path(pool_version.id) %><%= link_to_user pool_version.updater %> + <%= link_to_ip pool_version.updater_ip_addr %> + <%= compact_time pool_version.updated_at %> + <%= link_to "Revert to", revert_pool_path(pool_version.pool_id, :version_id => pool_version.id), :method => :put, :remote => true %> +
+
diff --git a/app/views/pool_versions/_standard_listing.html.erb b/app/views/pool_versions/_standard_listing.html.erb new file mode 100644 index 000000000..167de9ca0 --- /dev/null +++ b/app/views/pool_versions/_standard_listing.html.erb @@ -0,0 +1,34 @@ +
+ + + + + + + + + <% if CurrentUser.is_moderator? %> + + <% end %> + + + + + <% @pool_versions.each do |pool_version| %> + + + + + + + <% if CurrentUser.is_moderator? %> + + <% end %> + + + <% end %> + +
PoolPost CountChangesDesc ChgUpdaterIP AddressDate
<%= link_to pool_version.pretty_name, pool_path(pool_version.pool_id), :class => "pool-category-#{pool_version.pool.category}" %><%= link_to pool_version.post_ids.size, pool_versions_path(:search => {:pool_id => pool_version.pool_id}) %><%= pool_version_diff(pool_version) %><%= link_to_if pool_version.description_changed, pool_version.description_changed, diff_pool_version_path(pool_version.id) %><%= link_to_user pool_version.updater %> + <%= link_to_ip pool_version.updater_ip_addr %> + <%= compact_time pool_version.updated_at %>
+
diff --git a/app/views/pool_versions/index.html.erb b/app/views/pool_versions/index.html.erb index 9a6242899..561bab43e 100644 --- a/app/views/pool_versions/index.html.erb +++ b/app/views/pool_versions/index.html.erb @@ -2,46 +2,11 @@

Pool History

- - - - - - - - - <% if CurrentUser.is_moderator? %> - - <% end %> - - <% if CurrentUser.is_member? %> - - <% end %> - - - - <% @pool_versions.each do |pool_version| %> - - - - - - - <% if CurrentUser.is_moderator? %> - - <% end %> - - <% if CurrentUser.is_member? %> - - <% end %> - - <% end %> - -
PoolPost CountChangesDesc ChgUpdaterIP AddressDate
<%= link_to pool_version.pretty_name, pool_path(pool_version.pool_id), :class => "pool-category-#{pool_version.pool.category}" %><%= link_to pool_version.post_ids.size, pool_versions_path(:search => {:pool_id => pool_version.pool_id}) %><%= pool_version_diff(pool_version) %><%= link_to_if pool_version.description_changed, pool_version.description_changed, diff_pool_version_path(pool_version.id) %><%= link_to_user pool_version.updater %> - <%= link_to_ip pool_version.updater_ip_addr %> - <%= compact_time pool_version.updated_at %> - <%= link_to "Revert to", revert_pool_path(pool_version.pool_id, :version_id => pool_version.id), :method => :put, :remote => true %> -
+ <% if params.dig(:search, :pool_id).present? %> + <%= render "revert_listing" %> + <% else %> + <%= render "standard_listing" %> + <% end %> <%= numbered_paginator(@pool_versions) %>
diff --git a/app/views/post_versions/_listing.html.erb b/app/views/post_versions/_revert_listing.html.erb similarity index 94% rename from app/views/post_versions/_listing.html.erb rename to app/views/post_versions/_revert_listing.html.erb index e3ed085cb..0defec43f 100644 --- a/app/views/post_versions/_listing.html.erb +++ b/app/views/post_versions/_revert_listing.html.erb @@ -1,5 +1,5 @@ -
- +
+
@@ -17,7 +17,7 @@ - <% post_versions.each do |post_version| %> + <% @post_versions.each do |post_version| %> class="hilite"<% end %>> diff --git a/app/views/post_versions/_standard_listing.html.erb b/app/views/post_versions/_standard_listing.html.erb new file mode 100644 index 000000000..572671a91 --- /dev/null +++ b/app/views/post_versions/_standard_listing.html.erb @@ -0,0 +1,54 @@ +
+
Post
<%= link_to("#{post_version.post_id}.#{post_version.id}", post_path(post_version.post_id)) %> <%= compact_time(post_version.updated_at) %>
+ + + + + + + + <% if CurrentUser.is_moderator? %> + + <% end %> + + <% if CurrentUser.is_member? %> + + <% end %> + + + + <% @post_versions.each do |post_version| %> + class="hilite"<% end %>> + + + + + + <% if CurrentUser.is_moderator? %> + + <% end %> + + <% if CurrentUser.is_member? %> + + <% end %> + + <% end %> + +
PostDateUserRatingParentIP AddressTags
+ <%= link_to("#{post_version.post_id}.#{post_version.id}", post_path(post_version.post_id)) %> + <%= link_to "»", post_versions_path(search: {post_id: post_version.post_id}) %> + <%= compact_time(post_version.updated_at) %> + <% if post_version.updater %> + <%= link_to_user(post_version.updater) %> + <% end %> + <%= post_version.rating %><%= post_version.parent_id %> + <%= link_to_ip post_version.updater_ip_addr %> + <%= post_version_diff(post_version) %> + <% if post_version.visible? %> + <% if post_version.version != 1 %> + <%= link_to "Undo", undo_post_version_path(post_version), :method => :put, :remote => true %> | + <% end %> + <% end %> +
+
+ diff --git a/app/views/post_versions/index.html.erb b/app/views/post_versions/index.html.erb index 981c59046..9f35c8c70 100644 --- a/app/views/post_versions/index.html.erb +++ b/app/views/post_versions/index.html.erb @@ -7,7 +7,11 @@ <% if @post_versions.length == 0 %> <%= render "post_sets/blank" %> <% else %> - <%= render "listing", :post_versions => @post_versions %> + <% if params.dig(:search, :post_id).present? %> + <%= render "revert_listing" %> + <% else %> + <%= render "standard_listing" %> + <% end %> <% if params[:lr] && CurrentUser.is_moderator? %>

<%= link_to "Revert this user's changes", new_user_revert_path(:user_id => params[:lr]) %>