-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor tag modal for creation and update
- Loading branch information
1 parent
347ff5b
commit 91760ae
Showing
8 changed files
with
41 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,30 @@ | ||
angular.module('bhima.services') | ||
.service('TagsService', TagsService); | ||
.service('TagService', TagService); | ||
|
||
TagsService.$inject = ['PrototypeApiService']; | ||
TagService.$inject = ['PrototypeApiService', 'util', '$uibModal']; | ||
|
||
/** | ||
* Tags Service | ||
* @class TagService | ||
* @extends PrototypeApiService | ||
* | ||
* A service wrapper for the /tags HTTP endpoint. | ||
* @description | ||
* Encapsulates common requests to the /tags/ URL. | ||
*/ | ||
function TagsService(Api) { | ||
const service = new Api('/tags/'); | ||
function TagService(Api, util, $uibModal) { | ||
const baseUrl = '/tags/'; | ||
const service = new Api(baseUrl); | ||
service.types = new Api(baseUrl.concat('types/')); | ||
|
||
const tagKeys = ['uuid', 'name', 'color']; | ||
service.clean = tag => util.maskObjectFromKeys(tag, tagKeys); | ||
|
||
service.createUpdateTagsModal = (tag) => { | ||
$uibModal.open({ | ||
templateUrl : 'modules/tags/modal/createUpdate.html', | ||
controller : 'TagsModalController as ModalCtrl', | ||
resolve : { data : () => tag }, | ||
}); | ||
}; | ||
|
||
return service; | ||
} |