diff --git a/src/adonisjs/public/author/js/draft.js b/src/adonisjs/public/author/js/draft.js index 62783013..37f63b79 100644 --- a/src/adonisjs/public/author/js/draft.js +++ b/src/adonisjs/public/author/js/draft.js @@ -83,15 +83,16 @@ class DraftManager { ) } } - MessageBus.int.publish('control/dhtml/ready') } - async _draftCategoryCasesSelect (advanced, topic, message) { + async _draftCategoryCasesSelect (topic, message) { const cl = document.getElementsByClassName('buttons-container') const caseListInput = document.querySelector('#table_id') if(message != null && message.id != null && message.id == 'harena-dhtml-cases'){ + + if(document.querySelector('#select-all-checkbox')){ const selectAllCases = document.querySelector('#select-all-checkbox') diff --git a/src/adonisjs/public/author/js/template-case.js b/src/adonisjs/public/author/js/template-case.js index f3235329..e685b33a 100644 --- a/src/adonisjs/public/author/js/template-case.js +++ b/src/adonisjs/public/author/js/template-case.js @@ -97,6 +97,7 @@ class TemplateToCase { }) .catch(function (error) { console.log(error) + window.location.href = '/author/?id=' + _caseId }) } } catch (e) { diff --git a/src/adonisjs/public/infra/simple-page-tasks.js b/src/adonisjs/public/infra/simple-page-tasks.js index 91b8684f..019d649b 100644 --- a/src/adonisjs/public/infra/simple-page-tasks.js +++ b/src/adonisjs/public/infra/simple-page-tasks.js @@ -1,6 +1,7 @@ class PageController { constructor () { var isPageReady = false + var dhtmlLoaded = false var hasremovedLoading = false PageController.scriptsComplete = false this.removeLoadingIcon = this.removeLoadingIcon.bind(this) @@ -22,9 +23,8 @@ class PageController { MessageBus.int.subscribe('control/html/ready', this.pageReady) } async pageReady(){ - + PageController.instance.paginationButtons(parseInt(new URL(document.location).searchParams.get('page') || 1)) if(!this.isPageReady){ - PageController.instance.paginationButtons(parseInt(new URL(document.location).searchParams.get('page') || 1)) // Verifies if the page contains the correct element if(document.querySelector('#filter-form')){ var filterElements = [] @@ -45,8 +45,14 @@ class PageController { } async removeLoadingIcon(){ - - if(!this.hasremovedLoading){ + var dhtmlList = document.querySelectorAll('dcc-dhtml') + this.dhtmlLoaded = true + for(var i in dhtmlList){ + if(dhtmlList[i]._ready == false){ + this.dhtmlLoaded = false + } + } + if(!this.hasremovedLoading && this.dhtmlLoaded){ if(document.querySelector('#loading-page-container')){ setTimeout(function(){ document.querySelector('main').classList.remove('invisible') @@ -67,8 +73,9 @@ class PageController { PageController.instance.appropriateBreadcrumb() PageController.scriptsComplete = true // console.log(PageController.scriptsComplete) + this.hasremovedLoading = true + } - this.hasremovedLoading = true } controlDropdownMenu(){