Skip to content

Commit

Permalink
Merge pull request #236 from datasci4health/development
Browse files Browse the repository at this point in the history
Fix to draft buttons
  • Loading branch information
HeitorMatt authored Sep 10, 2020
2 parents c998892 + 448e016 commit 04df9c1
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 5 deletions.
62 changes: 61 additions & 1 deletion src/adonisjs/public/author/js/draft.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ class DraftManager {

this._boxesPanel = document.querySelector('#case-boxes')
// this._draftSelect(authorState.userid, advanced);
this._draftSelect(advanced)
//this._draftSelect(advanced)
this._draftQuestCasesSelect(advanced)
}

async _draftSelect (advanced) {
Expand Down Expand Up @@ -74,6 +75,65 @@ class DraftManager {
}
}

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

const cl = document.getElementsByClassName('buttons-container')
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

}


async deleteCase (topic, message) {
const decision =
await DCCNoticeInput.displayNotice(
Expand Down
4 changes: 2 additions & 2 deletions src/adonisjs/public/templates/simple/case/quiz_sequence.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Write here the **stem** of your question.
Write here the **stem** of your question.

> Write here the **lead-in** of your question.
+ Answer-key <-> "Feedback for Answer-key"
+ Answer-key <-> "Feedback for Answer-key" >((right))
+ Distractor 1 <-> "Feedback for Distractor 1"
+ Distractor 2 <-> "Feedback for Distractor 2"
+ Distractor 3 <-> "Feedback for Distractor 3"
Expand All @@ -32,7 +32,7 @@ Write here the **feedback**.
* [Enter References](References)
}}

* Next Case -> Flow.Next
* Next Case -> Case.Next

# Note (note)

Expand Down
4 changes: 2 additions & 2 deletions src/adonisjs/resources/views/author/drafts-cases.edge
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@layout('author.author-layout')

@section('content')
<body>
<body onload="DraftManager.instance.start()">
<!-- Create a section to place page content -->
<main role="main">
<div class="d-flex flex-column vh-100 vw-100 home-author-padding hidden-overflow">
Expand All @@ -25,7 +25,7 @@
@each(c in cases)
<div id="b{{c.id}}" class="row draft-author-case-container">
<div class="col draft-case-title">{{c.title}}</div>
<div class="d-flex justify-content-end">
<div class="d-flex justify-content-end buttons-container">
<div id="e{{c.id}}" class="col author-panel-button" onclick="window.location.href='/author?id={{c.id}}'">EDIT</div>
<div id="p{{c.id}}" class="col author-panel-button">PREVIEW</div>
<div id="d{{c.id}}" class="col author-panel-button">DELETE</div>
Expand Down

0 comments on commit 04df9c1

Please sign in to comment.