Skip to content

Commit

Permalink
Left hand column of report tables now freeze when scrolling horizonta…
Browse files Browse the repository at this point in the history
…lly, addresses #9.
  • Loading branch information
remomueller committed Aug 10, 2019
1 parent 7a2a1e5 commit 2eb07f3
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
- **Report Changes**
- Report pages without any reports now display a message
- Descriptions can be added to reports that support markdown formatting
- Left hand column of report tables now freeze when scrolling horizontally

## 10.0.0 (August 4, 2019)

Expand Down
9 changes: 9 additions & 0 deletions app/assets/stylesheets/components/tables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,12 @@
.table-overflow-scroll {
overflow-x: scroll;
}

.table-scroll {
margin: auto;
margin-bottom: $spacer;
overflow: auto;
position: relative;
width: 100%;
z-index: 1;
}
35 changes: 35 additions & 0 deletions app/assets/stylesheets/objects/reports.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,38 @@
font-size: 72px;
}
}

.report-table {
td,
th {
font-size: .8rem;
white-space: nowrap;

&:first-child {
left: 0;
position: sticky;
}
}
}

@each $name, $theme in $themes {
.theme-#{$name}-bg {
.report-table {
th:first-child {
background-color: map-get($theme, dashboard-bg);
}

tr:nth-of-type(even) {
td:first-child {
background-color: map-get($theme, dashboard-bg);
}
}

tr:nth-of-type(odd) {
td:first-child {
background-color: theme-color($theme, table-accent-bg, $table-accent-bg);
}
}
}
}
}
2 changes: 2 additions & 0 deletions app/assets/stylesheets/themes/default.scss
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,6 @@ $default: (

blockquote-border: null, // $p200-grey
blockquote-color: null, // $p500-grey

table-accent-bg: #f9f9f9,
);
4 changes: 2 additions & 2 deletions app/views/reports/_table.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
- counts[index + 1] ||= 0
- counts[index + 1] += hash["count"].to_i

.dashboard-container.dashboard-table{ style: "overflow-x: scroll;" }
%table.table.table-striped.table-borderless.table-hover
.dashboard-container.dashboard-table.table-scroll
%table.table.table-striped.table-borderless.report-table
%thead
%tr
%th= report.header_label
Expand Down

0 comments on commit 2eb07f3

Please sign in to comment.