|
|
|
@ -1,5 +1,5 @@
|
|
|
|
|
"use strict";
|
|
|
|
|
/* globals define, socket, ajaxify, app */
|
|
|
|
|
/* globals define, socket, ajaxify, app, bootbox */
|
|
|
|
|
|
|
|
|
|
define('forum/groups/details', ['iconSelect', 'vendor/colorpicker/colorpicker'], function(iconSelect) {
|
|
|
|
|
var Details = {};
|
|
|
|
@ -38,6 +38,10 @@ define('forum/groups/details', ['iconSelect', 'vendor/colorpicker/colorpicker'],
|
|
|
|
|
Details.update();
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 'delete':
|
|
|
|
|
Details.deleteGroup();
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 'join': // intentional fall-throughs!
|
|
|
|
|
case 'leave':
|
|
|
|
|
case 'accept':
|
|
|
|
@ -118,10 +122,33 @@ define('forum/groups/details', ['iconSelect', 'vendor/colorpicker/colorpicker'],
|
|
|
|
|
} else {
|
|
|
|
|
ajaxify.refresh();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
app.alertSuccess('[[groups:event.updated');
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
Details.deleteGroup = function() {
|
|
|
|
|
bootbox.confirm('Are you sure you want to delete the group: ' + ajaxify.variables.get('group_name'), function(confirm) {
|
|
|
|
|
if (confirm) {
|
|
|
|
|
bootbox.prompt('Please enter the name of this group in order to delete it:', function(response) {
|
|
|
|
|
if (response === ajaxify.variables.get('group_name')) {
|
|
|
|
|
socket.emit('groups.delete', {
|
|
|
|
|
groupName: ajaxify.variables.get('group_name')
|
|
|
|
|
}, function(err) {
|
|
|
|
|
if (!err) {
|
|
|
|
|
app.alertSuccess('[[groups:event.deleted, ' + ajaxify.variables.get('group_name') + ']]');
|
|
|
|
|
ajaxify.go('groups');
|
|
|
|
|
} else {
|
|
|
|
|
app.alertError(err.message);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return Details;
|
|
|
|
|
});
|