Skip to content

Commit

Permalink
Fix listener bug in form-selector
Browse files Browse the repository at this point in the history
The text is not updated when a second form is selected in the old
version.
  • Loading branch information
LFDM committed May 1, 2014
1 parent 7c56129 commit 67f595d
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions app/js/directives/form_selector.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,22 @@ annotationApp.directive('formSelector', function() {
controller: function($scope, $element, $attrs) {
var id = $scope.id;
var form = $scope.form;
$scope.text = 'Select';
$scope.selected = function() {
return $scope.plugin.isFormSelected(id, form);
};
$scope.text = function() {
return $scope.selected() ? 'Deselect' : 'Select';
};
$scope.action = function(event) {
event.stopPropagation();
if ($scope.plugin.isFormSelected(id, form)) {
$scope.text = "Select";
if ($scope.selected()) {
$scope.plugin.unsetState(id);
} else {
$scope.text = "Deselect";
$scope.plugin.setState(id, form);
}
};
},
template: '<span ng-click="action($event)">{{ text }}</span>'
template: '<span ng-click="action($event)">{{ text() }}</span>'
};

});

0 comments on commit 67f595d

Please sign in to comment.