Merge branch 'develop' of http://git.trustie.net/wrm1995/codepedia2 into develop

# Conflicts:
#	apps/operations/views.py
#	static/css/code_show.css
#	templates/projects/filesub/annotation.html
#	templates/projects/filesub/code-reading.html
This commit is contained in:
杨树明775174143 2018-08-07 19:51:40 +08:00
commit ffd2f988c1
18 changed files with 3125 additions and 161 deletions

View File

@ -17,7 +17,7 @@ Including another URLconf
from django.urls import path
from .views import ShowIssueQuestionView, ShowAnnotationView, ShowNavigationView
from .views import AddAnnotationView, AddArticleView, AddQuestionView, AddIssueAnswerView, AddCommentView
from .views import UpdateAnnotationView, UpdateArticleView, UpdateQuestionView, UpdateAnswerView, UpdateCommentView
from .views import UpdateAnnotationView, UpdateArticleView, UpdateQuestionView, UpdateAnswerView, UpdateCommentView,RightView
from .views import AddVoteView, AcceptAnswerView, ShowMethodInfo, GetHotestIssuesView, Get_CodeReading_Content_View, AddQuestionAnswerView, GetAddtabParasView,ModifyAnnotationView
app_name = "operations"
@ -42,5 +42,6 @@ urlpatterns = [
path('get_codereading_content/', Get_CodeReading_Content_View.as_view(),name='get_codereading_content'),
path('add_question_answer/',AddQuestionAnswerView.as_view(), name='add_question_answer/'),
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/')
]

View File

@ -16,7 +16,7 @@ from .models import Vote
from users.models import User
from .forms import NewArticleForm
from projects.models import File
from projects.models import Language, Project, FileAnnoIssueSummary
from projects.models import Language, Project, FileSummary
from django.template.loader import render_to_string
import base64
@ -732,8 +732,7 @@ class Get_CodeReading_Content_View(View):
return HttpResponse(json.dumps({"status": "success", "html_str": html_str}), content_type='application/json')
# 根据path确定它是不是文件
# (目前的判断方法是查看File_Anno_Issue_Summary表中是否有parentDir为传入的path,如果有说明是文件夹)
isDir = (len(FileAnnoIssueSummary.objects.filter(project_id=project_id, parent_path=path)) > 0)
if isDir:
isDir = (len(FileAnnoIssueSummary.objects.filter(project_id=project_id,parent_path=path))>0) if isDir:
html_str = get_dir_info(project_id,path)
return HttpResponse(json.dumps({"status": "success", "html_str": html_str,"is_dir":"1"}), content_type='application/json')
else:
@ -741,20 +740,6 @@ class Get_CodeReading_Content_View(View):
return HttpResponse(json.dumps({"status": "success", "html_str": html_str,"is_dir":"0"}), content_type='application/json')
# html_str = html_str.replace('style="background-color: white;"',"")
def get_self_annos_by_fileid(user_id,file_id):
self_anno_map = {}
try:
annos = Annotation.objects.filter(file_id=file_id,user_id=user_id)
for anno in annos:
self_anno_map[str(anno.linenum)] = anno.content
return self_anno_map
except:
return self_anno_map
def get_code(request,project_id,path):
project = Project.objects.filter(id=project_id).first()
file = File.objects.filter(path=path, project_id=project_id).first()
fileid = file.pk
@ -774,11 +759,6 @@ def get_code(request,project_id,path):
for i in questions:
questions_count[str(i['linenum'])] = i['nums']
if request.user.is_authenticated:
self_annos = get_self_annos_by_fileid(request.user.pk,fileid)
else:
self_annos = {}
html_str = render_to_string('projects/filesub/code-reading.html', locals())
return html_str

View File

