summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--js/controller/ShareController.js7
-rw-r--r--js/service/ShareResource.js10
-rw-r--r--templates/part.content.php4
3 files changed, 20 insertions, 1 deletions
diff --git a/js/controller/ShareController.js b/js/controller/ShareController.js
index 4b7f15d0e..2977dc2c2 100644
--- a/js/controller/ShareController.js
+++ b/js/controller/ShareController.js
@@ -25,4 +25,11 @@ app.controller('ShareController', function (ShareResource) {
});
};
+ this.shareItem = function(itemId, userId) {
+ var response = ShareResource.shareItem(itemId, userId);
+ response.then((result) => {
+ return result;
+ });
+ };
+
}); \ No newline at end of file
diff --git a/js/service/ShareResource.js b/js/service/ShareResource.js
index d497c18f7..4ccf90e11 100644
--- a/js/service/ShareResource.js
+++ b/js/service/ShareResource.js
@@ -22,6 +22,16 @@ app.factory('ShareResource', function (Resource, $http, BASE_URL) {
});
};
+ ShareResource.prototype.shareItem = function (itemId, userId) {
+ var url = this.BASE_URL +
+ '/items/' + itemId + '/share/' + userId;
+
+ return this.http({
+ url: url,
+ method: 'POST',
+ });
+ };
+
return new ShareResource($http, BASE_URL);
}); \ No newline at end of file
diff --git a/templates/part.content.php b/templates/part.content.php
index 3dcea9bd1..d3aaf0295 100644
--- a/templates/part.content.php
+++ b/templates/part.content.php
@@ -121,7 +121,9 @@
</form>
- <a ng-repeat="user in Share.userList">
+ <a
+ ng-repeat="user in Share.userList"
+ ng-click="Share.shareItem(item.id, user.value.shareWith)">
{{ user.value.shareWith }}
</a>