Skip to content

Commit

Permalink
Merge pull request #279 from harena-lab/development
Browse files Browse the repository at this point in the history
Hotfix: loading icon
  • Loading branch information
HeitorMatt authored Apr 29, 2021
2 parents 7b67b18 + 44f550f commit 6afefed
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
5 changes: 3 additions & 2 deletions src/adonisjs/public/author/js/draft.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')

Expand Down
1 change: 1 addition & 0 deletions src/adonisjs/public/author/js/template-case.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ class TemplateToCase {
})
.catch(function (error) {
console.log(error)
window.location.href = '/author/?id=' + _caseId
})
}
} catch (e) {
Expand Down
17 changes: 12 additions & 5 deletions src/adonisjs/public/infra/simple-page-tasks.js
Original file line number Diff line number Diff line change
@@ -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)
Expand All @@ -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 = []
Expand All @@ -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')
Expand All @@ -67,8 +73,9 @@ class PageController {
PageController.instance.appropriateBreadcrumb()
PageController.scriptsComplete = true
// console.log(PageController.scriptsComplete)
this.hasremovedLoading = true

}
this.hasremovedLoading = true
}

controlDropdownMenu(){
Expand Down

0 comments on commit 6afefed

Please sign in to comment.