Skip to content
This repository was archived by the owner on Sep 10, 2021. It is now read-only.

Commit c40fe40

Browse files
committed
ENH: Refs #223. two minor changes.
1) use variables to store dom objects to improve running performance. 2) set qtip's position to target on mouse
1 parent a4f6985 commit c40fe40

File tree

4 files changed

+33
-28
lines changed

4 files changed

+33
-28
lines changed

core/public/css/community/community.manage.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,5 @@ span.userDataTitle{
4141
.ui-draggable { cursor: pointer; }
4242

4343
div.userPersonalData{
44-
opacity: .85;
44+
opacity: .90;
4545
}

core/public/css/user/user.manage.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ span.communityTitle{
4141
.draggable { cursor: pointer; }
4242

4343
div.communityList{
44-
opacity: .85;
44+
opacity: .90;
4545
}
4646

4747
div.communityList span.communityShortDescription{

core/public/js/community/community.manage.js

Lines changed: 26 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,10 @@ $(document).ready(function() {
6363
"sEmptyTable": "No users in this group"
6464
}
6565
});
66-
if($(this).attr('groupid')!=undefined)
66+
var groupid=$(this).attr('groupid');
67+
if(groupid!=undefined)
6768
{
68-
datatable[$(this).attr('groupid')]=obj;
69+
datatable[groupid]=obj;
6970
}
7071
});
7172

@@ -194,6 +195,8 @@ function init()
194195
{
195196
groupUsersSelected=new Array();
196197
memberSelected=new Array();
198+
var mainDialogContentDiv = $('div.MainDialogContent');
199+
var createGroupFromDiv = $('div#createGroupFrom');
197200
$('a.groupLink').each(function(){
198201
var id=$(this).attr('groupid');
199202
$(this).parent('li').find('span').html(' ('+($('div#groupList_'+id+' td.tdUser').size())+')');
@@ -203,24 +206,22 @@ function init()
203206
{
204207
$('div.groupUsersSelection').hide();
205208
$('td.tdUser input').removeAttr('checked');
206-
$('div.MainDialogContent').html('');
207-
$('div.MainDialogContent').html('');
208-
$('div#createGroupFrom').find('input[name=groupId]').val('0');
209-
$('div#createGroupFrom').find('input[name=name]').val('');
210-
showDialogWithContent(json.community.message.createGroup,$('div#createGroupFrom').html(),false);
211-
$('div.MainDialogContent form.editGroupForm').ajaxForm( {beforeSubmit: validateGroupChange, success: successGroupChange} );
209+
mainDialogContentDiv.html('');
210+
createGroupFromDiv.find('input[name=groupId]').val('0');
211+
createGroupFromDiv.find('input[name=name]').val('');
212+
showDialogWithContent(json.community.message.createGroup,createGroupFromDiv.html(),false);
213+
mainDialogContentDiv.find('form.editGroupForm').ajaxForm( {beforeSubmit: validateGroupChange, success: successGroupChange} );
212214
});
213215

214216
$('a.editGroupLink').click(function()
215217
{
216-
$('div.MainDialogContent').html('');
218+
mainDialogContentDiv.html('');
217219
var id=$(this).attr('groupid');
218-
$('div.MainDialogContent').html('');
219-
$('div#createGroupFrom').find('input[name=groupId]').val(id);
220+
createGroupFromDiv.find('input[name=groupId]').val(id);
220221
var groupName=$(this).parent('li').find('a:first').html();
221-
showDialogWithContent(json.community.message.editGroup,$('div#createGroupFrom').html(),false);
222+
showDialogWithContent(json.community.message.editGroup,createGroupFromDiv.html(),false);
222223
$('form.editGroupForm input#name').val(groupName);
223-
$('div.MainDialogContent form.editGroupForm').ajaxForm( {beforeSubmit: validateGroupChange, success: successGroupChange} );
224+
mainDialogContentDiv.find('form.editGroupForm').ajaxForm( {beforeSubmit: validateGroupChange, success: successGroupChange} );
224225
});
225226

226227
$('a.groupLink').click(function()
@@ -498,19 +499,23 @@ function successInfoChange(responseText, statusText, xhr, form)
498499

499500
function initCommunityPrivacy()
500501
{
501-
if($('input[name=privacy]:checked').val()== 1) //private
502+
var inputCanJoin = $('input[name=canJoin]');
503+
var inputPrivacy = $('input[name=privacy]');
504+
var canJoinDiv = $('div#canJoinDiv');
505+
506+
if(inputPrivacy.filter(':checked').val()== 1) //private
502507
{
503-
$('input[name=canJoin]').attr('disabled','disabled');
504-
$('input[name=canJoin]').removeAttr('checked');
505-
$('input[name=canJoin][value=0]').attr('checked', true); //invitation
506-
$('div#canJoinDiv').hide();
508+
inputCanJoin.attr('disabled','disabled');
509+
inputCanJoin.removeAttr('checked');
510+
inputCanJoin.filter('[value=0]').attr('checked', true); //invitation
511+
canJoinDiv.hide();
507512
}
508513
else
509514
{
510-
$('input[name=canJoin]').removeAttr('disabled');
511-
$('div#canJoinDiv').show();
515+
inputCanJoin.removeAttr('disabled');
516+
canJoinDiv.show();
512517
}
513-
$('input[name=privacy]').change(function(){
518+
inputPrivacy.change(function(){
514519
initCommunityPrivacy();
515520
});
516521
}

core/public/js/user/user.manage.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,9 @@ function initDragAndDrop()
100100
}
101101
var destination_obj=this;
102102

103-
// do nothing if drop item(s) to its current folder
103+
// do nothing if drop item(s) to its current folder, otherwise move item(s)
104104
if ($(this).attr('id') != $(from_obj).attr('id')){
105-
$.post(json.global.webroot+'/browse/movecopy', {moveElement: true, elements: elements , destination:$(this).attr('element'),from:$(from_obj).attr('element'),ajax:true},
105+
$.post(json.global.webroot+'/browse/movecopy', {moveElement: true, elements: elements , destination:$(destination_obj).attr('element'),from:$(from_obj).attr('element'),ajax:true},
106106
function(data) {
107107

108108
jsonResponse = jQuery.parseJSON(data);
@@ -114,7 +114,7 @@ function initDragAndDrop()
114114
if(jsonResponse[0])
115115
{
116116
createNotive(jsonResponse[1],1500);
117-
$($(ui.draggable).parents("tr")).appendBranchTo(destination_obj);
117+
$($(ui.draggable).parents("tr")[0]).appendBranchTo(destination_obj);
118118
$(from_obj).reload();
119119
$(destination_obj).reload();
120120
}
@@ -147,11 +147,11 @@ function initDragAndDrop()
147147
});
148148

149149
$(this).parents("tr:[policy=0]").qtip({
150-
content: 'You do not have write permission on this folder and cannot drop items to it !',
150+
content: 'You do not have write permission on this folder and cannot drop item(s) to it !',
151151
show: 'mouseover',
152152
hide: 'mouseout',
153153
position: {
154-
at: 'center',
154+
target: 'mouse',
155155
my: 'bottom left',
156156
viewport: $(window), // Keep the qtip on-screen at all times
157157
effect: true // Disable positioning animation

0 commit comments

Comments
 (0)