codepedia2/templates/projects/filesub/annotation.html

203 lines
13 KiB
HTML

{% load base_filter %}
<div class="pr">
<div class="commentPanel" id="commentPanel">
{% if linenum == 0 %}
{% if isdir == 0 %}
<p class="ques-title">
{% comment %} 您可见{{ annos|length }}个注释 {% endcomment %}
该代码文件共有{{ annotation_length }}个注释
</p>
{% endif %}
{% if isdir == 1 %}
<p class="ques-title">
该代码模块共有{{ annotation_length }}个注释
</p>
{% endif %}
{% else %}
<p class="ques-title">
该行或该代码块共有{{annotation_length}}个注释
</p>
{% endif %}
{% for self_anno in self_annos%}
<div class="fl thumbsThis topthumbsThis">
{% if self_anno.id in anno_vote_map and anno_vote_map|keyValue:self_anno.id == 1 %}
<p><i class="fa fa-play thumbs_active deg270" aria-hidden="true" onclick="thumbsAnno(this,{{self_anno.pk}},1)"></i> </p>
{% else %}
<p><i class="fa fa-play deg270" aria-hidden="true" onclick="thumbsAnno(this,{{self_anno.pk}},1)"></i> </p>
{% endif %}
{% if self_anno.voteup == 0 %}
<p class="thumbsThisnth2 thumbsThisnthnew"><span id="annosum_{{self_anno.id}}">{{ self_anno.voteup | add:self_anno.votedown }}</span></p>
{% endif %}
{% if self_anno.voteup > 9 %}
<p class="thumbsThisnth2 thumbsThisnthnew" style="margin-left: -3px;"><span id="annosum_{{self_anno.id}}">{{ self_anno.voteup | add:self_anno.votedown }}</span></p>
{% endif %}
{% if self_anno.voteup > 99 %}
<p class="thumbsThisnth2 thumbsThisnthnew" style="margin-left: -7px;"><span id="annosum_{{self_anno.id}}">{{ self_anno.voteup | add:self_anno.votedown }}</span></p>
{% endif %}
{% if self_anno.id in anno_vote_map and anno_vote_map|keyValue:self_anno.id == -1 %}
<p><i class="fa fa-play thumbs_active deg90" aria-hidden="true" onclick="thumbsAnno(this,{{self_anno.pk}},-1)"></i> </p>
{% else %}
<p><i class="fa fa-play deg90" aria-hidden="true" onclick="thumbsAnno(this,{{self_anno.pk}},-1)"></i> </p>
{% endif %}
</div>
<div class="fl commentparthalf">
<div class="parthalf_con clearfix">
<textarea id="modify_anno_textarea" class="fl break_word color-grey-des colorblack inlineBlock wi216" oninput="Input_modifyAnno(this,{{self_anno.file_id}},{{self_anno.linenum}},{{self_anno.id}})" style="border:none" readonly>{{ self_anno.content }}</textarea>
<a class="modify-anno btn fr mt10 mb10" style="background-color:brown;margin-left:5px" id="delete_anno" href="javascript:void(0)" onclick="delete_anno({{self_anno.file_id}},{{self_anno.linenum}},{{self_anno.id}})">删除</a>
{% if allow_modify %}
<a class="modify-anno btn btn-blue fr mt10 mb10" id="modification" href="javascript:void(0)" onclick="inject_modifyAnno_html(this,{{self_anno.file_id}},{{self_anno.linenum}},{{self_anno.id}})">修改</a>
{% endif %}
{% if self_anno.user.nick_name == "" %}
<span class="color-grey-des inlineBlock marbox fr mt11">{{self_anno.user.username}}</span>
{% else %}
<span class="color-grey-des inlineBlock marbox fr mt11">{{self_anno.user.nick_name}}</span>
{% endif %}
</div>
</div>
<div class="parthalf_comment">
<div class="comment-btn clearfix borderbottom borderbottombox">
<a href="javascript:void(0)" class="btn btn-blue fr" onclick="addcomments(this,{{ self_anno.pk }})" >评论</a>
<div class="comment-write clearfix none">
<textarea class="writetext" id="writetext_{{ self_anno.pk }}" oninput="Input_writetext(this,{{ self_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,{{ self_anno.pk }},"annotation")'>评论</a>
</div>
</div>
</div>
{% for comment in anno_comments %}
{% if comment.annotation.pk == self_anno.pk %}
<div class="fl thumbsThis newtopthumbs">
{% comment %}
<div class="fl">
{% if comment.id in comment_vote_map and comment_vote_map|keyValue:comment.id == 1 %}
<p style="height:10px;" class="margin003"><i class="fa fa-play thumbs_active deg270" aria-hidden="true" onclick="thumbsComment(this,{{comment.pk}},1)"></i> </p>
{% else %}
<p class="margin003"><i class="fa fa-play deg270" aria-hidden="true" onclick="thumbsComment(this,{{comment.pk}},1)"></i> </p>
{% endif %}
<p class="margin023 thumbsThisnth2"><span id="comment_{{comment.pk}}">{{ comment.voteup | add:comment.votedown}}</span></p>
{% if comment.id in comment_vote_map and comment_vote_map|keyValue:comment.id == -1 %}
<p><i class="fa fa-play thumbs_active deg90" aria-hidden="true" onclick="thumbsComment(this,{{comment.pk}},-1)"></i> </p>
{% else %}
<p><i class="fa fa-play deg90" aria-hidden="true" onclick="thumbsComment(this,{{comment.pk}},-1)"></i> </p>
{% endif %}
</div>
{% endcomment %}
<div class="comment-item fl">
<span class="color-grey-des mr10 colorgray inlineBlock fl ellipsis" title="{{ comment.content }}">{{ comment.content }}</span>
{% comment %} <textarea id="modify_anno_textarea" class="fl break_word color-grey-des colorblack inlineBlock wi216" oninput="Input_modifyAnno(this,{{self_anno.file_id}},{{self_anno.linenum}},{{self_anno.id}})" style="border:none" readonly>{{ self_anno.content }}</textarea> {% endcomment %}
{% if is_annoy_comment %}
<span class="color-grey-des inlineBlock marbox fr mt11">用户-{{comment.user.id}}</span>
{% else %}
{% if comment.user.nick_name == "" %}
<span class="color-grey-des inlineBlock marbox fr mt11">{{comment.user.username}}</span>
{% else %}
<span class="color-grey-des inlineBlock fr inlineBlockfont">{{ comment.user.nick_name }}</span>
{% endif %}
{% endif %}
<div class="clear"></div>
</div>
</div>
{% endif %}
{% endfor %}
{% endfor %}
{% for anno in annos%}
{% if anno not in self_annos %}
<div class="fl thumbsThis topthumbsThis">
<!-- 是否已经点过赞的判断 -->
{% if anno.id in anno_vote_map and anno_vote_map|keyValue:anno.id == 1 %}
<p><i class="fa fa-play thumbs_active deg270" aria-hidden="true" onclick="thumbsAnno(this,{{anno.pk}},1)"></i> </p>
{% else %}
<p><i class="fa fa-play deg270" aria-hidden="true" onclick="thumbsAnno(this,{{anno.pk}},1)"></i> </p>
{% endif %}
<p class="thumbsThisnth2"><span id="annosum_{{anno.id}}">{{ anno.voteup | add:anno.votedown }}</span></p>
{% if anno.id in anno_vote_map and anno_vote_map|keyValue:anno.id == -1 %}
<p><i class="fa fa-play thumbs_active deg90" aria-hidden="true" onclick="thumbsAnno(this,{{anno.pk}},-1)"></i> </p>
{% else %}
<p><i class="fa fa-play deg90" aria-hidden="true" onclick="thumbsAnno(this,{{anno.pk}},-1)"></i> </p>
{% endif %}
</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 borderbottom">
<a href="javascript:void(0)" class="btn btn-blue fr" onclick="addcomments(this,{{ anno.pk }})" >评论</a>
{% if anno.user.nick_name == "" %}
<span class="color-grey-des inlineBlock fr inlineBlockfont">{{ anno.user.username }}</span>
{% else %}
<span class="color-grey-des inlineBlock fr inlineBlockfont">{{ anno.user.nick_name }}</span>
{% endif %}
<div class="comment-write clearfix none">
<textarea class="writetext" id="writetext_{{ anno.pk }}" oninput="Input_writetext(this,{{ 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 %}
{% if comment.annotation.pk == anno.pk %}
<div class="fl thumbsThis newtopthumbs">
{% comment %}
<div class="fl">
{% if comment.id in comment_vote_map and comment_vote_map|keyValue:comment.id == 1 %}
<p class="margin003"><i class="fa fa-play thumbs_active deg270" aria-hidden="true" onclick="thumbsComment(this,{{comment.pk}},1)"></i> </p>
{% else %}
<p class="margin003"><i class="fa fa-play deg270" aria-hidden="true" onclick="thumbsComment(this,{{comment.pk}},1)"></i> </p>
{% endif %}
<p class="margin023 thumbsThisnth2"><span id="comment_{{comment.pk}}">{{ comment.voteup | add:comment.votedown}}</span></p>
{% if comment.id in comment_vote_map and comment_vote_map|keyValue:comment.id == -1 %}
<p><i class="fa fa-play thumbs_active deg90" aria-hidden="true" onclick="thumbsComment(this,{{comment.pk}},-1)"></i> </p>
{% else %}
<p><i class="fa fa-play deg90" aria-hidden="true" onclick="thumbsComment(this,{{comment.pk}},-1)"></i> </p>
{% endif %}
</div>
{% endcomment %}
<div class="fl comment-item">
<span class="color-grey-des mr10 colorgray inlineBlock fl ellipsis" title="{{ comment.content }}">{{ comment.content }}</span>
{% if is_annoy_comment %}
<span class="color-grey-des inlineBlock marbox fr mt11">用户-{{comment.user.id}}</span>
{% else %}
{% if comment.user.nick_name == "" %}
<span class="color-grey-des inlineBlock marbox fr mt11">{{comment.user.username}}</span>
{% else %}
<span class="color-grey-des inlineBlock fr inlineBlockfont">{{ comment.user.nick_name }}</span>
{% endif %}
{% endif %}
<div class="clear"></div>
</div>
</div>
{% endif %}
{% endfor %}
{% endif %}
{% endfor %}
</div>
</div>