菜单active bug

pull/6/head
halcyon 2015-01-24 13:54:08 +08:00
parent 449bde4b03
commit 1a266f0b19
6 changed files with 68 additions and 28 deletions

View File

@ -5,7 +5,9 @@ from django.shortcuts import render_to_response
from django.core.paginator import Paginator, EmptyPage from django.core.paginator import Paginator, EmptyPage
from models import IDC, Asset, BisGroup from models import IDC, Asset, BisGroup
from juser.models import UserGroup
from connect import PyCrypt, KEY from connect import PyCrypt, KEY
from jpermission.models import Permission
cryptor = PyCrypt(KEY) cryptor = PyCrypt(KEY)
@ -20,6 +22,7 @@ def jadd_host(request):
groups = [] groups = []
eidc = IDC.objects.all() eidc = IDC.objects.all()
egroup = BisGroup.objects.all() egroup = BisGroup.objects.all()
eusergroup = UserGroup.objects.all()
if request.method == 'POST': if request.method == 'POST':
j_ip = request.POST.get('j_ip') j_ip = request.POST.get('j_ip')

View File

@ -0,0 +1,8 @@
PS1='[\u@192.168.196.73 \W]\$ '
Last login: Sun Jan 4 13:30:11 2015 from 192.168.199.162
clear;echo -e '\033[32mLogin 192.168.196.73 done. Enjoy it.\033[0m'
[halcyon@localhost ~]$ PS1='[\u@192.168.196.73 \W]\$ '
[halcyon@192.168.196.73 ~]$ clear;echo -e '\033[32mLogin 192.168.196.73 done. Enjoy it.\033[0m'
Login 192.168.196.73 done. Enjoy it.
[halcyon@192.168.196.73 ~]$ ls
[halcyon@192.168.196.73 ~]$

View File

