diff options
author | Michael Gapczynski <GapczynskiM@gmail.com> | 2011-08-09 17:55:51 -0400 |
---|---|---|
committer | Michael Gapczynski <GapczynskiM@gmail.com> | 2011-08-09 17:55:51 -0400 |
commit | 88e338ec232f91bf2ede2cf05b6b20cb568271f9 (patch) | |
tree | da4192f3267907fcebc161337f6ea28603c64648 | |
parent | 7c840e9bbb2adf3d2f3f32e20161b0aadf2b66fd (diff) | |
download | nextcloud-server-88e338ec232f91bf2ede2cf05b6b20cb568271f9.tar.gz nextcloud-server-88e338ec232f91bf2ede2cf05b6b20cb568271f9.zip |
Only show can edit (if not checked) and unshare button on hover
-rw-r--r-- | apps/files_sharing/css/sharing.css | 4 | ||||
-rw-r--r-- | apps/files_sharing/js/share.js | 38 |
2 files changed, 32 insertions, 10 deletions
diff --git a/apps/files_sharing/css/sharing.css b/apps/files_sharing/css/sharing.css index 43b70950044..152f43577ac 100644 --- a/apps/files_sharing/css/sharing.css +++ b/apps/files_sharing/css/sharing.css @@ -2,7 +2,7 @@ -moz-box-shadow:0 1px 1px #777; -webkit-box-shadow:0 1px 1px #777; box-shadow:0 1px 1px #777; -moz-border-radius-bottomleft:1em; -webkit-border-bottom-left-radius:1em; border-bottom-left-radius:1em; -moz-border-radius-bottomright:1em; -webkit-border-bottom-right-radius:1em; border-bottom-right-radius:1em; } -#shared_list>ul { list-style-type: none; } -#public { border-top:1px solid #ddd; margin-top:1em; padding-top:0.5em; } +#shared_list { padding:0.5em; list-style-type: none; } +#public { border-top:1px solid #ddd; padding-top:0.5em; } a.unshare { float:right; display:inline; margin:0 .5em; padding:.3em .3em 0 .3em !important; } a.unshare:hover { background:#fff; -moz-box-shadow:0 0 10px #fff; -webkit-box-shadow:0 0 10px #fff; box-shadow:0 0 10px #fff; -moz-border-radius:10px; -webkit-border-radius:10px; border-radius:10px; }
\ No newline at end of file diff --git a/apps/files_sharing/js/share.js b/apps/files_sharing/js/share.js index 38738892b8f..3834ebbf832 100644 --- a/apps/files_sharing/js/share.js +++ b/apps/files_sharing/js/share.js @@ -37,12 +37,32 @@ $(document).ready(function() { type: 'POST', url: OC.linkTo('files_sharing','ajax/share.php'), cache: false, - data: data + data: data, + success: function() { + $('#uid_shared_with option[value="'+uid_shared_with+'"]').remove(); + $('#uid_shared_with').trigger('liszt:updated'); + var list = "<li data-uid_shared_with='"+uid_shared_with+"'>"; + list += uid_shared_with; + list += "<input type='checkbox' name='permissions' class='permissions' style='display:none;' /><label>can edit</label>"; + list += "<a href='' title='Unshare' class='unshare' data-uid_shared_with='"+uid_shared_with+"' style='display:none;'><img class='svg' src='"+OC.imagePath('core','actions/delete')+"'/></a>"; + list += "</li>"; + $(list).prependTo('#shared_list'); + } }); }); + $('#shared_list > li').live('mouseenter', function(event) { + $(':hidden', this).show(); + }); + $('#shared_list > li').live('mouseleave', function(event) { + $('a', this).hide(); + if (!$('input:[type=checkbox]', this).is(':checked')) { + $('input:[type=checkbox]', this).hide(); + $('label', this).hide(); + } + }); $('.permissions').live('change', function() { var permissions; - if ($(this).checked) { + if (this.checked) { permissions = 1; } else { permissions = 0; @@ -118,13 +138,13 @@ function createShareDropdown(filenames, files) { 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 += "<ul id='shared_list'></ul>"; html += "</div>"; html += "<div id='public'>"; html += "<input type='checkbox' name='makelink' id='makelink' value='1' /><label for='makelink'>make public</label>"; html += "<input type='checkbox' name='public_link_write' id='public_link_write' value='1' /><label for='public_link_write'>allow upload</label>"; html += "<br />"; - html += "<input id='link' style='display:none;width:100%' />"; + html += "<input id='link' style='display:none; width:90%;' />"; html += "</div>"; $('tr[data-file="'+filenames+'"]').addClass('mouseOver'); $(html).appendTo($('tr[data-file="'+filenames+'"] td.filename')); @@ -138,7 +158,7 @@ function createShareDropdown(filenames, files) { }); $.getJSON(OC.linkTo('files_sharing', 'ajax/getitem.php'), { source: files }, function(users) { if (users) { - var list = "<ul>"; + var list; $.each(users, function(index, row) { $('#uid_shared_with option[value="'+row.uid_shared_with+'"]').remove(); if (typeof(index) == 'string') { @@ -148,16 +168,18 @@ function createShareDropdown(filenames, files) { list += "<li data-uid_shared_with='"+row.uid_shared_with+"'>"; list += row.uid_shared_with; var checked; + var style; if (row.permissions > 0) { checked = "checked='checked'"; + } else { + style = "style='display:none;'"; } - list += "<input type='checkbox' name='permissions' id='"+index+"' class='permissions' "+checked+" /><label for='"+index+"'>can edit</label>"; - list += "<a href='' title='Unshare' class='unshare' data-uid_shared_with='"+row.uid_shared_with+"'><img class='svg' src='"+OC.imagePath('core','actions/delete')+"'/></a>"; + list += "<input type='checkbox' name='permissions' id='"+index+"' class='permissions' "+checked+" "+style+" /><label for='"+index+"' "+style+">can edit</label>"; + list += "<a href='' title='Unshare' class='unshare' data-uid_shared_with='"+row.uid_shared_with+"' style='display:none;'><img class='svg' src='"+OC.imagePath('core','actions/delete')+"'/></a>"; list += "</li>"; } }); - list += "</ul>"; $(list).appendTo('#shared_list'); $('#uid_shared_with').trigger('liszt:updated'); } |