Skip to content

Commit

Permalink
Remove bootstrap-table from archive tables (alshedivat#2306)
Browse files Browse the repository at this point in the history
The blog archive page tables have `table-borderless`, but
bootstrap-table JS adds `table-bordered` by default and this forces an
`!important` border.
Since these tables are also supposed to be borderless, this PR excludes
them from bootstrap-table, just like the news and CV table are.
  • Loading branch information
sim642 authored Apr 3, 2024
1 parent 4eb8449 commit 307e62a
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion _layouts/archive-category.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ layout: default
<p class="post-description">an archive of posts in this category</p>
</header>

<article>
<article class="archive">
<div class="table-responsive">
<table class="table table-sm table-borderless">
{% for post in page.posts %}
Expand Down
2 changes: 1 addition & 1 deletion _layouts/archive-tag.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ layout: default
<p class="post-description">an archive of posts with this tag</p>
</header>

<article>
<article class="archive">
<div class="table-responsive">
<table class="table table-sm table-borderless">
{% for post in page.posts %}
Expand Down
2 changes: 1 addition & 1 deletion _layouts/archive-year.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ layout: default
<p class="post-description">an archive of posts from this year</p>
</header>

<article>
<article class="archive">
<div class="table-responsive">
<table class="table table-sm table-borderless">
{% for post in page.posts %}
Expand Down
7 changes: 6 additions & 1 deletion assets/js/no_defer.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,12 @@ $(document).ready(function () {
}

// only select tables that are not inside an element with "news" (about page) or "card" (cv page) class
if ($(this).parents('[class*="news"]').length == 0 && $(this).parents('[class*="card"]').length == 0 && $(this).parents("code").length == 0) {
if (
$(this).parents('[class*="news"]').length == 0 &&
$(this).parents('[class*="card"]').length == 0 &&
$(this).parents('[class*="archive"]').length == 0 &&
$(this).parents("code").length == 0
) {
// make table use bootstrap-table
$(this).attr("data-toggle", "table");
// add some classes to make the table look better
Expand Down

0 comments on commit 307e62a

Please sign in to comment.