Skip to content

Commit

Permalink
add tooltips to freshly posted comments
Browse files Browse the repository at this point in the history
  • Loading branch information
noi5e committed Feb 15, 2021
1 parent 91e67d3 commit 15794f9
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 10 deletions.
2 changes: 2 additions & 0 deletions app/views/comments/create.js.erb
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,5 @@ fileUploadElements.forEach(function(element) {
});
notyNotification('mint', 3000, 'success', 'topRight', 'Comment Added!');
$('#comment-count')[0].innerHTML = parseInt($('#comment-count')[0].innerHTML, 10)+1;
// attach tooltips to comment buttons
$('[data-toggle="tooltip"]').tooltip();
16 changes: 6 additions & 10 deletions app/views/notes/_comment.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
<a
aria-label="Edit Comment"
class="btn btn-outline-secondary btn-sm edit-comment-btn"
rel="tooltip"
data-toggle="tooltip"
title="Edit Comment"
href="javascript:void(0)" onClick="
$('#comment-form-wrapper-edit-<%= comment.cid %>').toggle();
Expand All @@ -69,21 +69,21 @@
</a>
<% end %>
<% if current_user &. can_moderate? %>
<a aria-label="Mark Spam" rel="tooltip" title="Mark Spam: Remove Comment and Ban User" class="btn btn-sm btn-outline-secondary btn-flag-spam-<%= comment.id %>" data-confirm="Are you sure? The user will no longer be able to log in or publish, and their content will be hidden except comments." href="/admin/mark_comment_spam/<%= comment.id %>">
<a aria-label="Mark Spam" data-toggle="tooltip" title="Mark Spam: Remove Comment and Ban User" class="btn btn-sm btn-outline-secondary btn-flag-spam-<%= comment.id %>" data-confirm="Are you sure? The user will no longer be able to log in or publish, and their content will be hidden except comments." href="/admin/mark_comment_spam/<%= comment.id %>">
<i class="fa fa-ban"></i>
</a>
<% else %>
<a aria-label="Flag as spam" rel="tooltip" title="Flag as spam to moderators" class="btn btn-sm btn-outline-secondary btn-flag-spam-<%= comment.id %>" href="/moderate/flag_comment/<%= comment.id %>" data-toggle="tooltip" data-placement="top" title="Flag this Comment">
<a aria-label="Flag as spam" data-toggle="tooltip" title="Flag as spam to moderators" class="btn btn-sm btn-outline-secondary btn-flag-spam-<%= comment.id %>" href="/moderate/flag_comment/<%= comment.id %>" data-toggle="tooltip" data-placement="top" title="Flag this Comment">
<i class="fa fa-flag"></i>
</a>
<% end %>
<% if logged_in_as(['admin', 'moderator']) || (current_user && (comment.uid == current_user.uid || comment.parent.uid == current_user.uid)) %>
<a aria-label="Delete Comment" rel="tooltip" title="Delete Comment" class="btn btn-outline-secondary btn-sm" id="c<%= comment.cid %>delete-btn">
<a aria-label="Delete Comment" data-toggle="tooltip" title="Delete Comment" class="btn btn-outline-secondary btn-sm" id="c<%= comment.cid %>delete-btn">
<i class='icon fa fa-trash'></i>
</a>
<% end %>
<% if current_user %>
<a aria-label="Leave an Emoji Reaction" rel="tooltip" title="Leave an Emoji Reaction" class="btn btn-outline-secondary btn-sm dropdown" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<a aria-label="Leave an Emoji Reaction" data-toggle="tooltip" title="Leave an Emoji Reaction" class="btn btn-outline-secondary btn-sm dropdown" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<i class='far fa-heart'></i>
</a>
<div id="emoji-dropdown" style="background:#f8f8f8;padding:0;" class=" dropdown-menu dropdown-menu-right" aria-labelledby="dropdownMenuButton">
Expand Down Expand Up @@ -132,13 +132,9 @@
}
});
});

$(function () {
$('[data-toggle="tooltip"]').tooltip()
})
</script>

<div style="border: 1px solid #e7e7e7;padding: 18px;" id="c<%= comment.cid %>show">
<div style="border: 1px solid #e7e7e7;padding: 36px;" id="c<%= comment.cid %>show">

<% comment_body = comment.render_body %>
<div class="comment-body" id="comment-body-<%= comment.cid %>">
Expand Down
2 changes: 2 additions & 0 deletions app/views/notes/_comments.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,7 @@
$(function() {
// create an instance of the editor
$E = new Editor();
// attach tooltips to comment buttons
$('[data-toggle="tooltip"]').tooltip();
});
</script>
2 changes: 2 additions & 0 deletions app/views/questions/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
$("img").lazyload();
// create an instance of the editor
$E = new Editor();
// attach tooltips to comment buttons
$('[data-toggle="tooltip"]').tooltip();
});
</script>
<%= javascript_include_tag('question') %>
Expand Down
2 changes: 2 additions & 0 deletions app/views/wiki/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@
<% if controller.action_name == 'comments' %>
// create an instance of the editor
$E = new Editor();
// attach tooltips to comment buttons
$('[data-toggle="tooltip"]').tooltip();
<% end %>

setupWiki(<%= @node.id %>, "<%= @node.title %>", <%= params[:raw] == 'true' %>, <%= current_user.nil? != true %>);
Expand Down

0 comments on commit 15794f9

Please sign in to comment.