summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorMichael Gapczynski <mtgap@owncloud.com>2012-08-08 17:50:09 -0400
committerMichael Gapczynski <mtgap@owncloud.com>2012-08-08 17:50:09 -0400
commitd02b0e39b217ad4c9b27d7d87f7d4cfd4f6f942f (patch)
tree509e3b8bc2d88bd2c0939f8bdb397fef6a012535 /core
parenta22f30fb780bce17300ce05a370b11d9afb602d1 (diff)
downloadnextcloud-server-d02b0e39b217ad4c9b27d7d87f7d4cfd4f6f942f.tar.gz
nextcloud-server-d02b0e39b217ad4c9b27d7d87f7d4cfd4f6f942f.zip
Fix issues with hiding and showing dropdown
Diffstat (limited to 'core')
-rw-r--r--core/js/share.js47
1 files changed, 33 insertions, 14 deletions
diff --git a/core/js/share.js b/core/js/share.js
index 991e307e5ca..70d822f8814 100644
--- a/core/js/share.js
+++ b/core/js/share.js
@@ -10,6 +10,7 @@ OC.Share={
PERMISSION_SHARE:16,
itemShares:[],
statuses:[],
+ droppedDown:false,
loadIcons:function(itemType) {
// Load all share icons
$.get(OC.filePath('core', 'ajax', 'share.php'), { fetch: 'getItemsSharedStatuses', itemType: itemType }, function(result) {
@@ -133,12 +134,18 @@ OC.Share={
return false;
}
});
- $('#dropdown').show('blind');
+ $('#dropdown').show('blind', function() {
+ OC.Share.droppedDown = true;
+ });
$('#shareWith').focus();
},
hideDropDown:function(callback) {
$('#dropdown').hide('blind', function() {
+ OC.Share.droppedDown = false;
$('#dropdown').remove();
+ if (typeof FileActions !== 'undefined') {
+ $('tr').removeClass('mouseOver');
+ }
if (callback) {
callback.call();
}
@@ -233,13 +240,28 @@ OC.Share={
$(document).ready(function() {
- $('.share').live('click', function() {
+ $('a.share').live('click', function(event) {
+ event.stopPropagation();
if ($(this).data('item-type') !== undefined && $(this).data('item') !== undefined) {
+ var itemType = $(this).data('item-type');
+ var item = $(this).data('item');
+ var appendTo = $(this).parent().parent();
var privateLink = false;
+ var possiblePermissions = $(this).data('possible-permissions');
if ($(this).data('private-link') !== undefined && $(this).data('private-link') == true) {
privateLink = true;
}
- OC.Share.showDropDown($(this).data('item-type'), $(this).data('item'), $(this).parent().parent(), privateLink, $(this).data('possible-permissions'));
+ if (OC.Share.droppedDown) {
+ if (item != $('#dropdown').data('item')) {
+ OC.Share.hideDropDown(function () {
+ OC.Share.showDropDown(itemType, item, appendTo, privateLink, possiblePermissions);
+ });
+ } else {
+ OC.Share.hideDropDown();
+ }
+ } else {
+ OC.Share.showDropDown(itemType, item, appendTo, privateLink, possiblePermissions);
+ }
}
});
@@ -281,13 +303,14 @@ $(document).ready(function() {
}
var appendTo = $('tr').filterAttr('data-file', filename).find('td.filename');
// Check if drop down is already visible for a different file
- if (($('#dropdown').length > 0)) {
+ if (OC.Share.droppedDown) {
if (item != $('#dropdown').data('item')) {
OC.Share.hideDropDown(function () {
- $('tr').removeClass('mouseOver');
$('tr').filterAttr('data-file', filename).addClass('mouseOver');
OC.Share.showDropDown(itemType, item, appendTo, true, possiblePermissions);
});
+ } else {
+ OC.Share.hideDropDown();
}
} else {
$('tr').filterAttr('data-file',filename).addClass('mouseOver');
@@ -296,15 +319,11 @@ $(document).ready(function() {
});
}
-// $(this).click(function(event) {
-// if (!($(event.target).hasClass('drop')) && $(event.target).parents().index($('#dropdown')) == -1) {
-// if ($('#dropdown').is(':visible')) {
-// OC.Share.hideDropDown(function() {
-// $('tr').removeClass('mouseOver');
-// });
-// }
-// }
-// });
+ $(this).click(function(event) {
+ if (OC.Share.droppedDown && !($(event.target).hasClass('drop')) && $('#dropdown').has(event.target).length === 0) {
+ OC.Share.hideDropDown();
+ }
+ });
$('#shareWithList li').live('mouseenter', function(event) {
// Show permissions and unshare button