Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #1498 Support html in the tutorial steps #1540

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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