diff --git a/app/javascript/src/javascripts/post_version.js b/app/javascript/src/javascripts/post_version.js index 0125b693e..4a3a493cb 100644 --- a/app/javascript/src/javascripts/post_version.js +++ b/app/javascript/src/javascripts/post_version.js @@ -33,7 +33,7 @@ PostVersion.undo_selected = async function () { let selected_rows = $("td .post-version-select-checkbox:checked").parents("tr"); for (let row of selected_rows) { - let id = $(row).data("post-version-id"); + let id = $(row).data("id"); await $.ajax(`/post_versions/${id}/undo.json`, { method: "PUT" }); updated++; diff --git a/app/logical/table_builder.rb b/app/logical/table_builder.rb index 2dcc672cb..5a2bde151 100644 --- a/app/logical/table_builder.rb +++ b/app/logical/table_builder.rb @@ -1,30 +1,35 @@ class TableBuilder class Column - attr_reader :attribute, :name, :block, :html_attributes + attr_reader :attribute, :name, :block, :header_attributes, :body_attributes, :is_html_safe - def initialize(attribute = nil, name: attribute.to_s.titleize, **html_attributes, &block) + def initialize(attribute = nil, header_attributes=nil, body_attributes=nil, is_html_safe=false, &block) @attribute = attribute - @html_attributes = html_attributes - @name = name + @header_attributes = header_attributes + @body_attributes = body_attributes + @name = attribute.kind_of?(String) ? attribute : attribute.to_s.titleize + @is_html_safe = is_html_safe @block = block end - def value(item) + def value(item, i, j) if block.present? - block.call(item, self) + block.call(item, i, j, self) nil - else + elsif attribute.kind_of?(Symbol) item.send(attribute) + else + "" end end end - attr_reader :columns, :html_attributes, :items + attr_reader :columns, :table_attributes, :row_attributes, :items - def initialize(items, **html_attributes) + def initialize(items, table_attributes=nil, row_attributes=nil) @items = items @columns = [] - @html_attributes = html_attributes + @table_attributes = table_attributes + @row_attributes = row_attributes yield self if block_given? end @@ -32,7 +37,22 @@ class TableBuilder @columns << Column.new(*options, &block) end - def row_attributes(item) - { id: "#{item.model_name.singular}-#{item.id}", "data-id": item.id } + def all_row_attributes(item, i) + if !item.id.nil? + standard_attributes = { id: "#{item.model_name.singular.dasherize}-#{item.id}", "data-id": item.id } + else + standard_attributes = {} + end + if !row_attributes.nil? + mapped_row_attributes = row_attributes.clone + mapped_row_attributes.clone.each do |key, value| + if value.kind_of?(Array) + mapped_row_attributes[key] = value[0] % value.slice(1,value.length).map {|param| eval(param)} + end + end + else + mapped_row_attributes = {} + end + standard_attributes.merge(mapped_row_attributes) end end diff --git a/app/views/artist_commentaries/index.html.erb b/app/views/artist_commentaries/index.html.erb index 81fbd8ff9..ddb774837 100644 --- a/app/views/artist_commentaries/index.html.erb +++ b/app/views/artist_commentaries/index.html.erb @@ -4,30 +4,19 @@ <%= render "posts/partials/common/inline_blacklist" %> - - - - - - - - - - <% @commentaries.each do |commentary| %> - - - - - - <% end %> - -
PostOriginalTranslated
<%= PostPresenter.preview(commentary.post, :tags => "status:any") %> - <%= format_commentary_title(commentary.original_title) %> - <%= format_commentary_description(commentary.original_description) %> - - <%= format_commentary_title(commentary.translated_title) %> - <%= format_commentary_description(commentary.translated_description) %> -
+ <%= table_for @commentaries, {class: "striped", width: "100%"} do |t| %> + <% t.column "Post", {width: "1%"} do |commentary| %> + <%= PostPresenter.preview(commentary.post, :tags => "status:any") %> + <% end %> + <% t.column "Original" do |commentary| %> + <%= format_commentary_title(commentary.original_title) %> + <%= format_commentary_description(commentary.original_description) %> + <% end %> + <% t.column "Translated" do |commentary| %> + <%= format_commentary_title(commentary.translated_title) %> + <%= format_commentary_description(commentary.translated_description) %> + <% end %> + <% end %> <%= numbered_paginator(@commentaries) %> diff --git a/app/views/artist_commentary_versions/_revert_listing.html.erb b/app/views/artist_commentary_versions/_revert_listing.html.erb index 32570bffa..ba4d80252 100644 --- a/app/views/artist_commentary_versions/_revert_listing.html.erb +++ b/app/views/artist_commentary_versions/_revert_listing.html.erb @@ -1,46 +1,33 @@
- - - - - - - <% 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 %> - + + <%= table_for @commentary_versions, {class: "striped autofit", width: "100%"} do |t| %> + <% t.column "Post", {width: "5%"} do |commentary_version| %> + <%= link_to commentary_version.post_id, post_path(commentary_version.post_id) %> + <% end %> + <% t.column "Original" do |commentary_version| %> + <%= format_commentary_title(commentary_version.original_title) %> + <%= format_commentary_description(commentary_version.original_description) %> + <% end %> + <% t.column "Translated" do |commentary_version| %> + <%= format_commentary_title(commentary_version.translated_title) %> + <%= format_commentary_description(commentary_version.translated_description) %> + <% end %> + <% if CurrentUser.is_moderator? %> + <% t.column "IP Address", {width: "10%"} do |commentary_version| %> + <%= link_to_ip commentary_version.updater_ip_addr %> <% end %> - -
PostOriginalTranslatedIP AddressEdited ByDate
<%= link_to commentary_version.post_id, post_path(commentary_version.post_id) %> - <%= format_commentary_title(commentary_version.original_title) %> - <%= format_commentary_description(commentary_version.original_description) %> - - <%= format_commentary_title(commentary_version.translated_title) %> - <%= format_commentary_description(commentary_version.translated_description) %> - - <%= 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?"} %> -
+ <% end %> + <% t.column "Edited by", {width: "10%"} do |commentary_version| %> + <%= link_to_user commentary_version.updater %> + <% end %> + <% t.column "Date", {width: "10%"} do |commentary_version| %> + <%= compact_time commentary_version.updated_at %> + <% end %> + <% if CurrentUser.is_member? %> + <% t.column "", {width: "7%"} do |commentary_version| %> + <%= 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?"} %> + <% end %> + <% end %> + <% end %> +
diff --git a/app/views/artist_commentary_versions/_standard_listing.html.erb b/app/views/artist_commentary_versions/_standard_listing.html.erb index f9bc5824c..bf305942b 100644 --- a/app/views/artist_commentary_versions/_standard_listing.html.erb +++ b/app/views/artist_commentary_versions/_standard_listing.html.erb @@ -1,40 +1,31 @@
- - - - - - - - <% if CurrentUser.is_moderator? %> - - <% end %> - - - - - - <% @commentary_versions.each do |commentary_version| %> - - - - - - <% if CurrentUser.is_moderator? %> - - <% end %> - - - + + <%= table_for @commentary_versions, {class: "striped autofit", width: "100%"} do |t| %> + <% t.column "Post", {width: "5%"} do |commentary_version| %> + <%= PostPresenter.preview(commentary_version.post, :tags => "status:any") %> + <% end %> + <% t.column "Version" do |commentary_version| %> + <%= link_to "#{commentary_version.post_id}.#{commentary_version.id}»", artist_commentary_versions_path(search: {post_id: commentary_version.post_id}) %> + <% end %> + <% t.column "Original" do |commentary_version| %> + <%= format_commentary_title(commentary_version.original_title) %> + <%= format_commentary_description(commentary_version.original_description) %> + <% end %> + <% t.column "Translated" do |commentary_version| %> + <%= format_commentary_title(commentary_version.translated_title) %> + <%= format_commentary_description(commentary_version.translated_description) %> + <% end %> + <% if CurrentUser.is_moderator? %> + <% t.column "IP Address", {width: "10%"} do |commentary_version| %> + <%= link_to_ip commentary_version.updater_ip_addr %> <% 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}) %> - <%= format_commentary_title(commentary_version.original_title) %> - <%= format_commentary_description(commentary_version.original_description) %> - - <%= format_commentary_title(commentary_version.translated_title) %> - <%= format_commentary_description(commentary_version.translated_description) %> - - <%= link_to_ip commentary_version.updater_ip_addr %> - <%= link_to_user commentary_version.updater %><%= compact_time commentary_version.updated_at %>
+ <% end %> + <% t.column "Edited by", {width: "10%"} do |commentary_version| %> + <%= link_to_user commentary_version.updater %> + <% end %> + <% t.column "Date", {width: "10%"} do |commentary_version| %> + <%= compact_time commentary_version.updated_at %> + <% end %> + <% end %> +
diff --git a/app/views/artist_versions/_standard_listing.html.erb b/app/views/artist_versions/_standard_listing.html.erb index 8c12d3cef..9c8b67aa2 100644 --- a/app/views/artist_versions/_standard_listing.html.erb +++ b/app/views/artist_versions/_standard_listing.html.erb @@ -1,55 +1,43 @@
- - - - - - - - <% if artist_versions_listing_type == :revert %> - + + <%= table_for @artist_versions, {class: "striped autofit", width: "100%"} do |t| %> + <% t.column "Name" do |artist_version| %> + <% if artist_version.visible? %> + <%= 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 %> <% end %> - - - - <% @artist_versions.each do |artist_version| %> - - <% if artist_version.visible? %> - - - <% else %> - - - <% end %> - - - <% if artist_versions_listing_type == :revert %> - - <% end %> - <% end %> - -
NameOther NamesURLsUpdated
- <%= 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_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?" %>
+ <% t.column "Other Names" do |artist_version| %> + <% if artist_version.visible? %> + <%= artist_version_other_names_diff(artist_version) %> + <% end %> + <% end %> + <% t.column "URLs", nil, {class: "col-expand"} do |artist_version| %> + <%= artist_version_urls_diff(artist_version) if artist_version.visible? %> + <% end %> + <% t.column "Updated" do |artist_version| %> + <%= 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 %> +

