Skip to content

Instantly share code, notes, and snippets.

@mathjazz
Created July 31, 2018 13:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mathjazz/43a0a66605781414bf5d8adf55b50d6e to your computer and use it in GitHub Desktop.
Save mathjazz/43a0a66605781414bf5d8adf55b50d6e to your computer and use it in GitHub Desktop.
diff --git a/pontoon/base/static/js/tour.js b/pontoon/base/static/js/tour.js
index 687d2ea4..1adcee71 100644
--- a/pontoon/base/static/js/tour.js
+++ b/pontoon/base/static/js/tour.js
@@ -1,9 +1,33 @@
$(function () {
- var canTranslate = Pontoon.user.canTranslate();
var isEntityClicked = false;
var isSubmitClicked = false;
+ var submitTarget = "#editor #single button#save";
+ var submitText = "A user needs to be logged in to be able to submit " +
+ "translations. Non-authenticated users will see a link to SIGN in " +
+ "instead of the translation toolbar with the green SAVE button.";
+
+ // Translators
+ if (Pontoon.user.canTranslate()) {
+ submitText = "If a translator has permissions to add translations directly, " +
+ "the green SAVE button should appear to the lower-right side of " +
+ "the editing space.To add translations directly, simply input " +
+ "the translation to the editing space and click SAVE";
+ }
+ // Contributors
+ else if (Pontoon.user.id) {
+ submitText = "When a translator is in Suggest Mode, or doesn’t have permissions " +
+ "to submit translations directly, a blue SUGGEST button will " +
+ "be visible in the lower-right side of the editing space. To " +
+ "suggest a translation, simply input the translation to the " +
+ "editing space and click SUGGEST";
+ }
+ // Non-authenticated users
+ else {
+ submitTarget = null;
+ }
+
Sideshow.registerWizard({
name: "introducing_pontoon",
title: "Introducing Pontoon",
@@ -122,21 +146,12 @@ $(function () {
},
{
title: "Submit a Translation",
- text: (!canTranslate) ?
- "When a translator is in Suggest Mode, or doesn’t have permissions" +
- " to submit translations directly, a blue SUGGEST button will " +
- "be visible in the lower-right side of the editing space. To " +
- "suggest a translation, simply input the translation to the " +
- "editing space and click SUGGEST" :
- "If a translator has permissions to add translations directly, " +
- "the green SAVE button should appear to the lower-right side of " +
- "the editing space.To add translations directly, simply input " +
- "the translation to the editing space and click SAVE",
+ text: submitText,
subject: "#editor #single",
format: "markdown",
autoContinue: true,
showNextButton: true,
- targets: "#editor #single button#save",
+ targets: submitTarget,
completingConditions: [
function() {
$("#editor #single button#save").click(function() {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment