Skip to content

Commit

Permalink
Merge pull request #239 from datasci4health/development
Browse files Browse the repository at this point in the history
Temporary fix: CSRF Off
  • Loading branch information
HeitorMatt authored Sep 11, 2020
2 parents 04df9c1 + 0bda8df commit 86e2cf0
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 54 deletions.
2 changes: 1 addition & 1 deletion src/adonisjs/config/shield.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ module.exports = {
|
*/
csrf: {
enable: true,
enable: false,
methods: ['POST', 'PUT', 'DELETE'],
filterUris: [],
cookieOptions: {
Expand Down
91 changes: 39 additions & 52 deletions src/adonisjs/public/author/js/draft.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@ class DraftManager {

this._boxesPanel = document.querySelector('#case-boxes')
// this._draftSelect(authorState.userid, advanced);
//this._draftSelect(advanced)
this._draftQuestCasesSelect(advanced)
document.getElementsByClassName('buttons-container').length > 0 ?
this._draftQuestCasesSelect(advanced) : this._draftSelect(advanced)
}

async _draftSelect (advanced) {
console.log('Drafting total cases')
const cases = await MessageBus.ext.request('data/case/*/list')
// {user: userid});

Expand Down Expand Up @@ -76,63 +77,49 @@ class DraftManager {
}

async _draftQuestCasesSelect (advanced) {
console.log('Drafting cases by quest')
// const cases = await MessageBus.ext.request('data/case/*/list')
// {user: userid});

const cl = document.getElementsByClassName('buttons-container')
// for (var i in cl){
// let test = cl[i].children
// for(var e in )
// }
for (const c in cl) {
//console.log(cl[c]);
const editButton = cl[c].children[0]
//console.log(editButton.id.substring(2))
const previewButton = cl[c].children[1]
const deleteButton = cl[c].children[2]

editButton.addEventListener('click',
function () {
Basic.service.authorPropertyStore('caseId', editButton.id.substring(1))
// window.location.href = "http://0.0.0.0:10010/author/author.html";
window.location.href =
'/author?id=' + editButton.id.substring(1)
}
)
previewButton.addEventListener('click',
function () {
Basic.service.authorPropertyStore('caseId', editButton.id.substring(1))
window.location.href = '/player/case?id=' +
previewButton.id.substring(1) +
'&preview'
}
)
deleteButton.addEventListener('click',
function () {
MessageBus.int.publish('control/case/delete', editButton.id.substring(1))
}
)
if (advanced) {
downloadButton.addEventListener('click',
function () {
MessageBus.int.publish('control/case/download', this.id.substring(1))
}
)
}
}
// const template = document.createElement('template')
// const html = DraftManager.caseBox
// .replace('[download]', (advanced) ? DraftManager.caseDownload : '')
// template.innerHTML = html
// .replace(/\[id\]/ig, cl[c].id)
// // .replace("[icon]", cl[c].icon)
// .replace('[title]', cl[c].title)
// // .replace("[description]", cl[c].description);
// this._boxesPanel.appendChild(template.content.cloneNode(true))
// const editButton = this._boxesPanel.querySelector('#e' + cl[c].id)
// const previewButton = this._boxesPanel.querySelector('#p' + cl[c].id)
// const deleteButton = this._boxesPanel.querySelector('#d' + cl[c].id)
// const downloadButton = (advanced)
// ? this._boxesPanel.querySelector('#w' + cl[c].id) : null
if (cl[c].children) {
const editButton = cl[c].children[0]
// console.log(editButton.id.substring(2))
const previewButton = cl[c].children[1]
const deleteButton = cl[c].children[2]

editButton.addEventListener('click',
function () {
Basic.service.authorPropertyStore('caseId', editButton.id.substring(1))
// window.location.href = "http://0.0.0.0:10010/author/author.html";
window.location.href =
'/author?id=' + editButton.id.substring(1)
})
previewButton.addEventListener('click',
function () {
Basic.service.authorPropertyStore('caseId', editButton.id.substring(1))
window.location.href = '/player/case?id=' +
previewButton.id.substring(1) +
'&preview'
})
deleteButton.addEventListener('click',
function () {
MessageBus.int.publish('control/case/delete', editButton.id.substring(1))
})
if (advanced) {
downloadButton.addEventListener('click',
function () {
MessageBus.int.publish('control/case/download', this.id.substring(1))
})
}
}
}

}

async deleteCase (topic, message) {
const decision =
Expand Down
1 change: 1 addition & 0 deletions src/adonisjs/resources/views/author/author.edge
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<link rel="stylesheet" href="{{ assetsUrl('dccs/css/dccs.css') }}">
<link rel="stylesheet" href="{{ assetsUrl('author/css/author.css') }}">
<link rel="stylesheet" href="{{ assetsUrl('dccs/css/properties.css') }}">
<link rel="stylesheet" href="{{ assetsUrl('lib/quill-1-3-7/quill.snow.css') }}">

@include('layout.template-min')

Expand Down
2 changes: 1 addition & 1 deletion src/adonisjs/resources/views/index.edge
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

<div class="d-flex ml-auto flex-column align-items-center justify-content-center align-items-center">
<div class="d-flex flex-column">
<h1 class="home-header-text"> Phil Muchbetter: a clinical reasoning game</h1>
<h1 class="home-header-text"> Jacinto Bemelhor: a clinical reasoning game</h1>
<p class="home-p-text">Join us in this adventure of becoming a doctor</p>
<div class="container-fluid">
<div class="row">
Expand Down

0 comments on commit 86e2cf0

Please sign in to comment.