user-group detail: fix #15

pull/530/head
xiaokong1937@gmail.com 8 years ago
parent 474f7e0f68
commit 05e961f29f

@ -79,7 +79,7 @@ th a {
} }
table.dataTable tbody > tr.selected, table.dataTable tbody > tr > .selected { table.dataTable tbody > tr.selected, table.dataTable tbody > tr > .selected {
background-color: #1ab394; background-color: #1ab394 !important;
} }
table.dataTable tbody tr.selected a, table.dataTable tbody tr.selected a,
table.dataTable tbody th.selected a, table.dataTable tbody th.selected a,
@ -88,7 +88,7 @@ table.dataTable tbody tr.selected td i.text-navy,
table.dataTable tbody th.selected td i.text-navy, table.dataTable tbody th.selected td i.text-navy,
table.dataTable tbody td.selected td i.text-navy table.dataTable tbody td.selected td i.text-navy
{ {
color: white; color: white !important;
} }
.m-0 { .m-0 {

@ -8,12 +8,12 @@
<script src="{% static "js/inspinia.js" %}"></script> <script src="{% static "js/inspinia.js" %}"></script>
<script src="{% static "js/jumpserver.js" %}"></script> <script src="{% static "js/jumpserver.js" %}"></script>
<script> <script>
activeNav(); activeNav();
$(document).ready(function(){ $(document).ready(function(){
setAjaxCSRFToken(); setAjaxCSRFToken();
$('textarea').attr('rows', 5);
// Set textarea rows five if ($('.tooltip')[0]) {
$('textarea').attr('rows', 5); $('.tooltip').tooltip();
}); }
});
</script> </script>

@ -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'));

@ -64,6 +64,10 @@ $(document).ready(function(){
var detail_btn = '<a href="{% url "users:user-detail" pk=99991937 %}">' + cellData + '</a>'; var detail_btn = '<a href="{% url "users:user-detail" pk=99991937 %}">' + cellData + '</a>';
$(td).html(detail_btn.replace('99991937', rowData.id)); $(td).html(detail_btn.replace('99991937', rowData.id));
}}, }},
{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>');
}},
{targets: 6, createdCell: function (td, cellData) { {targets: 6, createdCell: function (td, cellData) {
if (!cellData) { if (!cellData) {
$(td).html('<i class="fa fa-times text-danger"></i>') $(td).html('<i class="fa fa-times text-danger"></i>')

Loading…
Cancel
Save