first commit for v0.2
This commit is contained in:
parent
6ba03afc73
commit
1463854a45
143 changed files with 20775 additions and 2764 deletions
29
accounts/static/js/accounts.js
Normal file
29
accounts/static/js/accounts.js
Normal file
|
@ -0,0 +1,29 @@
|
|||
/* This script is used to remove user from group,
|
||||
* user from team or group from team dynamically
|
||||
* with a ajax request. */
|
||||
$('a[role="remove"]').on("click", function () {
|
||||
var a = $(this);
|
||||
var href = a.data('href');
|
||||
var type = a.data('type');
|
||||
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');
|
||||
} else {
|
||||
empty.addClass('hidden');
|
||||
}
|
||||
})
|
||||
.fail(function () {
|
||||
window.location.reload();
|
||||
});
|
||||
});
|
11
accounts/static/js/delete_modal.js
Normal file
11
accounts/static/js/delete_modal.js
Normal file
|
@ -0,0 +1,11 @@
|
|||
/* This script set the action url of the deletion form
|
||||
* and update messages. */
|
||||
$('#confirm-delete').on('show.bs.modal', function(e) {
|
||||
var item = $(e.relatedTarget).data('item');
|
||||
if (!item) {
|
||||
item = 'item';
|
||||
}
|
||||
$('#confirm-delete-form').attr('action', $(e.relatedTarget).data('action'));
|
||||
$('#confirm-delete-title').html('Delete ' + item);
|
||||
$('#confirm-delete-message').html('Are you sure to delete this ' + item + '?');
|
||||
});
|
13
accounts/static/js/team.js
Normal file
13
accounts/static/js/team.js
Normal file
|
@ -0,0 +1,13 @@
|
|||
/* 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';
|
||||
}
|
||||
$('#add-' + hiddentab + '-form').addClass('hidden');
|
||||
$('#add-' + tab + '-form').removeClass('hidden');
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue