From 6447750ff7ca0d8e29df76c2d649553d41b4c5b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Zrim=C5=A1ek?= Date: Thu, 25 Oct 2018 22:31:00 +0200 Subject: [PATCH] Fix showing projects in table view when all are archived [SCI-2787] --- app/assets/javascripts/projects/index.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/projects/index.js b/app/assets/javascripts/projects/index.js index 659c06797..d592226a8 100644 --- a/app/assets/javascripts/projects/index.js +++ b/app/assets/javascripts/projects/index.js @@ -435,10 +435,10 @@ sort: projectsViewSort }, success: function(data) { - if (data.html.search('id="edit-project-cards-form-') > 0) { + if (data.html.search(/id="edit-project-cards-form-\d+"/)) { + viewContainer.html(data.html); $('#projects-absent').hide(); $('#projects-present').show(); - viewContainer.html(data.html); } else { $('#projects-present').hide(); $('#projects-absent').show(); @@ -664,7 +664,16 @@ { data: 'tasks' }, { data: 'actions' } ], + fnPreDrawCallback: function() { + $('#projects-absent').hide(); + $('#projects-present').show(); + }, fnDrawCallback: function() { + var $table = TABLE.table().node(); + if ($('.dataTables_empty', $table).length) { + $('#projects-present').hide(); + $('#projects-absent').show(); + } animateSpinner(this, false); updateDataTableSelectAllCtrl(); initRowSelection();