render :partial => 'issue/issue', :locals => {:issue => @issue_results.issues.get(0)}
end
- # Form in a modal window to delete comment
- def delete_comment_form
- verify_ajax_request
- require_parameters :id
- render :partial => 'issue/delete_comment_form'
- end
-
# Delete an existing comment
def delete_comment
verify_post_request
+++ /dev/null
-<form id="delete-comment-form" method="post" action="<%= ApplicationController.root_context -%>/issue/delete_comment">
- <input type="hidden" name="id" value="<%= params[:id] -%>">
- <fieldset>
- <div class="modal-head">
- <h2><%= message 'issue.comment.delete_confirm_title' -%></h2>
- </div>
- <div class="modal-body">
- <div class="info">
- <img src="<%= ApplicationController.root_context -%>/images/information.png" style="vertical-align: text-bottom"/>
- <%= message 'issue.comment.delete_confirm_message' -%>
- </div>
- </div>
- <div class="modal-foot">
- <input type="submit" value="<%= message 'issue.comment.delete_confirm_button' -%>" id="confirm-submit"/>
- <a href="#" onclick="return closeModalWindow()" id="confirm-cancel"><%= h message('cancel') -%></a>
- </div>
- </fieldset>
-</form>
-<script>
- $j("#delete-comment-form").modalForm({
- success: function (html) {
- closeModalWindow();
- var commentElt = $j('#<%= params[:htmlId] -%>');
- var issueElt = commentElt.closest('[data-issue-key]');
- var replaced = $j(html);
- issueElt.replaceWith(replaced);
-
- // re-enable the links opening modal popups
- replaced.find('.open-modal').modal();
- }});
-</script>
\ No newline at end of file
<%= image_tag 'sep12.png' -%>
<a class="link-action" href="#" onclick="return formEditIssueComment(this)"><%= message('edit') -%></a>
- <a class="link-action spacer-right" href="#" onclick="return formDeleteIssueComment(this)"><%= message('delete') -%></a>
+ <a class="link-action spacer-right" href="#" onclick="return deleteIssueComment(this, '<%= escape_javascript(message('issue.comment.delete_confirm_message')) -%>')"><%= message('delete') -%></a>
<% end %>
</h4>
<%= Internal.text.markdownToHtml(comment.markdownText) -%>
return doIssueAction(elt, 'transition', parameters);
}
-function formDeleteIssueComment(elt) {
+function deleteIssueComment(elt, confirmMsg) {
var commentElt = $j(elt).closest("[data-comment-key]");
- var htmlId = commentElt.attr('id');
var commentKey = commentElt.attr('data-comment-key');
- return openModalWindow(baseUrl + '/issue/delete_comment_form/' + commentKey + '?htmlId=' + htmlId, {});
+ var issueElt = commentElt.closest('[data-issue-key]');
+ if (confirm(confirmMsg)) {
+ $j.ajax({
+ type: "POST",
+ url: baseUrl + "/issue/delete_comment?id=" + commentKey,
+ success: function (htmlResponse) {
+ issueElt.replaceWith($j(htmlResponse));
+ }
+ });
+ }
+ return false;
}
function formEditIssueComment(elt) {