table builder: add 'striped' css class by default.

This commit is contained in:
evazion
2020-01-06 02:12:04 -06:00
parent abe7f086b6
commit f1528e0fae
20 changed files with 22 additions and 22 deletions

View File

@@ -24,10 +24,10 @@ class TableBuilder
attr_reader :columns, :table_attributes, :items
def initialize(items, table_attributes=nil)
def initialize(items, **table_attributes)
@items = items
@columns = []
@table_attributes = table_attributes
@table_attributes = { class: "striped", **table_attributes }
yield self if block_given?
end

View File

@@ -4,7 +4,7 @@
<%= render "posts/partials/common/inline_blacklist" %>
<%= table_for @commentaries, {class: "striped", width: "100%"} do |t| %>
<%= table_for @commentaries, width: "100%" do |t| %>
<% t.column "Post", {width: "1%"} do |commentary| %>
<%= PostPresenter.preview(commentary.post, :tags => "status:any") %>
<% end %>

View File

@@ -1,4 +1,4 @@
<%= table_for bulk_update_requests, {class: "striped", width: "100%"} do |t| %>
<%= table_for bulk_update_requests, width: "100%" do |t| %>
<% t.column "Request" do |request| %>
<% if request.forum_post.present? %>
<p><%= 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}") %></p>

View File

@@ -10,7 +10,7 @@
<%= render "search" %>
<%= table_for @dmails, {class: "striped", width: "100%"} do |t| %>
<%= table_for @dmails, width: "100%" do |t| %>
<% t.column "Date" do |dmail| %>
<%= compact_time(dmail.created_at) %>
<% end %>

View File

@@ -1,7 +1,7 @@
<div id="c-favorite-groups">
<div id="a-index">
<%= table_for @favorite_groups, {class: "striped", width: "100%"} do |t| %>
<%= table_for @favorite_groups, 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) %>

View File

@@ -1,7 +1,7 @@
<div id="c-forum-posts">
<div id="a-index">
<%= table_for @forum_posts, {class: "striped", width: "100%"} do |t| %>
<%= table_for @forum_posts, width: "100%" 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 %>

View File

@@ -1,4 +1,4 @@
<%= table_for forum_topics, {class: "striped", width: "100%"} do |t| %>
<%= table_for forum_topics, width: "100%" do |t| %>
<% t.column "Title" do |topic| %>
<% if topic.is_sticky? %>
<span class="sticky">Sticky:</span>
@@ -40,4 +40,4 @@
.updated-at { display: none; }
}
</style>
<% end %>
<% end %>

View File

@@ -2,7 +2,7 @@
<div id="a-index">
<h1>IP Bans</h1>
<%= table_for @ip_bans, {class: "striped", width: "100%"} do |t| %>
<%= table_for @ip_bans, width: "100%" do |t| %>
<% t.column "IP Address" do |ip_ban| %>
<%= link_to_ip ip_ban.subnetted_ip %>
<% end %>

View File

@@ -2,7 +2,7 @@
<div id="a-index">
<h1>News Updates</h1>
<%= table_for @news_updates, {class: "striped", width: "100%"} do |t| %>
<%= table_for @news_updates, width: "100%" do |t| %>
<% t.column "Creator" do |news_update| %>
<%= link_to_user news_update.creator %>
<% end %>

View File

@@ -2,7 +2,7 @@
<div id="a-index">
<%= render "search", :path => pools_path %>
<%= table_for @pools, {class: "striped", width: "100%"} do |t| %>
<%= table_for @pools, width: "100%" do |t| %>
<% t.column nil, {width: "5%"} %>
<% t.column "Name", {width: "60%"} do |pool| %>
<span class="pool-category-<%= pool.category %>"><%= link_to pool.pretty_name, pool_path(pool) %></span>

View File

@@ -4,7 +4,7 @@
<%= render "search" %>
<%= render "posts/partials/common/inline_blacklist" %>
<%= table_for @post_appeals, {class: "striped", width: "100%"} do |t| %>
<%= table_for @post_appeals, width: "100%" do |t| %>
<% t.column "Post", {width: "1%"} do |post_appeal| %>
<%= PostPresenter.preview(post_appeal.post, :tags => "status:any") %>
<% end %>

View File

