From ebf57e0cdd1dcc9d5cc884a15e7cd5b5bbe78390 Mon Sep 17 00:00:00 2001 From: noi5e Date: Mon, 15 Feb 2021 21:47:09 -0800 Subject: [PATCH] Add Tooltips to Fresh Comments (#9198) * git rebase * better label sizing for cyto (#9189) * adjust padding on comments * add tooltips to freshly posted comments * add hover tooltips to emoji reaction button Co-authored-by: Jeffrey Warren --- app/views/comments/_form.html.erb | 2 +- app/views/comments/create.js.erb | 2 ++ app/views/notes/_comment.html.erb | 14 +++++--------- app/views/notes/_comments.html.erb | 3 +++ app/views/questions/show.html.erb | 3 +++ app/views/wiki/show.html.erb | 3 +++ 6 files changed, 17 insertions(+), 10 deletions(-) diff --git a/app/views/comments/_form.html.erb b/app/views/comments/_form.html.erb index ef2077aee2..803918b974 100644 --- a/app/views/comments/_form.html.erb +++ b/app/views/comments/_form.html.erb @@ -8,7 +8,7 @@ style=" background-color: #f8f8f8; border: 1px solid #e7e7e7; - padding: 18px; + padding: 36px; <%= "display: none" if location == :edit %> " > diff --git a/app/views/comments/create.js.erb b/app/views/comments/create.js.erb index 7456d2e763..a82100bb98 100644 --- a/app/views/comments/create.js.erb +++ b/app/views/comments/create.js.erb @@ -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(); \ No newline at end of file diff --git a/app/views/notes/_comment.html.erb b/app/views/notes/_comment.html.erb index 88f65adbd5..3e2e35a6ca 100644 --- a/app/views/notes/_comment.html.erb +++ b/app/views/notes/_comment.html.erb @@ -56,7 +56,7 @@ + <% else %> - + <% end %> <% if logged_in_as(['admin', 'moderator']) || (current_user && (comment.uid == current_user.uid || comment.parent.uid == current_user.uid)) %> - + <% end %> @@ -132,13 +132,9 @@ } }); }); - - $(function () { - $('[data-toggle="tooltip"]').tooltip() - }) -
+
<% comment_body = comment.render_body %>
diff --git a/app/views/notes/_comments.html.erb b/app/views/notes/_comments.html.erb index ea6267d4b2..4d50ad6c15 100644 --- a/app/views/notes/_comments.html.erb +++ b/app/views/notes/_comments.html.erb @@ -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(); }); \ No newline at end of file diff --git a/app/views/questions/show.html.erb b/app/views/questions/show.html.erb index 7909b483ef..187f2d4a40 100644 --- a/app/views/questions/show.html.erb +++ b/app/views/questions/show.html.erb @@ -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(); }); <%= javascript_include_tag('question') %> diff --git a/app/views/wiki/show.html.erb b/app/views/wiki/show.html.erb index ff71c42197..dea289b110 100644 --- a/app/views/wiki/show.html.erb +++ b/app/views/wiki/show.html.erb @@ -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 %>);