From 6d3b7cbe7be8b27b74ac3e56f4f86c0536ccab4d Mon Sep 17 00:00:00 2001 From: Nate Stemen Date: Wed, 22 Aug 2018 15:45:08 -0400 Subject: [PATCH 1/3] remove wufoo latex log responses --- services/web/app/views/project/editor/pdf.pug | 71 ------------------- .../ide/pdf/controllers/PdfController.coffee | 24 ++----- .../coffee/services/log-hints-feedback.coffee | 58 --------------- 3 files changed, 4 insertions(+), 149 deletions(-) delete mode 100644 services/web/public/coffee/services/log-hints-feedback.coffee diff --git a/services/web/app/views/project/editor/pdf.pug b/services/web/app/views/project/editor/pdf.pug index 26de2f35b1..c39a3dc4a1 100644 --- a/services/web/app/views/project/editor/pdf.pug +++ b/services/web/app/views/project/editor/pdf.pug @@ -161,7 +161,6 @@ div.full-size.pdf(ng-controller="PdfController") 'alert-info': entry.level == 'typesetting'\ }" ng-click="openInEditor(entry)" - ng-init="feedbackSent = false; showNegFeedbackUI = false; negFeedbackReason = ''; negFeedbackReasonFreeText = ''" ) span.line-no i.fa.fa-link(aria-hidden="true") @@ -179,76 +178,6 @@ div.full-size.pdf(ng-controller="PdfController") p.card-hint-text( ng-show="entry.humanReadableHint", ng-bind-html="wikiEnabled ? entry.humanReadableHint : stripHTMLFromString(entry.humanReadableHint)") - .card-hint-actions.clearfix - .card-hint-ext-link(ng-if="wikiEnabled && entry.extraInfoURL") - a( - ng-href="{{ entry.extraInfoURL }}", - ng-click="trackLogHintsLearnMore()" - target="_blank" - ) - i.fa.fa-external-link - | #{translate("log_hint_extra_info")} - .card-hint-feedback( - ng-hide="feedbackSent || showNegFeedbackUI" - ng-class="entry.ruleId" - ) - label.card-hint-feedback-label #{translate("log_hint_feedback_label")} - a.card-hint-feedback-positive( - ng-click="trackLogHintsPositiveFeedback(entry.ruleId); feedbackSent = true;" - href - ) #{translate("answer_yes")} - span  /  - a.card-hint-feedback-negative( - ng-click="trackLogHintsNegativeFeedback(entry.ruleId); showNegFeedbackUI = true;" - href - ) #{translate("answer_no")} - .card-hint-extra-feedback(ng-hide="!showNegFeedbackUI || feedbackSent") - p.card-hint-extra-feedback-label #{translate("log_hint_ask_extra_feedback")} - .radio: label - input( - type="radio" - name="{{ 'neg-feedback-reason-' + $index }}" - ng-model="negFeedbackReason" - value="{{ logHintsNegFeedbackValues.DIDNT_UNDERSTAND }}" - ) - | #{translate("log_hint_extra_feedback_didnt_understand")} - .radio: label - input( - type="radio" - name="{{ 'neg-feedback-reason-' + $index }}" - ng-model="negFeedbackReason" - value="{{ logHintsNegFeedbackValues.NOT_APPLICABLE }}" - ) - | #{translate("log_hint_extra_feedback_not_applicable")} - .radio: label - input( - type="radio" - name="{{ 'neg-feedback-reason-' + $index }}" - ng-model="negFeedbackReason" - value="{{ logHintsNegFeedbackValues.INCORRECT }}" - ) - | #{translate("log_hint_extra_feedback_incorrect")} - .radio: label - input( - type="radio" - name="{{ 'neg-feedback-reason-' + $index }}" - ng-model="negFeedbackReason" - value="{{ logHintsNegFeedbackValues.OTHER }}" - ) - | #{translate("log_hint_extra_feedback_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="trackLogHintsNegFeedbackDetails(entry.ruleId, negFeedbackReason, negFeedbackReasonFreeText); feedbackSent = true;" - ) #{translate("log_hint_extra_feedback_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() }} diff --git a/services/web/public/coffee/ide/pdf/controllers/PdfController.coffee b/services/web/public/coffee/ide/pdf/controllers/PdfController.coffee index 40264e1be0..0dda78dc90 100644 --- a/services/web/public/coffee/ide/pdf/controllers/PdfController.coffee +++ b/services/web/public/coffee/ide/pdf/controllers/PdfController.coffee @@ -12,7 +12,7 @@ define [ # and then again on ack. AUTO_COMPILE_DEBOUNCE = 2000 - App.controller "PdfController", ($scope, $http, ide, $modal, synctex, event_tracking, logHintsFeedback, localStorage) -> + App.controller "PdfController", ($scope, $http, ide, $modal, synctex, event_tracking, localStorage) -> # enable per-user containers by default perUserCompile = true autoCompile = true @@ -38,22 +38,6 @@ define [ $scope.$applyAsync () -> $scope.shouldDropUp = getFilesDropdownTopCoordAsRatio() > 0.65 - # log hints tracking - $scope.logHintsNegFeedbackValues = logHintsFeedback.feedbackOpts - - $scope.trackLogHintsLearnMore = () -> - event_tracking.sendMB "logs-hints-learn-more" - - trackLogHintsFeedback = (isPositive, hintId) -> - event_tracking.send "log-hints", (if isPositive then "feedback-positive" else "feedback-negative"), hintId - event_tracking.sendMB (if isPositive then "log-hints-feedback-positive" else "log-hints-feedback-negative"), { hintId } - - $scope.trackLogHintsNegFeedbackDetails = (hintId, feedbackOpt, feedbackOtherVal) -> - logHintsFeedback.submitFeedback hintId, feedbackOpt, feedbackOtherVal - - $scope.trackLogHintsPositiveFeedback = (hintId) -> trackLogHintsFeedback true, hintId - $scope.trackLogHintsNegativeFeedback = (hintId) -> trackLogHintsFeedback false, hintId - if ace.require("ace/lib/useragent").isMac $scope.modifierKey = "Cmd" else @@ -65,9 +49,9 @@ define [ if qs_args.length then "?" + qs_args.join("&") else "" $scope.stripHTMLFromString = (htmlStr) -> - tmp = document.createElement("DIV") - tmp.innerHTML = htmlStr - return tmp.textContent || tmp.innerText || "" + tmp = document.createElement("DIV") + tmp.innerHTML = htmlStr + return tmp.textContent || tmp.innerText || "" $scope.$on "project:joined", () -> return if !autoCompile diff --git a/services/web/public/coffee/services/log-hints-feedback.coffee b/services/web/public/coffee/services/log-hints-feedback.coffee deleted file mode 100644 index 104313e016..0000000000 --- a/services/web/public/coffee/services/log-hints-feedback.coffee +++ /dev/null @@ -1,58 +0,0 @@ -define [ - "base" -], (App) -> - App.factory "logHintsFeedback", ($http, $q) -> - 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" - NOT_APPLICABLE: "not_applicable" - INCORRECT: "incorrect" - OTHER: "other" - - createRequest = (hintId, feedbackOpt, feedbackOtherVal = "") -> - formData = new FormData() - - formData.append "Field#{ hintFieldAPIId }", hintId - formData.append "Field#{ reasonFieldAPIId }", feedbackOpt - 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.append "Field#{ reasonOtherFieldAPIId }", "#{ feedbackOpts.OTHER } empty" - else - formData.append "Field#{ reasonOtherFieldAPIId }", feedbackOtherVal - - req = - method: 'POST' - url: submitEndpoint - # 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 - $http(submitRequest) - - service = - feedbackOpts: feedbackOpts - submitFeedback: submitFeedback - - return service \ No newline at end of file From 80c74ce07b42b12014be0a0bc94142c20ccf524e Mon Sep 17 00:00:00 2001 From: Nate Stemen Date: Thu, 23 Aug 2018 11:42:00 -0400 Subject: [PATCH 2/3] add back learn more link --- services/web/app/views/project/editor/pdf.pug | 9 +++++++++ .../coffee/ide/pdf/controllers/PdfController.coffee | 10 ++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/services/web/app/views/project/editor/pdf.pug b/services/web/app/views/project/editor/pdf.pug index c39a3dc4a1..4a9b101f60 100644 --- a/services/web/app/views/project/editor/pdf.pug +++ b/services/web/app/views/project/editor/pdf.pug @@ -178,6 +178,15 @@ div.full-size.pdf(ng-controller="PdfController") p.card-hint-text( ng-show="entry.humanReadableHint", ng-bind-html="wikiEnabled ? entry.humanReadableHint : stripHTMLFromString(entry.humanReadableHint)") + .card-hint-footer.clearfix + .card-hint-ext-link(ng-if="wikiEnabled && entry.extraInfoURL") + a( + ng-href="{{ entry.extraInfoURL }}", + ng-click="trackLogHintsLearnMore()" + target="_blank" + ) + i.fa.fa-external-link + | #{translate("log_hint_extra_info")} p.entry-content(ng-show="entry.content") {{ entry.content.trim() }} diff --git a/services/web/public/coffee/ide/pdf/controllers/PdfController.coffee b/services/web/public/coffee/ide/pdf/controllers/PdfController.coffee index 0dda78dc90..1d8aabe842 100644 --- a/services/web/public/coffee/ide/pdf/controllers/PdfController.coffee +++ b/services/web/public/coffee/ide/pdf/controllers/PdfController.coffee @@ -3,7 +3,6 @@ define [ "ace/ace" "ide/human-readable-logs/HumanReadableLogs" "libs/bib-log-parser" - "services/log-hints-feedback" ], (App, Ace, HumanReadableLogs, BibLogParser) -> AUTO_COMPILE_MAX_WAIT = 5000 # We add a 1 second debounce to sending user changes to server if they aren't @@ -38,6 +37,9 @@ define [ $scope.$applyAsync () -> $scope.shouldDropUp = getFilesDropdownTopCoordAsRatio() > 0.65 + $scope.trackLogHintsLearnMore = () -> + event_tracking.sendMB "logs-hints-learn-more" + if ace.require("ace/lib/useragent").isMac $scope.modifierKey = "Cmd" else @@ -49,9 +51,9 @@ define [ if qs_args.length then "?" + qs_args.join("&") else "" $scope.stripHTMLFromString = (htmlStr) -> - tmp = document.createElement("DIV") - tmp.innerHTML = htmlStr - return tmp.textContent || tmp.innerText || "" + tmp = document.createElement("DIV") + tmp.innerHTML = htmlStr + return tmp.textContent || tmp.innerText || "" $scope.$on "project:joined", () -> return if !autoCompile From c646c3e1ecffc88ee8272d93388d3f5cbaa776ec Mon Sep 17 00:00:00 2001 From: Nate Stemen Date: Thu, 23 Aug 2018 13:02:42 -0400 Subject: [PATCH 3/3] rename selector for learn more footer --- .../public/stylesheets/app/editor/pdf.less | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/services/web/public/stylesheets/app/editor/pdf.less b/services/web/public/stylesheets/app/editor/pdf.less index af597933ea..b1609fe44b 100644 --- a/services/web/public/stylesheets/app/editor/pdf.less +++ b/services/web/public/stylesheets/app/editor/pdf.less @@ -305,25 +305,25 @@ line-height: 1.3; padding: 0 2px; } - + .synctex-control-goto-pdf > .synctex-control-icon when (@is-overleaf = true) { text-indent: 1px; // "Optical" adjustment. &::before { - content: "\f061"; + content: "\f061"; } } .synctex-control-goto-code > .synctex-control-icon when (@is-overleaf = true) { text-indent: -1px; // "Optical" adjustment. &::before { - content: "\f060"; + content: "\f060"; } } - + .synctex-control-goto-pdf > .synctex-control-icon::before when (@is-overleaf = false) { - content: "\f178"; + content: "\f178"; } .synctex-control-goto-code > .synctex-control-icon::before when (@is-overleaf = false) { - content: "\f177"; + content: "\f177"; } .editor-dark { @@ -401,7 +401,7 @@ } - &-text, + &-text, &-feedback-label { color: @log-hints-color; font-size: 0.9rem; @@ -424,8 +424,8 @@ display: inline-block; font-size: 0.8rem; } - - &-actions a, + + &-footer a, &-text a { .alert-danger & { color: @state-danger-text; @@ -492,7 +492,7 @@ .plv-text-layer { display: none; user-select: text; - + .pdf-page-container:hover &, .pdfjs-viewer-show-text & { display: block;