+ <% end %> + <% if artist_versions_listing_type == :revert %> + <% t.column "" do |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?" %> + <% end %> + <% end %> + <% end %> +
diff --git a/app/views/artists/index.html.erb b/app/views/artists/index.html.erb index 0f4fc69ed..2c94a946c 100644 --- a/app/views/artists/index.html.erb +++ b/app/views/artists/index.html.erb @@ -2,58 +2,43 @@
<%= render "search" %> - - - - - - - - - - - - <% @artists.each do |artist| %> - <%= tag.tr id: "artist-#{artist.id}" do %> - - - - - + <% if artist.is_active? %> + | <%= link_to "Delete", artist_path(artist, artist: { is_active: false }), method: :put, remote: true %> + <% else %> + | <%= link_to "Undelete", artist_path(artist, artist: { is_active: true }), method: :put, remote: true %> <% end %> <% end %> - -
NameOther NamesStatusUpdated
- <%= link_to artist.name, artist, class: "tag-type-#{Tag.categories.artist}" %> - <%= artist.tag.try(:post_count) || 0 %> - <% if !artist.group_name.blank? %> - (group: <%= link_to artist.group_name, artist %>) - <% end %> - - <% artist.other_names.each do |name| %> - <%= link_to name, artists_path(search: { any_name_matches: name }), class: "artist-other-name" %> - <% end %> - - <% if !artist.is_active? %> - <%= link_to "Deleted", artists_path(search: { is_active: false }) %> - <% end %> + <%= table_for @artists, {class: "striped autofit"} do |t| %> + <% t.column "Name" do |artist| %> + <%= link_to artist.name, artist, class: "tag-type-#{Tag.categories.artist}" %> + <%= artist.tag.try(:post_count) || 0 %> + <% if !artist.group_name.blank? %> + (group: <%= link_to artist.group_name, artist %>) + <% end %> + <% end %> + <% t.column "Other Names", nil, {class: "col-expand"} do |artist| %> + <% artist.other_names.each do |name| %> + <%= link_to name, artists_path(search: { any_name_matches: name }), class: "artist-other-name" %> + <% end %> + <% end %> + <% t.column "Status" do |artist| %> + <% if !artist.is_active? %> + <%= link_to "Deleted", artists_path(search: { is_active: false }) %> + <% end %> - <% if artist.is_banned? %> - <%= link_to "Banned", artists_path(search: { is_banned: true }) %> - <% end %> - - <%= time_ago_in_words_tagged(artist.updated_at) %> - - <% if CurrentUser.is_member? %> - <%= link_to "Edit", edit_artist_path(artist) %> + <% if artist.is_banned? %> + <%= link_to "Banned", artists_path(search: { is_banned: true }) %> + <% end %> + <% end %> + <% t.column "Updated" do |artist| %> + <%= time_ago_in_words_tagged(artist.updated_at) %> + <% end %> + <% t.column "" do |artist| %> + <% if CurrentUser.is_member? %> + <%= link_to "Edit", edit_artist_path(artist) %> - <% if artist.is_active? %> - | <%= link_to "Delete", artist_path(artist, artist: { is_active: false }), method: :put, remote: true %> - <% else %> - | <%= link_to "Undelete", artist_path(artist, artist: { is_active: true }), method: :put, remote: true %> - <% end %> - <% end %> -
+ <% end %> + <% end %> <%= numbered_paginator(@artists) %>
diff --git a/app/views/bans/index.html.erb b/app/views/bans/index.html.erb index 9542f6d91..2a9d1692d 100644 --- a/app/views/bans/index.html.erb +++ b/app/views/bans/index.html.erb @@ -4,44 +4,31 @@ <%= render "search" %> - - - - - - - - - - - - <% @bans.each do |ban| %> - - - - - - - + <%= table_for @bans, {class: "striped autofit"}, {"data-expired": ["%s", "item.expired?"]} do |t| %> + <% t.column "Banned User" do |ban| %> + <%= link_to_user(ban.user) %> + <%= link_to "»", bans_path(search: search_params.merge(user_name: ban.user.name)) %> + <% end %> + <% t.column "Duration" do |ban| %> + <%= humanized_duration(ban.created_at, ban.expires_at) %> + <% end %> + <% t.column "Reason", nil, {class: "col-expand"} do |ban| %> +
+ <%= format_text ban.reason %> +
+ <% end %> + <% t.column "Banner" do |ban| %> + <%= link_to_user ban.banner %> + <%= link_to "»", bans_path(search: { banner_name: ban.banner.name }) %> +
<%= time_ago_in_words_tagged(ban.created_at) %>
+ <% end %> + <% t.column "" do |ban| %> + <% if CurrentUser.is_moderator? %> + <%= link_to "Edit", edit_ban_path(ban) %> + | <%= link_to "Delete", ban_path(ban), :method => :delete, :remote => true %> <% end %> - -
Banned UserDurationReasonBanner
- <%= link_to_user(ban.user) %> - <%= link_to "»", bans_path(search: search_params.merge(user_name: ban.user.name)) %> - <%= humanized_duration(ban.created_at, ban.expires_at) %> -
- <%= format_text ban.reason %> -
-
- <%= link_to_user ban.banner %> - <%= link_to "»", bans_path(search: { banner_name: ban.banner.name }) %> -
<%= time_ago_in_words_tagged(ban.created_at) %>
-
- <% if CurrentUser.is_moderator? %> - <%= link_to "Edit", edit_ban_path(ban) %> - | <%= link_to "Delete", ban_path(ban), :method => :delete, :remote => true %> - <% end %> -
+ <% end %> + <% end %> <%= numbered_paginator(@bans) %> diff --git a/app/views/bulk_update_requests/_listing.html.erb b/app/views/bulk_update_requests/_listing.html.erb index a7bf9910f..f5ce9b4a7 100644 --- a/app/views/bulk_update_requests/_listing.html.erb +++ b/app/views/bulk_update_requests/_listing.html.erb @@ -1,49 +1,35 @@ - - - - - - - - - - - - <% bulk_update_requests.each do |request| %> - - - - - - - + <%= script_with_line_breaks(request.script) %> + <% end %> + <% t.column "Votes" do |request| %> + <% if request.forum_post.present? %> + <%= link_to forum_post_votes_path(search: { forum_post_id: request.forum_post_id }) do %> + +<%= request.forum_post.votes.select(&:up?).count %> / + -<%= request.forum_post.votes.select(&:down?).count %> + <% end %> <% end %> - -
RequestVotesStatusCreated
- <% if request.forum_post.present? %> -

