closes #25: reset query form and refocus it
This commit is contained in:
parent
ae813cc3b4
commit
b2c6b5dd0f
3 changed files with 31 additions and 9 deletions
|
@ -62,16 +62,16 @@
|
||||||
<p ng-if="person.company || person.job"><i ng-if="person.job">{{person.job}}</i><span ng-if="person.company && person.job"> @ </span><i ng-if="person.company">{{person.company}}</i></p>
|
<p ng-if="person.company || person.job"><i ng-if="person.job">{{person.job}}</i><span ng-if="person.company && person.job"> @ </span><i ng-if="person.company">{{person.company}}</i></p>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<button class="btn btn-link" name="switch-attended" ng-click="setPersonAttribute(person, 'attended', !person.attended)"><span class="glyphicon {{(person.attended) && 'glyphicon-ok-sign text-success' || 'glyphicon-remove-sign text-danger'}}"></span></button>
|
<button class="btn btn-link" reset-focus name="switch-attended" ng-click="setPersonAttributeAndRefocus(person, 'attended', !person.attended)"><span class="glyphicon {{(person.attended) && 'glyphicon-ok-sign text-success' || 'glyphicon-remove-sign text-danger'}}"></span></button>
|
||||||
|
</td>
|
||||||
|
<td ng-repeat="col in customFields">
|
||||||
|
<span ng-if="col.type == 'boolean'">
|
||||||
|
<button class="btn btn-link" ng-click="setPersonAttribute(person, col.key, !person[col.key])"><span class="glyphicon {{(person[col.key]) && 'glyphicon-ok-sign text-success' || 'glyphicon-remove-sign text-danger'}}"></span></button>
|
||||||
|
</span>
|
||||||
|
<span ng-if="col.type != 'boolean'">
|
||||||
|
{{person[col.key]}}
|
||||||
|
</span>
|
||||||
</td>
|
</td>
|
||||||
<td ng-repeat="col in customFields">
|
|
||||||
<span ng-if="col.type == 'boolean'">
|
|
||||||
<button class="btn btn-link" ng-click="setPersonAttribute(person, col.key, !person[col.key])"><span class="glyphicon {{(person[col.key]) && 'glyphicon-ok-sign text-success' || 'glyphicon-remove-sign text-danger'}}"></span></button>
|
|
||||||
</span>
|
|
||||||
<span ng-if="col.type != 'boolean'">
|
|
||||||
{{person[col.key]}}
|
|
||||||
</span>
|
|
||||||
</td>
|
|
||||||
<td>
|
<td>
|
||||||
<button ng-click="removeAttendee(person)" type="button" class="btn btn-link glyphicon glyphicon-trash"></button>
|
<button ng-click="removeAttendee(person)" type="button" class="btn btn-link glyphicon glyphicon-trash"></button>
|
||||||
</td>
|
</td>
|
||||||
|
|
9
angular_app/js/controllers.js
vendored
9
angular_app/js/controllers.js
vendored
|
@ -119,6 +119,8 @@ eventManControllers.controller('EventDetailsCtrl', ['$scope', 'Event', 'Person',
|
||||||
}
|
}
|
||||||
$scope.newPerson = {};
|
$scope.newPerson = {};
|
||||||
});
|
});
|
||||||
|
$scope.query = '';
|
||||||
|
console.log(angular.element($scope.query));
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.fastAddPerson = function(person, isNew) {
|
$scope.fastAddPerson = function(person, isNew) {
|
||||||
|
@ -148,6 +150,13 @@ eventManControllers.controller('EventDetailsCtrl', ['$scope', 'Event', 'Person',
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$scope.focusinControl = {};
|
||||||
|
|
||||||
|
$scope.setPersonAttributeAndRefocus = function(person, key, value) {
|
||||||
|
$scope.setPersonAttribute(person, key, value);
|
||||||
|
$scope.query = '';
|
||||||
|
};
|
||||||
|
|
||||||
$scope.removeAttendee = function(person) {
|
$scope.removeAttendee = function(person) {
|
||||||
Event.deletePerson({
|
Event.deletePerson({
|
||||||
_id: $stateParams.id,
|
_id: $stateParams.id,
|
||||||
|
|
13
angular_app/js/directives.js
vendored
13
angular_app/js/directives.js
vendored
|
@ -25,3 +25,16 @@ eventManApp.directive('eventmanFocus', function () {
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
eventManApp.directive('resetFocus', function () {
|
||||||
|
function link(scope, element, attrs) {
|
||||||
|
element.on('click', function() {
|
||||||
|
var el = angular.element(document.querySelector('#query-persons'));
|
||||||
|
el.length && el[0].focus();
|
||||||
|
});
|
||||||
|
};
|
||||||
|
return {
|
||||||
|
link: link
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue