Skip to content

Commit

Permalink
Merge pull request #330 from harena-lab/development
Browse files Browse the repository at this point in the history
feat (museum platform): first draft
  • Loading branch information
santanche authored Feb 1, 2022
2 parents 4211dd6 + 65b1391 commit 7dee17e
Show file tree
Hide file tree
Showing 7 changed files with 656 additions and 11 deletions.
116 changes: 116 additions & 0 deletions src/adonisjs/public/index-mc.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
<!doctype html>
<html lang="en">
<head>
<!-- meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta http-equiv="X-UA-Compatible" content="IE=edge">

<link rel="stylesheet" href="/author/css/author.css">

<script src="/lib/axios-0.21.0/axios.min.js"></script>
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>

<script src="/lib/jquery-3-4-1/jquery-3.4.1.slim.min.js"></script>
<script src="/lib/popper-1-15-0/popper.min.js"></script>
<script src="/lib/bootstrap-4.4.1/js/bootstrap.bundle.min.js"></script>

<script src="/config/config.js"></script>
<script src="/infra/bus.js"></script>
<script src="/infra/basic.js"></script>
<script src="/infra/dcc-common-server-proxy.js"></script>
<script src="/infra/dcc-common-server-address.js"></script>
<script src="/infra/simple-page-tasks.js"></script>
<script src="/infra/token-validator.js"></script>
<script src="/infra/conditional-layout.js"></script>

<script src="/dccs/base/primitive-dcc.js"></script>
<script src="/dccs/base/scope-dcc.js"></script>
<script src="/dccs/base/dcc.js"></script>
<script src="/dccs/base/dcc-base.js "></script>
<script src="/dccs/base/dcc-visual.js "></script>
<script src="/dccs/base/dcc-block.js"></script>
<script src="/dccs/components/visual/dcc-button.js"></script>
<script src="/dccs/components/visual/dcc-notice-input.js"></script>

<script src="/dccs/components/web/dcc-rest.js"></script>
<script src="/dccs/components/web/dcc-include.js"></script>
<script src="/dccs/components/web/dcc-dhtml.js"></script>

<script src="/dccs/components/data/dcc-submit.js"></script>
<script src="/dccs/components/data/dcc-model.js"></script>
<script src="/dccs/components/data/dcc-record.js"></script>

<script src="/dccs/base/subscribe-dcc.js"></script>
<script src="/dccs/base/trigger-dcc.js"></script>
<script src="/dccs/base/property-dcc.js"></script>
<script src="/dccs/base/connect-dcc.js"></script>

<script src="/infra/dcc-rest-proxy.js"></script>
<script src="/infra/dcc-basic.js"></script>

<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">
<link rel="shortcut icon" href="/icons/favicon.ico">
<link rel="manifest" href="/site.webmanifest">

<link rel="stylesheet" href="/lib/fontawesome-5-10-1/css/all.min.css">
<link rel="stylesheet" href="/lib/bootstrap-4.4.1/css/bootstrap.min.css">

<link rel="stylesheet" href="/dccs/css/dccs.css">
<link rel="stylesheet" href="/dccs/css/properties.css">
<link rel="stylesheet" href="/infra/css/common-player.css">
<link rel="stylesheet" href="/infra/css/common-author.css">

<script src="author/js/dcc-author-server-proxy.js"></script>

<script src="/author/js/create.js"></script>
<script src="/author/js/template-case.js"></script>
<script src="/author/js/draft.js"></script>
<!-- Reference CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
<link rel="stylesheet" href="/start/css/main.css"/>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Lato"/>

<!-- Favicon -->
<link rel="shortcut icon" href="#">

<title>Phil Muchbetter Game</title>

</head>

<body onload="TokenController.instance.checkToken()">
<!-- Login/logout header -->
<dcc-include src="/author/partials/header.html"></dcc-include>
<main>
<div class="d-flex vh-100 vw-100" style="background-color: rgb(245,245,245);">
<div class="d-flex w-100 mx-5 home-image-margin" style="">

