From 95db6ba93439f73827d7642ad94d86b167f6b868 Mon Sep 17 00:00:00 2001 From: Paulo Reis Date: Fri, 22 Jul 2016 11:56:45 +0100 Subject: [PATCH 01/11] Basic mark-up for the extra log hint feedback. --- .../web/app/views/project/editor/pdf.jade | 36 ++++++++++++++++++- .../public/stylesheets/app/editor/pdf.less | 13 +++++++ 2 files changed, 48 insertions(+), 1 deletion(-) diff --git a/services/web/app/views/project/editor/pdf.jade b/services/web/app/views/project/editor/pdf.jade index 5862e82db0..b6d0f67149 100644 --- a/services/web/app/views/project/editor/pdf.jade +++ b/services/web/app/views/project/editor/pdf.jade @@ -108,7 +108,7 @@ div.full-size.pdf(ng-controller="PdfController") 'alert-info': entry.level == 'typesetting'\ }" ng-click="openInEditor(entry)" - ng-init="feedbackSent = false;" + ng-init="feedbackSent = false; negFeedbackReason = ''" ) span.line-no i.fa.fa-link(aria-hidden="true") @@ -148,8 +148,42 @@ div.full-size.pdf(ng-controller="PdfController") ng-click="trackLogHintsNegativeFeedback(entry.ruleId); feedbackSent = true;" href ) #{translate("answer_no")} + .card-hint-extra-feedback + p Can you help us understand why this hint wasn't helpful? + .radio: label + input( + type="radio" + ng-model="negFeedbackReason" + value="didnt_understand" + ) + | I didn’t understand the hint + .radio: label + input( + type="radio" + ng-model="negFeedbackReason" + value="not_applicable" + ) + | I couldn’t apply it to my document + .radio: label + input( + type="radio" + ng-model="negFeedbackReason" + value="incorrect" + ) + | I don’t think this is correct + .radio: label + input( + type="radio" + ng-model="negFeedbackReason" + value="other" + ) + | Other: + .clearfix + button.btn.btn-default.btn-xs.pull-right Submit + .card-hint-feedback(ng-show="feedbackSent") label.card-hint-feedback-label #{translate("log_hint_feedback_gratitude")} + p.entry-content(ng-show="entry.content") {{ entry.content.trim() }} p diff --git a/services/web/public/stylesheets/app/editor/pdf.less b/services/web/public/stylesheets/app/editor/pdf.less index a4d2eeb214..3d60c31544 100644 --- a/services/web/public/stylesheets/app/editor/pdf.less +++ b/services/web/public/stylesheets/app/editor/pdf.less @@ -280,6 +280,19 @@ float: right; } + &-extra-feedback { + color: @gray-dark; + font-size: 0.8rem; + border-top: solid 1px @gray-light; + margin-top: 10px; + padding-top: 10px; + + .radio { + margin-top: 5px; + margin-bottom: 5px; + } + } + & + p { margin-top: 20px; } From 54eadf3256e6839ebf666a08fa558d2ee6320b68 Mon Sep 17 00:00:00 2001 From: Paulo Reis Date: Fri, 22 Jul 2016 12:20:26 +0100 Subject: [PATCH 02/11] Add textarea for 'other' feedback + styles. --- services/web/app/views/project/editor/pdf.jade | 4 ++++ .../web/public/stylesheets/app/editor/pdf.less | 14 ++++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/services/web/app/views/project/editor/pdf.jade b/services/web/app/views/project/editor/pdf.jade index b6d0f67149..1b32c55192 100644 --- a/services/web/app/views/project/editor/pdf.jade +++ b/services/web/app/views/project/editor/pdf.jade @@ -178,6 +178,10 @@ div.full-size.pdf(ng-controller="PdfController") value="other" ) | Other: + textarea.form-control( + ng-show="negFeedbackReason === 'other'" + rows="2" + ) .clearfix button.btn.btn-default.btn-xs.pull-right Submit diff --git a/services/web/public/stylesheets/app/editor/pdf.less b/services/web/public/stylesheets/app/editor/pdf.less index 3d60c31544..3c0dae07d5 100644 --- a/services/web/public/stylesheets/app/editor/pdf.less +++ b/services/web/public/stylesheets/app/editor/pdf.less @@ -283,14 +283,24 @@ &-extra-feedback { color: @gray-dark; font-size: 0.8rem; - border-top: solid 1px @gray-light; + border-top: solid 1px @gray-lighter; margin-top: 10px; - padding-top: 10px; + padding: 0 5px; .radio { margin-top: 5px; margin-bottom: 5px; } + + textarea { + font-size: 0.8rem; + margin-bottom: 10px; + padding: 5px; + } + + input[type="radio"] { + margin-top: 2px; + } } & + p { From b6cd6c2d7da5b961285513c5d3981e4920b640a0 Mon Sep 17 00:00:00 2001 From: Paulo Reis Date: Fri, 22 Jul 2016 14:14:58 +0100 Subject: [PATCH 03/11] UI logic to show or hide the negative feedback panel. --- services/web/app/views/project/editor/pdf.jade | 15 ++++++++++----- .../web/public/stylesheets/app/editor/pdf.less | 6 +++--- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/services/web/app/views/project/editor/pdf.jade b/services/web/app/views/project/editor/pdf.jade index 1b32c55192..75255dd914 100644 --- a/services/web/app/views/project/editor/pdf.jade +++ b/services/web/app/views/project/editor/pdf.jade @@ -108,7 +108,7 @@ div.full-size.pdf(ng-controller="PdfController") 'alert-info': entry.level == 'typesetting'\ }" ng-click="openInEditor(entry)" - ng-init="feedbackSent = false; negFeedbackReason = ''" + ng-init="feedbackSent = false; showNegFeedbackUI = false; negFeedbackReason = '';" ) span.line-no i.fa.fa-link(aria-hidden="true") @@ -135,7 +135,7 @@ div.full-size.pdf(ng-controller="PdfController") i.fa.fa-external-link | #{translate("log_hint_extra_info")} .card-hint-feedback( - ng-show="!feedbackSent" + ng-hide="feedbackSent || showNegFeedbackUI" ng-class="entry.ruleId" ) label.card-hint-feedback-label #{translate("log_hint_feedback_label")} @@ -145,10 +145,12 @@ div.full-size.pdf(ng-controller="PdfController") ) #{translate("answer_yes")} span  /  a.card-hint-feedback-negative( - ng-click="trackLogHintsNegativeFeedback(entry.ruleId); feedbackSent = true;" + ng-click="trackLogHintsNegativeFeedback(entry.ruleId); showNegFeedbackUI = true;" href ) #{translate("answer_no")} - .card-hint-extra-feedback + .card-hint-extra-feedback( + ng-show="showNegFeedbackUI && !feedbackSent" + ) p Can you help us understand why this hint wasn't helpful? .radio: label input( @@ -183,7 +185,10 @@ div.full-size.pdf(ng-controller="PdfController") rows="2" ) .clearfix - button.btn.btn-default.btn-xs.pull-right Submit + button.btn.btn-default.btn-sm.pull-right( + ng-disabled="!negFeedbackReason" + ng-click="feedbackSent = true;" + ) Submit .card-hint-feedback(ng-show="feedbackSent") label.card-hint-feedback-label #{translate("log_hint_feedback_gratitude")} diff --git a/services/web/public/stylesheets/app/editor/pdf.less b/services/web/public/stylesheets/app/editor/pdf.less index 3c0dae07d5..3f3cf68707 100644 --- a/services/web/public/stylesheets/app/editor/pdf.less +++ b/services/web/public/stylesheets/app/editor/pdf.less @@ -285,11 +285,10 @@ font-size: 0.8rem; border-top: solid 1px @gray-lighter; margin-top: 10px; - padding: 0 5px; + padding: 5px; .radio { - margin-top: 5px; - margin-bottom: 5px; + margin: 5px; } textarea { @@ -306,6 +305,7 @@ & + p { margin-top: 20px; } + } .files-dropdown-container { From 37eb6252d29f8314da9c5ea8aaf4dc64872aaf20 Mon Sep 17 00:00:00 2001 From: Paulo Reis Date: Fri, 22 Jul 2016 16:33:19 +0100 Subject: [PATCH 04/11] Rewording + animation when shown the feedback panel. --- .../web/app/views/project/editor/pdf.jade | 10 ++++----- .../public/stylesheets/app/editor/pdf.less | 22 +++++++++++++++++-- 2 files changed, 24 insertions(+), 8 deletions(-) diff --git a/services/web/app/views/project/editor/pdf.jade b/services/web/app/views/project/editor/pdf.jade index 75255dd914..8c9c0f434c 100644 --- a/services/web/app/views/project/editor/pdf.jade +++ b/services/web/app/views/project/editor/pdf.jade @@ -148,10 +148,8 @@ div.full-size.pdf(ng-controller="PdfController") ng-click="trackLogHintsNegativeFeedback(entry.ruleId); showNegFeedbackUI = true;" href ) #{translate("answer_no")} - .card-hint-extra-feedback( - ng-show="showNegFeedbackUI && !feedbackSent" - ) - p Can you help us understand why this hint wasn't helpful? + .card-hint-extra-feedback(ng-hide="!showNegFeedbackUI || feedbackSent") + p.card-hint-extra-feedback-label Can you help us understand why this hint wasn't helpful? .radio: label input( type="radio" @@ -165,14 +163,14 @@ div.full-size.pdf(ng-controller="PdfController") ng-model="negFeedbackReason" value="not_applicable" ) - | I couldn’t apply it to my document + | I can’t apply this solution to my document .radio: label input( type="radio" ng-model="negFeedbackReason" value="incorrect" ) - | I don’t think this is correct + | This doesn’t fix the error .radio: label input( type="radio" diff --git a/services/web/public/stylesheets/app/editor/pdf.less b/services/web/public/stylesheets/app/editor/pdf.less index 3f3cf68707..2183798650 100644 --- a/services/web/public/stylesheets/app/editor/pdf.less +++ b/services/web/public/stylesheets/app/editor/pdf.less @@ -203,6 +203,17 @@ white-space: nowrap; } + +@keyframes expand-feedback-area { + from { + max-height: 0; + } + + to { + max-height: 500px; + } +} + .card-hint:extend(.card-thin) { margin-top: 10px; padding-bottom: 7px; @@ -283,9 +294,16 @@ &-extra-feedback { color: @gray-dark; font-size: 0.8rem; - border-top: solid 1px @gray-lighter; margin-top: 10px; - padding: 5px; + padding-bottom: 5px; + animation: 0.5s ease-out expand-feedback-area; + overflow: hidden; + + &-label { + margin: 5px 0 10px; + padding-top: 5px; + border-top: solid 1px @gray-lighter; + } .radio { margin: 5px; From c083b424876c03501f5f87844c62a65407f64f4a Mon Sep 17 00:00:00 2001 From: Paulo Reis Date: Mon, 25 Jul 2016 15:56:29 +0100 Subject: [PATCH 05/11] Basic wufoo submit service. --- .../coffee/services/log-hints-feedback.coffee | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 services/web/public/coffee/services/log-hints-feedback.coffee diff --git a/services/web/public/coffee/services/log-hints-feedback.coffee b/services/web/public/coffee/services/log-hints-feedback.coffee new file mode 100644 index 0000000000..7ed383ebd3 --- /dev/null +++ b/services/web/public/coffee/services/log-hints-feedback.coffee @@ -0,0 +1,44 @@ +define [ + "base" +], (App) -> + App.factory "logHintsFeedback", ($http, $q) -> + if window.sharelatex?.wufoo? and window.sharelatex.wufoo?.token? and window.sharelatex.wufoo?.url? + hintsFeedbackFormAPIHash = "rl4xgvr1v5t64a" + hintFieldAPIId = '3' + feedbackFieldAPIId = '1' + basicAuthVal = window.btoa "#{ window.sharelatex.wufoo.token }:anypasswilldo" + submitEndpoint = "#{ window.sharelatex.wufoo.url }/api/v3/forms/#{ hintsFeedbackFormAPIHash }/entries.json" + + feedbackOpts = + DIDNT_UNDERSTAND: "didnt_understand" + NOT_APPLICABLE: "not_applicable" + INCORRECT: "incorrect" + OTHER: "other" + + createRequest = (hintId, feedbackOpt, feedbackOtherVal = "") -> + req = + method: 'POST' + url: submitEndpoint + headers: + Authorization: "Basic #{ basicAuthVal }" + + req.data = {} + req.data["Field#{ hintFieldAPIId }"] = hintId + req.data["Field#{ hintFieldAPIId }"] = feedbackOpt + + if feedbackOpt == feedbackOpts.OTHER and feedbackOtherVal != "" + req.data["Field#{ hintFieldAPIId }"] = feedbackOtherVal + + return req + + submitFeedback = (hintId, feedbackOpt, feedbackOtherVal = "") -> + submitRequest = createRequest hintId, feedbackOpt, feedbackOtherVal + + submitFeedback.then (response) -> + console.log response + + service = + feedbackOpts: feedbackOpts + submitFeedback: submitFeedback + + return service \ No newline at end of file From 32b57f228c805ce844bcce2789d9f23907771796 Mon Sep 17 00:00:00 2001 From: Paulo Reis Date: Mon, 25 Jul 2016 16:12:56 +0100 Subject: [PATCH 06/11] Integrate feedback UI with wufoo service. --- services/web/app/views/project/editor/pdf.jade | 12 ++++++------ .../coffee/ide/pdf/controllers/PdfController.coffee | 8 +++++++- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/services/web/app/views/project/editor/pdf.jade b/services/web/app/views/project/editor/pdf.jade index 8c9c0f434c..6ae20fde55 100644 --- a/services/web/app/views/project/editor/pdf.jade +++ b/services/web/app/views/project/editor/pdf.jade @@ -108,7 +108,7 @@ div.full-size.pdf(ng-controller="PdfController") 'alert-info': entry.level == 'typesetting'\ }" ng-click="openInEditor(entry)" - ng-init="feedbackSent = false; showNegFeedbackUI = false; negFeedbackReason = '';" + ng-init="feedbackSent = false; showNegFeedbackUI = false; negFeedbackReason = ''; negFeedbackReasonFreeText = ''" ) span.line-no i.fa.fa-link(aria-hidden="true") @@ -154,32 +154,32 @@ div.full-size.pdf(ng-controller="PdfController") input( type="radio" ng-model="negFeedbackReason" - value="didnt_understand" + value="{{ logHintsNegFeedbackValues.DIDNT_UNDERSTAND }}" ) | I didn’t understand the hint .radio: label input( type="radio" ng-model="negFeedbackReason" - value="not_applicable" + value="{{ logHintsNegFeedbackValues.NOT_APPLICABLE }}" ) | I can’t apply this solution to my document .radio: label input( type="radio" ng-model="negFeedbackReason" - value="incorrect" + value="{{ logHintsNegFeedbackValues.INCORRECT }}" ) | This doesn’t fix the error .radio: label input( type="radio" ng-model="negFeedbackReason" - value="other" + value="{{ logHintsNegFeedbackValues.OTHER }}" ) | Other: textarea.form-control( - ng-show="negFeedbackReason === 'other'" + ng-show="negFeedbackReason === logHintsNegFeedbackValues.OTHER" rows="2" ) .clearfix diff --git a/services/web/public/coffee/ide/pdf/controllers/PdfController.coffee b/services/web/public/coffee/ide/pdf/controllers/PdfController.coffee index 57b06b3bb1..eb549c983d 100644 --- a/services/web/public/coffee/ide/pdf/controllers/PdfController.coffee +++ b/services/web/public/coffee/ide/pdf/controllers/PdfController.coffee @@ -3,8 +3,9 @@ define [ "ace/ace" "ide/human-readable-logs/HumanReadableLogs" "libs/bib-log-parser" + "services/log-hints-feedback" ], (App, Ace, HumanReadableLogs, BibLogParser) -> - App.controller "PdfController", ($scope, $http, ide, $modal, synctex, event_tracking, localStorage) -> + App.controller "PdfController", ($scope, $http, ide, $modal, synctex, event_tracking, logHintsFeedback, localStorage) -> # enable per-user containers by default perUserCompile = true @@ -32,6 +33,8 @@ define [ $scope.shouldDropUp = getFilesDropdownTopCoordAsRatio() > 0.65 # log hints tracking + $scope.logHintsNegFeedbackValues = logHintsFeedback.feedbackOpts + $scope.trackLogHintsLearnMore = () -> event_tracking.sendCountly "logs-hints-learn-more" @@ -39,6 +42,9 @@ define [ event_tracking.send "log-hints", (if isPositive then "feedback-positive" else "feedback-negative"), hintId event_tracking.sendCountly (if isPositive then "log-hints-feedback-positive" else "log-hints-feedback-negative"), { hintId } + trackLogHintsNegFeedbackDetails = (hintId, feedbackOpt, feedbackOtherVal) + logHintsFeedback.submitFeedback + $scope.trackLogHintsPositiveFeedback = (hintId) -> trackLogHintsFeedback true, hintId $scope.trackLogHintsNegativeFeedback = (hintId) -> trackLogHintsFeedback false, hintId From 1c9d0a417f16e81460dc096dc1ad80bb040026eb Mon Sep 17 00:00:00 2001 From: Paulo Reis Date: Tue, 26 Jul 2016 11:30:42 +0100 Subject: [PATCH 07/11] Forge a form submission to avoid CORS checking with wufoo. --- .../coffee/services/log-hints-feedback.coffee | 43 +++++++++++-------- 1 file changed, 26 insertions(+), 17 deletions(-) diff --git a/services/web/public/coffee/services/log-hints-feedback.coffee b/services/web/public/coffee/services/log-hints-feedback.coffee index 7ed383ebd3..0c22f6d44b 100644 --- a/services/web/public/coffee/services/log-hints-feedback.coffee +++ b/services/web/public/coffee/services/log-hints-feedback.coffee @@ -2,12 +2,12 @@ define [ "base" ], (App) -> App.factory "logHintsFeedback", ($http, $q) -> - if window.sharelatex?.wufoo? and window.sharelatex.wufoo?.token? and window.sharelatex.wufoo?.url? - hintsFeedbackFormAPIHash = "rl4xgvr1v5t64a" - hintFieldAPIId = '3' - feedbackFieldAPIId = '1' - basicAuthVal = window.btoa "#{ window.sharelatex.wufoo.token }:anypasswilldo" - submitEndpoint = "#{ window.sharelatex.wufoo.url }/api/v3/forms/#{ hintsFeedbackFormAPIHash }/entries.json" + hintsFeedbackFormAPIHash = "rl4xgvr1v5t64a" + idStampVal = "OPkEWEFHUFAm7hKlraQMhiOXQabafWo8NipRvLT397w=" + hintFieldAPIId = "3" + reasonFieldAPIId = "1" + reasonOtherFieldAPIId = "1_other_other" + submitEndpoint = "https://sharelatex.wufoo.eu/forms/#{ hintsFeedbackFormAPIHash }/#public" feedbackOpts = DIDNT_UNDERSTAND: "didnt_understand" @@ -16,25 +16,34 @@ define [ OTHER: "other" createRequest = (hintId, feedbackOpt, feedbackOtherVal = "") -> + formData = new FormData() + + formData.append "Field#{ hintFieldAPIId }", hintId + formData.append "Field#{ reasonFieldAPIId }", feedbackOpt + formData.append "Field#{ reasonOtherFieldAPIId }", feedbackOtherVal + formData.append "idstamp", idStampVal + req = method: 'POST' url: submitEndpoint - headers: - Authorization: "Basic #{ basicAuthVal }" - - req.data = {} - req.data["Field#{ hintFieldAPIId }"] = hintId - req.data["Field#{ hintFieldAPIId }"] = feedbackOpt - - if feedbackOpt == feedbackOpts.OTHER and feedbackOtherVal != "" - req.data["Field#{ hintFieldAPIId }"] = feedbackOtherVal + # This will effectively disable Angular's default serialization mechanisms, + # forcing the XHR to be done with whatever data we provide (in this case, + # form data). Without this, Angular will forcefully try to serialize data + # to JSON. + transformRequest: angular.identity + data: formData + headers : + # This will tell Angular to use the browser-provided value, which is + # computed according to the data being sent (in this case, multipart + # form + browser-specific multipart boundary). Without this, Angular + # will set JSON. + "Content-Type": undefined return req submitFeedback = (hintId, feedbackOpt, feedbackOtherVal = "") -> submitRequest = createRequest hintId, feedbackOpt, feedbackOtherVal - - submitFeedback.then (response) -> + $http(submitRequest).then (response) -> console.log response service = From bfe3e160c92c5bc223368aecc0027bd50a7a8227 Mon Sep 17 00:00:00 2001 From: Paulo Reis Date: Tue, 26 Jul 2016 11:37:51 +0100 Subject: [PATCH 08/11] Integrate with UI. --- services/web/app/views/project/editor/pdf.jade | 3 ++- .../public/coffee/ide/pdf/controllers/PdfController.coffee | 4 ++-- services/web/public/coffee/services/log-hints-feedback.coffee | 3 +-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/services/web/app/views/project/editor/pdf.jade b/services/web/app/views/project/editor/pdf.jade index 6ae20fde55..8033f4aa16 100644 --- a/services/web/app/views/project/editor/pdf.jade +++ b/services/web/app/views/project/editor/pdf.jade @@ -180,12 +180,13 @@ div.full-size.pdf(ng-controller="PdfController") | Other: textarea.form-control( ng-show="negFeedbackReason === logHintsNegFeedbackValues.OTHER" + ng-model="negFeedbackReasonFreeText" rows="2" ) .clearfix button.btn.btn-default.btn-sm.pull-right( ng-disabled="!negFeedbackReason" - ng-click="feedbackSent = true;" + ng-click="trackLogHintsNegFeedbackDetails(entry.ruleId, negFeedbackReason, negFeedbackReasonFreeText); feedbackSent = true;" ) Submit .card-hint-feedback(ng-show="feedbackSent") diff --git a/services/web/public/coffee/ide/pdf/controllers/PdfController.coffee b/services/web/public/coffee/ide/pdf/controllers/PdfController.coffee index eb549c983d..36c0b1cdae 100644 --- a/services/web/public/coffee/ide/pdf/controllers/PdfController.coffee +++ b/services/web/public/coffee/ide/pdf/controllers/PdfController.coffee @@ -42,8 +42,8 @@ define [ event_tracking.send "log-hints", (if isPositive then "feedback-positive" else "feedback-negative"), hintId event_tracking.sendCountly (if isPositive then "log-hints-feedback-positive" else "log-hints-feedback-negative"), { hintId } - trackLogHintsNegFeedbackDetails = (hintId, feedbackOpt, feedbackOtherVal) - logHintsFeedback.submitFeedback + $scope.trackLogHintsNegFeedbackDetails = (hintId, feedbackOpt, feedbackOtherVal) -> + logHintsFeedback.submitFeedback hintId, feedbackOpt, feedbackOtherVal $scope.trackLogHintsPositiveFeedback = (hintId) -> trackLogHintsFeedback true, hintId $scope.trackLogHintsNegativeFeedback = (hintId) -> trackLogHintsFeedback false, hintId diff --git a/services/web/public/coffee/services/log-hints-feedback.coffee b/services/web/public/coffee/services/log-hints-feedback.coffee index 0c22f6d44b..e9ec173697 100644 --- a/services/web/public/coffee/services/log-hints-feedback.coffee +++ b/services/web/public/coffee/services/log-hints-feedback.coffee @@ -43,8 +43,7 @@ define [ submitFeedback = (hintId, feedbackOpt, feedbackOtherVal = "") -> submitRequest = createRequest hintId, feedbackOpt, feedbackOtherVal - $http(submitRequest).then (response) -> - console.log response + $http(submitRequest) service = feedbackOpts: feedbackOpts From 24614effc48e4a9f4d4c72730ebc42d13d57eb02 Mon Sep 17 00:00:00 2001 From: Paulo Reis Date: Tue, 26 Jul 2016 11:50:29 +0100 Subject: [PATCH 09/11] Support other as answer, without further details. --- .../web/public/coffee/services/log-hints-feedback.coffee | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/services/web/public/coffee/services/log-hints-feedback.coffee b/services/web/public/coffee/services/log-hints-feedback.coffee index e9ec173697..f8dc350a94 100644 --- a/services/web/public/coffee/services/log-hints-feedback.coffee +++ b/services/web/public/coffee/services/log-hints-feedback.coffee @@ -23,6 +23,11 @@ define [ formData.append "Field#{ reasonOtherFieldAPIId }", feedbackOtherVal formData.append "idstamp", idStampVal + # Allow user to specify "other" without any extra details; an empty string + # would trigger an error submitting. + if feedbackOpt == feedbackOpts.OTHER and feedbackOtherVal == "" + formData.set "Field#{ reasonOtherFieldAPIId }", "#{ feedbackOpts.OTHER } empty" + req = method: 'POST' url: submitEndpoint From a3ee3134b1c37c2589c81f0e94a30a884c843f37 Mon Sep 17 00:00:00 2001 From: Paulo Reis Date: Tue, 26 Jul 2016 11:56:15 +0100 Subject: [PATCH 10/11] Support for i18n. --- services/web/app/views/project/editor/pdf.jade | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/services/web/app/views/project/editor/pdf.jade b/services/web/app/views/project/editor/pdf.jade index 8033f4aa16..3fe04c41dc 100644 --- a/services/web/app/views/project/editor/pdf.jade +++ b/services/web/app/views/project/editor/pdf.jade @@ -149,35 +149,35 @@ div.full-size.pdf(ng-controller="PdfController") href ) #{translate("answer_no")} .card-hint-extra-feedback(ng-hide="!showNegFeedbackUI || feedbackSent") - p.card-hint-extra-feedback-label Can you help us understand why this hint wasn't helpful? + p.card-hint-extra-feedback-label #{translate("log_hint_ask_extra_feedback")} .radio: label input( type="radio" ng-model="negFeedbackReason" value="{{ logHintsNegFeedbackValues.DIDNT_UNDERSTAND }}" ) - | I didn’t understand the hint + | #{translate("log_hint_extra_feedback_didnt_understand")} .radio: label input( type="radio" ng-model="negFeedbackReason" value="{{ logHintsNegFeedbackValues.NOT_APPLICABLE }}" ) - | I can’t apply this solution to my document + | #{translate("log_hint_extra_feedback_not_applicable")} .radio: label input( type="radio" ng-model="negFeedbackReason" value="{{ logHintsNegFeedbackValues.INCORRECT }}" ) - | This doesn’t fix the error + | #{translate("log_hint_extra_feedback_incorrect")} .radio: label input( type="radio" ng-model="negFeedbackReason" value="{{ logHintsNegFeedbackValues.OTHER }}" ) - | Other: + | #{translate("log_hint_extra_feedback_other")} textarea.form-control( ng-show="negFeedbackReason === logHintsNegFeedbackValues.OTHER" ng-model="negFeedbackReasonFreeText" @@ -187,7 +187,7 @@ div.full-size.pdf(ng-controller="PdfController") button.btn.btn-default.btn-sm.pull-right( ng-disabled="!negFeedbackReason" ng-click="trackLogHintsNegFeedbackDetails(entry.ruleId, negFeedbackReason, negFeedbackReasonFreeText); feedbackSent = true;" - ) Submit + ) #{translate("log_hint_extra_feedback_submit")} .card-hint-feedback(ng-show="feedbackSent") label.card-hint-feedback-label #{translate("log_hint_feedback_gratitude")} From 6d0779b8f878517c00fe2a14b12609ae9d4e2e45 Mon Sep 17 00:00:00 2001 From: Paulo Reis Date: Tue, 26 Jul 2016 14:47:48 +0100 Subject: [PATCH 11/11] Add forgotten name attribute. --- services/web/app/views/project/editor/pdf.jade | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/services/web/app/views/project/editor/pdf.jade b/services/web/app/views/project/editor/pdf.jade index 3fe04c41dc..200c609d97 100644 --- a/services/web/app/views/project/editor/pdf.jade +++ b/services/web/app/views/project/editor/pdf.jade @@ -153,6 +153,7 @@ div.full-size.pdf(ng-controller="PdfController") .radio: label input( type="radio" + name="{{ 'neg-feedback-reason-' + $index }}" ng-model="negFeedbackReason" value="{{ logHintsNegFeedbackValues.DIDNT_UNDERSTAND }}" ) @@ -160,6 +161,7 @@ div.full-size.pdf(ng-controller="PdfController") .radio: label input( type="radio" + name="{{ 'neg-feedback-reason-' + $index }}" ng-model="negFeedbackReason" value="{{ logHintsNegFeedbackValues.NOT_APPLICABLE }}" ) @@ -167,6 +169,7 @@ div.full-size.pdf(ng-controller="PdfController") .radio: label input( type="radio" + name="{{ 'neg-feedback-reason-' + $index }}" ng-model="negFeedbackReason" value="{{ logHintsNegFeedbackValues.INCORRECT }}" ) @@ -174,6 +177,7 @@ div.full-size.pdf(ng-controller="PdfController") .radio: label input( type="radio" + name="{{ 'neg-feedback-reason-' + $index }}" ng-model="negFeedbackReason" value="{{ logHintsNegFeedbackValues.OTHER }}" )