<%= link_to "Topic ##{request.forum_topic_id}: #{request.forum_topic.title}", forum_topic_path(request.forum_topic_id, page: request.forum_post.forum_topic_page, anchor: "forum_post_#{request.forum_post_id}") %>

- <% elsif request.forum_topic.present? %> -

<%= link_to "Topic ##{request.forum_topic_id}: #{request.forum_topic.title}", request.forum_topic %>

- <% end %> +<%= table_for bulk_update_requests, {class: "striped", width: "100%"} do |t| %> + <% t.column "Request" do |request| %> + <% if request.forum_post.present? %> +

<%= link_to "Topic ##{request.forum_topic_id}: #{request.forum_topic.title}", forum_topic_path(request.forum_topic_id, page: request.forum_post.forum_topic_page, anchor: "forum_post_#{request.forum_post_id}") %>

+ <% elsif request.forum_topic.present? %> +

<%= link_to "Topic ##{request.forum_topic_id}: #{request.forum_topic.title}", request.forum_topic %>

+ <% end %> - <%= script_with_line_breaks(request.script) %> -
- <% if request.forum_post.present? %> - <%= link_to forum_post_votes_path(search: { forum_post_id: request.forum_post_id }) do %> - +<%= request.forum_post.votes.select(&:up?).count %> / - -<%= request.forum_post.votes.select(&:down?).count %> - <% end %> - <% end %> - - <%= request.status %> - <% if request.is_approved? %> -
by <%= link_to_user request.approver %> - <% end %> -
- <%= link_to_user request.user %> - <%= link_to "»", bulk_update_requests_path(search: { user_name: request.user.name }) %> -
<%= time_ago_in_words_tagged(request.created_at) %>
-
- <%= link_to "Show", bulk_update_request_path(request) %> | - <%= render "bulk_update_requests/bur_edit_links", bur: request %> -
+ <% end %> + <% t.column "Status" do |request| %> + <%= request.status %> + <% if request.is_approved? %> +
by <%= link_to_user request.approver %> + <% end %> + <% end %> + <% t.column "Created" do |request| %> + <%= link_to_user request.user %> + <%= link_to "»", bulk_update_requests_path(search: { user_name: request.user.name }) %> +
<%= time_ago_in_words_tagged(request.created_at) %>
+ <% end %> + <% t.column "" do |request| %> + <%= link_to "Show", bulk_update_request_path(request) %> | + <%= render "bulk_update_requests/bur_edit_links", bur: request %> + <% end %> +<% end %> + diff --git a/app/views/comment_votes/index.html.erb b/app/views/comment_votes/index.html.erb index d6f9e290c..a7ebd4246 100644 --- a/app/views/comment_votes/index.html.erb +++ b/app/views/comment_votes/index.html.erb @@ -10,48 +10,34 @@ <%= f.submit "Search" %> <% end %> - - - - - - - - - - - - - <% @comment_votes.each do |vote| %> - - - - - - - - + <%= table_for @comment_votes, {class: "striped autofit"} do |t| %> + <% t.column "Post" do |vote| %> + <%= PostPresenter.preview(vote.comment.post, show_deleted: true) %> + <% end %> + <% t.column "Comment", nil, {class: "col-expand"} do |vote| %> +
+ <%= format_text(vote.comment.body) %> +
+ <% end %> + <% t.column "Score" do |vote| %> + <%= link_to sprintf("%+d", vote.score), comment_votes_path(search: { score: vote.score }) %> + <% end %> + <% t.column "Commenter" do |vote| %> + <%= link_to_user vote.comment.creator %> + <%= link_to "»", comment_votes_path(search: { comment: { creator_name: vote.comment.creator_name }}) %> +
<%= time_ago_in_words_tagged(vote.comment.created_at) %>
+ <% end %> + <% t.column "Voter" do |vote| %> + <%= link_to_user vote.user %> + <%= link_to "»", comment_votes_path(search: { user_name: vote.user.name }) %> +
<%= time_ago_in_words_tagged(vote.created_at) %>
+ <% end %> + <% t.column "" do |vote| %> + <% if vote.user == CurrentUser.user %> + <%= link_to "unvote", comment_comment_votes_path(vote.comment), remote: true, method: :delete %> <% end %> - -
PostCommentScoreCommenterVoter
- <%= PostPresenter.preview(vote.comment.post, show_deleted: true) %> - -
- <%= format_text(vote.comment.body) %> -
-
<%= link_to sprintf("%+d", vote.score), comment_votes_path(search: { score: vote.score }) %> - <%= link_to_user vote.comment.creator %> - <%= link_to "»", comment_votes_path(search: { comment: { creator_name: vote.comment.creator_name }}) %> -
<%= time_ago_in_words_tagged(vote.comment.created_at) %>
-
- <%= link_to_user vote.user %> - <%= link_to "»", comment_votes_path(search: { user_name: vote.user.name }) %> -
<%= time_ago_in_words_tagged(vote.created_at) %>
-
- <% if vote.user == CurrentUser.user %> - <%= link_to "unvote", comment_comment_votes_path(vote.comment), remote: true, method: :delete %> - <% end %> -
+ <% end %> + <% end %> <%= numbered_paginator(@comment_votes) %> diff --git a/app/views/delayed_jobs/index.html.erb b/app/views/delayed_jobs/index.html.erb index 04610e1df..ef31dd4a3 100644 --- a/app/views/delayed_jobs/index.html.erb +++ b/app/views/delayed_jobs/index.html.erb @@ -2,55 +2,41 @@

