summaryrefslogtreecommitdiffstats
path: root/core/js/shareitemmodel.js
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@owncloud.com>2015-09-12 14:21:14 +0200
committerVincent Petry <pvince81@owncloud.com>2015-09-16 07:23:27 +0200
commitf29b51682bc0be785e1a3e4e5901db3255e4a377 (patch)
tree93375423f13d63a4ca97cc800b8fb981d48432f5 /core/js/shareitemmodel.js
parent4c702aa8fdfb28bea4b021e55e7df5eeeb6999d2 (diff)
downloadnextcloud-server-f29b51682bc0be785e1a3e4e5901db3255e4a377.tar.gz
nextcloud-server-f29b51682bc0be785e1a3e4e5901db3255e4a377.zip
share and unshare via link (not yet password). also some internal changes to reduce unnecessary rendering
Diffstat (limited to 'core/js/shareitemmodel.js')
-rw-r--r--core/js/shareitemmodel.js33
1 files changed, 28 insertions, 5 deletions
diff --git a/core/js/shareitemmodel.js b/core/js/shareitemmodel.js
index 81e905b082e..9e153dcb3e5 100644
--- a/core/js/shareitemmodel.js
+++ b/core/js/shareitemmodel.js
@@ -89,12 +89,33 @@
linkShare: {}
},
+ addLinkShare: function() {
+ var model = this;
+ var expiration = this.configModel.getDefaultExpirationDateString();
+ var itemType = this.get('itemType');
+ var itemSource = this.get('itemSource');
+ OC.Share.share(itemType, itemSource, OC.Share.SHARE_TYPE_LINK, '', OC.PERMISSION_READ, this.fileInfoModel.get('name'), expiration, function(data) {
+ model.fetch();
+ //FIXME: updateIcon belongs to view
+ OC.Share.updateIcon(itemType, itemSource);
+ });
+ },
+
+ removeLinkShare: function() {
+ var model = this;
+ var itemType = this.get('itemType');
+ var itemSource = this.get('itemSource');
+
+ OC.Share.unshare(itemType, itemSource, OC.Share.SHARE_TYPE_LINK, '', function() {
+ model.fetch();
+ //FIXME: updateIcon belongs to view
+ OC.Share.updateIcon(itemType, itemSource);
+ });
+ },
+
addShare: function(event, selected, options) {
event.preventDefault();
- //console.warn(selected);
- //return false;
-
var shareType = selected.item.value.shareType;
var shareWith = selected.item.value.shareWith;
var fileName = this.fileInfoModel.get('name');
@@ -121,8 +142,10 @@
}
var model = this;
- OC.Share.share(this.get('itemType'), this.get('itemSource'), shareType, shareWith, permissions, fileName, options.expiration, function() {
- model.fetch()
+ var itemType = this.get('itemType');
+ var itemSource = this.get('itemSource');
+ OC.Share.share(itemType, itemSource, shareType, shareWith, permissions, fileName, options.expiration, function() {
+ model.fetch();
//FIXME: updateIcon belongs to view
OC.Share.updateIcon(itemType, itemSource);
});