Skip to content

Commit

Permalink
Merge pull request #62 from nzzdev/release-1.6.0
Browse files Browse the repository at this point in the history
Release 1.6.0
  • Loading branch information
benib authored Apr 19, 2018
2 parents 2ea872d + 3899467 commit 7b8f8df
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ script:
- npm run build
- npm run test
- docker build -t $DOCKER_IMAGE_NAME:$DOCKER_TAG .
- docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD"; docker tag $DOCKER_IMAGE_NAME:$DOCKER_TAG
- echo $DOCKER_PASSWORD | docker login -u="$DOCKER_USERNAME" --password-stdin; docker tag $DOCKER_IMAGE_NAME:$DOCKER_TAG
nzzonline/$DOCKER_IMAGE_NAME:$DOCKER_TAG; docker push nzzonline/$DOCKER_IMAGE_NAME:$DOCKER_TAG;
- if [ "$TRAVIS_BRANCH" == "staging" ]; then docker run --rm -it -e RANCHER_URL -e CATTLE_ACCESS_KEY
-e CATTLE_SECRET_KEY etlweather/gaucho upgrade $RANCHER_SERVICE_ID_STAGING --auto_complete
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Q Quiz

**Maintainer**: [manuelroth](https://github.com/manuelroth)

Q quiz is one tool of the Q toolbox to render quizzes containing questions of type multiple choice, number guess and map point guess. It also includes the rendering of answer statistics for each question type.

## Implementation details
Expand Down
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nzz/q-quiz",
"version": "1.5.5",
"version": "1.6.0",
"description": "Q quiz",
"keywords": [
"storytelling",
Expand Down
14 changes: 13 additions & 1 deletion routes/rendering-info/html-js.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,24 @@ module.exports = {
item,
request.payload.toolRuntimeConfig
);

if (!process.env.ENRICO_PRODUCTS) {
process.env.ENRICO_PRODUCTS = `[]`;
}

const clientEnv = {
ENRICO_API_URL: process.env.ENRICO_API_URL,
ENRICO_PRODUCTS: JSON.parse(process.env.ENRICO_PRODUCTS)
};

const loaderScript = `
System.import('q-quiz/quiz.js')
.then(function(module) {
return module.display(${JSON.stringify(
scriptData
)}, document.querySelector('#${quizContainerId}'))
)}, document.querySelector('#${quizContainerId}'), ${JSON.stringify(
clientEnv
)})
})
.catch(function(error) {
console.log(error)
Expand Down
4 changes: 4 additions & 0 deletions script_src/env.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export default {
ENRICO_API_URL: "",
ENRICO_PRODUCTS: []
};
7 changes: 4 additions & 3 deletions script_src/helpers.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import env from "./env.js";

export function loadAdditionalArticles(articleIds) {
let loadPromises = [];
const apiUrl = "https://enrico.nzz-tech.ch/v1/article";

const enricoProducts = ["nzz", "nzzas"];
const apiUrl = env.ENRICO_API_URL;
const enricoProducts = env.ENRICO_PRODUCTS;

articleIds.forEach(articleId => {
if (!articleId || articleId.length === 0) {
Expand Down
6 changes: 5 additions & 1 deletion script_src/quiz.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
import MultiQuizPositionHandler from "./MultiQuizPositionHandler.js";
import QuestionHandler from "./QuestionHandler.js";
import * as helpers from "./helpers.js";
import env from "./env.js";

export function display(data, quizRootElement, clientEnv) {
env.ENRICO_API_URL = clientEnv.ENRICO_API_URL;
env.ENRICO_PRODUCTS = clientEnv.ENRICO_PRODUCTS;

export function display(data, quizRootElement) {
let questionHandler = new QuestionHandler(quizRootElement, data);
let position = 0;

Expand Down

0 comments on commit 7b8f8df

Please sign in to comment.