forked from triaquae/CrazyEye
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
647 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
cryptography==1.5.2 | ||
Django==1.10.2 | ||
django-session-security==2.4.0 | ||
djangorestframework==3.5.3 | ||
paramiko==2.0.2 | ||
pycparser==2.16 | ||
PyMySQL==0.7.9 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -69,3 +69,4 @@ | |
height: 300px; | ||
overflow: auto; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/** | ||
* Created by alex on 11/24/16. | ||
*/ | ||
|
||
|
||
//run this script before submit,to make sure all chosen options all selected | ||
function CheckSelectedOptions() { | ||
$("select[data-type='m2m_chosen'] option").prop("selected",true); | ||
} | ||
|
||
|
||
function ChoseAllOptions(from_select_ele_id,target_select_ele_id) { | ||
console.log(from_select_ele_id +'--' + target_select_ele_id); | ||
var from_options = $("#"+from_select_ele_id + " option"); | ||
|
||
console.log(from_options); | ||
$("#" +target_select_ele_id).append(from_options); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
|
||
{% load custom_tag %} | ||
|
||
<div class="col-md-5"> | ||
{# {% get_attr field %}#} | ||
<p>可选 </p> | ||
{% get_m2m_objs field.name form_obj.instance as m2m_objs %} | ||
{% get_chosen_m2m_objs field form_obj.instance as chosen_m2m_objs %} | ||
|
||
|
||
<select style="height: 200px" id="available_{{ field.name }}" multiple class="form-control "> | ||
{% for obj in m2m_objs %} | ||
{% if obj not in chosen_m2m_objs%} | ||
<option value="{{ obj.id }}">{{ obj }}</option> | ||
{% endif %} | ||
{% endfor %} | ||
</select> | ||
<p class="btn-link" onclick="ChoseAllOptions('available_{{ field.name }}','id_{{ field.name }}')" align="center" style="cursor:pointer;font-weight:bold;margin-top:10px"> | ||
Choose all <i class="fa fa-chevron-circle-right" aria-hidden="true"></i> | ||
</p> | ||
</div> | ||
<div class="col-md-1" align="center" style="margin-top: 35px"> | ||
<i class="fa fa-arrow-circle-left" aria-hidden="true"></i> | ||
<br> | ||
<i class="fa fa-arrow-circle-right" style="margin-left: -3px" aria-hidden="true"></i> | ||
|
||
</div> | ||
<div class="col-md-5"> | ||
<p>已选 </p> | ||
<select data-type="m2m_chosen" style="height: 200px" multiple class="form-control" id="id_{{ field.name }}" name="{{ field.name }}" > | ||
{% for obj in chosen_m2m_objs %} | ||
<option value="{{ obj.id }}" selected>{{ obj }}</option> | ||
{% endfor %} | ||
|
||
</select> | ||
<p class="btn-link" onclick="ChoseAllOptions('id_{{ field.name }}','available_{{ field.name }}')" align="center" style="cursor:pointer;font-weight:bold;margin-top:10px"> | ||
<i class="fa fa-chevron-circle-left" aria-hidden="true"></i>Remove all | ||
</p> | ||
</div> | ||
<script> | ||
document.getElementById("available_{{ field.name }}").addEventListener("dblclick", function (ele) { | ||
moveClickedOption(ele,"id_{{ field.name }}"); | ||
|
||
}); | ||
document.getElementById("id_{{ field.name }}").addEventListener("dblclick", function (ele) { | ||
moveClickedOption(ele,"available_{{ field.name }}"); | ||
|
||
}); | ||
document.getElementById("id_{{ field.name }}").addEventListener("click", function (ele) { | ||
$(ele).preventDefault; | ||
|
||
}); | ||
function moveClickedOption(ele,target_select_ele_id){ | ||
console.log("to target_select_ele: "+target_select_ele_id); | ||
console.log(ele); | ||
console.log(ele.srcElement.type); | ||
if (ele.srcElement.type != 'select-multiple'){ //为避免当select里无option时,再点击会把select自己删除 掉 | ||
|
||
var clone_ele = $(ele)[0].srcElement; | ||
$(ele)[0].srcElement.remove(); | ||
$("#" +target_select_ele_id ).append(clone_ele); | ||
console.log(ele.srcElement.firstChild +ele.srcElement.value ); | ||
|
||
$("#id_{{ field.name }} option").prop("selected",true); //设定右边select的全为选 中状态 | ||
console.log($("#id_{{ field.name }} option")); //设定右边select的全为选 中状态 | ||
} | ||
|
||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
{% extends 'index.html' %} | ||
{% load custom_tag %} | ||
{% block breadcrumb %} | ||
<ol class="breadcrumb"> | ||
<li class="active">配置中心</li> | ||
|
||
</ol> | ||
{% endblock %} | ||
{% block page-content %} | ||
|
||
|
||
<div class="row"> | ||
|
||
<div class="panel col-md-7"> | ||
<div class="panel-heading"> | ||
<h3 class="panel-title">配置中心</h3> | ||
</div> | ||
|
||
<div class="panel-body"> | ||
<table class="table table-hover table-vcenter"> | ||
{% for k,admin_class in enabled_admins.items %} | ||
|
||
<tr> | ||
<td><a style="font-weight:bold ;color: #447e9b" href="{% url 'table_list' k %}">{% get_db_table_name admin_class %}</a></td> | ||
<td><a href="{% url 'table_add' k %}"><i style="color: green" class="fa fa-plus-square-o pull-right" aria-hidden="true">增加</i></a></td> | ||
<td><a href="{% url 'table_list' k %}"><i style="color: red" class="fa fa-edit " aria-hidden="true">修改</i></a></td> | ||
|
||
</tr> | ||
|
||
|
||
{% endfor %} | ||
</table> | ||
</div> | ||
</div> | ||
|
||
|
||
</div> | ||
|
||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
{% extends 'index.html' %} | ||
{% load custom_tag %} | ||
{% block breadcrumb %} | ||
<ol class="breadcrumb"> | ||
<li><a href="{% url 'table_index' %}">配置中心</a></li> | ||
<li class="active"> {{ table_obj.model_verbose_name }}</li> | ||
</ol> | ||
{% endblock %} | ||
{% block page-content %} | ||
|
||
<div class="panel"> | ||
<div class="panel-heading"> | ||
<h3 class="panel-title">Select {{ table_obj.model_verbose_name }} to change</h3> | ||
</div> | ||
<div class="panel-body"> | ||
<div class="table-responsive"> | ||
<table class="table table-hover"> | ||
<thead> | ||
<tr> | ||
{% if table_obj.list_display %} | ||
{% for column in table_obj.list_display %} | ||
<th>{{ column }}</th> | ||
{% endfor %} | ||
{% else %} | ||
<th>{{ table_obj }}</th> | ||
{% endif %} | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{% for row in table_obj.query_sets %} | ||
<tr> | ||
{% build_table_row row table_obj %} | ||
|
||
</tr> | ||
{% endfor %} | ||
</tbody> | ||
<footer> | ||
<tr> | ||
<td colspan="12" class="footable-visible"> | ||
<div class="pagination"> | ||
|
||
<nav> | ||
<p>共{{ paginator.count }}条数据</p> | ||
<ul class="pagination"> | ||
{% if table_obj.query_sets.has_previous %} | ||
<li class="disabled"> | ||
<a href="{{ request.get_full_path }}?page={{ table_obj.query_sets.previous_page_number }}" aria-label="Previous"><span aria-hidden="true">«</span></a> | ||
</li> | ||
{% endif %} | ||
{% for p_num in paginator.page_range %} | ||
{% render_page_num request table_obj.query_sets p_num %} | ||
{% endfor %} | ||
{% if customer_list.has_next %} | ||
<li> | ||
<a href="{{ request.get_full_path }}?page={{ table_obj.query_sets.next_page_number }}" aria-label="Next"> | ||
<span aria-hidden="true">»</span> | ||
</a> | ||
</li> | ||
{% endif %} | ||
</ul> | ||
</nav> | ||
|
||
</div> <!--end pagination--> | ||
|
||
</td> | ||
</tr> | ||
</footer> | ||
</table> | ||
</div> | ||
</div> | ||
|
||
</div> | ||
|
||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
{% extends 'index.html' %} | ||
{% load custom_tag %} | ||
{% block breadcrumb %} | ||
<ol class="breadcrumb"> | ||
<li><a href="{% url 'table_index' %}">配置中心</a></li> | ||
<li><a href="{% url 'table_list' model_db_table %}">{{ model_name }}</a></li> | ||
<li class="active"> 添加 {{ model_name }}</li> | ||
</ol> | ||
{% endblock %} | ||
|
||
{% block page-content %} | ||
|
||
<div class="panel"> | ||
<div class="panel-heading"> | ||
<h3 class="panel-title">Add {{ model_name }}</h3> | ||
</div> | ||
|
||
<form method="post" onsubmit="return CheckSelectedOptions()" class=" form-horizontal form-padding">{% csrf_token %} | ||
<div class="panel-body"> | ||
{% for field in form_obj %} | ||
<div class="form-group"> | ||
{%if field.field.required%} | ||
<label class="col-md-2 control-label"> | ||
<b>{{field.label}}</b> | ||
</label> | ||
{% else %} | ||
<label class="col-md-2 control-label"> | ||
{{field.label}} | ||
</label> | ||
{% endif %} | ||
<div class="col-md-9"> | ||
{% if field.name not in admin_class.filter_horizontal %} | ||
{{ field }} | ||
{% if field.errors %} | ||
<span style="color: red">{{ field.errors }}</span> | ||
{% endif %} | ||
{% else %} | ||
{% include 'king_admin/filter_horizontal_multi_select.html' %} | ||
{% endif %} | ||
</div> | ||
</div> | ||
{% endfor %} | ||
{{ form_obj.errors }} | ||
</div> <!--end panel-body--> | ||
<div class="panel-footer"> | ||
<div class="row"> | ||
<div class="col-sm-2 "> | ||
<button class="btn btn-danger " type="reset">Delete</button> | ||
</div> | ||
<div class="col-sm-4 "> | ||
<button class="btn btn-info pull-right " type="submit">Save</button> | ||
</div> | ||
</div> | ||
</div> | ||
</form> | ||
|
||
</div> | ||
<script src="/static/js/king_admin/filter_horizontal.js"></script> | ||
|
||
{% endblock %} |
Oops, something went wrong.