Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Tooltips to Fresh Comments #9198

Merged
merged 5 commits into from
Feb 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/views/comments/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
style="
background-color: #f8f8f8;
border: 1px solid #e7e7e7;
padding: 18px;
padding: 36px;
<%= "display: none" if location == :edit %>
"
>
Expand Down
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();
14 changes: 5 additions & 9 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,16 +69,16 @@
</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 %>
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
3 changes: 3 additions & 0 deletions app/views/notes/_comments.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,8 @@
$(function() {
// create an instance of the editor
$E = new Editor();
// attach tooltips to comment buttons
$('[data-toggle="tooltip"]').tooltip();
$('[rel="tooltip"]').tooltip();
});
</script>
3 changes: 3 additions & 0 deletions app/views/questions/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
$("img").lazyload();
// create an instance of the editor
$E = new Editor();
// attach tooltips to comment buttons
$('[data-toggle="tooltip"]').tooltip();
$('[rel="tooltip"]').tooltip();
});
</script>
<%= javascript_include_tag('question') %>
Expand Down
3 changes: 3 additions & 0 deletions app/views/wiki/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@
<% if controller.action_name == 'comments' %>
// create an instance of the editor
$E = new Editor();
// attach tooltips to comment buttons
$('[data-toggle="tooltip"]').tooltip();
$('[rel="tooltip"]').tooltip();
<% end %>

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