@@ -9,7 +9,7 @@
<%= f.submit "Search" %>
<% end %>
<%= table_for @post_approvals, {class: "striped", width: "100%"} do |t| %>
<%= table_for @post_approvals, width: "100%" do |t| %>
<% t.column "Post", {width: "1%"} do |post_approval| %>
<%= PostPresenter.preview(post_approval.post, :tags => "status:any") %>
<% end %>

View File

@@ -4,7 +4,7 @@
<%= render "search" %>
<%= render "posts/partials/common/inline_blacklist" %>
<%= table_for @post_flags, {class: "striped", width: "100%"} do |t| %>
<%= table_for @post_flags, width: "100%" do |t| %>
<% t.column "Post", {width: "1%"} do |post_flag| %>
<%= PostPresenter.preview(post_flag.post, :tags => "status:any") %>
<% end %>

View File

@@ -1,4 +1,4 @@
<%= table_for tag_aliases, {class: "striped", width: "100%"} do |t| %>
<%= table_for tag_aliases, width: "100%" do |t| %>
<% t.column "From", {width: "25%"} do |tag_alias| %>
<span class="category-<%= tag_alias.antecedent_tag.try(:category) %>"><%= link_to tag_alias.antecedent_name, posts_path(:tags => tag_alias.antecedent_name) %> <span class="count"><%= tag_alias.antecedent_tag.post_count rescue 0 %></span></span>
<% end %>

View File

@@ -1,4 +1,4 @@
<%= table_for tag_implications, {class: "striped", width: "100%"} do |t| %>
<%= table_for tag_implications, width: "100%" do |t| %>
<% t.column "From", {width: "25%"} do |tag_implication| %>
<span class="category-<%= tag_implication.antecedent_tag.try(:category) %>"><%= link_to tag_implication.antecedent_name, posts_path(:tags => tag_implication.antecedent_name) %> <span class="count"><%= tag_implication.antecedent_tag.post_count rescue 0 %></span></span>
<% end %>

View File

@@ -2,7 +2,7 @@
<div id="a-index">
<h1>Name Change Requests</h1>
<%= table_for @change_requests, {class: "striped", width: "100%"} do |t| %>
<%= table_for @change_requests, width: "100%" do |t| %>
<% t.column "User" do |change_request| %>
<%= link_to_user change_request.user %>
<% end %>

View File

@@ -2,7 +2,7 @@
<div id="a-index">
<h1>Users</h1>
<%= table_for @users, {class: "striped", width: "100%"} do |t| %>
<%= table_for @users, width: "100%" do |t| %>
<% t.column "" do |user| %>
<% if CurrentUser.is_admin? %>
<%= link_to "Edit", edit_admin_user_path(user) %>

View File

@@ -1,6 +1,6 @@
<div id="p-global-listing">
<%= table_for @wiki_page_versions, {class: "striped", width: "100%"} do |t| %>
<%= table_for @wiki_page_versions, width: "100%" do |t| %>
<% t.column "", {width: "3%"} do |wiki_page_version| %>
<%= link_to_if wiki_page_version.previous.present?, "diff", diff_wiki_page_versions_path(otherpage: wiki_page_version.previous.try(:id), thispage: wiki_page_version.id) %>
<% end %>

View File

@@ -1,7 +1,7 @@
<div id="p-page-listing">
<%= form_tag(diff_wiki_page_versions_path, :method => :get) do %>
<%= table_for @wiki_page_versions, {class: "striped", width: "100%"} do |t| %>
<%= table_for @wiki_page_versions, width: "100%" do |t| %>
<% t.column "", {width: "3%"} do |wiki_page_version, i| %>
<% if i < @wiki_page_versions.length - 1 %>
<%= link_to "diff", diff_wiki_page_versions_path(:otherpage => wiki_page_version.id, :thispage => @wiki_page_versions[i + 1].id) %>

View File

@@ -3,7 +3,7 @@
<% content_for(:content) do %>
<h1>Wiki</h1>
<%= table_for @wiki_pages, {class: "striped", width: "100%"} do |t| %>
<%= table_for @wiki_pages, width: "100%" do |t| %>
<% t.column "Title" do |wiki_page| %>
<span class="category-<%= wiki_page.category_name %>"><%= link_to_wiki wiki_page.title %></span>
<% end %>