user can be added to group and team from user page

This commit is contained in:
Élie Bouttier 2014-08-30 18:56:02 -07:00
parent 30d8b7bd85
commit f0c6691df2
10 changed files with 298 additions and 55 deletions

View file

@ -8,19 +8,23 @@ $('a[role="remove"]').on("click", function () {
a.html('removing...');
$.ajax(href)
.done(function(data, textStatus) {
a.parents('li').remove();
var counter = $('#' + type + '-counter');
var empty = $('#' + type + '-empty');
var count = parseInt(counter.html());
count--;
counter.html(count);
if (count < 0) {
// should not happen
window.location.reload();
} else if (count == 0) {
empty.removeClass('hidden');
if (data) {
a.parents('span').html(data);
} else {
empty.addClass('hidden');
a.parents('li').remove();
var counter = $('#' + type + '-counter');
var empty = $('#' + type + '-empty');
var count = parseInt(counter.html());
count--;
counter.html(count);
if (count < 0) {
// should not happen
window.location.reload();
} else if (count == 0) {
empty.removeClass('hidden');
} else {
empty.addClass('hidden');
}
}
})
.fail(function () {

View file

@ -1,13 +1,8 @@
/* This script switch the visible add form when we
* change between user and group tab on team page. */
$('a[data-toggle="tab"]').on("show.bs.tab", function () {
var tab = $(this).data('tab');
var hiddentab;
if (tab == 'user') {
hiddentab = 'group';
} else {
hiddentab = 'user';
}
var tab = $(this).data('showtab');
var hiddentab = $(this).data('hidetab');
$('#add-' + hiddentab + '-form').addClass('hidden');
$('#add-' + tab + '-form').removeClass('hidden');
});