Change the share file action icon if the file is already shared with someone
This commit is contained in:
parent
d78b75a0d1
commit
a8e6be6016
|
@ -4,5 +4,5 @@
|
||||||
-moz-border-radius-bottomright:1em; -webkit-border-bottom-right-radius:1em; border-bottom-right-radius:1em; }
|
-moz-border-radius-bottomright:1em; -webkit-border-bottom-right-radius:1em; border-bottom-right-radius:1em; }
|
||||||
#shared_list { padding:0.5em; list-style-type: none; }
|
#shared_list { padding:0.5em; list-style-type: none; }
|
||||||
#public { border-top:1px solid #ddd; padding-top:0.5em; }
|
#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 { float:right; display:inline; margin:0 .5em; padding:.3em .3em 0 .3em !important; opacity:.5; }
|
||||||
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; }
|
a.unshare:hover { opacity:1; }
|
|
@ -1,7 +1,25 @@
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
if (typeof FileActions !== 'undefined') {
|
if (typeof FileActions !== 'undefined') {
|
||||||
FileActions.register('all', 'Share', OC.imagePath('core', 'actions/share'), function(filename) {
|
FileActions.register('all', 'Share', function(filename) {
|
||||||
if (($('#dropdown').length)) {
|
var icon;
|
||||||
|
var file = $('#dir').val()+'/'+filename;
|
||||||
|
$.ajax({
|
||||||
|
type: 'GET',
|
||||||
|
url: OC.linkTo('files_sharing', 'ajax/getitem.php'),
|
||||||
|
dataType: 'json',
|
||||||
|
data: 'source='+file,
|
||||||
|
async: false,
|
||||||
|
success: function(users) {
|
||||||
|
if (users.length > 0) {
|
||||||
|
icon = OC.imagePath('core', 'actions/shared');
|
||||||
|
} else {
|
||||||
|
icon = OC.imagePath('core', 'actions/share');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return icon;
|
||||||
|
}, function(filename) {
|
||||||
|
if (($('#dropdown').length > 0)) {
|
||||||
$('#dropdown').hide('blind', function() {
|
$('#dropdown').hide('blind', function() {
|
||||||
var dropdownFile = $('#dropdown').data('file')
|
var dropdownFile = $('#dropdown').data('file')
|
||||||
var file = $('#dir').val()+'/'+filename;
|
var file = $('#dir').val()+'/'+filename;
|
||||||
|
|
Loading…
Reference in New Issue