Commit 990f35ba authored by Baptiste Mouterde's avatar Baptiste Mouterde Committed by ikoalaz
Browse files

comment: add filename as arg, add user check

parent 7584bd55
# -*- coding: utf-8 -*-
<%page args='id,package_version_id,comment=None'/>
<%page args='id,package_version_id,comment=None,filename=""'/>
<span id='comments${id}'>
<script type="text/javascript">
<script type="text/javascript">
$(document).ready(function () {
highlight(null);
$(".idlink").click(function (event) {
window.location = this;
highlight(event);
});
$("#form").hide();
$(".toggle").click(function () {
var id = "" + this.id;
var to_toggle = id.split('.');
if (to_toggle[1] == 'form') {
$("#related").html(window.getSelection().toString())
$(document).ready(function () {
highlight(null);
$(".idlink").click(function (event) {
window.location = this;
highlight(event);
});
$("#form").hide();
$(".toggle").click(function () {
var id = "" + this.id;
var to_toggle = id.split('.');
if (to_toggle[1] == 'form') {
$("#related").html(window.getSelection().toString())
}
$("#" + to_toggle[1]).show()
}
$("#" + to_toggle[1]).show()
});
});
});
</script>
%if comment is not None:
<%include file='./comment.mako' args='id=id,comment=comment,main_page=True'/>
</script>
%if comment is not None:
<%include file='./comment.mako' args='id=id,comment=comment,main_page=True'/>
</span>
%else:
%if not hasattr(c,'comments'):
<span>no Comments yet,
%else:
%if not hasattr(c,'comments'):
<span>no Comments yet,
%else:
<span>
%endif
%if 'user_id' in session:
<button class="toggle" id='first.form'>comment!</button> </span>
%endif
%if hasattr(c,'comments'):
%for comment in c.comments:
<%include file='./comment.mako' args='id=id,comment=comment'/>
%endfor
%endif
<div id="form${id}">
<%include file='./form.mako' args='id=id,package_version_id=package_version_id'/>
</div>
<span>
%endif
%if 'user_id' in session:
<button class="toggle" id='first.form'>comment!</button> </span>
%endif
%if hasattr(c,'comments'):
%for comment in c.comments:
<%include file='./comment.mako' args='id=id,comment=comment'/>
%endfor
%endif
</span>
%if 'user_id' in session:
<div id="form${id}">
<% print filename %>
<%include file='./form.mako' args='id=id,package_version_id=package_version_id,filename=filename'/>
</div>
<script type="text/javascript">
%if hasattr(c,'fileName') and c.fileName !='':
var filename = '${c.fileName}';
%elif comment is not None :
var filename = '${comment.file}';
%else:
var filename = "";
%endif
$(document).ready(function () {
console.log('loading comment ${id}')
comments(${id}, "${h.url(controller='comments',action='reload_comments')}", '${h.url(controller='comments', action='ajax_call')}', "${h.url(controller='comments',action='score_ajax')}",${package_version_id}, filename);
})
$(document).ready(function () {
console.log('loading comment ${id}')
comments(${id}, "${h.url(controller='comments',action='reload_comments')}", '${h.url(controller='comments', action='ajax_call')}', "${h.url(controller='comments',action='score_ajax')}",${package_version_id}, '${filename}');
})
</script>
%endif
</span>
\ No newline at end of file
%endif
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment