modify add_para
This commit is contained in:
parent
61559ef051
commit
4e7aa1a3d0
|
@ -17,7 +17,7 @@ Including another URLconf
|
||||||
from django.urls import path
|
from django.urls import path
|
||||||
from .views import ShowIssueQuestionView, ShowAnnotationView, ShowNavigationView
|
from .views import ShowIssueQuestionView, ShowAnnotationView, ShowNavigationView
|
||||||
from .views import AddAnnotationView, AddArticleView, AddQuestionView, AddIssueAnswerView, AddCommentView
|
from .views import AddAnnotationView, AddArticleView, AddQuestionView, AddIssueAnswerView, AddCommentView
|
||||||
from .views import UpdateAnnotationView, UpdateArticleView, UpdateQuestionView, UpdateAnswerView, UpdateCommentView,RightView
|
from .views import UpdateAnnotationView, UpdateArticleView, UpdateQuestionView, UpdateAnswerView, UpdateCommentView,RightView,GetJstreeIdView
|
||||||
from .views import AddVoteView, AcceptAnswerView, ShowMethodInfo, GetHotestIssuesView, Get_CodeReading_Content_View, AddQuestionAnswerView, GetAddtabParasView,ModifyAnnotationView
|
from .views import AddVoteView, AcceptAnswerView, ShowMethodInfo, GetHotestIssuesView, Get_CodeReading_Content_View, AddQuestionAnswerView, GetAddtabParasView,ModifyAnnotationView
|
||||||
|
|
||||||
app_name = "operations"
|
app_name = "operations"
|
||||||
|
@ -43,5 +43,6 @@ urlpatterns = [
|
||||||
path('add_question_answer/',AddQuestionAnswerView.as_view(), name='add_question_answer/'),
|
path('add_question_answer/',AddQuestionAnswerView.as_view(), name='add_question_answer/'),
|
||||||
path('get_addtab_paras/', GetAddtabParasView.as_view(),name='get_addtab_paras/'),
|
path('get_addtab_paras/', GetAddtabParasView.as_view(),name='get_addtab_paras/'),
|
||||||
path('modify_anno/', ModifyAnnotationView.as_view(),name='modify_anno/'),
|
path('modify_anno/', ModifyAnnotationView.as_view(),name='modify_anno/'),
|
||||||
path('right/',RightView.as_view(),name='right/')
|
path('right/',RightView.as_view(),name='right/'),
|
||||||
|
path('get_jstree_id/',GetJstreeIdView.as_view(),name='get_jstree_id/')
|
||||||
]
|
]
|
||||||
|
|
|
@ -53,6 +53,23 @@ def get_group_users(user_id,file_id):
|
||||||
users = User.objects.filter(educoder_userid__in=educoder_userids)
|
users = User.objects.filter(educoder_userid__in=educoder_userids)
|
||||||
return users
|
return users
|
||||||
|
|
||||||
|
class GetJstreeIdView(View):
|
||||||
|
def post(self, request):
|
||||||
|
try:
|
||||||
|
project_id = request.POST.get("project_id","")
|
||||||
|
path = request.POST.get("path","")
|
||||||
|
path_id_map = projectTreeObj.get_project_pathidmap_by_projectid(project_id)
|
||||||
|
jstree_id = None
|
||||||
|
if path == "/":
|
||||||
|
jstree_id= path_id_map[""]
|
||||||
|
else:
|
||||||
|
jstree_id = path_id_map[path]
|
||||||
|
return HttpResponse(json.dumps({"status": "success", "jstree_id":jstree_id}), content_type='application/json')
|
||||||
|
except:
|
||||||
|
return HttpResponse(json.dumps({"status": "fail", "msg":"没有获取到改节点对应的id"}), content_type='application/json')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class ShowAnnotationView(View):
|
class ShowAnnotationView(View):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
@ -1200,7 +1217,7 @@ class GetAddtabParasView(View):
|
||||||
else:
|
else:
|
||||||
first_tabs_jstree_id = path_id_map[path]
|
first_tabs_jstree_id = path_id_map[path]
|
||||||
|
|
||||||
return HttpResponse(json.dumps({"status": "success", "project_id": project.id,"path":path,"filename":filename,"project_jstree_map":path_id_map,"first_tabs_jstree_id":first_tabs_jstree_id}), content_type='application/json')
|
return HttpResponse(json.dumps({"status": "success", "project_id": project.id,"path":path,"filename":filename,"first_tabs_jstree_id":first_tabs_jstree_id}), content_type='application/json')
|
||||||
|
|
||||||
# 可能len(all_symbol)==3对于除了java外其他编程语言会有问题
|
# 可能len(all_symbol)==3对于除了java外其他编程语言会有问题
|
||||||
def getMethodNum(project_path,file_path):
|
def getMethodNum(project_path,file_path):
|
||||||
|
|
|
@ -504,7 +504,7 @@ function show_currentLine(linenum) {
|
||||||
|
|
||||||
function hide_currentLine(linenum) {
|
function hide_currentLine(linenum) {
|
||||||
// document.getElementById("code_" + linenum).style.backgroundColor = 'white';
|
// document.getElementById("code_" + linenum).style.backgroundColor = 'white';
|
||||||
document.getElementById("addanno_" + linenum).style.visibility = "visible";
|
document.getElementById("addanno_" + linenum).style.visibility = "hidden";
|
||||||
}
|
}
|
||||||
|
|
||||||
$(function () {
|
$(function () {
|
||||||
|
@ -804,8 +804,6 @@ function generate_codereading_linestatus(fileid,linenum,annos_count,issues_count
|
||||||
function add_tab(project_id,path,filename) {
|
function add_tab(project_id,path,filename) {
|
||||||
|
|
||||||
// var tree_node = $("#jstree").jstree("get_selected");
|
// var tree_node = $("#jstree").jstree("get_selected");
|
||||||
var tree_node = project_jstree_map[path]
|
|
||||||
console.log(tree_node)
|
|
||||||
var path_before = path
|
var path_before = path
|
||||||
//需要将path处理一下,因为css样式中/以及.是不行的
|
//需要将path处理一下,因为css样式中/以及.是不行的
|
||||||
tmp_index = path.indexOf("#");
|
tmp_index = path.indexOf("#");
|
||||||
|
@ -815,9 +813,6 @@ function add_tab(project_id,path,filename) {
|
||||||
var path_input = path;
|
var path_input = path;
|
||||||
path = path_predeal(path)
|
path = path_predeal(path)
|
||||||
|
|
||||||
// add to path
|
|
||||||
tree_nodes[path]=tree_node
|
|
||||||
|
|
||||||
|
|
||||||
if (tabSet.has(path)) {
|
if (tabSet.has(path)) {
|
||||||
open_tab(path_input)
|
open_tab(path_input)
|
||||||
|
@ -959,7 +954,27 @@ function add_tab(project_id,path,filename) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
cache: false,
|
||||||
|
type: "POST",
|
||||||
|
url: '/operations/get_jstree_id/',
|
||||||
|
data: { 'project_id': project_id, 'path': path_input},
|
||||||
|
dataType: 'json',
|
||||||
|
async: true,
|
||||||
|
beforeSend: function (xhr, settings) {
|
||||||
|
xhr.setRequestHeader("X-CSRFToken", csrftoken);
|
||||||
|
},
|
||||||
|
success: function (data) {
|
||||||
|
if (data.status === 'success') {
|
||||||
|
var tree_node = data.jstree_id
|
||||||
|
tree_nodes[path]=tree_node
|
||||||
|
$('#jstree').jstree("deselect_all", true);
|
||||||
|
$('#jstree').jstree("select_node", tree_nodes[path]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
tabSet.add(path);
|
tabSet.add(path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1442,7 +1457,6 @@ function deal_votetag_color(vote_tag,msg,vote_value){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var project_jstree_map={}
|
|
||||||
|
|
||||||
window.onload = function () {
|
window.onload = function () {
|
||||||
url = window.location.href;
|
url = window.location.href;
|
||||||
|
@ -1466,7 +1480,6 @@ window.onload = function () {
|
||||||
// $('#jstree').jstree("deselect_all", true);
|
// $('#jstree').jstree("deselect_all", true);
|
||||||
// $('#jstree').jstree("select_node", "j1_1355554");
|
// $('#jstree').jstree("select_node", "j1_1355554");
|
||||||
// 第一个标签页对应的id,保存在first_tabs_jstree_id中
|
// 第一个标签页对应的id,保存在first_tabs_jstree_id中
|
||||||
project_jstree_map=data.project_jstree_map
|
|
||||||
|
|
||||||
var first_tabs_jstree_id = data.first_tabs_jstree_id
|
var first_tabs_jstree_id = data.first_tabs_jstree_id
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue