diff --git a/apps/static/js/jumpserver.js b/apps/static/js/jumpserver.js index 8567b418a..5b7452b6b 100644 --- a/apps/static/js/jumpserver.js +++ b/apps/static/js/jumpserver.js @@ -153,23 +153,29 @@ function getIDall() { return check_array.join(","); } -function APIUpdateAttr(url, body, success, error, method) { +function APIUpdateAttr(props) { + // props = {url: .., body: , success: , error: , method: ,} + props = props || {}; $.ajax({ - url: url, - type: method || "PATCH", - data: body + url: props.url, + type: props.method || "PATCH", + data: props.body, + contentType: props.content_type || "application/json; charset=utf-8", + dataType: props.data_type || "json", }).done(function(data, textStatue, jqXHR) { - if (typeof success === 'function') { - return success(data) + if (typeof props.success === 'function') { + return props.success(data) } else { toastr.success('Update Success!') } }).fail(function(jqXHR, textStatue, errorThrown) { - if (typeof error === 'function') { - return error(errorThrown) + if (typeof props.error === 'function') { + return props.error(errorThrown) } else { toastr.error('Error occurred while updating.') } }) return true; } + +var jumpserver = new Object(); diff --git a/apps/users/templates/users/user_detail.html b/apps/users/templates/users/user_detail.html index c11ee523e..6b23790b3 100644 --- a/apps/users/templates/users/user_detail.html +++ b/apps/users/templates/users/user_detail.html @@ -181,31 +181,31 @@ {% trans 'User group' %}
- +
{% for group in user_object.groups.all %} - - + + {% endfor %} @@ -223,8 +223,43 @@ {% endblock %} {% block custom_foot_js %} {% endblock %}
- {% for group in groups %} - + {% endfor %}
- +
{{ group.name }} - - {{ group.name }} + +