1 <script type=
"text/javascript" src=
"{{STATIC_URL}}/js/jquery.form.js"></script>
2 <script type=
"text/javascript">
3 $(document
).ready(function() {
5 $('#add_user').click(function(event
){
6 event
.preventDefault();
7 $('.qtip').qtip('destroy');
10 url
: '{% url group-add-user object.id %}',
11 title
: {text
:'Add User: ', button
:'close'}
13 position
: { corner
:{target
:'center', tooltip
:'center'}},
14 style
: {name
: 'dark', border
:{radius
:5}, width
:400, background
:'#eeeeee'},
15 show
: {when
:false, ready
:true},
16 hide
: {fixed
: true, when
:false},
17 api
:{onShow:function(){
18 $(".ajax_form input[type!=hidden], .ajax_form select").first().focus();
24 $('#op_users .delete').live("click", function(event
) {
25 event
.preventDefault();
26 var name
= $(this).parent().parent().children('.name');
27 if (name
.children('a').size() > 0) {
28 name
= name
.children('a').html();
32 if (confirm("Remove user: " + name
)) {
33 var id
= this.parentNode
.parentNode
.id
.substring(5);
34 $.post('{% url group-remove-user object.id %}', {'user':id
},
36 if(code
==1) {$('#user_'+id
).remove();}
42 $(".add_user_form").live('submit', function(event
){
43 event
.preventDefault();
45 $(this).ajaxSubmit({success
: update_group_user
});
49 function update_group_user(responseText
, statusText
, xhr
, $form
) {
50 if (xhr
.getResponseHeader('Content-Type') == 'application/json') {
52 for (var key
in responseText
) {
53 $("#errors").append("<li>"+ responseText
[key
] +"</li>")
56 // successful permissions change. replace the user row with the
57 // newly rendered html
58 $('.qtip').qtip('hide');
59 var html
= $(responseText
);
60 var id
= html
.attr('id');
61 var $row
= $('#op_users #' + id
);
62 if ($row
.length
== 1) {
63 $row
.replaceWith(html
);
65 $("#op_users").append(html
);
71 <div id=
"add_user" class=
"button add">Add User
</div>
75 {% block user_headers%}{% endblock %}
78 {% for user_detail in users %}
79 {% block user_row %}{% include
"group/user_row.html" %}{% endblock %}