-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3017 from sbull/horizontal-scroll-list
Add config.horizontal_scroll_list to enable horizontal scrolling colu…
- Loading branch information
Showing
8 changed files
with
297 additions
and
35 deletions.
There are no files selected for viewing
16 changes: 16 additions & 0 deletions
16
app/assets/javascripts/rails_admin/ra.horizontal-scroll-list.coffee
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
(-> | ||
$ = jQuery | ||
|
||
setFrozenColPositions = -> | ||
$listForm = $('#bulk_form') | ||
return unless $listForm.is('.ra-horizontal-scroll-list') | ||
$listForm.find('table tr').each (index, tr) -> | ||
firstPosition = 0 | ||
$(tr).find('.ra-horizontal-scroll-frozen').each (idx, td) -> | ||
tdLeft = $(td).position().left | ||
firstPosition = tdLeft if idx == 0 | ||
td.style.left = "#{tdLeft - firstPosition}px" | ||
|
||
$(window).on('load', setFrozenColPositions) # Update after link icons load. | ||
$(document).on('rails_admin.dom_ready', setFrozenColPositions) | ||
)() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
app/assets/stylesheets/rails_admin/ra.horizontal-scroll-table.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
.ra-horizontal-scroll-table { | ||
margin-bottom: 20px; | ||
overflow-x: auto; | ||
.table { | ||
margin-bottom: 0; | ||
} | ||
|
||
.ra-horizontal-scroll-frozen { | ||
position: sticky; | ||
} | ||
|
||
// Remove transparency on frozen cells. | ||
$table-bg-default: if($table-bg == transparent, if($body-bg == transparent, #fff, $body-bg), $table-bg) !default; | ||
.table-striped > tbody > tr:nth-child(even) > td, .table-striped > thead > tr > th { | ||
background-color: $table-bg-default; | ||
} | ||
$table-bg-header-sort: #e2eff6 !default; | ||
.table .ra-horizontal-scroll-frozen { | ||
&.headerSortUp, &.headerSortDown { | ||
background-color: $table-bg-header-sort; | ||
} | ||
} | ||
|
||
// border-right isn't sticky | ||
.ra-horizontal-scroll-frozen-last { | ||
box-shadow: -1px 0 0 0 $table-border-color inset; | ||
padding-right: $table-condensed-cell-padding + 1px; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters