Skip to content

Commit

Permalink
Changing Feedback dialog to not pass any score if the user hasn’t int…
Browse files Browse the repository at this point in the history
…eracted with it.
  • Loading branch information
longdogz committed Apr 10, 2017
1 parent 8693c06 commit 2c70ebe
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
5 changes: 3 additions & 2 deletions modules/ui/app/scripts/controllers/FeedbackModalCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@ angular.module('wasabi.controllers')
comments: '',
contactOkay: false
};
$scope.userInteractedWithScore = false;
$scope.closeFunction = $modalInstance.close;

$scope.sendFeedback = function () {
if ($.trim($scope.feedback.score).length === 0 &&
if (!$scope.userInteractedWithScore &&
$.trim($scope.feedback.comments).length === 0 &&
!$scope.feedback.contactOkay) {
// No feedback
Expand All @@ -31,7 +32,7 @@ angular.module('wasabi.controllers')
// Remove it
delete $scope.feedback.comments;
}
if ($scope.feedback.score.length === 0) {
if (!$scope.userInteractedWithScore) {
delete $scope.feedback.score;
}
FeedbackFactory.sendFeedback($scope.feedback).$promise.then(function(/*result*/) {
Expand Down
1 change: 1 addition & 0 deletions modules/ui/app/scripts/directives/NPSWidgetDirective.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ angular.module('wasabi.directives').directive('npsWidget', [
$(element).on('click', 'li', function() {
$(this).addClass('sel').siblings().removeClass('sel');
scope.$parent.feedback.score = $(this).text();
scope.$parent.userInteractedWithScore = true;
});
}
};
Expand Down
8 changes: 4 additions & 4 deletions modules/ui/app/styles/wasabi.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3263,7 +3263,7 @@ form input.ng-dirty.ng-invalid:not(.ng-focused) {
list-style: none;
position: relative;
margin: 7px auto 0 auto;
width: 355px;
width: 305px;
padding: 0;
padding-top: 4px;
}
Expand Down Expand Up @@ -3310,15 +3310,15 @@ form input.ng-dirty.ng-invalid:not(.ng-focused) {
position: absolute;
text-align: center;
width: 100px;
left: 50%;
left: 47%;
top: 2px;
margin-left: -50px;
}
#npsLables label:first-child {
left: 21%;
left: 25%;
}
#npsLables label:last-child {
left: 78%;
left: 74%;
}
#txtFeedbackComments {
height: 50px;
Expand Down
2 changes: 1 addition & 1 deletion modules/ui/app/views/FeedbackModal.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ <h2>We love feedback and can't wait to hear from you!</h2>

<label>How satisfied are you with the Wasabi AB Testing Service?</label>
<ul id="nps" nps-widget>
<li>0</li><li>1</li><li>2</li><li>3</li><li>4</li><li>5</li><li>6</li><li>7</li><li>8</li><li>9</li><li>10</li>
<li>1</li><li>2</li><li>3</li><li>4</li><li>5</li><li>6</li><li>7</li><li>8</li><li>9</li><li>10</li>
</ul>
<div id="npsLables">
<label>Not at all<br>satisfied</label><label>Somewhat<br>satisfied</label><label>Very<br>satisfied</label>
Expand Down

0 comments on commit 2c70ebe

Please sign in to comment.