toggle checkboxes by clicking whole cell

This commit is contained in:
Kyle Spearrin 2017-06-09 01:10:53 -04:00
parent f170157817
commit 488dbb6715
4 changed files with 28 additions and 10 deletions

View File

@ -0,0 +1,10 @@
angular
.module('bit.directives')
.directive('stopProp', function () {
return function (scope, element, attrs) {
$(element).click(function (event) {
event.stopPropagation();
});
};
});

View File

@ -312,6 +312,11 @@
return $scope.folderIdFilter === undefined || folder.id === $scope.folderIdFilter;
};
$scope.select = function ($event) {
var checkbox = $($event.currentTarget).parent().find('input[name="loginSelection"]');
checkbox.prop('checked', !checkbox.prop('checked'));
};
function distinct(value, index, self) {
return self.indexOf(value) === index;
}
@ -323,7 +328,7 @@
}
function clearLoginSelections() {
$('input[name="loginSelection"]').attr('checked', false);
$('input[name="loginSelection"]').prop('checked', false);
}
$scope.bulkMove = function () {

View File

@ -107,10 +107,11 @@
<td class="action-select">
<input type="checkbox" value="{{::login.id}}" name="loginSelection" />
</td>
<td>
<a href="#" stop-click ng-click="editLogin(login)">{{login.name}}</a>
<i class="fa fa-share-alt text-muted" title="Shared" ng-show="login.organizationId"></i>
<div class="text-sm text-muted">{{login.username}}</div>
<td ng-click="select($event)">
<a href="#" stop-click ng-click="editLogin(login)" stop-prop>{{login.name}}</a>
<i class="fa fa-share-alt text-muted" title="Shared" ng-show="login.organizationId"
stop-prop></i><br />
<span class="text-sm text-muted" stop-prop>{{login.username}}</span>
</td>
</tr>
</tbody>
@ -204,11 +205,12 @@
<td class="action-select">
<input type="checkbox" value="{{::login.id}}" name="loginSelection" />
</td>
<td>
<a href="#" stop-click ng-click="editLogin(login)">{{login.name}}</a>
<i class="fa fa-star text-muted" title="Favorite" ng-show="login.favorite"></i>
<i class="fa fa-share-alt text-muted" title="Shared" ng-show="login.organizationId"></i>
<div class="text-sm text-muted">{{login.username}}</div>
<td ng-click="select($event)">
<a href="#" stop-click ng-click="editLogin(login)" stop-prop>{{login.name}}</a>
<i class="fa fa-star text-muted" title="Favorite" ng-show="login.favorite" stop-prop></i>
<i class="fa fa-share-alt text-muted" title="Shared" ng-show="login.organizationId" stop-prop></i>
<br />
<span class="text-sm text-muted" stop-prop>{{login.username}}</span>
</td>
</tr>
</tbody>

View File

@ -120,6 +120,7 @@
<script src="app/directives/passwordViewerDirective.js"></script>
<script src="app/directives/letterAvatarDirective.js"></script>
<script src="app/directives/stopClickDirective.js"></script>
<script src="app/directives/stopPropDirective.js"></script>
<script src="app/filters/filtersModule.js"></script>
<script src="app/filters/enumNameFilter.js"></script>