Delayed Jobs

- - - - - - <% if CurrentUser.is_admin? %> - - <% end %> - - - - - - - - - <% @delayed_jobs.each do |job| %> - - - - <% if CurrentUser.is_admin? %> - - <% end %> - - - - - - + <%= table_for @delayed_jobs, {class: "striped autofit"} do |t| %> + <% t.column :queue %> + <% t.column "Name" do |job| %> + <%= raw print_name(job) %> + <% end %> + <% t.column "Handler", nil, {class: "col-expand"} do |job| %> + <%= raw print_handler(job) %> + <% end %> + <% t.column :attempts %> + <% t.column "Last error", nil, {class: "col-expand"} do |job| %> + <% if job.last_error %> + <%= job.last_error.split(/\n/)[0] %> + <%= job.last_error.split(/\n/)[1..-1].grep(/releases/).join("\n") %> <% end %> - -
QueueNameHandlerAttemptsLast errorFailed atRun at
<%= job.queue %><%= raw print_name(job) %><%= raw print_handler(job) %><%= job.attempts %> - <% if job.last_error %> - <%= job.last_error.split(/\n/)[0] %> - <%= job.last_error.split(/\n/)[1..-1].grep(/releases/).join("\n") %> - <% end %> - <%= time_ago_in_words_tagged(job.failed_at) if job.failed_at %><%= time_ago_in_words_tagged(job.run_at) %> - <% if CurrentUser.is_admin? %> - <% if job.locked_at? %> - Running - <% elsif job.failed? %> - <%= link_to "Retry", retry_delayed_job_path(job), method: :put, remote: true %> | - <%= link_to "Delete", delayed_job_path(job), method: :delete, remote: true %> - <% else %> - <%= link_to "Run", run_delayed_job_path(job), method: :put, remote: true %> | - <%= link_to "Cancel", cancel_delayed_job_path(job), method: :put, remote: true %> - <% end %> - <% end %> -
+ <% end %> + <% t.column "Failed at" do |job| %> + <%= time_ago_in_words_tagged(job.failed_at) if job.failed_at %> + <% end %> + <% t.column "Run at" do |job| %> + <%= time_ago_in_words_tagged(job.run_at) %> + <% end %> + <% t.column "" do |job| %> + <% if CurrentUser.is_admin? %> + <% if job.locked_at? %> + Running + <% elsif job.failed? %> + <%= link_to "Retry", retry_delayed_job_path(job), method: :put, remote: true %> | + <%= link_to "Delete", delayed_job_path(job), method: :delete, remote: true %> + <% else %> + <%= link_to "Run", run_delayed_job_path(job), method: :put, remote: true %> | + <%= link_to "Cancel", cancel_delayed_job_path(job), method: :put, remote: true %> + <% end %> + <% end %> + <% end %> + <% end %> <%= numbered_paginator(@delayed_jobs) %>
diff --git a/app/views/dmails/index.html.erb b/app/views/dmails/index.html.erb index eaaa09cce..4a58606a4 100644 --- a/app/views/dmails/index.html.erb +++ b/app/views/dmails/index.html.erb @@ -10,42 +10,31 @@ <%= render "search" %> - - - - - - - - - - - - <% @dmails.each do |dmail| %> - - - - - - - + <%= table_for @dmails, {class: "striped", width: "100%"}, {class: ["read-%s", "item.is_read?"]} do |t| %> + <% t.column "Date" do |dmail| %> + <%= compact_time(dmail.created_at) %> + <% end %> + <% t.column "From" do |dmail| %> + <% if dmail.filtered? %> + <%= link_to "[filtered]", user_path(dmail.from) %> + <% else %> + <%= link_to_user dmail.from %> <% end %> - -
DateFromToSubject
<%= compact_time(dmail.created_at) %> - <% if dmail.filtered? %> - <%= link_to "[filtered]", user_path(dmail.from) %> - <% else %> - <%= link_to_user dmail.from %> - <% end %> - <%= link_to_user dmail.to %> - <% if dmail.filtered? %> - <%= link_to "[filtered]", dmail_path(dmail) %> - <% else %> - <%= link_to dmail.title, dmail_path(dmail) %> - <% end %> - - <%= link_to "delete", dmail_path(dmail), :method => :delete, :data => {:confirm => "Are you sure you want to delete this Dmail?"} %> -
+ <% end %> + <% t.column "To" do |dmail| %> + <%= link_to_user dmail.from %> + <% end %> + <% t.column "Subject" do |dmail| %> + <% if dmail.filtered? %> + <%= link_to "[filtered]", dmail_path(dmail) %> + <% else %> + <%= link_to dmail.title, dmail_path(dmail) %> + <% end %> + <% end %> + <% t.column "" do |dmail| %> + <%= link_to "delete", dmail_path(dmail), :method => :delete, :data => {:confirm => "Are you sure you want to delete this Dmail?"} %> + <% end %> + <% end %> <%= numbered_paginator(@dmails) %> diff --git a/app/views/favorite_groups/index.html.erb b/app/views/favorite_groups/index.html.erb index 65d8975f2..f3c83d406 100644 --- a/app/views/favorite_groups/index.html.erb +++ b/app/views/favorite_groups/index.html.erb @@ -1,33 +1,18 @@
- - - - - - - - - - <% @favorite_groups.each do |favgroup| %> - <%= content_tag(:tr, :id => "favorite-group-#{favgroup.id}") do %> - - - - <% end %> + <%= table_for @favorite_groups, {class: "striped", width: "100%"} do |t| %> + <% t.column nil, {width: "5%"} %> + <% t.column "Name", {width: "60%"} do |favgroup| %> + <%= link_to favgroup.pretty_name, favorite_group_path(favgroup) %> + <% if favgroup.post_count > CurrentUser.user.per_page %> + <%= link_to "page #{favgroup.last_page}", favorite_group_path(favgroup, :page => favgroup.last_page), :class => "last-page" %> <% end %> - -
NameCount
- - <%= link_to favgroup.pretty_name, favorite_group_path(favgroup) %> - - <% if favgroup.post_count > CurrentUser.user.per_page %> - <%= link_to "page #{favgroup.last_page}", favorite_group_path(favgroup, :page => favgroup.last_page), :class => "last-page" %> - <% end %> - - <%= favgroup.post_count %> -
+ <% end %> + <% t.column "Count", {width: "10%"} do |favgroup| %> + <%= favgroup.post_count %> + <% end %> + <% end %> <%= render "secondary_links" %>
diff --git a/app/views/forum_post_votes/index.html.erb b/app/views/forum_post_votes/index.html.erb index 51d732ca3..28693d79a 100644 --- a/app/views/forum_post_votes/index.html.erb +++ b/app/views/forum_post_votes/index.html.erb @@ -10,49 +10,33 @@ <%= f.submit "Search" %> <% end %> - - - - - - - - - - - - - <% @forum_post_votes.each do |forum_post_vote| %> - - - - - - - - + <%= table_for @forum_post_votes, {class: "striped autofit"} do |t| %> + <% t.column "Forum Post" do |forum_post_vote| %> + <%= link_to "Forum ##{forum_post_vote.forum_post_id}", forum_post_vote.forum_post %> + <%= link_to "»", forum_post_votes_path(search: { forum_post_id: forum_post_vote.forum_post_id }) %> + <% end %> + <% t.column "Forum Topic", nil, {class: "col-expand"} do |forum_post_vote| %> + <%= link_to forum_post_vote.forum_post.topic.title, forum_post_vote.forum_post.topic %> + <% end %> + <% t.column "Score" do |forum_post_vote| %> + <%= link_to sprintf("%+d", forum_post_vote.score), forum_post_votes_path(search: { score: forum_post_vote.score }) %> + <% end %> + <% t.column "Forum Poster" do |forum_post_vote| %> + <%= link_to_user forum_post_vote.forum_post.creator %> + <%= link_to "»", forum_post_votes_path(search: { forum_post: { creator_name: forum_post_vote.forum_post.creator.name }}) %> +
<%= time_ago_in_words_tagged(forum_post_vote.forum_post.created_at) %>
+ <% end %> + <% t.column "Voter" do |forum_post_vote| %> + <%= link_to_user forum_post_vote.creator %> + <%= link_to "»", forum_post_votes_path(search: { creator_name: forum_post_vote.creator.name }) %> +
<%= time_ago_in_words_tagged(forum_post_vote.created_at) %>
+ <% end %> + <% t.column "" do |forum_post_vote| %> + <% if forum_post_vote.creator == CurrentUser.user %> + <%= link_to "unvote", forum_post_vote_path(forum_post_vote, format: "js"), remote: true, method: :delete %> <% end %> - -
Forum PostForum TopicScoreForum PosterVoter
- <%= link_to "Forum ##{forum_post_vote.forum_post_id}", forum_post_vote.forum_post %> - <%= link_to "»", forum_post_votes_path(search: { forum_post_id: forum_post_vote.forum_post_id }) %> - - <%= link_to forum_post_vote.forum_post.topic.title, forum_post_vote.forum_post.topic %> - - <%= link_to sprintf("%+d", forum_post_vote.score), forum_post_votes_path(search: { score: forum_post_vote.score }) %> - - <%= link_to_user forum_post_vote.forum_post.creator %> - <%= link_to "»", forum_post_votes_path(search: { forum_post: { creator_name: forum_post_vote.forum_post.creator.name }}) %> -
<%= time_ago_in_words_tagged(forum_post_vote.forum_post.created_at) %>
-
- <%= link_to_user forum_post_vote.creator %> - <%= link_to "»", forum_post_votes_path(search: { creator_name: forum_post_vote.creator.name }) %> -
<%= time_ago_in_words_tagged(forum_post_vote.created_at) %>
-
- <% if forum_post_vote.creator == CurrentUser.user %> - <%= link_to "unvote", forum_post_vote_path(forum_post_vote, format: "js"), remote: true, method: :delete %> - <% end %> -
+ <% end %> + <% end %> <%= numbered_paginator(@forum_post_votes) %>
diff --git a/app/views/forum_posts/index.html.erb b/app/views/forum_posts/index.html.erb index 4743c127f..87683811f 100644 --- a/app/views/forum_posts/index.html.erb +++ b/app/views/forum_posts/index.html.erb @@ -1,29 +1,20 @@
- - - - - - - - - - - <% @forum_posts.each do |forum_post| %> - <% if CurrentUser.is_moderator? || !forum_post.is_deleted? %> - - - - - - - <% end %> - <% end %> - -
TopicExcerptCreatorDate
<%= link_to forum_post.topic.title, forum_topic_path(forum_post.topic) %> - <%= link_to truncate(forum_post.body, :length => 50), forum_post_path(forum_post) %> - <%= link_to_user forum_post.creator %><%= time_ago_in_words_tagged forum_post.created_at %>
+ + <%= table_for @forum_posts, {class: "striped", width: "100%"}, {"data-is-deleted": ["%s", "item.is_deleted?"], "data-topic-is-deleted": ["%s", "item.topic.is_deleted?"]} do |t| %> + <% t.column "Topic", nil, {class: "forum-post-topic-title"} do |forum_post| %> + <%= link_to forum_post.topic.title, forum_topic_path(forum_post.topic) %> + <% end %> + <% t.column "Excerpt", nil, {class: "forum-post-excerpt"} do |forum_post| %> + <%= link_to truncate(forum_post.body, :length => 50), forum_post_path(forum_post) %> + <% end %> + <% t.column "Creator" do |forum_post| %> + <%= link_to_user forum_post.creator %> + <% end %> + <% t.column "Date" do |forum_post| %> + <%= time_ago_in_words_tagged forum_post.created_at %> + <% end %> + <% end %> <%= numbered_paginator(@forum_posts) %>
diff --git a/app/views/forum_topics/_listing.html.erb b/app/views/forum_topics/_listing.html.erb index bf0850176..8121940e4 100644 --- a/app/views/forum_topics/_listing.html.erb +++ b/app/views/forum_topics/_listing.html.erb @@ -1,47 +1,37 @@ - - - - - - - - - - - <% forum_topics.each do |topic| %> - <% if CurrentUser.user.level >= topic.min_level %> - - - - - - - <% end %> +<%= table_for forum_topics, {class: "striped", width: "100%"} do |t| %> + <% t.column "Title" do |topic| %> + <% if topic.is_sticky? %> + Sticky: <% end %> - -
TitleCreatorUpdated byUpdated at
- <% if topic.is_sticky? %> - Sticky: - <% end %> - - <% unless topic.read_by?(CurrentUser.user) %> - NEW - <% end %> - - <%= link_to topic.title, forum_topic_path(topic), class: "forum-post-link" %> - - <% if topic.response_count > Danbooru.config.posts_per_page %> - <%= link_to "page #{topic.last_page}", forum_topic_path(topic, :page => topic.last_page), :class => "last-page" %> - <% end %> - - <% if topic.is_locked? %> - (locked) - <% end %> - - <% if topic.min_level > 0 %> - (<%= User.level_string(topic.min_level).downcase %> only) - <% end %> - <%= link_to_user topic.creator %><%= link_to_user topic.updater %><%= compact_time topic.updated_at %>
+ + <% unless topic.read_by?(CurrentUser.user) %> + NEW + <% end %> + + <%= link_to topic.title, forum_topic_path(topic), class: "forum-post-link" %> + + <% if topic.response_count > Danbooru.config.posts_per_page %> + <%= link_to "page #{topic.last_page}", forum_topic_path(topic, :page => topic.last_page), :class => "last-page" %> + <% end %> + + <% if topic.is_locked? %> + (locked) + <% end %> + + <% if topic.min_level > 0 %> + (<%= User.level_string(topic.min_level).downcase %> only) + <% end %> + <% end %> + <% t.column "Creator" do |topic| %> + <%= link_to_user topic.creator %> + <% end %> + <% t.column "Updated by", {class: "updater"} do |topic| %> + <%= link_to_user topic.updater %> + <% end %> + <% t.column "Updated at", {class: "updated-at"} do |topic| %> + <%= compact_time topic.updated_at %> + <% end %> +<% end %> <% content_for(:html_header) do %>