From 1b060893e7f62a7cc786636be44710f3326b7cae Mon Sep 17 00:00:00 2001 From: Giga Chubinidze Date: Tue, 23 May 2023 18:03:10 +0400 Subject: [PATCH 1/2] moved toolbar --- app/assets/javascripts/reports/reports_datatable.js | 13 +++++++------ app/assets/stylesheets/report_index.scss | 13 ++++++------- app/views/reports/_index_toolbar.html.erb | 4 ---- 3 files changed, 13 insertions(+), 17 deletions(-) diff --git a/app/assets/javascripts/reports/reports_datatable.js b/app/assets/javascripts/reports/reports_datatable.js index cbc7ba940..e8e30176a 100644 --- a/app/assets/javascripts/reports/reports_datatable.js +++ b/app/assets/javascripts/reports/reports_datatable.js @@ -168,7 +168,7 @@ var $table = $('#reports-table'); CHECKBOX_SELECTOR = null; REPORTS_TABLE = $table.DataTable({ - dom: "Rt<'pagination-row hidden'<'pagination-info'li><'pagination-actions'p>>", + dom: "R<'reports-toolbar'f>t<'pagination-row hidden'<'pagination-info'li><'pagination-actions'p>>", order: [[9, 'desc']], sScrollX: '100%', stateSave: true, @@ -213,10 +213,16 @@ }); DataTableHelpers.initLengthAppearance($table.closest('.dataTables_wrapper')); + DataTableHelpers.initSearchField($table.closest('.dataTables_wrapper'), I18n.t('projects.reports.index.search_reports')); $('.pagination-row').removeClass('hidden'); $('.report-row.processing').each(function() { setTimeout(() => { checkProcessingStatus($(this).data('id')); }, START_POLLING_INTERVAL); }); + + let topToolbar = $('#toolbarWrapper').detach().html(); + $('.reports-datatable .reports-toolbar').prepend(topToolbar); + + }, drawCallback: function() { if (CHECKBOX_SELECTOR) CHECKBOX_SELECTOR.checkSelectAllStatus(); @@ -334,11 +340,6 @@ }); } - - $('.reports-index').on('keyup', '.report-search', function() { - REPORTS_TABLE.search($(this).val()).draw(); - }); - $('.reports-index').on('click', '.generate-docx', function(e) { var reportId = $(this).closest('.report-row').attr('data-id'); e.preventDefault(); diff --git a/app/assets/stylesheets/report_index.scss b/app/assets/stylesheets/report_index.scss index 6403e4a5a..86b449040 100644 --- a/app/assets/stylesheets/report_index.scss +++ b/app/assets/stylesheets/report_index.scss @@ -18,13 +18,6 @@ } } } - - .search-report-container { - display: inline-block; - float: right; - margin-right: 2em; - width: 200px; - } } .reports-datatable { @@ -35,6 +28,12 @@ flex-direction: column; height: 100%; + .reports-toolbar { + display: flex; + justify-content: space-between; + padding-bottom: 1em; + } + .dataTables_scroll { display: flex; flex-direction: column; diff --git a/app/views/reports/_index_toolbar.html.erb b/app/views/reports/_index_toolbar.html.erb index 3dd2fd6f0..415b0c643 100644 --- a/app/views/reports/_index_toolbar.html.erb +++ b/app/views/reports/_index_toolbar.html.erb @@ -46,8 +46,4 @@ <% end %> -
- "> - -
<% end %> From 34d64f6f444c40e10ded6e215daec7cd93c117ac Mon Sep 17 00:00:00 2001 From: Giga Chubinidze Date: Wed, 24 May 2023 13:39:38 +0400 Subject: [PATCH 2/2] hound fix --- app/assets/javascripts/reports/reports_datatable.js | 7 ++++--- app/assets/stylesheets/report_index.scss | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/app/assets/javascripts/reports/reports_datatable.js b/app/assets/javascripts/reports/reports_datatable.js index e8e30176a..d669382e6 100644 --- a/app/assets/javascripts/reports/reports_datatable.js +++ b/app/assets/javascripts/reports/reports_datatable.js @@ -213,7 +213,10 @@ }); DataTableHelpers.initLengthAppearance($table.closest('.dataTables_wrapper')); - DataTableHelpers.initSearchField($table.closest('.dataTables_wrapper'), I18n.t('projects.reports.index.search_reports')); + DataTableHelpers.initSearchField( + $table.closest('.dataTables_wrapper'), + I18n.t('projects.reports.index.search_reports') + ); $('.pagination-row').removeClass('hidden'); $('.report-row.processing').each(function() { setTimeout(() => { checkProcessingStatus($(this).data('id')); }, START_POLLING_INTERVAL); @@ -221,8 +224,6 @@ let topToolbar = $('#toolbarWrapper').detach().html(); $('.reports-datatable .reports-toolbar').prepend(topToolbar); - - }, drawCallback: function() { if (CHECKBOX_SELECTOR) CHECKBOX_SELECTOR.checkSelectAllStatus(); diff --git a/app/assets/stylesheets/report_index.scss b/app/assets/stylesheets/report_index.scss index 86b449040..926d34f3a 100644 --- a/app/assets/stylesheets/report_index.scss +++ b/app/assets/stylesheets/report_index.scss @@ -31,9 +31,9 @@ .reports-toolbar { display: flex; justify-content: space-between; - padding-bottom: 1em; + padding-bottom: 1em; } - + .dataTables_scroll { display: flex; flex-direction: column;