Skip to content

Commit

Permalink
Merge pull request #226 from datasci4health/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
HeitorMatt authored Sep 6, 2020
2 parents bcf187a + 77d5e3b commit 71c13f6
Show file tree
Hide file tree
Showing 25 changed files with 111 additions and 12 deletions.
4 changes: 3 additions & 1 deletion src/adonisjs/public/author/js/author.js
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,9 @@ class AuthorManager {

this._knots = this._compiledCase.knots

Basic.service.currentThemeFamily = this._compiledCase.theme
// Basic.service.currentThemeFamily = this._compiledCase.theme
console.log('=== setting theme family')
Basic.service.composedThemeFamily(this._compiledCase.theme)
if (this._compiledCase.title) { this._currentCaseTitle = this._compiledCase.title }

console.log('***** COMPILED CASE *****')
Expand Down
5 changes: 4 additions & 1 deletion src/adonisjs/public/dccs/components/dcc-block.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,10 @@ class DCCBlock extends DCCMultiVisual {
} else if (this.xstyle == 'theme') {
html = "<style>@import '" +
Basic.service.themeStyleResolver(this.elementTag() + '.css') +
"' </style>" + html
"' </style>\n" +
"<style>@import '" +
Basic.service.themeCustomStyleResolver(this.elementTag() + '.css') +
"' </style>" + html
}

const template = document.createElement('template')
Expand Down
35 changes: 34 additions & 1 deletion src/adonisjs/public/infra/basic.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class Basic {
// initial values of shared states
this._currentThemeFamily = Basic.standardThemeFamily
this._currentThemeCSS = null
this._currentCustomCSS = null
this.currentCaseId = null

/*
Expand Down Expand Up @@ -48,13 +49,40 @@ class Basic {
}

set currentThemeFamily (newValue) {
// Translator.instance.currentThemeFamily = newValue;
this._currentThemeFamily = newValue

this._currentThemeCSS =
this.replaceStyle(document, this._currentThemeCSS, newValue)
}

get currentCustomTheme () {
return this._currentCustomTheme
}

set currentCustomTheme (newValue) {
this._currentCustomTheme = newValue

this._currentCustomCSS =
this.replaceStyle(document, this._currentCustomCSS, this.currentThemeFamily,
newValue + '/theme.css')
}

composedThemeFamily (themeFamily) {
const dtf = this.decomposeThemeFamily(themeFamily);
this.currentThemeFamily = dtf.family
this.currentCustomTheme = dtf.custom
}

decomposeThemeFamily (themeFamily) {
let family = themeFamily;
let custom = "default";
if (family.includes("(")) {
custom = family.substring(family.indexOf('(') + 1, family.length - 1)
family = family.substring(0, family.indexOf('('))
}
return {family: family, custom: custom}
}

/*
requestCurrentThemeFamily(topic, message) {
MessageBus.ext.publish(MessageBus.buildResponseTopic(topic, message),
Expand Down Expand Up @@ -244,6 +272,11 @@ class Basic {
'/css/' + cssFile
}

themeCustomStyleResolver (cssFile) {
return this._rootPath + 'themes/' + this.currentThemeFamily +
'/css/' + this.currentCustomTheme + "/" + cssFile
}

systemStyleResolver (cssFile) {
return this._rootPath + 'themes/' + Basic.systemThemeFamily +
'/css/' + cssFile
Expand Down
1 change: 1 addition & 0 deletions src/adonisjs/public/infra/css/common-author.css
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ nav.navbar {
font-size: 18px;
font-weight: bold;
color: #808080;
line-height: 1.2;
margin-right: 3%;
margin-left: 3%;
}
Expand Down
3 changes: 2 additions & 1 deletion src/adonisjs/public/player/js/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,8 @@ class PlayerManager {
console.log('***** COMPILED CASE *****')
console.log(this._compiledCase)
this._knots = this._compiledCase.knots
Basic.service.currentThemeFamily = this._compiledCase.theme
// Basic.service.currentThemeFamily = this._compiledCase.theme
Basic.service.composedThemeFamily(this._compiledCase.theme)
}

_caseFlow () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ ___ Flow ___

___ Data ___

* theme: simple
* theme: simple(yellow)
* namespaces:
* evidence: http://purl.org/versum/evidence/
* templates:
Expand Down
2 changes: 1 addition & 1 deletion src/adonisjs/public/templates/simple/case/quiz_sequence.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ ___ Flow ___

___ Data ___

* theme: simple
* theme: simple(purple)
* namespaces:
* evidence: http://purl.org/versum/evidence/
* templates:
Expand Down
2 changes: 1 addition & 1 deletion src/adonisjs/public/templates/simple/case/quiz_short.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ ___ Flow ___

___ Data ___

* theme: simple
* theme: simple(red)
* namespaces:
* evidence: http://purl.org/versum/evidence/
* templates:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ ___ Flow ___

___ Data ___

* theme: simple
* theme: simple(green)
* namespaces:
* evidence: http://purl.org/versum/evidence/
* templates:
Expand Down
2 changes: 1 addition & 1 deletion src/adonisjs/public/templates/simple/case/virtual_visit.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ ___ Flow ___

___ Data ___

* theme: simple
* theme: simple(blue)
* namespaces:
* evidence: http://purl.org/versum/evidence/
* templates:
Expand Down
5 changes: 5 additions & 0 deletions src/adonisjs/public/themes/simple/css/blue/dcc-trigger.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@charset "UTF-8";

.dcc-trigger-theme {
background-color: #234a98;
}
5 changes: 5 additions & 0 deletions src/adonisjs/public/themes/simple/css/blue/theme.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@charset "UTF-8";

.styt-button, .styt-button-option {
background-color: #234a98;
}
1 change: 0 additions & 1 deletion src/adonisjs/public/themes/simple/css/dcc-trigger.css
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
margin-right: auto;
text-align: center;

background-color: #ba2027;
color: white;
/* padding: 12px 0px 0px 0px; */
border-radius: 10px;
Expand Down
5 changes: 5 additions & 0 deletions src/adonisjs/public/themes/simple/css/default/dcc-trigger.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@charset "UTF-8";

.dcc-trigger-theme {
background-color: gray;
}
5 changes: 5 additions & 0 deletions src/adonisjs/public/themes/simple/css/default/theme.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@charset "UTF-8";

.styt-button, .styt-button-option {
background-color: gray;
}
5 changes: 5 additions & 0 deletions src/adonisjs/public/themes/simple/css/green/dcc-trigger.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@charset "UTF-8";

.dcc-trigger-theme {
background-color: #00903a;
}
5 changes: 5 additions & 0 deletions src/adonisjs/public/themes/simple/css/green/theme.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@charset "UTF-8";

.styt-button, .styt-button-option {
background-color: #00903a;
}
5 changes: 5 additions & 0 deletions src/adonisjs/public/themes/simple/css/purple/dcc-trigger.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@charset "UTF-8";

.dcc-trigger-theme {
background-color: #650061;
}
5 changes: 5 additions & 0 deletions src/adonisjs/public/themes/simple/css/purple/theme.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@charset "UTF-8";

.styt-button, .styt-button-option {
background-color: #650061;
}
5 changes: 5 additions & 0 deletions src/adonisjs/public/themes/simple/css/red/dcc-trigger.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@charset "UTF-8";

.dcc-trigger-theme {
background-color: #ba2027;
}
5 changes: 5 additions & 0 deletions src/adonisjs/public/themes/simple/css/red/theme.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@charset "UTF-8";

.styt-button, .styt-button-option {
background-color: #ba2027;
}
1 change: 0 additions & 1 deletion src/adonisjs/public/themes/simple/css/theme.css
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@
margin-right: auto;
text-align: center;

background-color: #ba2027;
color: white;
/* padding: 12px 0px 0px 0px; */
border-radius: 10px;
Expand Down
5 changes: 5 additions & 0 deletions src/adonisjs/public/themes/simple/css/yellow/dcc-trigger.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@charset "UTF-8";

.dcc-trigger-theme {
background-color: #839b27;
}
5 changes: 5 additions & 0 deletions src/adonisjs/public/themes/simple/css/yellow/theme.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@charset "UTF-8";

.styt-button, .styt-button-option {
background-color: #839b27;
}
3 changes: 2 additions & 1 deletion src/adonisjs/public/translator/translator.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ class Translator {
if (this._themeSettings) { delete this._themeSettings }
if (compiledCase.theme) {
const themeSt = await MessageBus.int.request(
'data/theme_family/' + compiledCase.theme + '/settings')
'data/theme_family/' + Basic.service.decomposeThemeFamily(compiledCase.theme).family +
'/settings')
if (themeSt != null) { this._themeSettings = themeSt.message }
}

Expand Down

0 comments on commit 71c13f6

Please sign in to comment.