Use bootstrap table striping to replace hand-cycled table stripes
This cuts down on the complexity of having to use the `cycle` function and makes the templates easier to read. CSS-based striping has been around for many years. The CSS is in order to keep our custom colour for striped tables.
This commit is contained in:
parent
b0c50ab344
commit
5fdada204c
9 changed files with 22 additions and 33 deletions
|
@ -2048,16 +2048,11 @@ a.button {
|
|||
}
|
||||
}
|
||||
|
||||
/* Rules for doing distinct colour of alternate table rows */
|
||||
/* Customise the background colour of striped tables */
|
||||
|
||||
.table0,
|
||||
.item0 {
|
||||
background: $offwhite;
|
||||
}
|
||||
|
||||
.table1,
|
||||
.item1 {
|
||||
background: #fff;
|
||||
.table-striped > tbody > tr:nth-child(2n+1) > td,
|
||||
.table-striped > tbody > tr:nth-child(2n+1) > th {
|
||||
background-color: $offwhite;
|
||||
}
|
||||
|
||||
/* Rules for OpenID logo */
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<h1><%= t(".has_commented_on", :display_name => @user.display_name) %></h1>
|
||||
<% end %>
|
||||
|
||||
<table class="messages" width="100%">
|
||||
<table class="table table-striped" width="100%">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="25%"><%= t ".post" %></th>
|
||||
|
@ -11,8 +11,7 @@
|
|||
</tr>
|
||||
</thead>
|
||||
<% @comments.each do |comment| -%>
|
||||
<% cl = cycle("table0", "table1") %>
|
||||
<tr class="<%= cl %><%= " deemphasize" unless comment.visible? %>">
|
||||
<tr class="<%= "deemphasize" unless comment.visible? %>">
|
||||
<td width="25%"><%= link_to comment.diary_entry.title, diary_entry_path(comment.diary_entry.user, comment.diary_entry) %></td>
|
||||
<td width="25%"><span title="<%= l comment.created_at, :format => :friendly %>"><%= time_ago_in_words(comment.created_at, :scope => :'datetime.distance_in_words_ago') %></span></td>
|
||||
<td width="50%" class="richtext"><%= comment.body.to_html %></td>
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
<tr>
|
||||
<% cl = cycle("table0", "table1") %>
|
||||
<td class="<%= cl %>">
|
||||
<td>
|
||||
<% if Settings.status != "gpx_offline" %>
|
||||
<% if trace.inserted %>
|
||||
<a href="<%= url_for :controller => "traces", :action => "show", :id => trace.id, :display_name => trace.user.display_name %>"><img src="<%= url_for :controller => "traces", :action => "icon", :id => trace.id, :display_name => trace.user.display_name %>" border="0" alt="" /></a>
|
||||
|
@ -9,7 +8,7 @@
|
|||
<% end %>
|
||||
<% end %>
|
||||
</td>
|
||||
<td class="<%= cl %>"><%= link_to trace.name, :controller => "traces", :action => "show", :display_name => trace.user.display_name, :id => trace.id %>
|
||||
<td><%= link_to trace.name, :controller => "traces", :action => "show", :display_name => trace.user.display_name, :id => trace.id %>
|
||||
<span class="trace_summary" title="<%= trace.timestamp %>"> ...
|
||||
<% if trace.inserted %>
|
||||
(<%= t ".count_points", :count => trace.size %>)
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
<% if @traces.size > 0 %>
|
||||
<%= render :partial => "trace_paging_nav" %>
|
||||
|
||||
<table id="trace_list" cellpadding="3">
|
||||
<table id="trace_list" class="table table-borderless table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th>
|
||||
|
|
|
@ -1,24 +1,22 @@
|
|||
<tr>
|
||||
<% c1 = cycle("table0", "table1") %>
|
||||
|
||||
<% if show_user_name %>
|
||||
<td class="<%= c1 %>"><%= link_to h(block.user.display_name), user_path(block.user) %></td>
|
||||
<td><%= link_to h(block.user.display_name), user_path(block.user) %></td>
|
||||
<% end %>
|
||||
<% if show_creator_name %>
|
||||
<td class="<%= c1 %>"><%= link_to h(block.creator.display_name), user_path(block.creator) %></td>
|
||||
<td><%= link_to h(block.creator.display_name), user_path(block.creator) %></td>
|
||||
<% end %>
|
||||
<td class="<%= c1 %>"><%= h truncate(block.reason) %></td>
|
||||
<td class="<%= c1 %>"><%= h block_status(block) %></td>
|
||||
<td class="<%= c1 %>">
|
||||
<td><%= h truncate(block.reason) %></td>
|
||||
<td><%= h block_status(block) %></td>
|
||||
<td>
|
||||
<% if block.revoker_id.nil? %>
|
||||
<%= t(".not_revoked") %>
|
||||
<% else %>
|
||||
<%= link_to h(block.revoker.display_name), user_path(block.revoker) %>
|
||||
<% end %>
|
||||
</td>
|
||||
<td class="<%= c1 %>"><%= link_to t(".show"), block %></td>
|
||||
<td class="<%= c1 %>"><% if current_user and current_user.id == block.creator_id and block.active? %><%= link_to t(".edit"), edit_user_block_path(block) %><% end %></td>
|
||||
<td><%= link_to t(".show"), block %></td>
|
||||
<td><% if current_user and current_user.id == block.creator_id and block.active? %><%= link_to t(".edit"), edit_user_block_path(block) %><% end %></td>
|
||||
<% if show_revoke_link %>
|
||||
<td class="<%= c1 %>"><% if block.active? %><%= link_to t(".revoke"), :controller => "user_blocks", :action => "revoke", :id => block.id %><% end %></td>
|
||||
<td><% if block.active? %><%= link_to t(".revoke"), :controller => "user_blocks", :action => "revoke", :id => block.id %><% end %></td>
|
||||
<% end %>
|
||||
</tr>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<table id="block_list" cellpadding="3">
|
||||
<table id="block_list" class="table table-borderless table-striped table-sm">
|
||||
<thead>
|
||||
<tr>
|
||||
<% if show_user_name %>
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
<% cl = cycle("table0", "table1") %>
|
||||
|
||||
<tr class="<%= cl %>">
|
||||
<tr>
|
||||
<td>
|
||||
<%= user_thumbnail(user) %>
|
||||
</td>
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
<%= hidden_field_tag :status, params[:status] if params[:status] %>
|
||||
<%= hidden_field_tag :ip, params[:ip] if params[:ip] %>
|
||||
<%= hidden_field_tag :page, params[:page] if params[:page] %>
|
||||
<table id="user_list">
|
||||
<table id="user_list" class="table table-borderless table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
|
|
|
@ -873,7 +873,7 @@ class DiaryEntriesControllerTest < ActionController::TestCase
|
|||
get :comments, :params => { :display_name => user.display_name }
|
||||
assert_response :success
|
||||
assert_template :comments
|
||||
assert_select "table.messages" do
|
||||
assert_select "table.table-striped" do
|
||||
assert_select "tr", :count => 1 # header, no comments
|
||||
end
|
||||
|
||||
|
@ -883,7 +883,7 @@ class DiaryEntriesControllerTest < ActionController::TestCase
|
|||
get :comments, :params => { :display_name => other_user.display_name }
|
||||
assert_response :success
|
||||
assert_template :comments
|
||||
assert_select "table.messages" do
|
||||
assert_select "table.table-striped" do
|
||||
assert_select "tr", :count => 2 # header and one comment
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue