点击左边树形目录 地址随之修改对应的地址

This commit is contained in:
杨树明775174143 2018-08-14 17:50:40 +08:00
parent bdd370c7f3
commit 80de3ec4d5
7 changed files with 17 additions and 10 deletions

View File

@ -44,8 +44,8 @@ def genetree(path,parentdirs):
index = path.find(project_name)
relative_path = path[index+len(project_name):]+"/"+dir
dirname = parentdirs + dir
# ondbclick_str = '<text ondbclick=add_tab("%s","%s","%s")>' %(project_id,relative_path,dirname)
ondbclick_str = '<text ondblclick=add_tab("%s","%s","%s")>' %(project_id,relative_path,dirname)
# ondbclick_str = '<text id="pathName" ondbclick=add_tab("%s","%s","%s")>' %(project_id,relative_path,dirname)
ondbclick_str = '<text id="pathName" ondblclick=add_tab("%s","%s","%s")>' %(project_id,relative_path,dirname)
ondbclick_str += (dirname +"</text>")
# 形成li字符串
@ -62,7 +62,7 @@ def genetree(path,parentdirs):
# 合成ondbclick 字符串
index = path.find(project_name)
relative_path = path[index+len(project_name):]+"/"+file
ondbclick_str = '<text ondblclick=add_tab("%s","%s","%s")>' %(project_id,relative_path,file)
ondbclick_str = '<text id="pathName" ondblclick=add_tab("%s","%s","%s")>' %(project_id,relative_path,file)
ondbclick_str += (file +"</text>")
# 合成li
htmlstr += "<li data-jstree='{\"icon\":\"fa fa-file-code-o color-blue\"}'>"+ ondbclick_str+"</li>"
@ -81,7 +81,7 @@ def getHtml(path):
project_name = path.split("/")[-1]
project_id = str(Project.objects.get(name=project_name).pk)
ondbclick_str = '<text ondblclick=add_tab("%s","%s","%s")>' %(project_id,"",project_name)
ondbclick_str = '<text id="pathName" ondblclick=add_tab("%s","%s","%s")>' %(project_id,"",project_name)
ondbclick_str += (project_name+"</text>")
htmlstr += "<ul><li>"+ ondbclick_str
htmlstr += genetree(path,"")

View File

@ -26,7 +26,7 @@ p, input, table {
}
.color-yellow{
color: #4CD5FC;
color: #2281a9;
}
.color-dark-blue {
@ -1485,11 +1485,10 @@ color: #FFF !important;
margin-left: -5px;
}
.rightimgcomment{
color: red;
font-size: 13px;
background-size: 100% 100%;
height: 14px;
width: 16px;
width: 14px;
}
.rightimgcommentblue{
@ -1497,5 +1496,4 @@ color: #FFF !important;
background-size: 100% 100%;
height: 16px;
width: 16px;
color: blue;
}

View File

@ -28,7 +28,7 @@ Monokai Sublime style. Derived from Monokai by noformnocontent http://nn.mit-lic
.hljs-regexp,
.hljs-literal,
.hljs-link {
color: #ae81ff;
color: #CCC;
}
.hljs-code,

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -663,7 +663,16 @@ function open_tab(path) {
// 如果标签页已经存在,则打开对应的标签页
// 并调用open_tab
function add_tab(project_id,path,filename) {
// var href = window.location.href;
var ip=window.location.host; //端口号
// console.log(window.location.pathname); 端口号后面的路径
var pathName= $("#pathName").text();
var newhtefpath = "/projects/"+pathName+path;
console.log(pathName);
var stateObject = {};
//修改地址栏中的地址
history.pushState(stateObject, ip, newhtefpath);
var tree_node = $("#jstree").jstree("get_selected");
var path_before = path