summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/image_diff/image_diff.js
diff options
context:
space:
mode:
Diffstat (limited to 'app/assets/javascripts/image_diff/image_diff.js')
-rw-r--r--app/assets/javascripts/image_diff/image_diff.js41
1 files changed, 19 insertions, 22 deletions
diff --git a/app/assets/javascripts/image_diff/image_diff.js b/app/assets/javascripts/image_diff/image_diff.js
index 64af534eeb4..e171319cb1a 100644
--- a/app/assets/javascripts/image_diff/image_diff.js
+++ b/app/assets/javascripts/image_diff/image_diff.js
@@ -23,7 +23,7 @@ export default class ImageDiff {
bindEvents() {
this.imageClickedWrapper = this.imageClicked.bind(this);
- this.imageBlurredWrapper = this.imageBlurred.bind(this);
+ this.imageBlurredWrapper = imageDiffHelper.removeCommentIndicator.bind(null, this.imageFrameEl);
this.addBadgeWrapper = this.addBadge.bind(this);
this.removeBadgeWrapper = this.removeBadge.bind(this);
this.renderBadgesWrapper = this.renderBadges.bind(this);
@@ -56,34 +56,31 @@ export default class ImageDiff {
imageDiffHelper.showCommentIndicator(this.imageFrameEl, selection.browser);
}
- imageBlurred() {
- return imageDiffHelper.removeCommentIndicator(this.imageFrameEl);
- }
-
renderBadges() {
const discussionsEls = this.el.querySelectorAll('.note-container .discussion-notes .notes');
+ [...discussionsEls].forEach(this.renderBadge);
+ }
- [...discussionsEls].forEach((discussionEl, index) => {
- const imageBadge = imageDiffHelper
- .generateBadgeFromDiscussionDOM(this.imageFrameEl, discussionEl);
+ renderBadge(discussionEl, index) {
+ const imageBadge = imageDiffHelper
+ .generateBadgeFromDiscussionDOM(this.imageFrameEl, discussionEl);
- this.imageBadges.push(imageBadge);
+ this.imageBadges.push(imageBadge);
- const options = {
- coordinate: imageBadge.browser,
- noteId: imageBadge.noteId,
- };
+ const options = {
+ coordinate: imageBadge.browser,
+ noteId: imageBadge.noteId,
+ };
- if (this.renderCommentBadge) {
- imageDiffHelper.addImageCommentBadge(this.imageFrameEl, options);
- } else {
- const numberBadgeOptions = Object.assign(options, {
- badgeText: index + 1,
- });
+ if (this.renderCommentBadge) {
+ imageDiffHelper.addImageCommentBadge(this.imageFrameEl, options);
+ } else {
+ const numberBadgeOptions = Object.assign(options, {
+ badgeText: index + 1,
+ });
- imageDiffHelper.addImageBadge(this.imageFrameEl, numberBadgeOptions);
- }
- });
+ imageDiffHelper.addImageBadge(this.imageFrameEl, numberBadgeOptions);
+ }
}
addBadge(event) {