|
|
@ -12,18 +12,21 @@
|
|
|
|
<script src="{% static "js/plugins/dataTables/dataTables.min.js" %}"></script>
|
|
|
|
<script src="{% static "js/plugins/dataTables/dataTables.min.js" %}"></script>
|
|
|
|
<style>
|
|
|
|
<style>
|
|
|
|
.user_div {
|
|
|
|
.user_div {
|
|
|
|
background-color: #d1dade;
|
|
|
|
|
|
|
|
color: #5e5e5e;
|
|
|
|
color: #5e5e5e;
|
|
|
|
font-family: "Open Sans";
|
|
|
|
font-family: "Open Sans";
|
|
|
|
padding: 3px 8px;
|
|
|
|
padding: 3px 8px;
|
|
|
|
text-shadow: none;
|
|
|
|
text-shadow: none;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
.user_div .remove {
|
|
|
|
.user_div .ui_container {
|
|
|
|
color: #fff;
|
|
|
|
background-color: #d1dade;
|
|
|
|
|
|
|
|
width: 100%;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
.user_div span {
|
|
|
|
.user_div a {
|
|
|
|
color: #5e5e5e;
|
|
|
|
color: #5e5e5e;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.user_div .remove {
|
|
|
|
|
|
|
|
color: #fff;
|
|
|
|
|
|
|
|
}
|
|
|
|
dl {
|
|
|
|
dl {
|
|
|
|
width: 100%;
|
|
|
|
width: 100%;
|
|
|
|
overflow: hidden;
|
|
|
|
overflow: hidden;
|
|
|
@ -99,7 +102,7 @@ dd {
|
|
|
|
<dt>{% trans 'Users' %}:</dt>
|
|
|
|
<dt>{% trans 'Users' %}:</dt>
|
|
|
|
<dd style="line-height: 2" id="group_user_container">
|
|
|
|
<dd style="line-height: 2" id="group_user_container">
|
|
|
|
{% for user in object.users.all %}
|
|
|
|
{% for user in object.users.all %}
|
|
|
|
<div class="col-sm-4 user_div"><div class="col-xs-9"><a href="{{ user.get_absolute_url }}"><span>{{ user.name }}</span></a></div><div class="col-xs-3"><a data-uid="{{ user.id }}" class="btn_remove m-l-5"><i class="remove fa fa-times-circle"></i></a></div></div>
|
|
|
|
<div class="col-sm-4 user_div"><div class="ui_container row"><div class="col-xs-9"><a href="{{ user.get_absolute_url }}" title="{{ user.name }}" data-toggle="tooltip">{{ user.name|truncatechars:15 }}</a></div><div class="col-xs-3"><a data-uid="{{ user.id }}" class="btn_remove m-l-5"><i class="remove fa fa-times-circle"></i></a></div></div></div>
|
|
|
|
{% endfor %}
|
|
|
|
{% endfor %}
|
|
|
|
</dd>
|
|
|
|
</dd>
|
|
|
|
</dl>
|
|
|
|
</dl>
|
|
|
@ -189,6 +192,10 @@ $(document).on('click', '.btn_remove', function(){
|
|
|
|
$(td).html('<i class="fa fa-check text-navy"></i>')
|
|
|
|
$(td).html('<i class="fa fa-check text-navy"></i>')
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}},
|
|
|
|
}},
|
|
|
|
|
|
|
|
{targets: 4, createdCell: function (td, cellData) {
|
|
|
|
|
|
|
|
var innerHtml = cellData.length > 8 ? cellData.substring(0, 8) + '...': cellData;
|
|
|
|
|
|
|
|
$(td).html('<a href="javascript:void(0);" data-toggle="tooltip" title="' + cellData + '">' + innerHtml + '</a>');
|
|
|
|
|
|
|
|
}}
|
|
|
|
],
|
|
|
|
],
|
|
|
|
ajax_url: '{% url "users:user-bulk-update-api" %}',
|
|
|
|
ajax_url: '{% url "users:user-bulk-update-api" %}',
|
|
|
|
columns: [{data: function(){return ""}}, {data: "username" }, {data: "name" }, {data: "get_role_display" }, {data: "group_display" },
|
|
|
|
columns: [{data: function(){return ""}}, {data: "username" }, {data: "name" }, {data: "get_role_display" }, {data: "group_display" },
|
|
|
@ -203,7 +210,6 @@ $(document).on('click', '.btn_remove', function(){
|
|
|
|
plain_id_list.push(this.data().id);
|
|
|
|
plain_id_list.push(this.data().id);
|
|
|
|
selected_users.push({id: this.data().id, name: this.data().name});
|
|
|
|
selected_users.push({id: this.data().id, name: this.data().name});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
console.log(selected_users)
|
|
|
|
|
|
|
|
if (plain_id_list === []) {
|
|
|
|
if (plain_id_list === []) {
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
};
|
|
|
|
};
|
|
|
@ -218,13 +224,15 @@ $(document).on('click', '.btn_remove', function(){
|
|
|
|
var html = "";
|
|
|
|
var html = "";
|
|
|
|
$.each(selected_users, function(index, user) {
|
|
|
|
$.each(selected_users, function(index, user) {
|
|
|
|
html += [
|
|
|
|
html += [
|
|
|
|
'<div class="col-sm-4 user_div"><div class="col-xs-9"><a href="',
|
|
|
|
'<div class="col-sm-4 user_div"><div class="ui_container row"><div class="col-xs-9"><a title="',
|
|
|
|
'{% url "users:user-detail" pk=99991937 %}'.replace(99991937, user.id),
|
|
|
|
|
|
|
|
'"><span>',
|
|
|
|
|
|
|
|
user.name,
|
|
|
|
user.name,
|
|
|
|
'</span></a></div><div class="col-xs-3"><a data-uid="',
|
|
|
|
'" data-toggle="tooltip" href="',
|
|
|
|
|
|
|
|
'{% url "users:user-detail" pk=99991937 %}'.replace(99991937, user.id),
|
|
|
|
|
|
|
|
'">',
|
|
|
|
|
|
|
|
user.name.length >=13 ? user.name.substring(0, 12) + '...' : user.name,
|
|
|
|
|
|
|
|
'</a></div><div class="col-xs-3"><a data-uid="',
|
|
|
|
user.id,
|
|
|
|
user.id,
|
|
|
|
'" class="btn_remove m-l-5"><i class="remove fa fa-times-circle"></i></a></div></div>\n',
|
|
|
|
'" class="btn_remove m-l-5"><i class="remove fa fa-times-circle"></i></a></div></div></div>\n',
|
|
|
|
].join("");
|
|
|
|
].join("");
|
|
|
|
});
|
|
|
|
});
|
|
|
|
$(html).appendTo($('#group_user_container'));
|
|
|
|
$(html).appendTo($('#group_user_container'));
|
|
|
|