<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"> Plataforma Museu</h1>
<p class="home-p-text">Junte-se a nós nesta aventura!</p>
<div class="container-fluid">
<div class="row home-play-container">
<button id="player-btn" class="btn col-4 ml-4 lets-play rounded-pill" onclick="location.href='/user/signup/tale-check.html'">Player</button>
</div>

</div>
</div>
</div>
<div class="d-flex ml-auto w-50 flex-column align-items-center justify-content-center"
style="background: url('start/img/background_museu.png');">
<div>
<img src="start/img/home_museu.png" alt="" class="h-100 float-right" id="home-image"/>
</div>
</div>
</div>
</div>
</main>
<div id="version-footnote" class="fixed-bottom" style="text-align:center">
</div>

</body>

</html>
Original file line number Diff line number Diff line change
Expand Up @@ -99,17 +99,6 @@
<script src="/dccs/components/visual/dcc-slider.js"></script>
<script src="/dccs/components/visual/dcc-report.js"></script>

<!-- bundle cellular -->
<script src="/dccs/components/cell/dcc-space-cellular.js"></script>
<script src="/dccs/components/cell/dcc-cell.js"></script>
<script src="/dccs/components/cell/dcc-cell-color.js"></script>
<script src="/dccs/components/cell/dcc-cell-image.js"></script>
<script src="/dccs/components/cell/dcc-cell-ruler.js"></script>
<script src="/dccs/components/cell/rule-dcc-cell.js"></script>
<script src="/dccs/components/cell/rule-dcc-cell-transition.js"></script>
<script src="/dccs/components/cell/rule-dcc-cell-neighbor.js"></script>
<script src="/dccs/components/cell/rule-dcc-cell-expression.js"></script>

<script src="/lib/showdown/showdown.min.js"></script>

<script src="/translator/translator.js"></script>
Expand Down
11 changes: 11 additions & 0 deletions src/adonisjs/public/player/case/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,17 @@
<script src="/dccs/components/visual/dcc-slider.js"></script>
<script src="/dccs/components/visual/dcc-report.js"></script>

<!-- bundle cellular -->
<script src="/dccs/components/cell/dcc-space-cellular.js"></script>
<script src="/dccs/components/cell/dcc-cell.js"></script>
<script src="/dccs/components/cell/dcc-cell-color.js"></script>
<script src="/dccs/components/cell/dcc-cell-image.js"></script>
<script src="/dccs/components/cell/dcc-cell-ruler.js"></script>
<script src="/dccs/components/cell/rule-dcc-cell.js"></script>
<script src="/dccs/components/cell/rule-dcc-cell-transition.js"></script>
<script src="/dccs/components/cell/rule-dcc-cell-neighbor.js"></script>
<script src="/dccs/components/cell/rule-dcc-cell-expression.js"></script>

<script src="/lib/showdown/showdown.min.js"></script>

