Commit 7a7f3f2d authored by Robert Knight's avatar Robert Knight

Update Cancel button style as per design

 * Use cancel button with a thin circle outline

 * Change normal and hover colors to light/dark grey as
   per discussion on the card.

Card 89
parent 31ed0b64
...@@ -19,6 +19,10 @@ function PublishAnnotationBtnController($scope, localStorage) { ...@@ -19,6 +19,10 @@ function PublishAnnotationBtnController($scope, localStorage) {
$scope.onSave(); $scope.onSave();
}; };
this.cancel = function () {
$scope.onCancel();
}
this.setPrivacy = function (level) { this.setPrivacy = function (level) {
localStorage.setItem(STORAGE_KEY, level); localStorage.setItem(STORAGE_KEY, level);
$scope.onSetPrivacy({level: level}); $scope.onSetPrivacy({level: level});
...@@ -66,6 +70,7 @@ module.exports = function () { ...@@ -66,6 +70,7 @@ module.exports = function () {
canPost: '=', canPost: '=',
isShared: '=', isShared: '=',
isNew: '=', isNew: '=',
onCancel: '&',
onSave: '&', onSave: '&',
onSetPrivacy: '&' onSetPrivacy: '&'
}, },
......
...@@ -40,12 +40,13 @@ describe('publishAnnotationBtn', function () { ...@@ -40,12 +40,13 @@ describe('publishAnnotationBtn', function () {
isNew: false, isNew: false,
onSave: function () {}, onSave: function () {},
onSetPrivacy: function (level) {}, onSetPrivacy: function (level) {},
onCancel: function () {}
}); });
}); });
it('should display "Post to Only Me"', function () { it('should display "Post to Only Me"', function () {
var buttons = element.find('button'); var buttons = element.find('button');
assert.equal(buttons.length, 2); assert.equal(buttons.length, 3);
assert.equal(buttons[0].innerHTML, 'Post to Only Me'); assert.equal(buttons[0].innerHTML, 'Post to Only Me');
}); });
...@@ -115,4 +116,15 @@ describe('publishAnnotationBtn', function () { ...@@ -115,4 +116,15 @@ describe('publishAnnotationBtn', function () {
assert.equal(disabledBtns.length, 0); assert.equal(disabledBtns.length, 0);
}); });
it('should revert changes when cancel is clicked', function () {
var cancelSpy = sinon.spy();
element.link({
onCancel: cancelSpy
});
var cancelBtn = element.find('.publish-annotation-cancel-btn');
assert.equal(cancelBtn.length, 1);
angular.element(cancelBtn).click();
assert.equal(cancelSpy.callCount, 1);
});
}); });
...@@ -256,7 +256,10 @@ ...@@ -256,7 +256,10 @@
.btn-icon { .btn-icon {
display: inline-block; display: inline-block;
transform: scale(1.2); // enlarge icons within buttons and shift the icon
// down slightly so that the icon aligns vertically
// with the button label
transform: scale(1.2) translateY(10%);
} }
// Positions a message/icon to the left of a button. // Positions a message/icon to the left of a button.
......
.publish-annotation-btn { .publish-annotation-btn {
display: flex;
margin-right: 5px;
&__btn { &__btn {
width: 250px; width: 250px;
} }
...@@ -7,3 +10,18 @@ ...@@ -7,3 +10,18 @@
width: 100%; width: 100%;
} }
} }
.publish-annotation-cancel-btn {
$color: #bbb;
color: $color;
font-weight: normal;
&__icon {
margin-right: 3px;
}
&:hover {
color: darken($color, 15%);
}
}
...@@ -115,15 +115,14 @@ ...@@ -115,15 +115,14 @@
ng-click="vm.save()" ng-click="vm.save()"
class="dropdown-menu-btn"><i class="h-icon-check btn-icon"></i> Delete</button> class="dropdown-menu-btn"><i class="h-icon-check btn-icon"></i> Delete</button>
<publish-annotation-btn <publish-annotation-btn
class="publish-annotation-btn"
group="vm.group()" group="vm.group()"
can-post="vm.hasContent()" can-post="vm.hasContent()"
is-new="vm.action == 'create'" is-new="vm.action == 'create'"
is-shared="vm.isShared()" is-shared="vm.isShared()"
on-cancel="vm.revert()"
on-save="vm.save()" on-save="vm.save()"
on-set-privacy="vm.setPrivacy(level)"></publish-annotation-btn> on-set-privacy="vm.setPrivacy(level)"></publish-annotation-btn>
<button class="btn btn-clean"
ng-click="vm.revert()"
><i class="h-icon-cancel btn-icon"></i> Cancel</button>
</div> </div>
<div class="annotation-section annotation-license" <div class="annotation-section annotation-license"
......
...@@ -34,3 +34,9 @@ ...@@ -34,3 +34,9 @@
</li> </li>
</ul> </ul>
</div> </div>
<button class="publish-annotation-cancel-btn btn-clean"
ng-click="vm.cancel()"
title="Cancel changes to this annotation"
>
<i class="h-icon-cancel-outline publish-annotation-cancel-btn__icon btn-icon"></i> Cancel
</button>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment