Skip to content

Commit

Permalink
Optional sticky header
Browse files Browse the repository at this point in the history
  • Loading branch information
gryphon committed May 8, 2024
1 parent aa16182 commit 6337ca9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
7 changes: 7 additions & 0 deletions app/assets/stylesheets/custom_table/table.scss
Original file line number Diff line number Diff line change
Expand Up @@ -101,3 +101,10 @@ table.custom-table {
}
}
}


@include media-breakpoint-down(lg) {
.overflow-x-lg-scroll {
overflow-x: scroll;
}
}
4 changes: 2 additions & 2 deletions app/views/custom_table/_table.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@

- fields = fields.except(*local_assigns[:skip_fields]) if !local_assigns[:skip_fields].nil?

%div.table-wrapper{data: {controller: "batch-actions"}}
%div.table-wrapper.overflow-x-lg-scroll{data: {controller: "batch-actions"}}
- if local_assigns[:batch_actions]
= self.send(local_assigns[:batch_actions])
%table{class: ["search-fields", "custom-table", "table", "table-hover", "table-sm", model_class.model_name.plural], data: {controller: "table toggle"}}
%thead.sticky
%thead.sticky-lg-top
- if local_assigns[:quick_filter]
%tr
%td{colspan: "100%"}
Expand Down

0 comments on commit 6337ca9

Please sign in to comment.