pagure-new/pagure/templates/comment_update.html

69 lines
2.1 KiB
HTML
Raw Normal View History

2016-09-21 23:21:07 +00:00
{% if not is_js %}
{% extends "repo_master.html" %}
{% endif %}
{% block repo %}
<section class="edit_comment">
<form action="{{ request.base_url }}" method="post"
onsubmit="return try_async_comment(this, null)" >
<div class="tabs ui-widget ui-widget-content ui-corner-all"
id="comment_block">
<div id="edit">
<textarea class="form-control" id="update_comment" name="update_comment" style="width:100%;">
{{- comment.comment -}}
</textarea>
</div>
<div>
{{ form.csrf_token }}
<div>
<input type="hidden" name="edit_comment" value="{{ comment.id }}" />
<input type="submit" class="btn btn-primary" value="Update" />
<input type="button" id="comment_update_cancel" class="btn btn-secondary cancel" value="Cancel" {% if not is_js -%}
onclick="history.back();"{% endif %} />
</div>
</form>
</section>
<script>
$.get("{{ url_for('api_ns.api_users') }}", {
pattern: '*'
}).done(function(resp) {
var userConfig = {
at: '@',
data: resp['mention'],
insertTpl: '@${username}',
displayTpl: "<li><img src=\"${image}\"> ${username} <small>${name}</small></li>",
searchKey: "username"
}
$("#update_comment").atwho(userConfig);
});
$.when($.get("{{ url_for('api_ns.api_view_issues', namespace=repo.namespace, repo=repo.name, username=username, status='all') }}"),
$.get("{{ url_for('api_ns.api_pull_request_views', namespace=repo.namespace, repo=repo.name, username=username, status='all') }}")
).done(function(issuesResp, prResp) {
// 0 is the api response
var issuesAndPrs = issuesResp[0]['issues'].concat(prResp[0]['requests']);
var data = $.map(issuesAndPrs, function(ticket, idx) {
return {
name: ticket.id.toString(),
title: $('<div>').text(ticket.title).html()
}
});
var issueAndPrConfig = {
at: '#',
data: data,
insertTpl: '#${name}',
displayTpl: "<li>#${name}<small> ${title}</small></li>",
}
$("#update_comment").atwho(issueAndPrConfig);
})
</script>
{% endblock %}