Skip to content

Commit

Permalink
Remove threeDots menu container, use icons instead
Browse files Browse the repository at this point in the history
  • Loading branch information
seballot committed Apr 17, 2020
1 parent 665b2cc commit 7079897
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 42 deletions.
22 changes: 0 additions & 22 deletions static/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,6 @@ ep_comments.prototype.init = function(){
// hide the option window when it show the edit form
var $commentOptions = $commentBox.children('.comment-options'); // edit, delete actions
$commentOptions.addClass('hidden');
$commentBox.children('.comment-options-button').removeClass('comment-options-selected');

// hide the comment author name and the comment text
$commentBox.children('.comment-author-name, .comment-text').addClass('hidden');
Expand Down Expand Up @@ -181,21 +180,6 @@ ep_comments.prototype.init = function(){
});
});

this.container.parent().on("click", ".comment-options-button", function(){ // three dots button
// if it exists any other comment option window open, hide them
var $padOuter = $('iframe[name="ace_outer"]').contents();
var $thisCommentOption = $(this).siblings('.comment-options');
$padOuter.find('.comment-options').not($thisCommentOption).addClass('hidden');

// unselect any other three dots selected
$thisThreeDotsClicked = $(this);
$padOuter.find('.comment-options-button').not($thisThreeDotsClicked).removeClass('comment-options-selected');

$(this).siblings('.comment-options').toggleClass('hidden');
var threeDotsButtonIsSelected = $(this).siblings('.comment-options').hasClass('hidden') === false;
$(this).toggleClass('comment-options-selected', threeDotsButtonIsSelected);
});

// hide the edit form and make the comment author and text visible again
this.container.parent().on("click", ".comment-edit-cancel", function(e){
e.preventDefault();
Expand Down Expand Up @@ -270,12 +254,6 @@ ep_comments.prototype.init = function(){

});

this.container.parent().on("mouseleave", ".comment-options-wrapper", function(){
var $padOuter = $('iframe[name="ace_outer"]').contents();
$padOuter.find('.comment-options-button').removeClass('comment-options-selected');
$padOuter.find('.comment-options').addClass('hidden');
});

// User accepts a change
this.container.on("submit", ".comment-changeTo-form", function(e){
e.preventDefault();
Expand Down
2 changes: 0 additions & 2 deletions static/tests/frontend/specs/commentEdit.js
Original file line number Diff line number Diff line change
Expand Up @@ -283,8 +283,6 @@ ep_comments_page_test_helper.commentEdit = {
},
clickEditCommentReplyButton: function () {
var outer$ = helper.padOuter$;
var $threeDots = outer$('.comment-options-button').last();
$threeDots.click();
var $editButton = outer$(".comment-edit").last();
$editButton.click();
},
Expand Down
22 changes: 4 additions & 18 deletions templates/comments.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,8 @@
<script id="commentsTemplate" type="text/html">
<note id="${commentId}" class="sidebar-comment" title="${date}" data-commentid="${commentId}">
<div class="comment-options-wrapper">
<span class="comment-options-button">
<span class="comment-options-button--icon"></span>
</span>
<div class="comment-options hidden">
<p data-l10n-id="ep_comments_page.delete_comment.title" class="comment-delete-container">
<span class="comment-delete" title="Delete this comment" data-l10n-id="ep_comments_page.delete_comment.title">delete</span>
</p>
<p class="comment-edit-container">
<span class="comment-edit" title="Edit this comment" data-l10n-id="ep_comments_page.edit_comment.title">edit</span>
</p>
<span class="comment-delete buttonicon buttonicon-trash" data-l10n-id="ep_comments_page.delete_comment.title"></span>
<span class="comment-edit buttonicon buttonicon-pencil" data-l10n-id="ep_comments_page.edit_comment.title"></span>
</div>
</div>
<address class="comment-author-name">${name}:</address>
Expand Down Expand Up @@ -89,14 +81,8 @@
<script id="replyTemplate" type="text/html">
<note id="${replyId}" class="sidebar-comment-reply" data-commentid="${replyId}">
<div class="comment-options-wrapper">
<span class="comment-options-button">
<span class="comment-options-button--icon"></span>
</span>
<div class="comment-options hidden">
<p class="comment-edit-container">
<span class="comment-edit" title="Edit this comment" data-l10n-id="ep_comments_page.edit_comment.title">edit</span>
</p>
</div>
<span class="comment-edit buttonicon buttonicon-pencil" title="Edit this comment" data-l10n-id="ep_comments_page.edit_comment.title"></span>
</div>
</div>
<address class="comment-author-name">${name}:</address>
<section class="comment-text">${text}</section>
Expand Down

0 comments on commit 7079897

Please sign in to comment.