From 747767386aafb1e512919f2c19e7bfb10730ceb6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Sun, 30 Jun 2019 19:12:22 +0200 Subject: [PATCH] Use `this` instead of `@` in CoffeeScript We're using `this` most of the time, and it's what's used in JavaScript. --- app/assets/javascripts/documentable.js.coffee | 4 ++-- app/assets/javascripts/imageable.js.coffee | 4 ++-- app/assets/javascripts/legislation_annotatable.js.coffee | 6 +++--- app/assets/javascripts/table_sortable.js.coffee | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/app/assets/javascripts/documentable.js.coffee b/app/assets/javascripts/documentable.js.coffee index 5c5f8d315..5da604b45 100644 --- a/app/assets/javascripts/documentable.js.coffee +++ b/app/assets/javascripts/documentable.js.coffee @@ -17,9 +17,9 @@ App.Documentable = initializeDirectUploadInput: (input) -> - inputData = @buildData([], input) + inputData = this.buildData([], input) - @initializeRemoveCachedDocumentLink(input, inputData) + this.initializeRemoveCachedDocumentLink(input, inputData) $(input).fileupload diff --git a/app/assets/javascripts/imageable.js.coffee b/app/assets/javascripts/imageable.js.coffee index c8395646c..67a2e2370 100644 --- a/app/assets/javascripts/imageable.js.coffee +++ b/app/assets/javascripts/imageable.js.coffee @@ -18,9 +18,9 @@ App.Imageable = initializeDirectUploadInput: (input) -> - inputData = @buildData([], input) + inputData = this.buildData([], input) - @initializeRemoveCachedImageLink(input, inputData) + this.initializeRemoveCachedImageLink(input, inputData) $(input).fileupload diff --git a/app/assets/javascripts/legislation_annotatable.js.coffee b/app/assets/javascripts/legislation_annotatable.js.coffee index a549b9c53..46f95e114 100644 --- a/app/assets/javascripts/legislation_annotatable.js.coffee +++ b/app/assets/javascripts/legislation_annotatable.js.coffee @@ -85,7 +85,7 @@ App.LegislationAnnotatable = return customShow: (position) -> - $(@element).html "" + $(this.element).html "" # Clean comments section and open it $("#comments-box").html "" App.LegislationAllegations.show_comments() @@ -96,8 +96,8 @@ App.LegislationAnnotatable = method: "GET" url: "#{annotation_url}/annotations/new" dataType: "script").done (-> - $("#new_legislation_annotation #legislation_annotation_quote").val(@annotation.quote) - $("#new_legislation_annotation #legislation_annotation_ranges").val(JSON.stringify(@annotation.ranges)) + $("#new_legislation_annotation #legislation_annotation_quote").val(this.annotation.quote) + $("#new_legislation_annotation #legislation_annotation_ranges").val(JSON.stringify(this.annotation.ranges)) $("#comments-box").css({ top: position.top - $(".calc-comments").offset().top }) unless $("[data-legislation-open-phase]").data("legislation-open-phase") == false diff --git a/app/assets/javascripts/table_sortable.js.coffee b/app/assets/javascripts/table_sortable.js.coffee index 49d833356..80f429239 100644 --- a/app/assets/javascripts/table_sortable.js.coffee +++ b/app/assets/javascripts/table_sortable.js.coffee @@ -12,9 +12,9 @@ App.TableSortable = $("table.sortable th").click -> table = $(this).parents("table").eq(0) rows = table.find("tbody tr").toArray().sort(App.TableSortable.comparer($(this).index())) - @asc = !@asc + this.asc = !this.asc - if @asc + if this.asc table.append rows else table.append rows.reverse()