Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Development #455

Merged
merged 2 commits into from
Oct 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions src/adonisjs/public/author/js/navigator.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class Navigator {
if (this._navigatorSpread == 0) { Panels.s.setupVisibleNavigator() } else {
Panels.s.setupWideNavigator()
this._retracted = false
this._presentTreeCase()
// this._presentTreeCase()
}
this._navigatorSpread++
}
Expand All @@ -32,7 +32,7 @@ class Navigator {
if (this._navigatorSpread == 1) { Panels.s.setupHiddenNavigator() } else {
Panels.s.setupRegularNavigator()
this._retracted = true
this._presentTreeCase()
// this._presentTreeCase()
}
this._navigatorSpread--
}
Expand Down Expand Up @@ -70,7 +70,14 @@ class Navigator {
label: knots[k].title,
render: knots[k].render,
level: knots[k].level
// width: knots[k].title.length * 10 + 20
}
/*
if (newKnot.level == 1) {
newKnot.width = newKnot.label.length * 10 + 20
// newKnot.height = newKnot.width / 1.618 // golden ratio
}
*/

// attach menus to nodes
const items = {}
Expand Down
8 changes: 4 additions & 4 deletions src/adonisjs/public/author/js/panels.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ class Panels {
document.querySelector('#button-expand-prop').style.display = 'initial'
if (this._propertiesVisible) { this.setupPropertiesExpand() }
// this._knotMain.classList.add('w-' + this._knotPanelSize)
// this._navigationBlock.classList.remove('w-100')
// this._navigationBlock.classList.add('w-25')
this._navigationBlock.classList.remove('w-50')
this._navigationBlock.classList.add('w-25')
this._navigationBlock.style.display = 'initial'
this._buttonExpandNav.style.display = 'initial'
this._buttonRetractNav.style.display = 'initial'
Expand All @@ -92,8 +92,8 @@ class Panels {
this._propertiesVisible = true
}
// this._knotMain.classList.remove('w-' + this._knotPanelSize)
// this._navigationBlock.classList.remove('w-25')
// this._navigationBlock.classList.add('w-100')
this._navigationBlock.classList.remove('w-25')
this._navigationBlock.classList.add('w-50')
this._navigationBlock.style.width = '100%'
this._buttonExpandNav.style.display = 'none'
this._buttonRetractNav.style.display = 'initial'
Expand Down
235 changes: 235 additions & 0 deletions src/adonisjs/public/infra/dcc-basic-jacinto.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,235 @@
(function () {
DCC.component(
'submit-login',
'dcc-submit',
{
pre: function (message, form, schema) {
// console.log('============ logging')
if (form.checkValidity() === false) {
for ( i = 0; i < form.elements.length; i++){
if(form[i].required && form[i].validity.valid){
form[i].classList.add('is-valid')
form[i].classList.remove('is-invalid')
}else{
form[i].classList.add('is-invalid')
form[i].classList.remove('is-valid')
}
}
// console.log('form invalid')
return false
}
// console.log('form valid')
for ( i = 0; i < form.elements.length; i++){
// form[i].classList.add('is-valid')
form[i].classList.remove('is-invalid')
}
// form.classList.add('was-validated')
return true

},
pos: function (response) {
// console.log(response['harena-login']['response'])
if(response['harena-login']['response'] === 'Login successful'){
// console.log('login successful');
if(document.querySelector('#login-message-alert')){
document.querySelector('#btn-submit-login').firstElementChild.innerHTML = 'Logging...'
document.querySelector('#login-message-alert').innerHTML = response['harena-login']['response']
document.querySelector('#login-message-alert').classList.add('alert-success')
document.querySelector('#login-message-alert').classList.remove('alert-danger')

}

setTimeout(function(){
if(new URL(document.location).searchParams.get('redirected')){
let redirectTo = sessionStorage.getItem('redirectBack')
if(redirectTo == null || redirectTo == '')
redirectTo = '/index-jacinto.html'
sessionStorage.removeItem('redirectBack')
window.location.href = redirectTo
}else{
sessionStorage.removeItem('redirectBack')
window.location.href = '/index-jacinto.html'
}

}, 2000)
}else if (response['harena-login']['response'] === 'Email or password incorrect'){
// console.log('login failed, password or email incorrect');
if(document.querySelector('#login-message-alert')){
document.querySelector('#login-message-alert').innerHTML = response['harena-login']['response']
document.querySelector('#login-message-alert').classList.add('alert-danger')
document.querySelector('#login-message-alert').classList.remove('alert-success')

document.querySelector('#email').classList.add('is-invalid')
document.querySelector('#password').classList.add('is-invalid')

}
}
}
}
)
DCC.component(
'submit-logout',
'dcc-submit',
{
pre: async function (message, form, schema) {
if(MessageBus.progn && MessageBus.progn.hasSubscriber('user/#')){
// console.log('============ if logout')
MessageBus.progn.publish(`user/logout/${sessionStorage.getItem('harena-user-id')}`)
// console.log(await MessageBus.progn.waitMessage('system/logout/ready'))
// console.log('============ true')
return true
}else{
// console.log('============ else logout')
return true
}
},
pos: function (response) {
// console.log(response)
window.location.href = '/index-jacinto.html'
}
}
)

DCC.component(
'submit-change-password',
'dcc-submit',
{
pos: async function (response) {
// console.log(response['harena-change-password'])
const responseContainer = document.querySelector('#updatePasswordResponse')
responseContainer.innerHTML = response['harena-change-password']
if(response['harena-change-password'] === 'Password changed successfully.'){
// console.log('if')
responseContainer.classList.remove('text-danger')
responseContainer.classList.add('text-success')
const promise = new Promise((resolve, reject) => {
setTimeout(() => resolve(window.location.href = '/index-jacinto.html'), 1000)
})
}else {
// console.log('else')
responseContainer.classList.remove('text-success')
responseContainer.classList.add('text-danger')
}
}
}
)

DCC.component(
'submit-case-property',
'dcc-submit',
{
pos: async function (response) {
// console.log('============ pos dcc-submit prop')
let propValue = null
if(response['harena-case-property']['case_property']){
propValue = response['harena-case-property']['case_property']['value']
}else{
propValue = response['harena-case-property']['value']
}
LayoutController.instance.feedbackButtonCaseState(propValue)
}
}
)

DCC.component(
'submit-save-case-and-property',
'dcc-submit',
{
pre: function (message, form, schema) {
const saveCase = document.querySelector(`button[id="btn-save-draft"]`)
saveCase.click()
return true
},
pos: async function (response) {

// console.log(response)
let propValue = null
if(response['harena-case-property']['case_property']){
propValue = response['harena-case-property']['case_property']['value']
}else{
propValue = response['harena-case-property']['value']
}
LayoutController.instance.labDeliverButtonCaseState(propValue)
}
}
)

DCC.component(
'submit-filter',
'dcc-submit',
{
pre: function (message, form, schema) {
// console.log('============ pre submit-filter')
// console.log(message['value'])
// console.log('============ form')
// console.log(form)
var url = new URL(document.location)
for(_info in message['value']){
url.searchParams.set(_info,message['value'][_info])
}
document.location = url
return true

},
pos: function (response) {

}
}
)

DCC.component(
'submit-share',
'dcc-submit',
{
pre: function (message, form, schema) {
$('#notice-modal').modal('show')
var txt = document.querySelector('#modal-notice-txt')
var modalBody = document.querySelector('#modal-notice-body')
txt.innerHTML = 'Sharing cases...'

modalBody.classList.remove('bg-danger')
modalBody.classList.remove('bg-success')
txt.classList.remove('text-white')
modalBody.classList.add('bg-white')
txt.classList.add('text-secondary')

return true
},
pos: async function (response) {

// console.log(response['harena-share-cases'].message)
var txt = document.querySelector('#modal-notice-txt')
var modalBody = document.querySelector('#modal-notice-body')

txt.innerHTML = response['harena-share-cases'].message
if(response['harena-share-cases'].message.includes('Error')){
modalBody.classList.remove('bg-success')
modalBody.classList.remove('bg-white')
txt.classList.remove('text-secondary')
modalBody.classList.add('bg-danger')
txt.classList.add('text-white')
}else if(response['harena-share-cases'].message.includes("Cannot read property 'split'")){
txt.innerHTML = 'Error. Please select at least one case to share.'

modalBody.classList.remove('bg-success')
modalBody.classList.remove('bg-white')
txt.classList.remove('text-secondary')
modalBody.classList.add('bg-danger')
txt.classList.add('text-white')
}else{
modalBody.classList.remove('bg-danger')
modalBody.classList.remove('bg-white')
txt.classList.remove('text-secondary')
modalBody.classList.add('bg-success')
txt.classList.add('text-white')
}

setTimeout(function(){
$('#notice-modal').modal('hide')
}, 7000)

}
}
)

})()
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions src/adonisjs/public/player/case/images/heart/images/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Image Sources

* `heart1.svg` - https://pixabay.com/vectors/human-heart-blood-flow-1700453/
* `heart2.svg` - https://pixabay.com/vectors/anatomical-healthcare-heart-human-2023188/

* `character-2023874.svg` - https://pixabay.com/vectors/character-creature-robot-2023874/
Loading
Loading