@ -0,0 +1,33 @@
# Generated by Django 2.0.6 on 2018-07-31 21:15
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('projects', '0009_fileannoissuesummary_parent_path'),
]
operations = [
migrations.CreateModel(
name='FileSummary',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('anno_num', models.IntegerField(default=0, verbose_name='注释总数')),
('isuue_num', models.IntegerField(default=0, verbose_name='问题总数')),
('parent_path', models.CharField(default='', max_length=255, verbose_name='父文件夹路径')),
('line_num', models.IntegerField(default=0, verbose_name='代码总数')),
('method_num', models.IntegerField(default=0, verbose_name='方法总数')),
('file_num', models.IntegerField(default=0, verbose_name='文件总数')),
('file', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='projects.File', verbose_name='文件')),
('project', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='projects.Project', verbose_name='文件')),
],
options={
'verbose_name': '文件汇总',
'verbose_name_plural': '文件汇总',
'db_table': 'File_Summary',
},
),
]

View File

@ -0,0 +1,18 @@
# Generated by Django 2.0.6 on 2018-07-31 22:04
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('projects', '0010_filesummary'),
]
operations = [
migrations.AddField(
model_name='filesummary',
name='current_path',
field=models.CharField(default='', max_length=255, verbose_name='文件路径'),
),
]

View File

@ -133,7 +133,19 @@ class FileAnnoIssueSummary(models.Model):
verbose_name = "文件注释问题总数"
verbose_name_plural = verbose_name
class FileSummary(models.Model):
project = models.ForeignKey(
Project, verbose_name='文件', on_delete=models.CASCADE)
file = models.ForeignKey(File, verbose_name='文件', on_delete=models.CASCADE)
anno_num = models.IntegerField(default=0, verbose_name='注释总数')
isuue_num = models.IntegerField(default=0, verbose_name='问题总数')
parent_path = models.CharField(default="",max_length=255, verbose_name='父文件夹路径')
line_num = models.IntegerField(default=0, verbose_name='代码总数')
method_num = models.IntegerField(default=0, verbose_name='方法总数')
file_num = models.IntegerField(default=0, verbose_name='文件总数')
current_path = models.CharField(default="",max_length=255, verbose_name='文件路径')
class Meta:
db_table = 'File_Summary'
verbose_name = "文件汇总"
verbose_name_plural = verbose_name

View File

@ -9,14 +9,14 @@ from datetime import datetime
from .task import import_project
from .models import Project, File
from .forms import NewProjectForm
from operations.models import Article, Annotation, Issue, QuestionAnswer
from operations.models import Article, Annotation, Issue, QuestionAnswer,AnnotationStrategy
from pure_pagination import Paginator, EmptyPage, PageNotAnInteger
from utils import get_project_tree,scanner_project
logger = logging.getLogger('django')
sourcepath = settings.SOURCEPATH
class NewProjectView(View):
def get(self, request):
project_form = NewProjectForm()
@ -34,6 +34,14 @@ class NewProjectView(View):
try:
# logging.info(str(datetime.now()) + '准备导入工程')
import_project(project_id, root_path)
# scanner_project
scanner_project.get_anno_issue_summary("/opt/opengrok/source/"+project.name, project.id)
# 设置默认的权限,默认为所有人都可以看见
stragegy = AnnotationStrategy()
stragegy.project = project
stragegy.choice = 1
return HttpResponse("Scanner Done!!")
# logging.info(str(datetime.now()) + '导入工程完成')
all_projects = Project.objects.all()
return render(request, 'projects/list.html', locals())
@ -172,8 +180,13 @@ class FileListlView(View):
'hot_objs': hot_blobs,
})
from django.http import HttpResponse
class ScannerProjectView(View):
def get(self,request):
scanner_project.get_anno_issue_summary("/opt/opengrok/source/Notes", 1)
project_name = request.GET.get('project_name','')
try:
project = Project.objects.get(name=project_name)
scanner_project.get_anno_issue_summary("/opt/opengrok/source/"+project_name, project.pk)
return HttpResponse("Scanner Done!!")
except:
return HttpResponse("Scanner Fail!!")

View File

@ -0,0 +1,18 @@
# Generated by Django 2.0.6 on 2018-07-31 21:15
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('users', '0002_emailverifyrecord'),
]
operations = [
migrations.AlterField(
model_name='user',
name='avatar',
field=models.ImageField(default='avatar/users/default.png', upload_to='avatar/'),
),
]

View File

@ -22,6 +22,7 @@ import linecache
# Create your views here.
# 搜索自定义django auther
class CustomBackend(ModelBackend): #通过邮箱登陆
def authenticate(self, email=None, password=None, **kwargs):
try:
@ -143,7 +144,6 @@ class UserInfoAnnoView(View):
all_files = all_annos.order_by('-update_time')
else:
all_files = all_annos.order_by('-voteup')
print(all_annos)
# 根据anno获取到评论的数目
comment_nums = []
for anno in all_annos:
@ -181,7 +181,6 @@ class LoginView(View):
email = request.POST.get('email', '')
pass_word = request.POST.get('password', '')
user = authenticate(email=email, password=pass_word)
print(user)
# 如果本地用户没有获取到前往trustie获取用户
if user is not None:
if user.is_active:

View File

@ -1,7 +1,7 @@
from operations.models import Annotation,Issue
from projects.models import File,Project
from django.db.models import Count
from projects.models import FileAnnoIssueSummary
from projects.models import FileSummary
import os
@ -11,9 +11,13 @@ fileid_issue_sum = {}
fileid_parentpath = {}
filepath_id, fileid_annonum,fileid_issuenum=None,None,None
fileid_method_sum = {}
fileid_file_sum = {}
fileid_line_sum = {}
def get_anno_issue_summary(project_path,project_id):
global project_name, filepath_id, fileid_annonum, fileid_issuenum
global project_name, filepath_id, fileid_annonum, fileid_issuenum,fileid_parentpath,fileid_method_sum,fileid_file_sum,fileid_line_sum,fileid_anno_sum,fileid_issue_sum
project_name = project_path[project_path.rfind('/')+1:]
print(project_name)
@ -24,18 +28,28 @@ def get_anno_issue_summary(project_path,project_id):
# print(filepath_id)
projectAnnoNum,projectIssueNum=deepSearch(project_path)
projectMethods,projectFiles,projectLines = deepSearchForMethod(project_path)
root_fileid = filepath_id[""]
fileid_anno_sum[root_fileid]=projectAnnoNum
fileid_issue_sum[root_fileid]=projectIssueNum
fileid_parentpath[root_fileid]="self"
fileid_file_sum[root_fileid]=projectFiles
fileid_method_sum[root_fileid]=projectMethods
fileid_line_sum[root_fileid]=projectLines
save(project_id)
def save(project_id):
for file_id in filepath_id.values():
print(file_id)
obj = FileAnnoIssueSummary()
try:
obj = FileSummary.objects.get(file_id=file_id)
except:
print(111)
obj = FileSummary()
obj.file = File.objects.get(pk=file_id)
obj.project = Project.objects.get(pk=project_id)
@ -44,12 +58,15 @@ def save(project_id):
obj.anno_num = fileid_anno_sum[file_id]
obj.isuue_num = fileid_issue_sum[file_id]
obj.parent_path = fileid_parentpath[file_id]
obj.file_num = fileid_file_sum[file_id]
obj.line_num = fileid_line_sum[file_id]
obj.method_num = fileid_method_sum[file_id]
obj.current_path = obj.file.path
obj.save()
def deepSearch(current_path):
global fileid_anno_sum,fileid_issue_sum
global fileid_anno_sum,fileid_issue_sum,fileid_parentpath
index=current_path.find(project_name)
files = os.listdir(current_path)
@ -60,8 +77,8 @@ def deepSearch(current_path):
filePath = current_path + os.path.sep + files[i]
# print(filePath)
relative_path = filePath[index+len(project_name):]
#相对路径是否在filepath_id中可能会有这样的情况
#路径没有对应的file_id也就是当前路劲没有收录
# 相对路径是否在filepath_id中可能会有这样的情况
# 路径没有对应的file_id也就是当前路劲没有收录
if relative_path not in filepath_id:
continue
file_id = filepath_id[relative_path]
@ -132,3 +149,77 @@ def getFileIssueInfo(project_id):
else:
fileid_issuenum[issue.file_id] = 1
return fileid_issuenum
def deepSearchForMethod(current_path):
global fileid_method_sum,fileid_line_sum,fileid_file_sum
index=current_path.find(project_name)
files = os.listdir(current_path)
currentFiles = 0
currentLines = 0
currentMethods = 0
for i in range(len(files)):
filePath = current_path + os.path.sep + files[i]
# print(filePath)
relative_path = filePath[index+len(project_name):]
# 相对路径是否在filepath_id中可能会有这样的情况
# 路径没有对应的file_id也就是当前路劲没有收录
if relative_path not in filepath_id:
continue
file_id = filepath_id[relative_path]
# 获取当前文件/文件夹下的问题和注释总数
if os.path.isdir(filePath):
methods,filenum,lines= deepSearchForMethod(filePath)
fileid_method_sum[file_id] = methods
currentMethods += fileid_method_sum[file_id]
fileid_file_sum[file_id] = filenum
currentFiles += fileid_file_sum[file_id]
fileid_line_sum[file_id] = lines
currentLines += fileid_line_sum[file_id]
else:
fileid_method_sum[file_id] = getFileMethodCount(project_name,relative_path)
currentMethods += fileid_method_sum[file_id]
fileid_file_sum[file_id] = 1
currentFiles += fileid_file_sum[file_id]
fileid_line_sum[file_id] = getFileLineNum(project_name,relative_path)
currentLines += fileid_line_sum[file_id]
return currentMethods,currentFiles,currentLines
import json
from django.conf import settings
import requests
# 获取单个文件的Method个数
# 这个和之前的不一样之前的是通过遍历数据库表例如Annotation表和Issue表
# 但是这个在数据库表中并无记录
def getFileMethodCount(project_path,file_path):
try:
navigation_url = settings.OPENGROK_NAVIGATION_URL
navigation_url = navigation_url +project_path + file_path
response = requests.get(navigation_url).text
project_id = Project.objects.get(name=project_path)
file_id = File.objects.get(project_id=project_id,path=file_path).pk
response = response.replace("]],[","]]|[")
if response:
all_symbols = response.split("|")
if len(all_symbols)==3:
symbol = json.loads(all_symbols[2])
return len(symbol[2])
return 0;
except:
return 0;
def getFileLineNum(project_path,file_path):
path ="/opt/opengrok/source/"+project_path+file_path
try:
return len(open(path,'rU').readlines())
except:
return 0;

