import TransitionsFormView from './views/transitions-form-view';
import AssignFormView from './views/assign-form-view';
import CommentFormView from './views/comment-form-view';
+import DeleteCommentView from './views/DeleteCommentView';
import SetSeverityFormView from './views/set-severity-form-view';
import SetTypeFormView from './views/set-type-form-view';
import TagsFormView from './views/tags-form-view';
},
deleteComment (e) {
- const that = this;
- const commentKey = $(e.target).closest('[data-comment-key]').data('comment-key');
- const confirmMsg = $(e.target).data('confirm-msg');
- if (confirm(confirmMsg)) {
- this.disableControls();
- return $.ajax({
- type: 'POST',
- url: window.baseUrl + '/api/issues/delete_comment?key=' + commentKey
- }).done(function () {
- that.updateAfterAction(true);
- });
- }
+ e.stopPropagation();
+ $('body').click();
+ const commentEl = $(e.currentTarget).closest('.issue-comment');
+ const commentKey = commentEl.data('comment-key');
+ this.popup = new DeleteCommentView({
+ triggerEl: $(e.currentTarget),
+ bottomRight: true,
+ onDelete: () => {
+ this.disableControls();
+ $.ajax({
+ type: 'POST',
+ url: window.baseUrl + '/api/issues/delete_comment?key=' + commentKey
+ }).done(() => this.updateAfterAction(true));
+ }
+ });
+ this.popup.render();
},
transition (e) {
--- /dev/null
+<div class="text-right">
+ <div class="spacer-bottom">{{t 'issue.comment.delete_confirm_message'}}</div>
+ <button class="button-red">{{t 'delete'}}</button>
+</div>
+
+<div class="bubble-popup-arrow"></div>
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2016 SonarSource SA
+ * mailto:contact AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+import PopupView from '../../common/popup';
+import Template from '../templates/DeleteComment.hbs';
+
+export default PopupView.extend({
+ template: Template,
+
+ events: {
+ 'click button': 'handleSubmit'
+ },
+
+ handleSubmit (e) {
+ e.preventDefault();
+ this.options.onDelete();
+ }
+});