From fd52a85dbb1ee753ad8c3f457030ab59fd125aa9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B1=9F=E4=B8=96=E5=B3=B0?= <93648765@qq.com> Date: Fri, 30 Sep 2016 18:25:50 +0800 Subject: [PATCH] fix #25 --- .../templates/assets/asset_group_create.html | 17 ++---- .../templates/assets/asset_modal_list.html | 58 +++++++++++++------ apps/templates/_head_css_js.html | 16 ++--- apps/templates/base.html | 4 +- 4 files changed, 56 insertions(+), 39 deletions(-) diff --git a/apps/assets/templates/assets/asset_group_create.html b/apps/assets/templates/assets/asset_group_create.html index f78607e4e..2d22e997e 100644 --- a/apps/assets/templates/assets/asset_group_create.html +++ b/apps/assets/templates/assets/asset_group_create.html @@ -5,18 +5,11 @@ {% block custom_head_css_js %} - - {% endblock %} {% block content %} @@ -50,7 +43,7 @@ {{ form.name|bootstrap_horizontal }} {{ form.comment|bootstrap_horizontal }}
-

资产数量

+

用户选择的资产

diff --git a/apps/assets/templates/assets/asset_modal_list.html b/apps/assets/templates/assets/asset_modal_list.html index 86a0fd73c..228152626 100644 --- a/apps/assets/templates/assets/asset_modal_list.html +++ b/apps/assets/templates/assets/asset_modal_list.html @@ -9,7 +9,7 @@ - + id 资产名称 @@ -21,11 +21,12 @@ {% for asset in asset_modal_list %} - {% if asset.id in group_assets %} - + + {% else %} - + + {% endif %} {{ asset.id }} {{ asset.hostname }} @@ -54,6 +55,9 @@ $(document).ready(function(){ "aaSorting": [[2, "asc"]], "aoColumnDefs": [ { "bSortable": false, "aTargets": [ 0 ] }], "bAutoWidth": false, + "language": { + "url": "/static/js/plugins/dataTables/i18n/zh-hans.json" + }, columns: [ {data: "checkbox"}, {data: "id"}, @@ -64,36 +68,56 @@ $(document).ready(function(){ {data: "dp"} ] }); + //讲ID列隐藏 table.column('1').visible(false); + $('#editable tbody').on( 'click', 'tr', function () { - $(this).toggleClass('selected'); + //alert($(this).hasClass('selected')); + if($(this).hasClass('selected')){ + $(this).removeClass('selected'); + this.children[0].children[0].checked=0; + }else{ + $(this).addClass('selected'); + this.children[0].children[0].checked=1; + }; }); $('#save-btn').on('click',function(){ - //alert( table.rows('.selected').data().length +' row(s) selected' ); + // alert( table.rows('.selected').data().length +' row(s) selected' ); var d = table.rows('.selected').data(); var size = d.length; document.getElementById('add_asset').value = size; var column2 = table.rows('.selected').data(); $("#asset_sed").find("input[name='assets']").remove(); for(var i=0;i"); } $('#modal').modal('hide'); }); +}); //$(document).ready - - -}); - $('#close-btn').on('click',function(){ - //alert('点击关闭按钮时触发;') - $('#modal').modal('hide'); - }); - - - - + var bCheck = 1; + function checkAll(){ + if(bCheck){ + $("tr[name='oAssets']").each(function(){ + oCheckbox = this.children[0].children[0]; + $(this).toggleClass('selected',true); + oCheckbox.checked=1; + }); + document.getElementById('check_all').checked=1; + bCheck = 0; + }else{ + $("tr[name='oAssets']").each(function(){ + oCheckbox = this.children[0].children[0]; + $(this).toggleClass('selected',false); + oCheckbox.checked=0; + }); + document.getElementById('check_all').checked=0; + bCheck = 1; + }; + }; diff --git a/apps/templates/_head_css_js.html b/apps/templates/_head_css_js.html index 4bb984ae3..fbde7e9cd 100644 --- a/apps/templates/_head_css_js.html +++ b/apps/templates/_head_css_js.html @@ -1,15 +1,15 @@ {% load static %} - - - - - - + + + + + + + - - + \ No newline at end of file diff --git a/apps/templates/base.html b/apps/templates/base.html index f13a96dc9..2cee87750 100644 --- a/apps/templates/base.html +++ b/apps/templates/base.html @@ -8,10 +8,10 @@ Jumpserver - + {% include '_head_css_js.html' %} + {% block custom_head_css_js %} {% endblock %} -