2661
nohup.out

File diff suppressed because it is too large Load Diff

View File

@ -25,6 +25,7 @@ p, input, table {
word-wrap: break-word;
}
}
.color-yellow{
color: #FFC90E;
}
@ -37,6 +38,9 @@ p, input, table {
color: #575757;
}
.fontcolor-white{
color: white;
}
.color-grey-des {
color: #808080;
}
@ -499,11 +503,13 @@ a:hover {
}
.panel-right {
color: #EBEBEB;
font-size:13px;
display: block;
float: left;
flex: 1;
padding-left: 30px;
}
.middle-area {
@ -1141,6 +1147,14 @@ pre.prettyprint {
color: black;
}
.path_info img{
cursor: pointer;
}
.path_info i{
cursor: pointer;
}
.filePathInfo {
background-color: #26292b!important;
width: 100%;
@ -1217,9 +1231,10 @@ color: #FFF !important;
.info-nav{
color: #FFF;
}
.path_infonav span{
/* .path_infonav span{
color: #FFF;
}
} */
/* nav-right */
.navbar-right {
@ -1436,4 +1451,10 @@ color: #FFF !important;
margin: 4px 0px 0px 5px;
width: 27px;
padding-left: 7px;
}
.modify_anno{
float: right;
margin-right: 20px;
color: blue;
}

View File

@ -42,7 +42,6 @@ function show_annotation(file_id, line_num) {
$("#ItemcommentPanel").remove()
var html="<div id='ItemcommentPanel'>"+data.html_str+"</div>"
$("#linestatus_"+file_id+"_"+line_num).append(html);
}else{
alert(data.msg)
}
@ -621,7 +620,9 @@ function mouseCoords(ev) {
}
var tabSet = new Set();
var issue_map = new Map();
// var issue_map = new Map();
var right_map = new Map();
var tree_nodes = new Map();
function path_predeal(path){
// path = path.replace('.', '');
@ -637,6 +638,9 @@ function open_tab(path) {
path_input=path
path = path_predeal(path)
$('#jstree').jstree("deselect_all", true);
$('#jstree').jstree("select_node", tree_nodes[path]);
var tabcontent = document.getElementsByClassName("codereading");
for (var i = 0; i < tabcontent.length; i++) {
tabcontent[i].style.display = "none";
@ -653,11 +657,18 @@ function open_tab(path) {
document.getElementById("tab_" + path).className += " active";
document.getElementsByClassName("filename")[0].innerHTML = path_input;
if(!issue_map.has(path)){
window.setTimeout(function () { $("#hotest_issue").html(issue_map[path]) }, 3000);
if(!right_map.has(path)){
window.setTimeout(function () { $("#right_panel").html(right_map[path]) }, 3000);
}else{
$("#hotest_issue").html(issue_map[path]);
$("#right_panel").html(right_map[path]);
}
// if(!issue_map.has(path)){
// window.setTimeout(function () { $("#hotest_issue").html(issue_map[path]) }, 3000);
// }else{
// $("#hotest_issue").html(issue_map[path]);
// }
show_navigation();
}
// 添加一个新的标签页,
@ -666,12 +677,15 @@ function open_tab(path) {
// 并调用open_tab
function add_tab(project_id,path,filename) {
var tree_node = $("#jstree").jstree("get_selected");
var path_before = path
//需要将path处理一下因为css样式中/以及.是不行的
tmp_index = path.indexOf("#");
if(tmp_index != -1){
path = path.substring(0,tmp_index)
}
var path_input = path;
path = path_predeal(path)
@ -768,13 +782,33 @@ function add_tab(project_id,path,filename) {
open_tab(path_input);
// 现在Hotest Question 模块先不用了
// // 填充hotest_question
// $.ajax({
// cache: false,
// type: "POST",
// url: '/operations/get_hotest_issues/',
// data: { 'project_id': project_id, 'path': path_input,"question_num":5 },
// dataType: 'json',
// async: true,
// beforeSend: function (xhr, settings) {
// xhr.setRequestHeader("X-CSRFToken", csrftoken);
// },
// success: function (data) {
// if (data.status === 'success') {
// issue_map[path] = data.html_str;
// }
// else {
// issue_map[path] = ""
// }
// }
// });
// 填充hotest_question
$.ajax({
cache: false,
type: "POST",
url: '/operations/get_hotest_issues/',
data: { 'project_id': project_id, 'path': path_input,"question_num":5 },
url: '/operations/right/',
data: { 'project_id': project_id, 'path': path_input},
dataType: 'json',
async: true,
beforeSend: function (xhr, settings) {
@ -782,14 +816,15 @@ function add_tab(project_id,path,filename) {
},
success: function (data) {
if (data.status === 'success') {
issue_map[path] = data.html_str;
right_map[path] = data.html_str;
}
else {
issue_map[path] = ""
right_map[path] = ""
}
}
});
tree_nodes[path]=tree_node
tabSet.add(path);
}
}
@ -872,6 +907,96 @@ function add_dir_annotation(item, file_id, line_num){
}
}
function show_dir_annotation(file_id){
ev = window.event;
var mousePos = mouseCoords(ev);
$.ajax({
cache: false,
type: "POST",
url: '/operations/show_annotation/',
data: { 'file_id': file_id, 'line_num': 0 },
dataType: 'json',
async: true,
beforeSend: function (xhr, settings) {
xhr.setRequestHeader("X-CSRFToken", csrftoken);
},
success: function (data) {
if (data.status === "success") {
console.log(1111)
//console.log("linestatus_"+line_num);
//$("#loadCommentpanel").html(data.html_str);
//$("#commentPanel").css("top", mousePos.y);
//$("#commentPanel").css("left", mousePos.x+35);
//$("#loadCommentpanel").show();
//console.log(data.html_str);
$("#ItemcommentPanel").remove()
var html="<div id='ItemcommentPanel' style='margin-top: 70px;'>"+data.html_str+"</div>"
$("#dir_anno_"+file_id).append(html);
}else{
alert(data.msg)
}
}
});
}
function show_dir_issue_question(file_id){
ev = window.event;
var mousePos = mouseCoords(ev)
//发送问题id返回问题内容
$.ajax({
cache: false,
type: "POST",
url: '/operations/show_issue_question/',
data: { 'file_id': file_id, 'line_num': 0, 'issue_ids': "[]"},
dataType: 'json',
async: true,
beforeSend: function (xhr, settings) {
xhr.setRequestHeader("X-CSRFToken", csrftoken);
},
success: function (data) {
if(data.status=='success'){
var html="<div id='ItemquestionPanel' style='margin-top:70px;'>"+data.html_str+"</div>";
$("#dir_question_"+file_id).append(html);
// $("#loadQuestionpanel").html(data.html_str);
if (data.issueAnswers) {
//字符串转换成整型数组
var dataStrArr = issueid_str.substring(1, issueid_str.length - 1).split(",")
var issue_ids = dataStrArr.map(function (data) {
return +data;
});
//
issueAnswers = JSON.parse(data.issueAnswers);
issueStandardAnswers = JSON.parse(data.issueStandardAnswers);
let count = 0;
for (let i = 0; i < issue_ids.length; i++) {
issue_id = issue_ids[i]
if (issue_id == issueAnswers[count].fields.issue) {
var radios = document.getElementsByName("issue_" + issue_id)
user_answer = issueAnswers[0].fields.content;
standard_answer = issueStandardAnswers[0].fields.choice_position;
if (user_answer == standard_answer) {
radios[user_answer - 1].parentNode.style.color = "green";
} else {
radios[parseInt(user_answer) - 1].parentNode.style.color = "red";
radios[parseInt(standard_answer) - 1].parentNode.style.color = "green";
}
document.getElementById("submit_onechoice_" + issue_id).style.display = "None";
count = count + 1
}
}
}
//$("#questionPanel").css("top", mousePos.y);
//$("#questionPanel").css("left", mousePos.x - 400);
//$("#loadQuestionpanel").show();
}else{
alert(data.msg)
}
}
});
}
function submint_dir_annotation(file_id, line_num, content) {
@ -894,7 +1019,9 @@ function submint_dir_annotation(file_id, line_num, content) {
$("#dir_anno_" + +file_id).html(parseInt(value) + 1);
}
}
alert(data.msg);
$(".addno-panel").hide();
$(".source-addno-panel").remove();
show_dir_annotation(file_id);
}
});
}
@ -920,7 +1047,9 @@ function submint_dir_question(file_id, line_num, content) {
$("#dir_question_" + +file_id).html(parseInt(value) + 1);
}
}
alert(data.msg);
$(".addno-panel").hide();
$(".source-addno-panel").remove();
show_dir_issue_question(file_id);
}
});
}
@ -970,6 +1099,9 @@ window.onload = function () {
},
success: function (data) {
if (data.status === 'success') {
// 展开当前标签对应的节点
// $('#jstree').jstree("deselect_all", true);
// $('#jstree').jstree("select_node", "j1_1355554");
add_tab(data.project_id, data.path, data.filename)
}
}

