Skip to content

Commit

Permalink
feat(journal): the bhAccountSelect is clear-able (#1510)
Browse files Browse the repository at this point in the history
The bhAccountSelect did not previously support transclusion, leading to a poor experience for users
who wanted to search on the account field.  They would have to clear the entire field (from outside
the search modal) to be able to erase the account select.  This commit allows the account select to
be cleared.
  • Loading branch information
jniles committed Apr 15, 2017
1 parent 6ead30d commit 0ff8e0a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
7 changes: 4 additions & 3 deletions client/src/js/components/bhAccountSelect.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
angular.module('bhima.components')
.component('bhAccountSelect', {
templateUrl : 'modules/templates/bhAccountSelect.tmpl.html',
controller : AccountSelectController,
bindings: {
controller : AccountSelectController,
transclude : true,
bindings : {
accountId : '<',
disable : '<',
onSelectCallback : '&?',
required : '<?',
label : '@?',
name : '@?',
}
},
});

AccountSelectController.$inject = [
Expand Down
2 changes: 1 addition & 1 deletion client/src/modules/journal/modals/search.modal.html
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,11 @@
name="account_id"
on-select-callback="ModalCtrl.onSelectAccount(account)"
required="0">
<bh-clear on-clear="ModalCtrl.clear('account_id')"></bh-clear>
</bh-account-select>

<div class="form-group" ng-class="{ 'has-error' : ModalForm.$submitted && ModalForm.project_id.$invalid }">
<label class="control-label" translate>FORM.LABELS.PROJECT</label>
<bh-clear on-clear="ModalCtrl.clear('project_id')"></bh-clear>
<select
class="form-control"
name="project_id"
Expand Down
2 changes: 2 additions & 0 deletions client/src/modules/templates/bhAccountSelect.tmpl.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
{{ ::$ctrl.label }}
</label>

<ng-transclude></ng-transclude>

<ui-select
name="account_id"
ng-model="$ctrl.accountId"
Expand Down

0 comments on commit 0ff8e0a

Please sign in to comment.