Show edit and delete buttons for comments that can be edited by the user

This commit is contained in:
Maximilian Grundke
2017-08-24 11:48:26 +02:00
parent b64809c4b9
commit 771793f32e
2 changed files with 22 additions and 3 deletions

View File

@ -65,9 +65,13 @@ p.comment {
margin-bottom: 10px; margin-bottom: 10px;
} }
.popover-action-button {
display: none;
}
#otherComments { #otherComments {
h5 { h5 {
margin-top: 0px; margin-top: 0;
} }
.container { .container {
@ -75,6 +79,15 @@ p.comment {
max-height: 200px; max-height: 200px;
overflow-y: auto; overflow-y: auto;
border: 1px solid #cccccc; border: 1px solid #cccccc;
.popover-actions {
display: flex;
.popover-action-button {
display: block;
margin-right: 5px;
}
}
} }
} }

View File

@ -193,8 +193,14 @@ also, all settings from the rails model needed for the editor configuration in t
'<%= t('request_for_comments.comment_edited') %>' + '<%= t('request_for_comments.comment_edited') %>' +
'</div>' '</div>'
} }
htmlContent += '</div>'; htmlContent += '</div>' +
htmlContent += '<div class="popover-comment">' + preprocess(comment.text) + '</div>'; '<div class="popover-comment">' + preprocess(comment.text) + '</div>';
if (comment.editable) {
htmlContent += '<div class="popover-actions">' +
'<button class="popover-action-button btn btn-xs btn-warning" id="edit-' + comment.id + '"><%= t('shared.edit') %></button>' +
'<button class="popover-action-button btn btn-xs btn-danger" id="delete-' + comment.id + '"><%= t('shared.destroy') %></button>' +
'</div>';
}
htmlContent += '</p>'; htmlContent += '</p>';
}); });
return htmlContent; return htmlContent;