diff options
author | Arthur Schiwon <blizzz@owncloud.com> | 2015-07-31 00:07:41 +0200 |
---|---|---|
committer | Vincent Petry <pvince81@owncloud.com> | 2015-09-16 07:23:25 +0200 |
commit | edd163a6113664921a2fda730037dcf68bfe08ae (patch) | |
tree | 2e5b7b0911e121c5e2b019259d3a0247c31ee1c9 /core/js/share.js | |
parent | 2fc19635f6a98c0acbd223b3f9d0028ff2755585 (diff) | |
download | nextcloud-server-edd163a6113664921a2fda730037dcf68bfe08ae.tar.gz nextcloud-server-edd163a6113664921a2fda730037dcf68bfe08ae.zip |
refactor share dialog for multi-purpose use (dropdown, sidebar) and better maintainability
Diffstat (limited to 'core/js/share.js')
-rw-r--r-- | core/js/share.js | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/core/js/share.js b/core/js/share.js index cd4a614e9d1..5d3253e6d5c 100644 --- a/core/js/share.js +++ b/core/js/share.js @@ -3,7 +3,7 @@ /** * @namespace */ -OC.Share={ +OC.Share = _.extend(OC.Share, { SHARE_TYPE_USER:0, SHARE_TYPE_GROUP:1, SHARE_TYPE_LINK:3, @@ -289,6 +289,12 @@ OC.Share={ } img.attr('src', image); }, + /** + * + * @param itemType + * @param itemSource + * @returns {OC.Share.Types.ShareInfo} + */ loadItem:function(itemType, itemSource) { var data = ''; var checkReshare = true; @@ -371,6 +377,21 @@ OC.Share={ }); }, showDropDown:function(itemType, itemSource, appendTo, link, possiblePermissions, filename) { + var itemModel = new OC.Share.ShareItemModel(itemType, itemSource); + var dialogView = new OC.Share.ShareDialogView('dropdown'); + dialogView.setContainerClasses('drop shareDropDown'); + dialogView.setShowLink(link); + dialogView.setPossiblePermissions(possiblePermissions); + dialogView.setItemModel(itemModel); + var $dialog = dialogView.render(); + $dialog.appendTo(appendTo); + $dialog.attr('data-item-source-name', filename); + $dialog.slideDown(OC.menuSpeed, function() { + OC.Share.droppedDown = true; + }); + return; + + var data = OC.Share.loadItem(itemType, itemSource); var dropDownEl; var html = '<div id="dropdown" class="drop shareDropDown" data-item-type="'+itemType+'" data-item-source="'+itemSource+'">'; @@ -897,7 +918,7 @@ OC.Share={ } return expireDateString; } -}; +}); $(document).ready(function() { |