<script src="/translator/translator.js"></script>
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/adonisjs/public/start/img/home_museu.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
135 changes: 135 additions & 0 deletions src/adonisjs/public/user/js/tale-check.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
class UserTale {
async start () {
this._userId = new URL(document.location).searchParams.get('user')
const userTerm = await this._retrieveTerm()
if (!userTerm.message.error)
await this._requestAgree(userTerm.message[0])
}

async check() {
this._userId = null
const userTerm = await this._retrieveTerm()
if (!userTerm.message.error) {
if (userTerm.message.length > 1 || userTerm.message[0].agree == '0')
document.querySelector('#proceed').style.display = 'initial'
else {
document.querySelector('#title-form').style.display = 'initial'
document.querySelector('#complete-form').style.display = 'initial'
await this._requestAgree(userTerm.message[0])
}
}
}

async _retrieveTerm() {
this._termId = 'museu_harena_2021'
const userTermJson = {
userId: this._userId,
termId: this._termId
}
let userTerm = await MessageBus.i.request('user/term/get', userTermJson)
console.log(userTerm.message)
if (userTerm.message.error) {
console.log('--- error')
console.log(userTerm.message)
this._showFeedback('Houve algum erro na recuperação do seu cadastro.')
} else if (this._userId == null)
this._userId = userTerm.message[0].user_id
return userTerm
}

async _requestAgree (userTerm) {
this._userTerm = userTerm
document.querySelector('#username_1').innerHTML = this._userTerm.name_participant
document.querySelector('#username_2').innerHTML = this._userTerm.name_participant
document.querySelector('#respname_1').innerHTML = this._userTerm.name_responsible

this._expandTermA = this._expandTermA.bind(this)
MessageBus.i.subscribe('/user/term/expand/a', this._expandTermA)
this._expandTermB = this._expandTermB.bind(this)
MessageBus.i.subscribe('/user/term/expand/b', this._expandTermB)
this._retractTerm = this._retractTerm.bind(this)
MessageBus.i.subscribe('/user/term/retract', this._retractTerm)
this._agreement = this._agreement.bind(this)
MessageBus.i.subscribe('/user/agreement', this._agreement)
this.update = this.update.bind(this)

const now = new Date()
const sdate = now.getDate() + '/' + (now.getMonth()+1) + '/' + now.getFullYear()
document.querySelector('#date_agree_1').value = sdate
document.querySelector('#date_agree_2').innerHTML = sdate
}

update () {
document.querySelector('#answer_agree').innerHTML =
(document.querySelector('#agree_radio').checked)
? 'Concordo em participar da pesquisa'
: (document.querySelector('#not_agree_radio').checked)
? 'Não desejo participar da pesquisa'
: ''
}

_expandTermA () {
document.querySelector('#term-part-a').style.display = 'initial'
document.querySelector('#term-part-both').style.display = 'initial'
document.querySelector('#button-expand-a').style.display = 'none'
document.querySelector('#button-expand-b').style.display = 'none'
}

_expandTermB () {
document.querySelector('#term-part-b').style.display = 'initial'
document.querySelector('#term-part-both').style.display = 'initial'
document.querySelector('#button-expand-a').style.display = 'none'
document.querySelector('#button-expand-b').style.display = 'none'
}

_retractTerm () {
document.querySelector('#term-part-a').style.display = 'none'
document.querySelector('#term-part-b').style.display = 'none'
document.querySelector('#term-part-both').style.display = 'none'
document.querySelector('#button-expand-a').style.display = 'initial'
document.querySelector('#button-expand-b').style.display = 'initial'
}

_showFeedback (message, color) {
const feed1 = document.querySelector('#feedback-message-1')
const feed2 = document.querySelector('#feedback-message-2')
if (color != null) {
feed1.style.color = 'blue'
feed2.style.color = 'blue'
}
feed1.innerHTML = message
feed2.innerHTML = message
}

async _agreement (topic, message) {
const parameters = (message && message.value) ? message.value : null
console.log('===== user parameters')
console.log(parameters)

const agree = (parameters.agree && parameters.agree.length > 0 && parameters.agree == 'agree')
const termJson = {
userId: this._userId,
termId: this._termId,
nameResponsible: this._userTerm.name_responsible,
emailResponsible: this._userTerm.email_responsible,
nameParticipant: this._userTerm.name_participant,
date: parameters.date_agree_1,
role: parameters.role,
agree: (agree) ? '1' : '0'
}
console.log('=== term json')
console.log(termJson)
let term = await MessageBus.i.request('user/term/post', termJson)
console.log('=== term add')
console.log(term)
document.querySelector('#complete-form').style.display = 'none'
if (agree)
this._showFeedback('Termo aceito com sucesso.', 'blue')
else
this._showFeedback('O termo não foi aceito pelo participante.', 'blue')
}
}

(function () {
UserTale.i = new UserTale()
})()
Loading

0 comments on commit 7dee17e

Please sign in to comment.