View File

@ -1,29 +0,0 @@
# class CustomBackend(ModelBackend):
# def authenticate(self, username=None, password=None, **kwargs):
# try:
# user = UserProfile.objects.get(Q(username=username)|Q(email=username))
# if user.check_password(password):
# return user
# except Exception as e:
# return None
#
#
# # 使用类来完成登录功能
# class LoginView(View):
# def get(self, request):
# return render(request, "login.html", {})
#
# def post(self, request):
# login_form = LoginForm(request.POST)
# if login_form.is_valid():
# user_name = request.POST.get("username", "")
# pass_word = request.POST.get("password", "")
# user = authenticate(username=user_name, password=pass_word)
# if user is not None:
# login(request,user)
# return render(request,"index.html")
# else:
# return render(request, "login.html", {"msg": "用户名或密码错误"})
#
# else:
# return render(request,"login.html", {'login_form': login_form})

View File

@ -3,42 +3,10 @@
<p class="ques-title">
该代码块共有{{annos|length}}个注释
</p>
{% for anno in annos%}
<div class="fl thumbsThis topthumbsThis">
<p><i class="fa fa-play color-grey-c deg270" aria-hidden="true" onclick="thumbsAnno(this,{{anno.pk}},1)"></i> </p>
<p class="thumbsThisnth2"><span id="annosum">{{ anno.vote }}</span></p>
<p><i class="fa fa-play color-grey-c deg90" aria-hidden="true" onclick="thumbsAnno(this,{{anno.pk}},1)"></i> </p>
</div>
<div class="fl commentparthalf">
<div class="parthalf_con clearfix">
<span class="fl break_word color-grey-des colorblack inlineBlock wi216" >{{ forloop.counter }}.{{ anno.content }}</span>
</div>
</div>
<div class="parthalf_comment">
<div class="comment-btn clearfix">
<span class="color-grey-des inlineBlock marbox">{{anno.user.nick_name}}</span>
<a href="javascript:void(0)" class="btn btn-blue fr" onclick="addcomments(this)" id="addcom">添加评论</a>
<div class="comment-write clearfix none">
<textarea class="writetext" id="writetext_{{ anno.pk }}" placehoder="请输入评论内容"></textarea>
<a href="javascript:void(0)" class="btn fr" onclick="cancelcom(this)">取消</a>
<a href="javascript:void(0)" class="btn btn-blue fr" style="margin-right:10px;" onclick='add_comment_action(this,{{ anno.pk }},"annotation")'>添加评论</a>
</div>
</div>
</div>
{% for comment in anno_comments %}
<div class="fl thumbsThis newtopthumbs">
<p><i class="fa fa-play color-grey-c deg270" aria-hidden="true" onclick="thumbsAnno(this,{{anno.pk}},1)"></i> </p>
{# <p><i class="fa fa-thumbs-up mr3 color-grey-c"></i></p>#}
<p class="thumbsThisnth2"><span id="annosum">{{ anno.vote }}</span></p>
<p><i class="fa fa-play color-grey-c deg90" aria-hidden="true" onclick="thumbsAnno(this,{{anno.pk}},1)"></i> </p>
{# <p><i class="fa fa-thumbs-down mr3 color-grey-c" ></i></p>#}
</div>
{% if comment.annotation.pk == anno.pk %}
{% if comment.annotation.pk == self_anno.pk %}
<div class="comment-item">
<span class="color-grey-des mr10 colorblack inlineBlock fl ellipsis" title="{{ comment.content }}">{{ comment.content }}</span>
<span class="color-grey-des inlineBlock fr">{{ comment.user.nick_name }}</span>
@ -47,6 +15,43 @@
{% endif %}
{% endfor %}
{% endfor %}
{% else %}
<h5>其他人的注释:</h5>
{% for anno in annos%}
{% if self_anno is None or anno.id != self_anno.id %}
<div class="commentparthalf">
<div class="parthalf_con clearfix">
<div class="fl thumbsThis">
<p><i class="fa fa-thumbs-up mr3 color-grey-c" onclick="thumbsAnno(this,{{anno.pk}},1)"></i></p>
<p><span id="annosum">{{ anno.vote }}</span></p>
<p><i class="fa fa-thumbs-down mr3 color-grey-c" onclick="thumbsAnno(this,{{anno.pk}},1)"></i></p>
</div>
<span class="fr break_word color-grey-des colorblack inlineBlock wi216" >{{ forloop.counter }}.{{ anno.content }}</span>
<div class="parthalf_comment">
<div class="comment-btn clearfix">
<span class="color-grey-des inlineBlock marbox">{{anno.user.nick_name}}</span>
<a href="javascript:void(0)" class="btn btn-blue fr" onclick="addcomments(this)" id="addcom">添加评论</a>
<div class="comment-write clearfix none">
<textarea class="writetext" id="writetext_{{ anno.pk }}" placehoder="请输入评论内容"></textarea>
<a href="javascript:void(0)" class="btn fr" onclick="cancelcom(this)">取消</a>
<a href="javascript:void(0)" class="btn btn-blue fr" style="margin-right:10px;" onclick='add_comment_action(this,{{ anno.pk }},"annotation")'>添加评论</a>
</div>
</div>
</div>
</div>
{% for comment in anno_comments %}
{% if comment.annotation.pk == anno.pk %}
<div class="comment-item">
<span class="color-grey-des mr10 colorblack inlineBlock fl ellipsis" title="{{ comment.content }}">{{ comment.content }}</span>
<span class="color-grey-des inlineBlock fr">{{ comment.user.nick_name }}</span>
<div class="clear"></div>
</div>
{% endif %}
{% endfor %}
</div>
{% endif %}
{% endfor %}
{% endif %}
</div>
</div>

View File

@ -38,8 +38,7 @@
<div id="{{fileid}}_L{{ linenum }}" class="codeline codelinebox" onmouseover="show_currentLine('{{fileid}}_{{linenum}}')" onmouseout="hide_currentLine('{{fileid}}_{{linenum}}')">
<div class="linenum">{{ linenum }}</div>
<div class="sourcecode">
<div class="sourcecode">
<pre class="mypre">
{{line}}
</pre>

View File

@ -3,12 +3,12 @@
<span class="fl font-20 colorFFF">目录信息</span>
<p class="fr">
<span class="fl mr15 mt7">
<img src="/static/image/annotation.png" class="mr3">
<span class="font-12" id="dir_anno_{{file_id}}">{{anno_num}}</span>
<img src="/static/image/annotation.png" onclick="show_dir_annotation({{file_id}})" class="mr3">
<span class="font-12 fontcolor-white" id="dir_anno_{{file_id}}">{{anno_num}}</span>
</span>
<span class="fl mr15 mt7">
<img src="/static/image/question.png" class="mr3">
<span class="font-12" id="dir_question_{{file_id}}">{{question_num}}</span>
<img src="/static/image/question.png" onclick="show_dir_issue_question({{file_id}})" class="mr3">
<span class="font-12 fontcolor-white" id="dir_question_{{file_id}}">{{question_num}}</span>
</span>
<span class="fl mt7" onclick="show_next_addnoPanel({{file_id}})">
@ -29,6 +29,20 @@
</p>
</div>
<div class="filePathInfo">
<div class="clearfix filePathline">
<span>
<label>代码行数</label>
<label>{{line_sum}}</label>
</span>
<span>
<label>方法数</label>
<label>{{method_sum}}</label>
</span>
<span>
<label>文件数</label>
<label>{{file_sum}}</label>
</span>
</div>
<div class="clearfix filePathline">
<span>
<label>标注文件数</label>

View File

@ -0,0 +1,29 @@
<!-- 这个是文件的信息 -->
<div class="middle-right-item">
<p class="right-item-title">File Infomation</p>
<p class="clearfix">
<span class="panel-left">methods</span>
<span class="panel-right">{{method_num}}</span>
</p>
<p class="clearfix">
<span class="panel-left">lines</span>
<span class="panel-right">{{filelinenum}}</span>
</p>
<p class="clearfix">
<span class="panel-left">view</span>
<span class="panel-right">{{view_num}}</span>
</p>
<p class="clearfix">
<span class="panel-left">annotation</span>
<span class="panel-right">{{anno_num}}</span>
</p>
<p class="clearfix">
<span class="panel-left">questions</span>
<span class="panel-right">{{issue_num}}</span>
</p>
</div>
<!-- 相关文档链接 -->
<!-- <div class="middle-right-item">
<p class="right-item-title">Relatvie Links</p>
</div> -->

View File

@ -133,41 +133,8 @@
</div>
</div>
<div class="fl middle-right">
<div class="middle-right-item">
<p class="right-item-title">Project Infomation</p>
<p class="clearfix">
<span class="panel-left">Created</span>
<span class="panel-right">2018年4月22日 11:19</span>
</p>
<p class="clearfix">
<span class="panel-left">Views</span>
<span class="panel-right">392</span>
</p>
<p class="clearfix">
<span class="panel-left">Active</span>
<span class="panel-right">2018年4月22日 11:19</span>
</p>
<p class="clearfix">
<span class="panel-left">Source</span>
<span class="panel-right color-blue">GitHub/MiNote
<br/>OSSEAN/Minote</span>
</p>
</div>
<div class="middle-right-item">
<p class="right-item-title">Project Description</p>
<p class="right-description">This method was deprecated in API level 23 as of JDK version 1.1</p>
<div class="des clearfix">
<span>style</span>
<span>script</span>
<span>script</span>
</div>
</div>
<div class="middle-right-item" id="hotest_issue">
</div>
<div class="fl middle-right" id="right_panel">
</div>
</div>
</div>