@ -103,6 +103,16 @@
</div> </div>
</div> </div>
<div class="hr-line-dashed"></div>
<div class="form-group">
<label for="j_group" class="col-sm-2 control-label"> 所属用户组 </label>
<div class="col-sm-8">
{% for g in eusergroup %}
<label class="checkbox-inline"><input type="checkbox" id="j_usergroup" value="{{ g }}" name="j_usergroup"> {{ g }} </label>
{% endfor %}
</div>
</div>
<div class="hr-line-dashed"></div> <div class="hr-line-dashed"></div>
<div class="form-group"><label class="col-sm-2 control-label"> 是否激活 </label> <div class="form-group"><label class="col-sm-2 control-label"> 是否激活 </label>
<div class="col-sm-8"> <div class="col-sm-8">
@ -169,6 +179,12 @@ $('#assetForm').validator({
ok: "", ok: "",
msg: {checked: "至少选择一个组"} msg: {checked: "至少选择一个组"}
}, },
"j_usergroup": {
rule: "checked",
tip: "选择用户组",
ok: "",
msg: {checked: "至少选择一个组"}
},
"j_user": { "j_user": {
rule: "required(type_m)", rule: "required(type_m)",
tip: "普通用户名", tip: "普通用户名",

View File

@ -71,23 +71,34 @@
{% endfor %} {% endfor %}
</tbody> </tbody>
</table> </table>
<div class="row">
<div class="col-sm-6">
<div class="dataTables_info" id="editable_info" role="status" aria-live="polite">
Showing {{ contacts.start_index }} to {{ contacts.end_index }} of {{ p.count }} entries
</div>
</div>
<div class="col-sm-6">
<div class="dataTables_paginate paging_simple_numbers" id="editable_paginate">
<ul class="pagination" style="margin-top: 0; float: right">
<ul class="pagination"> {% if contacts.has_previous %}
{% if contacts.has_previous %} <li><a href="?page={{ contacts.previous_page_number }}">&laquo;</a></li>
<li><a href="?page={{ contacts.previous_page_number }}">&laquo;</a></li> {% endif %}
{% endif %}
{% for page in p.page_range %} {% for page in p.page_range %}
{% ifequal offset1 page %} {% ifequal offset1 page %}
<li class="active"><a href="?page={{ page }}" title="第{{ page }}页">{{ page }}</a></li> <li class="active"><a href="?page={{ page }}" title="第{{ page }}页">{{ page }}</a></li>
{% else %} {% else %}
<li><a href="?page={{ page }}" title="第{{ page }}页">{{ page }}</a></li> <li><a href="?page={{ page }}" title="第{{ page }}页">{{ page }}</a></li>
{% endifequal %} {% endifequal %}
{% endfor %} {% endfor %}
{% if contacts.has_next %} {% if contacts.has_next %}
<li><a href="?page={{ contacts.next_page_number }}">&raquo;</a></li> <li><a href="?page={{ contacts.next_page_number }}">&raquo;</a></li>
{% endif %} {% endif %}
</ul> </ul>
</div>
</div>
</div>
</div> </div>
</div> </div>
</div> </div>

View File

@ -14,21 +14,21 @@
<li id="juser"> <li id="juser">
<a href="#"><i class="fa fa-rebel"></i> <span class="nav-label">用户管理</span><span class="fa arrow"></span></a> <a href="#"><i class="fa fa-rebel"></i> <span class="nav-label">用户管理</span><span class="fa arrow"></span></a>
<ul class="nav nav-second-level"> <ul class="nav nav-second-level">
<li><a href="/juser/user_list/">查看用户</a></li> <li id="user_list"><a href="/juser/user_list/">查看用户</a></li>
<li><a href="/juser/user_add/">添加用户</a></li> <li id="user_add"><a href="/juser/user_add/">添加用户</a></li>
<li><a href="/juser/group_list/">查看属组</a></li> <li id="group_list"><a href="/juser/group_list/">查看属组</a></li>
<li><a href="/juser/group_add/">添加属组</a></li> <li id="group_add"><a href="/juser/group_add/">添加属组</a></li>
</ul> </ul>
</li> </li>
<li id="jasset"> <li id="jasset">
<a href="mailbox.html"><i class="fa fa-cube"></i> <span class="nav-label">资产管理</span><span class="fa arrow"></span></a> <a href="mailbox.html"><i class="fa fa-cube"></i> <span class="nav-label">资产管理</span><span class="fa arrow"></span></a>
<ul class="nav nav-second-level"> <ul class="nav nav-second-level">
<li><a href="/jasset/host_list/">查看资产</a></li> <li id="host_list"><a href="/jasset/host_list/">查看资产</a></li>
<li><a href="/jasset/host_add/">添加资产</a></li> <li id="host_add"><a href="/jasset/host_add/">添加资产</a></li>
<li><a href="/jasset/idc_list/">查看机房</a></li> <li id="idc_list"><a href="/jasset/idc_list/">查看机房</a></li>
<li><a href="/jasset/idc_add/">添加机房</a></li> <li id="idc_add"><a href="/jasset/idc_add/">添加机房</a></li>
<li><a href="/jasset/group_list/">查看业务组</a></li> <li id="group_list"><a href="/jasset/group_list/">查看业务组</a></li>
<li><a href="/jasset/group_add/">添加业务组</a></li> <li id="group_add"><a href="/jasset/group_add/">添加业务组</a></li>
</ul> </ul>
</li> </li>
<li id="jperm"> <li id="jperm">
@ -40,11 +40,11 @@
<li><a href="/jperm/add/">添加sudo</a></li> <li><a href="/jperm/add/">添加sudo</a></li>
</ul> </ul>
</li> </li>
<li> <li id="jlog">
<a href="#"><i class="fa fa-files-o"></i> <span class="nav-label">日志审计</span><span class="fa arrow"></span></a> <a href="#"><i class="fa fa-files-o"></i> <span class="nav-label">日志审计</span><span class="fa arrow"></span></a>
<ul class="nav nav-second-level"> <ul class="nav nav-second-level">
<li><a href="/log/showlist/">查看日志</a></li> <li id="log_list"><a href="/jlog/log_list/">查看日志</a></li>
<li><a href="/log/detail/">日志分析</a></li> <li id="log_detail"><a href="/jlog/log_detail/">日志分析</a></li>
</ul> </ul>
</li> </li>
<li> <li>

View File

@ -37,5 +37,7 @@
<!-- active menu --> <!-- active menu -->
<script> <script>
var str = document.location.pathname.split("/")[1]; var str = document.location.pathname.split("/")[1];
var str1 = document.location.pathname.split("/")[2];
$("#"+str).addClass('active'); $("#"+str).addClass('active');
$("#"+str1).addClass('active');
</script> </script>