diff --git a/app/assets/javascripts/protocols/index.js b/app/assets/javascripts/protocols/index.js index b8a63f95e..dc58cc5ec 100644 --- a/app/assets/javascripts/protocols/index.js +++ b/app/assets/javascripts/protocols/index.js @@ -1,5 +1,5 @@ //= require protocols/import_export/import -/* global ProtocolRepositoryHeader PdfPreview */ +/* global ProtocolRepositoryHeader PdfPreview DataTableHelpers */ // Global variables var rowsSelected = []; @@ -27,7 +27,7 @@ function initProtocolsTable() { protocolsDatatable = protocolsTableEl.DataTable({ order: [[1, "asc"]], - dom: "RB<'main-actions'lf>t<'pagination-row'ip>", + dom: "R<'main-actions hidden'<'toolbar'><'filter-container'f>>t<'pagination-row hidden'<'pagination-info'li><'pagination-actions'p>>", stateSave: true, sScrollX: '100%', sScrollXInner: '100%', @@ -110,6 +110,12 @@ function initProtocolsTable() { JSON.stringify(data) ); }, + fnInitComplete: function(e) { + var dataTableWrapper = $(e.nTableWrapper); + DataTableHelpers.initLengthAppearance(dataTableWrapper); + DataTableHelpers.initSearchField(dataTableWrapper, 'Enter...'); + dataTableWrapper.find('.main-actions, .pagination-row').removeClass('hidden'); + }, stateLoadCallback: function (settings) { // Load the table state for the current team var state = localStorage.getItem( @@ -123,6 +129,12 @@ function initProtocolsTable() { return null; } }); + + $('#wrapper').on('sideBar::shown sideBar::hidden', function() { + if (protocolsDatatable) { + protocolsDatatable.columns.adjust(); + } + }); } function initRowSelection() { diff --git a/app/assets/stylesheets/label_templates/index.scss b/app/assets/stylesheets/label_templates/index.scss index e76164f09..d7da963d5 100644 --- a/app/assets/stylesheets/label_templates/index.scss +++ b/app/assets/stylesheets/label_templates/index.scss @@ -73,6 +73,10 @@ .dataTables_scrollHead { flex-shrink: 0; } + + .dataTables_scrollBody { + height: 100%; + } } .pagination-row { diff --git a/app/assets/stylesheets/partials/_sidebar.scss b/app/assets/stylesheets/partials/_sidebar.scss index a25762d7c..bc180e478 100644 --- a/app/assets/stylesheets/partials/_sidebar.scss +++ b/app/assets/stylesheets/partials/_sidebar.scss @@ -165,9 +165,12 @@ font-weight: bold; } + .fas { + margin-right: .5em; + } + .fa-folder { color: $brand-primary-light; - margin-right: .5em; } &.back-button::before { diff --git a/app/assets/stylesheets/protocol_management.scss b/app/assets/stylesheets/protocol_management.scss index 2c1f975ab..ee2256e5d 100644 --- a/app/assets/stylesheets/protocol_management.scss +++ b/app/assets/stylesheets/protocol_management.scss @@ -25,7 +25,6 @@ #protocols-index, #load-from-repository-modal { - padding: 0; .nav-tabs > li { text-transform: uppercase; diff --git a/app/assets/stylesheets/protocols/index.scss b/app/assets/stylesheets/protocols/index.scss new file mode 100644 index 000000000..246462aa1 --- /dev/null +++ b/app/assets/stylesheets/protocols/index.scss @@ -0,0 +1,26 @@ +// scss-lint:disable IdSelector + +.protocols-index { + .protocols-datatable { + --content-header-size: 5em; + height: calc(100vh - var(--navbar-height) - var(--content-header-size)); + + #protocols-table_wrapper { + display: flex; + flex-direction: column; + height: 100%; + width: 100%; + } + + .dataTables_scroll { + display: flex; + flex-direction: column; + flex-grow: 1; + height: calc(100% - var(--datatable-pagination-row)); + } + + .dataTables_scrollBody { + height: 100%; + } + } +} diff --git a/app/assets/stylesheets/themes/scinote.scss b/app/assets/stylesheets/themes/scinote.scss index 5a6a8a430..8bd66b1b1 100644 --- a/app/assets/stylesheets/themes/scinote.scss +++ b/app/assets/stylesheets/themes/scinote.scss @@ -533,22 +533,6 @@ a[data-toggle="tooltip"] { } .protocols-datatable { - .dataTables_wrapper { - clear: both; - - .main-actions, - .pagination-row { - display: flex; - } - - .dataTables_filter, - .dataTables_info, - .dataTables_paginate, - .dataTables_length { - flex-grow: 1; - } - } - table { tbody tr.selected { & > td:nth-child(3), td:nth-child(4) { diff --git a/app/views/protocols/index.html.erb b/app/views/protocols/index.html.erb index 5533c0564..bcd5e32c3 100644 --- a/app/views/protocols/index.html.erb +++ b/app/views/protocols/index.html.erb @@ -9,110 +9,88 @@ <%= content_for :sidebar do %> <%= render partial: "/shared/sidebar/templates_sidebar", locals: {active: :protocol} %> <% end %> -