mirror of
https://github.com/atlanticbiomedical/biomedjs.git
synced 2025-07-02 00:47:26 -04:00
Added support for tags
This commit is contained in:
@ -141,7 +141,7 @@ angular.module('biomed.directives', [])
|
||||
var isTouch = 'ontouchstart' in window && !window.navigator.userAgent.match(/PhantomJS/i);
|
||||
|
||||
return {
|
||||
restrict: 'A',
|
||||
restrict: 'AC',
|
||||
require: '?ngModel',
|
||||
link: function postLink(scope, element, attrs, controller) {
|
||||
|
||||
@ -310,6 +310,7 @@ angular.module('biomed.directives', [])
|
||||
var options = {};
|
||||
|
||||
return {
|
||||
restrict: 'AC',
|
||||
require: '?ngModel',
|
||||
compile: function (tElm, tAttrs) {
|
||||
var watch,
|
||||
|
37
public/tags/app.js
Normal file
37
public/tags/app.js
Normal file
@ -0,0 +1,37 @@
|
||||
var tags = {}
|
||||
|
||||
angular.module('tags', ['ngResource', 'biomed.directives'])
|
||||
.factory("Tag", function($resource) {
|
||||
return $resource('/api/tags');
|
||||
})
|
||||
.factory("Clients", function($resource) {
|
||||
return $resource('/api/clients/:id/:cmd',
|
||||
{ id: "@id", cmd: "@cmd" },
|
||||
{
|
||||
index: { method: 'GET', params: {}, isArray: true },
|
||||
});
|
||||
})
|
||||
tags.PageCtrl = function($scope, $window, Tag, Clients) {
|
||||
console.log($window.payload)
|
||||
|
||||
var payload = $scope.payload = $window.payload;
|
||||
|
||||
$scope.tag = payload.tag ? payload.tag.data : undefined;
|
||||
|
||||
if (payload.user) {
|
||||
$scope.user = payload.user;
|
||||
$scope.clients = Clients.index(function() {
|
||||
if (payload.tag && payload.tag.client) {
|
||||
$scope.client = payload.tag.client._id;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$scope.save = function() {
|
||||
Tag.save({
|
||||
tag_id: $window.payload.id,
|
||||
client: $scope.client,
|
||||
data: $scope.tag
|
||||
});
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user