Skip to content

Commit

Permalink
Added Tutorial HTML steps
Browse files Browse the repository at this point in the history
  • Loading branch information
allyoucanmap committed Mar 13, 2017
1 parent 2bd795e commit 8bf7e2d
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
10 changes: 9 additions & 1 deletion web/client/plugins/Tutorial.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ const {Glyphicon} = require('react-bootstrap');
SELECTORS
every selector must be unique, start with # and different from '#error-tutorial'.
TRANSLATION
TRANSLATION - TRANSLATION HTML
to add the title and text of the step with property translation
insert a new object in the translation file at the tutorial section
with title and text properties
Expand All @@ -122,6 +122,10 @@ const {Glyphicon} = require('react-bootstrap');
{
translation: 'mySecondStepTranslation',
selector: '#second-selector'
},
{
translationHTML: 'myHTMLStepTranslation',
selector: '#html-translation-selector'
}
]
Expand All @@ -141,6 +145,10 @@ const {Glyphicon} = require('react-bootstrap');
"title": "My second step title",
"text": "My second step description"
},
"myHTMLStepTranslation": {
"title": "<div style="color:blue;">My html step title</div>",
"text": "<div style="color:red;">My html step description</div>"
}
...
}
...
Expand Down
2 changes: 1 addition & 1 deletion web/client/plugins/tutorial/preset/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ module.exports = [
selector: '#intro-tutorial'
},*/
{
translation: 'drawerMenu',
translationHTML: 'drawerMenu',
selector: '#drawer-menu-button'
},
{
Expand Down
8 changes: 6 additions & 2 deletions web/client/reducers/tutorial.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,12 @@ function tutorial(state = initialState, action) {
setup.steps = setup.steps.filter((step) => {
return step.selector && step.selector.substring(0, 1) === '#';
}).map((step) => {
let title = step.title || step.translation ? step.title || < I18N.Message msgId = {"tutorial." + step.translation + ".title"}/> : '';
let text = step.text || step.translation ? step.text || < I18N.Message msgId = {"tutorial." + step.translation + ".text"}/> : '';
let title = step.title ? step.title : '';
title = step.translation ? <I18N.Message msgId = {"tutorial." + step.translation + ".title"}/> : title;
title = step.translationHTML ? <I18N.HTML msgId = {"tutorial." + step.translationHTML + ".title"}/> : title;
let text = step.text ? step.text : '';
text = step.translation ? <I18N.Message msgId = {"tutorial." + step.translation + ".text"}/> : text;
text = step.translationHTML ? <I18N.HTML msgId = {"tutorial." + step.translationHTML + ".text"}/> : text;
text = (step.selector === '#intro-tutorial') ? <div><div>{text}</div>{action.checkbox}</div> : text;
let style = (step.selector === '#intro-tutorial') ? action.style : {};
let isFixed = (step.selector === '#intro-tutorial') ? true : step.isFixed || false;
Expand Down

0 comments on commit 8bf7e2d

Please sign in to comment.