Skip to content

Commit

Permalink
Merge pull request #174 from datasci4health/development
Browse files Browse the repository at this point in the history
feat(creation date store and update)
  • Loading branch information
lealfp authored Aug 14, 2020
2 parents 7460986 + 5d0add0 commit e57f6c9
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 55 deletions.
43 changes: 2 additions & 41 deletions src/adonisjs/app/Controllers/Http/CaseController.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,48 +36,9 @@ class CaseController {
//console.log(request.cookie('token'))
const endpoint_url = Env.get("HARENA_MANAGER_URL") + "/api/v1/case"

/*
const template_source =
`
# Presentation (quiz)
Write here the **stem** of your quiz.
> Write here the **lead-in** of your quiz.
+ Distractor 1 <-> "Feedback for Distractor 1"
+ Distractor 1 <-> "Feedback for Distractor 1"
+ Distractor 2 <-> "Feedback for Distractor 2"
+ Distractor 3 <-> "Feedback for Distractor 3"
* Next Case -> Case.Next
* Menu -> Presentation
# Feedback Note (note)
You answered: ^Presentation.hypothesis^.
^parameter^
* Return -> Presentation
___ Flow ___
* Sequential:
* _sequential_
___ Data ___
* theme: simple
* namespaces:
* evidence: http://purl.org/versum/evidence/
* templates:
* categories:
* detailed: simple/knot/description
`
*/

console.log("******************************************** token from Adonis");
console.log(request.cookie('token'));
console.log(params)
let token = request.cookie('token')

// load template
Expand Down Expand Up @@ -112,6 +73,7 @@ class CaseController {
specialty: params.specialty,
keywords: params.keywords,
source: markdown,
original_date: params.creationDate
},
headers: {
'Authorization': 'Bearer ' + token
Expand Down Expand Up @@ -183,7 +145,6 @@ class CaseController {
}

async populate_modal({ params, request, view, response }) {
console.log(request.input('id'))
try{
// const params = request.all()

Expand Down
4 changes: 2 additions & 2 deletions src/adonisjs/resources/views/author/template-case.edge
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@
</select>
</div>
<div class="form-group">
<label for="created">Creation Date</label>
<input type="date" class="form-control" id="created" name="created">
<label for="creationDate">Creation Date</label>
<input type="date" class="form-control" id="creationDate" name="creationDate">
</div>
<div class="form-group">
<label for="institution">Institution</label>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
</div>
<div class="form-group">
<label for="created">Original Date</label>
<input type="date" class="form-control" id="originalDate" name="originalDate" value="{{caseInstitution}}">
<input type="date" class="form-control" id="originalDate" name="originalDate" value="{{caseOriginalDate}}">
{{-- <small id="keywords-help" class="form-text text-muted">Inform the date of case creation on Jacinto Moodle</small> --}}
</div>
<div class="form-group">
Expand Down
22 changes: 11 additions & 11 deletions src/adonisjs/start/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,18 +73,18 @@ Route.get('author', async ({ view, request }) => {

console.log(endpoint_response.data)
//return view.render('author.author')
let asd = endpoint_response.data
let caseId = asd.id;
let caseTitle = asd.title
let caseDescription = asd.description
let caseLanguage = asd.language
let caseInstitution = asd.institution
let caseDomain = asd.domain
let caseSpecialty = asd.specialty
let caseKeywords = asd.keywords

let responseContent = endpoint_response.data
let caseId = responseContent.id;
let caseTitle = responseContent.title
let caseDescription = responseContent.description
let caseLanguage = responseContent.language
let caseInstitution = responseContent.institution
let caseDomain = responseContent.domain
let caseSpecialty = responseContent.specialty
let caseKeywords = responseContent.keywords
let caseOriginalDate = responseContent.original_date
return view.render('author.author',
{caseId, caseTitle, caseDescription, caseLanguage, caseInstitution, caseDomain, caseSpecialty, caseKeywords})
{caseId, caseTitle, caseDescription, caseLanguage, caseInstitution, caseDomain, caseSpecialty, caseKeywords, caseOriginalDate})
})
.catch(function (error) {
console.log(error);
Expand Down

0 comments on commit e57f6c9

Please sign in to comment.