aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/js
diff options
context:
space:
mode:
authorMichael Gapczynski <GapczynskiM@gmail.com>2011-08-09 10:34:00 -0400
committerMichael Gapczynski <GapczynskiM@gmail.com>2011-08-09 10:34:00 -0400
commitcdf2dbcd523e99c3c147d29a410c9734020bb5dd (patch)
tree2085cd0beec45aa5e92fe0793c65eae5475b1043 /apps/files_sharing/js
parent23c8d7b3fb316daa7c70552ed47e63e9bbcd300f (diff)
downloadnextcloud-server-cdf2dbcd523e99c3c147d29a410c9734020bb5dd.tar.gz
nextcloud-server-cdf2dbcd523e99c3c147d29a410c9734020bb5dd.zip
Use chosen select form for selecting users in sharing drop down
Diffstat (limited to 'apps/files_sharing/js')
-rw-r--r--apps/files_sharing/js/share.js35
1 files changed, 25 insertions, 10 deletions
diff --git a/apps/files_sharing/js/share.js b/apps/files_sharing/js/share.js
index d6cf45bf44f..f914f8da175 100644
--- a/apps/files_sharing/js/share.js
+++ b/apps/files_sharing/js/share.js
@@ -28,17 +28,21 @@ $(document).ready(function() {
}
createShareDropdown(filenames, files);
});
- $('#uid_shared_with').live('keyup', function() {
- $(this).autocomplete({
- source: OC.linkTo('files_sharing','ajax/userautocomplete.php')
- });
- $('.ui-autocomplete').click(function(event) {
- event.stopPropagation();
+ $('#uid_shared_with').live('change', function() {
+ var source = $('#dropdown').data('file');
+ var uid_shared_with = $(this).val();
+ var permissions = 0;
+ var data = 'sources='+encodeURIComponent(source)+'&uid_shared_with='+encodeURIComponent(uid_shared_with)+'&permissions='+encodeURIComponent(permissions);
+ $.ajax({
+ type: 'POST',
+ url: OC.linkTo('files_sharing','ajax/share.php'),
+ cache: false,
+ data: data
});
});
$('.permissions').live('change', function() {
var permissions;
- if (this.checked) {
+ if ($(this).checked) {
permissions = 1;
} else {
permissions = 0;
@@ -111,7 +115,9 @@ $(document).ready(function() {
function createShareDropdown(filenames, files) {
var html = "<div id='dropdown' data-file='"+files+"'>";
html += "<div id='private'>";
- html += "<input placeholder='User or Group' id='uid_shared_with' />";
+ html += "<select data-placeholder='User or Group' style='width:220px;' id='uid_shared_with' class='chzen-select'>";
+ html += "<option value=''></option>";
+ html += "</select>";
html += "<div id='shared_list'></div>";
html += "</div>";
html += "<div id='public'>";
@@ -122,7 +128,15 @@ function createShareDropdown(filenames, files) {
html += "</div>";
$('tr[data-file="'+filenames+'"]').addClass('mouseOver');
$(html).appendTo($('tr[data-file="'+filenames+'"] td.filename'));
- $.getJSON(OC.linkTo('files_sharing','ajax/getitem.php'), { source: files }, function(users) {
+ $.getJSON(OC.linkTo('files_sharing', 'ajax/userautocomplete.php'), function(users) {
+ if (users) {
+ $.each(users, function(index, row) {
+ $(row).appendTo('#uid_shared_with');
+ });
+ $('#uid_shared_with').trigger('liszt:updated');
+ }
+ });
+ $.getJSON(OC.linkTo('files_sharing', 'ajax/getitem.php'), { source: files }, function(users) {
if (users) {
var list = "<ul>";
$.each(users, function(index, row) {
@@ -146,7 +160,7 @@ function createShareDropdown(filenames, files) {
$(list).appendTo('#shared_list');
}
});
- $.getJSON(OC.linkTo('files_publiclink','ajax/getlink.php'), { path: files }, function(token) {
+ $.getJSON(OC.linkTo('files_publiclink', 'ajax/getlink.php'), { path: files }, function(token) {
if (token) {
$('#makelink').attr('checked', true);
$('#link').data('token', token);
@@ -155,4 +169,5 @@ function createShareDropdown(filenames, files) {
}
});
$('#dropdown').show('blind');
+ $('#uid_shared_with').chosen();
}