Skip to content

Commit

Permalink
Merge pull request #161 from datasci4health/development
Browse files Browse the repository at this point in the history
New links and routes for cloud
  • Loading branch information
santanche authored Aug 11, 2020
2 parents 7f75082 + 02927a6 commit f7d78ad
Show file tree
Hide file tree
Showing 10 changed files with 52 additions and 52 deletions.
8 changes: 4 additions & 4 deletions src/adonisjs/app/Controllers/Http/AuthController.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class AuthController {
return response.redirect('back')
}

const endpoint_url = Env.get("HARENA_MANAGER_URL") + "/api/v2/auth/login"
const endpoint_url = Env.get("HARENA_MANAGER_URL") + "/api/v2/auth/login"

var config = {
method: 'post',
Expand All @@ -47,20 +47,20 @@ class AuthController {

await axios(config)
.then(async function (endpoint_response) {

let user = endpoint_response.data
console.log("-----------------------------------------------------------------------------------------------------------")
console.log(user.token)
//let token = await auth.generate(user)

//console.log(token.token)
//request.cookie("token", token.token)
console.log('login feito')
//const data = { user : 'hello world' }
response.cookie('token', user.token)
//yield response.sendView('index', data)
//return view.render('index', { user: user.toJSON() })
return response.redirect('/')
return response.redirect('/space')
})
.catch(function (error) {
console.log(error);
Expand Down
4 changes: 2 additions & 2 deletions src/adonisjs/app/Controllers/Http/CaseController.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ class CaseController {
await axios(config)
.then(function (endpoint_response) {
// return response.redirect('/author/author.html')
return response.redirect('/author')
return response.route('author_home')
})
.catch(function (error) {
console.log(error);
Expand All @@ -130,7 +130,7 @@ class CaseController {
catch (e) {
console.log(e)
}
return response.redirect('/author')
return response.route('author_home')
}


Expand Down
2 changes: 1 addition & 1 deletion src/adonisjs/public/author/js/author.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ class AuthorManager {
break;
case "control/leave/drafts": await this.caseSave();
//window.location.href = 'draft.html';
window.location.href = '/drafts';
window.location.href = '/space/drafts';
break;
}
}
Expand Down
24 changes: 12 additions & 12 deletions src/adonisjs/public/author/js/dcc-author-server-proxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ class DCCAuthorServer {

this.themeFamiliesList = this.themeFamiliesList.bind(this);
MessageBus.ext.subscribe("data/theme_family/*/list", this.themeFamiliesList);

this.templatesList = this.templatesList.bind(this);
MessageBus.ext.subscribe("data/template/*/list", this.templatesList);
this.uploadArtifact = this.uploadArtifact.bind(this);
MessageBus.ext.subscribe("data/asset//new", this.uploadArtifact);

/*
this.prepareCaseHTML = this.prepareCaseHTML.bind(this);
MessageBus.ext.subscribe("case/+/prepare", this.prepareCaseHTML);
Expand All @@ -35,7 +35,7 @@ class DCCAuthorServer {
MessageBus.ext.subscribe("case/+/set", this.saveCaseObject);
*/
}

// wrapper of the services

async themeFamiliesList(topic, message) {
Expand All @@ -47,7 +47,7 @@ class DCCAuthorServer {
"Content-Type": "application/json",
}
}
const response = await fetch("../themes/themes.json", header);
const response = await fetch("/themes/themes.json", header);
let jsonResponse = await response.json();
/*
let busResponse = {};
Expand All @@ -62,7 +62,7 @@ class DCCAuthorServer {
busResponse.push({
id: jsonResponse[t].path,
name: t,
icon: "../themes/" + jsonResponse[t].path + "/images/" + jsonResponse[t].icon
icon: "/themes/" + jsonResponse[t].path + "/images/" + jsonResponse[t].icon
});
MessageBus.ext.publish(MessageBus.buildResponseTopic(topic, message),
busResponse);
Expand All @@ -77,7 +77,7 @@ class DCCAuthorServer {
"Content-Type": "application/json",
}
}
const response = await fetch("../templates/templates.json", header);
const response = await fetch("/templates/templates.json", header);
let jsonResponse = await response.json();
let busResponse = [];
for (let t in jsonResponse)
Expand Down Expand Up @@ -202,12 +202,12 @@ class DCCAuthorServer {
"Content-Type": "text/html",
}
}
const response = await fetch("../modules/" + moduleName + ".html", header);
const response = await fetch("/modules/" + moduleName + ".html", header);
let textResponse = await response.text();
MessageBus.ext.publish(MessageBus.buildResponseTopic(topic, message),
textResponse);
}

async loadTemplate(topic, message) {
let templatePath =
MessageBus.extractLevel(topic, 3).replace(/\./g, "/");
Expand All @@ -219,7 +219,7 @@ class DCCAuthorServer {
"Content-Type": "text/plain",
}
}
const response = await fetch("../templates/" + templatePath +
const response = await fetch("/templates/" + templatePath +
".md", header);
let textResponse = await response.text();
MessageBus.ext.publish(MessageBus.buildResponseTopic(topic, message),
Expand Down Expand Up @@ -302,7 +302,7 @@ class DCCAuthorServer {
async saveKnotHTML(topic, message) {
const knotId = MessageBus.extractLevel(topic, 2);
const response = await fetch(DCCCommonServer.managerAddressAPI + "save-knot-html", {
method: "POST",
body: JSON.stringify({"caseName": message.caseId,
Expand All @@ -319,7 +319,7 @@ class DCCAuthorServer {
async saveCaseObject(topic, message) {
if (message.format == "json") {
const caseId = MessageBus.extractLevel(topic, 2);
// <TODO> change the name of the service
const response = await fetch(DCCCommonServer.managerAddressAPI + "save-case-script", {
method: "POST",
Expand All @@ -339,4 +339,4 @@ class DCCAuthorServer {

(function() {
DCCAuthorServer.instance = new DCCAuthorServer();
})();
})();
2 changes: 1 addition & 1 deletion src/adonisjs/public/author/js/draft.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class DraftManager {
previewButton.addEventListener("click",
function(){
Basic.service.authorPropertyStore("caseId", this.id.substring(1));
window.location.href = "../player/index.html?caseid=" +
window.location.href = "/player/index.html?caseid=" +
this.id.substring(1) +
"&preview";
}
Expand Down
6 changes: 3 additions & 3 deletions src/adonisjs/resources/views/index.edge
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<!-- Reference CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<link rel="stylesheet" href="start/css/main.css"/>
<link rel="stylesheet" href="/start/css/main.css"/>
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Lato"/>

<title>Phil Muchbetter Game</title>
Expand All @@ -31,7 +31,7 @@

<div class="d-flex vh-100 vw-100" style="background-color: rgb(245,245,245);">
<div class="w-100 mx-5 home-image-margin" style="">
<img src="../start/img/home-image.png" class="h-100 float-right" id="home-image" />
<img src="/start/img/home-image.png" class="h-100 float-right" id="home-image" />
<div class="d-flex h-100 align-items-center">
<div class="flex-column">
<h1 class="home-header-text"> Phil Muchbetter: a clinical reasoning game</h1>
Expand All @@ -42,7 +42,7 @@
</div>
</div>

<script src="start/js/Js_Anim.js"> </script>
<script src="/start/js/Js_Anim.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="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
Expand Down
4 changes: 2 additions & 2 deletions src/adonisjs/resources/views/layout/partials/breadcrumbs.edge
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<div class="container-fluid" >
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="{{ breadHome }}">Home</a></li>
<li class="breadcrumb-item active" aria-current="{{ breadDrafts }}">Drafts</li>
<li class="breadcrumb-item"><a href="{{ route('author_home') }}">Home</a></li>
<li class="breadcrumb-item active" aria-current="{{ route('cases_drafts') }}">Drafts</li>
</ol>
</nav>
</div>
8 changes: 4 additions & 4 deletions src/adonisjs/resources/views/layout/partials/header.edge
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
Hello {{ auth.user.username }}
{{ token }} -->
<span class="inline-flex mr-4 rounded-md shadow mr-auto">
<a href="/" class="inline-flex items-center px-3 py-2 text-base font-medium leading-6 text-indigo-600 transition duration-150 ease-in-out bg-white border border-transparent rounded-md hover:text-indigo-500 focus:outline-none focus:shadow-outline-blue active:bg-gray-50 active:text-indigo-700">
<a href="{{route('author_home')}}" class="inline-flex items-center px-3 py-2 text-base font-medium leading-6 text-indigo-600 transition duration-150 ease-in-out bg-white border border-transparent rounded-md hover:text-indigo-500 focus:outline-none focus:shadow-outline-blue active:bg-gray-50 active:text-indigo-700">
Home
</a>
</span>
Expand All @@ -31,16 +31,16 @@ Hello {{ auth.user.username }}
</span>
@else
<span class="inline-flex mr-4 rounded-md shadow">
<a href="/login" class="inline-flex items-center px-4 py-2 text-base font-medium leading-6 text-indigo-600 transition duration-150 ease-in-out bg-white border border-transparent rounded-md hover:text-indigo-500 focus:outline-none focus:shadow-outline-blue active:bg-gray-50 active:text-indigo-700">
<a href={{route('login')}} class="inline-flex items-center px-4 py-2 text-base font-medium leading-6 text-indigo-600 transition duration-150 ease-in-out bg-white border border-transparent rounded-md hover:text-indigo-500 focus:outline-none focus:shadow-outline-blue active:bg-gray-50 active:text-indigo-700">
Log in
</a>
</span>
<span class="inline-flex rounded-md shadow">
<a href="/signup" class="inline-flex items-center px-4 py-2 text-base font-medium leading-6 text-indigo-600 transition duration-150 ease-in-out bg-white border border-transparent rounded-md hover:text-indigo-500 focus:outline-none focus:shadow-outline-blue active:bg-gray-50 active:text-indigo-700">
<a href={{route('signup')}} class="inline-flex items-center px-4 py-2 text-base font-medium leading-6 text-indigo-600 transition duration-150 ease-in-out bg-white border border-transparent rounded-md hover:text-indigo-500 focus:outline-none focus:shadow-outline-blue active:bg-gray-50 active:text-indigo-700">
Sign Up
</a>
</span>
@endloggedIn
</div>
</nav>
</div>
</div>
26 changes: 13 additions & 13 deletions src/adonisjs/resources/views/registration/template.edge
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,25 @@

<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no, shrink-to-fit=no" name="viewport">

<link rel="stylesheet" href="../lib/fontawesome-5-10-1/css/all.min.css">
<link rel="stylesheet" href="/lib/fontawesome-5-10-1/css/all.min.css">
{{-- {{ sytle('https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css') }} --}}
<link rel="stylesheet" href="../lib/bootstrap-4-3-1/css/bootstrap.min.css">
<link rel="stylesheet" href="/lib/bootstrap-4-3-1/css/bootstrap.min.css">

<link rel="stylesheet" href="../infra/css/common-player.css">
<link rel="stylesheet" href="../infra/css/common-author.css">
<link rel="stylesheet" href="/infra/css/common-player.css">
<link rel="stylesheet" href="/infra/css/common-author.css">
{{-- {{ style('author') }} --}}

<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/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="js/dcc-author-server-proxy.js"></script>

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

<script src="js/template-case.js"></script>
<script src="/js/template-case.js"></script>
</head>

<body onload="TemplateToCase.s.start()">
Expand Down Expand Up @@ -52,4 +52,4 @@
<!-- end of div /.container -->

</body>
</html>
</html>
20 changes: 10 additions & 10 deletions src/adonisjs/start/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const axios = use("axios")

Route.get( 'populate_modal', 'CaseController.populate_modal')

Route.get('/', ({ view }) => view.render('index') )
Route.get('space', ({ view }) => view.render('index') )

Route.get('institution-registration', async ({ view }) => {
const pageTitle = "Institution Registration"
Expand All @@ -32,18 +32,18 @@ Route.get('institution-registration', async ({ view }) => {
// when you are not logged in
Route.group(() => {

Route.get( 'signup', 'UserController.create')
Route.get( 'login', 'AuthController.create')
Route.get( 'space/signup', 'UserController.create').as('signup')
Route.get( 'space/login', 'AuthController.create').as('login')

Route.post( 'signup', 'UserController.signup')
Route.post( 'login', 'AuthController.login')
Route.post( 'space/signup', 'UserController.signup').as('signup')
Route.post( 'space/login', 'AuthController.login').as('login')

}).middleware(['guest'])




Route.get('author', async ({ view, request }) => {
Route.get('space/author', async ({ view, request }) => {
// View.global('name_you_like', function () {

// return "ase"
Expand Down Expand Up @@ -91,11 +91,11 @@ Route.get('author', async ({ view, request }) => {
return view.render('author.author')
}).as('author_edit')

Route.get('home', ({ view }) => {
Route.get('space/home', ({ view }) => {
return view.render('author.home')
}).as('author_home')

Route.get('create', ({ view }) => {
Route.get('space/create', ({ view }) => {
return view.render('author.create')
}).as('author_create')

Expand All @@ -108,10 +108,10 @@ Route.group(() => {

Route.post('store', 'CaseController.store');
Route.post('update', 'CaseController.update');
}).prefix('author/choose-template').as('author_template_case')
}).prefix('space/choose-template').as('author_template_case')


Route.get("drafts", ({ view }) => {
Route.get("space/drafts", ({ view }) => {
return view.render('author.drafts')
}).as('cases_drafts')

Expand Down

0 comments on commit f7d78ad

Please sign in to comment.