From 2af09d65c7d4c0a5b2729711072fc8371030bc2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Tue, 2 Jul 2019 02:35:47 +0200 Subject: [PATCH 1/8] Remove unused JavaScript poll token code We don't load the token message since commit 585f9ea5, so the JavaScript to show it wasn't doing anything anymore. --- app/assets/javascripts/polls.js.coffee | 8 -------- app/assets/stylesheets/participation.scss | 6 ------ spec/features/polls/voter_spec.rb | 2 -- 3 files changed, 16 deletions(-) diff --git a/app/assets/javascripts/polls.js.coffee b/app/assets/javascripts/polls.js.coffee index d5402d46b..69893a82b 100644 --- a/app/assets/javascripts/polls.js.coffee +++ b/app/assets/javascripts/polls.js.coffee @@ -19,14 +19,6 @@ App.Polls = @token = App.Polls.generateToken() App.Polls.replaceToken() - $(".js-question-answer").on - click: => - token_message = $(".js-token-message") - if !token_message.is(":visible") - token_message.html("#{token_message.html()}
#{@token}") - token_message.show() - false - $(".zoom-link").on "click", (event) -> element = event.target answer = $(element).closest("div.answer") diff --git a/app/assets/stylesheets/participation.scss b/app/assets/stylesheets/participation.scss index f003c4632..a31978cee 100644 --- a/app/assets/stylesheets/participation.scss +++ b/app/assets/stylesheets/participation.scss @@ -346,12 +346,6 @@ } .callout { - &.token-message { - background-color: #fff; - border-color: $info-border; - color: $color-info; - } - &.proposal-retired { font-size: $base-font-size; } diff --git a/spec/features/polls/voter_spec.rb b/spec/features/polls/voter_spec.rb index f444df31a..77e14e17d 100644 --- a/spec/features/polls/voter_spec.rb +++ b/spec/features/polls/voter_spec.rb @@ -177,8 +177,6 @@ describe "Voter" do visit poll_path(poll) - expect(page).not_to have_selector(".js-token-message") - expect(page).to have_content "You have already participated in this poll. If you vote again it will be overwritten." within("#poll_question_#{question.id}_answers") do expect(page).not_to have_link(answer_yes.title) From 0ef75ff1993a03ff77b49c2bd034f8a692190eca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Tue, 2 Jul 2019 02:36:30 +0200 Subject: [PATCH 2/8] Remove unused JavaScript banners code The banner `update_style` method isn't used since commit 82cb8d4c. --- app/assets/javascripts/banners.js.coffee | 4 ---- 1 file changed, 4 deletions(-) diff --git a/app/assets/javascripts/banners.js.coffee b/app/assets/javascripts/banners.js.coffee index b136d19a0..50b6db3d5 100644 --- a/app/assets/javascripts/banners.js.coffee +++ b/app/assets/javascripts/banners.js.coffee @@ -3,10 +3,6 @@ App.Banners = update_banner: (selector, text) -> $(selector).html(text) - update_style: (selector, style) -> - $(selector).removeClass($(selector).attr("class"), true) - .addClass(style, true) - update_background_color: (selector, background_color) -> $(selector).css("background-color", background_color) From 36a557927a0ab2989b8ef5b6a61ed34832238d26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Tue, 2 Jul 2019 02:37:07 +0200 Subject: [PATCH 3/8] Remove unused variables --- app/assets/javascripts/columns_selector.js.coffee | 6 ++---- app/assets/javascripts/comments.js.coffee | 2 +- app/assets/javascripts/dashboard_graphs.js | 2 +- app/assets/javascripts/documentable.js.coffee | 2 +- app/assets/javascripts/gettext.js.coffee | 2 +- app/assets/javascripts/imageable.js.coffee | 4 ++-- app/assets/javascripts/legislation_allegations.js.coffee | 2 +- app/assets/javascripts/legislation_annotatable.js.coffee | 9 +++------ app/assets/javascripts/managers.js.coffee | 4 ++-- app/assets/javascripts/sortable.js.coffee | 4 ++-- app/assets/javascripts/stats.js.coffee | 2 +- app/assets/javascripts/tree_navigator.js.coffee | 2 +- app/assets/javascripts/watch_form_changes.js.coffee | 4 ++-- 13 files changed, 20 insertions(+), 25 deletions(-) diff --git a/app/assets/javascripts/columns_selector.js.coffee b/app/assets/javascripts/columns_selector.js.coffee index 29b91224d..8a7f61208 100644 --- a/app/assets/javascripts/columns_selector.js.coffee +++ b/app/assets/javascripts/columns_selector.js.coffee @@ -1,6 +1,6 @@ App.ColumnsSelector = - initColums: (name) -> + initColums: () -> App.ColumnsSelector.hideAll() c_value = App.ColumnsSelector.currentValue() @@ -15,8 +15,6 @@ App.ColumnsSelector = $("#column_selector_" + column).prop("checked", true) initChecks: () -> - fields = $(".column-selecteable th[data-field]") - columns = [] $(".column-selecteable th[data-field]").each -> field = $(this).data("field") text = $.trim($(this).text()) @@ -70,7 +68,7 @@ App.ColumnsSelector = initialize: -> App.ColumnsSelector.initChecks() - columns = App.ColumnsSelector.initColums($("#js-columns-selector").data("cookie")) + App.ColumnsSelector.initColums() $("#js-columns-selector").on click: (event) -> diff --git a/app/assets/javascripts/comments.js.coffee b/app/assets/javascripts/comments.js.coffee index 370ab7a53..d80ee6e0b 100644 --- a/app/assets/javascripts/comments.js.coffee +++ b/app/assets/javascripts/comments.js.coffee @@ -10,7 +10,7 @@ App.Comments = $("##{parent_id} .comment-children:first").prepend($(response_html)) this.update_comments_count() - update_comments_count: (parent_id) -> + update_comments_count: -> $(".js-comments-count").each -> new_val = $(this).text().trim().replace /\d+/, (match) -> parseInt(match, 10) + 1 $(this).text(new_val) diff --git a/app/assets/javascripts/dashboard_graphs.js b/app/assets/javascripts/dashboard_graphs.js index 22a52f3e9..ba71e5de4 100644 --- a/app/assets/javascripts/dashboard_graphs.js +++ b/app/assets/javascripts/dashboard_graphs.js @@ -263,7 +263,7 @@ }; ProposalGraph.prototype.formatXColumnValues = function () { - var i, l, parts; + var i, l; this.xColumnValues = this.xColumnValues.sort(); diff --git a/app/assets/javascripts/documentable.js.coffee b/app/assets/javascripts/documentable.js.coffee index 035371834..2cfe3323a 100644 --- a/app/assets/javascripts/documentable.js.coffee +++ b/app/assets/javascripts/documentable.js.coffee @@ -6,7 +6,7 @@ App.Documentable = $.each inputFiles, (index, input) -> App.Documentable.initializeDirectUploadInput(input) - $("#nested-documents").on "cocoon:after-remove", (e, insertedItem) -> + $("#nested-documents").on "cocoon:after-remove", -> App.Documentable.unlockUploads() $("#nested-documents").on "cocoon:after-insert", (e, nested_document) -> diff --git a/app/assets/javascripts/gettext.js.coffee b/app/assets/javascripts/gettext.js.coffee index 52ae42375..4d9700921 100644 --- a/app/assets/javascripts/gettext.js.coffee +++ b/app/assets/javascripts/gettext.js.coffee @@ -19,7 +19,7 @@ i18n = { } } -window.Gettext = (key) -> +window.Gettext = -> gettext: (key) -> locale_id = $("html").attr("lang") locale = i18n[locale_id] diff --git a/app/assets/javascripts/imageable.js.coffee b/app/assets/javascripts/imageable.js.coffee index bdb71f4f9..7317c2b49 100644 --- a/app/assets/javascripts/imageable.js.coffee +++ b/app/assets/javascripts/imageable.js.coffee @@ -5,10 +5,10 @@ App.Imageable = $.each inputFiles, (index, input) -> App.Imageable.initializeDirectUploadInput(input) - $("#nested-image").on "cocoon:after-remove", (e, item) -> + $("#nested-image").on "cocoon:after-remove", -> $("#new_image_link").removeClass("hide") - $("#nested-image").on "cocoon:before-insert", (e, nested_image) -> + $("#nested-image").on "cocoon:before-insert", -> if $(".js-image-attachment").length > 0 $(".js-image-attachment").closest(".image").remove() diff --git a/app/assets/javascripts/legislation_allegations.js.coffee b/app/assets/javascripts/legislation_allegations.js.coffee index 98dc36009..3a3f9ce4d 100644 --- a/app/assets/javascripts/legislation_allegations.js.coffee +++ b/app/assets/javascripts/legislation_allegations.js.coffee @@ -18,7 +18,7 @@ App.LegislationAllegations = App.LegislationAllegations.toggle_comments() $(".js-toggle-allegations").on - click: (e) -> + click: -> # Toggle comments when the section title is visible if !App.LegislationAnnotatable.isMobile() if $(this).find(".draft-panel .panel-title:visible").length == 0 diff --git a/app/assets/javascripts/legislation_annotatable.js.coffee b/app/assets/javascripts/legislation_annotatable.js.coffee index ff6849d2c..ba5b445fa 100644 --- a/app/assets/javascripts/legislation_annotatable.js.coffee +++ b/app/assets/javascripts/legislation_annotatable.js.coffee @@ -1,5 +1,3 @@ -_t = (key) -> new Gettext().gettext(key) - App.LegislationAnnotatable = makeEditableAndHighlight: (colour) -> @@ -83,7 +81,7 @@ App.LegislationAnnotatable = return window.innerWidth <= 652 viewerExtension: (viewer) -> - viewer._onHighlightMouseover = (event) -> + viewer._onHighlightMouseover = -> return customShow: (position) -> @@ -106,7 +104,7 @@ App.LegislationAnnotatable = App.LegislationAnnotatable.highlight("#7fff9a") $("#comments-box textarea").focus() - $("#new_legislation_annotation").on("ajax:complete", (e, data, status, xhr) -> + $("#new_legislation_annotation").on("ajax:complete", (e, data) -> App.LegislationAnnotatable.app.destroy() if data.status == 200 App.LegislationAnnotatable.remove_highlight() @@ -127,7 +125,7 @@ App.LegislationAnnotatable = editor.show = App.LegislationAnnotatable.customShow scrollToAnchor: -> - annotationsLoaded: (annotations) -> + annotationsLoaded: -> anchor = $(location).attr("hash") if anchor && anchor.startsWith("#annotation") ann_id = anchor.split("-")[-1..] @@ -183,7 +181,6 @@ App.LegislationAnnotatable = $(".legislation-annotatable").each -> $this = $(this) - ann_type = "legislation_draft_version" ann_id = $this.data("legislation-draft-version-id") base_url = $this.data("legislation-annotatable-base-url") diff --git a/app/assets/javascripts/managers.js.coffee b/app/assets/javascripts/managers.js.coffee index 60eab58e9..63218f2f5 100644 --- a/app/assets/javascripts/managers.js.coffee +++ b/app/assets/javascripts/managers.js.coffee @@ -14,11 +14,11 @@ App.Managers = $("#user_password").prop "type", type initialize: -> - $(".generate-random-value").on "click", (event) -> + $(".generate-random-value").on "click", -> password = App.Managers.generatePassword() $("#user_password").val(password) - $(".show-password").on "click", (event) -> + $(".show-password").on "click", -> if $("#user_password").is("input[type='password']") App.Managers.togglePassword("text") else diff --git a/app/assets/javascripts/sortable.js.coffee b/app/assets/javascripts/sortable.js.coffee index ee98703f3..1e24da891 100644 --- a/app/assets/javascripts/sortable.js.coffee +++ b/app/assets/javascripts/sortable.js.coffee @@ -1,7 +1,7 @@ App.Sortable = initialize: -> $(".sortable").sortable - update: (event, ui) -> + update: -> new_order = $(this).sortable("toArray", { attribute: "data-answer-id" }) $.ajax url: $(".sortable").data("js-url"), @@ -9,7 +9,7 @@ App.Sortable = type: "POST" $(".sortable-priotirized-votation").sortable - update: (event, ui) -> + update: -> new_order = $(this).sortable("toArray", { attribute: "data-answer-id" }) $.ajax url: $(this).data("js-url"), diff --git a/app/assets/javascripts/stats.js.coffee b/app/assets/javascripts/stats.js.coffee index 56987c27a..982d2f98e 100644 --- a/app/assets/javascripts/stats.js.coffee +++ b/app/assets/javascripts/stats.js.coffee @@ -4,7 +4,7 @@ buildGraph = (el) -> url = $(el).data "graph" conf = bindto: el, data: { x: "x", url: url, mimeType: "json" }, axis: { x: { type: "timeseries", tick: { format: "%Y-%m-%d" } } } - graph = c3.generate conf + c3.generate conf App.Stats = initialize: -> diff --git a/app/assets/javascripts/tree_navigator.js.coffee b/app/assets/javascripts/tree_navigator.js.coffee index bd7192caf..86fd240fd 100644 --- a/app/assets/javascripts/tree_navigator.js.coffee +++ b/app/assets/javascripts/tree_navigator.js.coffee @@ -20,7 +20,7 @@ App.TreeNavigator = App.TreeNavigator.setNodes(ul.children()) $("[data-tree-navigator] span").on - click: (e) -> + click: -> elem = $(this) if(elem.hasClass("open")) elem.removeClass("open").addClass("closed") diff --git a/app/assets/javascripts/watch_form_changes.js.coffee b/app/assets/javascripts/watch_form_changes.js.coffee index 693a68d0e..740876506 100644 --- a/app/assets/javascripts/watch_form_changes.js.coffee +++ b/app/assets/javascripts/watch_form_changes.js.coffee @@ -6,7 +6,7 @@ App.WatchFormChanges = if($("[data-watch-form-message]").length) return $("[data-watch-form-message]").data("watch-form-message") - checkChanges: (event) -> + checkChanges: -> changes = false App.WatchFormChanges.forms().each -> form = $(this) @@ -21,7 +21,7 @@ App.WatchFormChanges = if App.WatchFormChanges.forms().length == 0 || App.WatchFormChanges.msg() == undefined return - $(document).off("page:before-change").on("page:before-change", (e) -> App.WatchFormChanges.checkChanges(e)) + $(document).off("page:before-change").on("page:before-change", -> App.WatchFormChanges.checkChanges()) App.WatchFormChanges.forms().each -> form = $(this) From 457ec11e6d003b8ddf9d7cbbeec96a55b4afb1e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Tue, 2 Jul 2019 02:39:49 +0200 Subject: [PATCH 4/8] Remove unnecessary `return false` statements The `initialize` functions don't need to return anything, since their returned value is never used. Returning false is a common practice in jQuery to stop an event, but in plain JavaScript methods it doesn't have any side effects. --- app/assets/javascripts/allow_participation.js.coffee | 1 - app/assets/javascripts/forms.js.coffee | 1 - app/assets/javascripts/prevent_double_submission.js.coffee | 2 -- app/assets/javascripts/users.js.coffee | 1 - .../javascripts/valuation_budget_investment_form.js.coffee | 1 - app/assets/javascripts/votations.js.coffee | 2 -- app/assets/javascripts/votes.js.coffee | 1 - app/assets/javascripts/watch_form_changes.js.coffee | 2 -- 8 files changed, 11 deletions(-) diff --git a/app/assets/javascripts/allow_participation.js.coffee b/app/assets/javascripts/allow_participation.js.coffee index 9482826ca..0427ae730 100644 --- a/app/assets/javascripts/allow_participation.js.coffee +++ b/app/assets/javascripts/allow_participation.js.coffee @@ -9,4 +9,3 @@ App.AllowParticipation = $(this).find(".js-participation-not-allowed").hide() $(this).find(".js-participation-allowed").show() }, ".js-participation" - false diff --git a/app/assets/javascripts/forms.js.coffee b/app/assets/javascripts/forms.js.coffee index 5cf403e59..2ce43367c 100644 --- a/app/assets/javascripts/forms.js.coffee +++ b/app/assets/javascripts/forms.js.coffee @@ -58,4 +58,3 @@ App.Forms = App.Forms.toggleLink() App.Forms.synchronizeInputs() App.Forms.hideOrShowFieldsAfterSelection() - false diff --git a/app/assets/javascripts/prevent_double_submission.js.coffee b/app/assets/javascripts/prevent_double_submission.js.coffee index c47b40b70..eefb8a9fe 100644 --- a/app/assets/javascripts/prevent_double_submission.js.coffee +++ b/app/assets/javascripts/prevent_double_submission.js.coffee @@ -34,5 +34,3 @@ App.PreventDoubleSubmission = buttons = $(this).find(":button, :submit") App.PreventDoubleSubmission.reset_buttons(buttons) ) - - false diff --git a/app/assets/javascripts/users.js.coffee b/app/assets/javascripts/users.js.coffee index cae04abaf..29039de95 100644 --- a/app/assets/javascripts/users.js.coffee +++ b/app/assets/javascripts/users.js.coffee @@ -2,4 +2,3 @@ App.Users = initialize: -> $(".initialjs-avatar").initial() - false diff --git a/app/assets/javascripts/valuation_budget_investment_form.js.coffee b/app/assets/javascripts/valuation_budget_investment_form.js.coffee index 6e9910cb3..51fb1d156 100644 --- a/app/assets/javascripts/valuation_budget_investment_form.js.coffee +++ b/app/assets/javascripts/valuation_budget_investment_form.js.coffee @@ -29,4 +29,3 @@ App.ValuationBudgetInvestmentForm = initialize: -> App.ValuationBudgetInvestmentForm.showFeasibilityFields() App.ValuationBudgetInvestmentForm.showFeasibilityFieldsOnChange() - false diff --git a/app/assets/javascripts/votations.js.coffee b/app/assets/javascripts/votations.js.coffee index 80f026c10..48f3873fd 100644 --- a/app/assets/javascripts/votations.js.coffee +++ b/app/assets/javascripts/votations.js.coffee @@ -41,5 +41,3 @@ App.Votations = url = "/admin/get_options_traductions.json" params = { enum_type: $("#votation_type_enum_type").val() } $.get(url, params, (response) -> App.Votations.setTraduction response, "json") - -false diff --git a/app/assets/javascripts/votes.js.coffee b/app/assets/javascripts/votes.js.coffee index 003187bca..d0bed54ad 100644 --- a/app/assets/javascripts/votes.js.coffee +++ b/app/assets/javascripts/votes.js.coffee @@ -15,4 +15,3 @@ App.Votes = App.Votes.hoverize "div.supports" App.Votes.hoverize "div.debate-questions" App.Votes.hoverize "div.comment-footer" - false diff --git a/app/assets/javascripts/watch_form_changes.js.coffee b/app/assets/javascripts/watch_form_changes.js.coffee index 740876506..f2ee99569 100644 --- a/app/assets/javascripts/watch_form_changes.js.coffee +++ b/app/assets/javascripts/watch_form_changes.js.coffee @@ -26,5 +26,3 @@ App.WatchFormChanges = App.WatchFormChanges.forms().each -> form = $(this) form.data("watchChanges", form.serialize()) - - false From bf20c93e99ad3f5d8cb9d110e137a4e84cc0300d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Tue, 2 Jul 2019 02:42:46 +0200 Subject: [PATCH 5/8] Remove legacy annotations JavaScript file This code isn't used since commit 54e59a8a. --- app/assets/javascripts/annotatable.js.coffee | 38 -------------------- app/assets/javascripts/application.js | 2 -- 2 files changed, 40 deletions(-) delete mode 100644 app/assets/javascripts/annotatable.js.coffee diff --git a/app/assets/javascripts/annotatable.js.coffee b/app/assets/javascripts/annotatable.js.coffee deleted file mode 100644 index 90cabb9e4..000000000 --- a/app/assets/javascripts/annotatable.js.coffee +++ /dev/null @@ -1,38 +0,0 @@ -_t = (key) -> new Gettext().gettext(key) - -App.Annotatable = - initialize: -> - current_user_id = $("html").data("current-user-id") - if current_user_id == "" - annotator.ui.editor.Editor.template = [ - '
', - '
', - " #{_t("Unregistered")}", - '
', - " #{_t("Cancel")}", - "
", - "
", - "
" - ].join("\n") - - $("[data-annotatable-type]").each -> - $this = $(this) - ann_type = $this.data("annotatable-type") - ann_id = $this.data("annotatable-id") - - app = new annotator.App() - .include -> - beforeAnnotationCreated: (ann) -> - ann["#{ann_type}_id"] = ann_id - ann.permissions = ann.permissions || {} - ann.permissions.admin = [] - .include(annotator.ui.main, { element: this }) - .include(annotator.storage.http, { prefix: "", urls: { search: "/annotations/search" } }) - - - app.start().then -> - app.ident.identity = current_user_id - - options = {} - options["#{ann_type}_id"] = ann_id - app.annotations.load(options) diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index dda27c914..9a50e623d 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -42,7 +42,6 @@ //= require users //= require votes //= require allow_participation -//= require annotatable //= require advanced_search //= require registration_form //= require suggest @@ -102,7 +101,6 @@ var initialize_modules = function() { App.CheckAllNone.initialize(); App.PreventDoubleSubmission.initialize(); App.IeAlert.initialize(); - App.Annotatable.initialize(); App.AdvancedSearch.initialize(); App.RegistrationForm.initialize(); App.Suggest.initialize(); From a9d28bee1548f221e49a2f4bd99eda007cd74b5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Tue, 2 Jul 2019 03:50:59 +0200 Subject: [PATCH 6/8] Remove unused code in App.Cookies The `removeCookie` function is never called, and the `initialize` function doesn't do anything. The only functions we use here are `getCookie` and `saveCookie`. --- app/assets/javascripts/application.js | 1 - app/assets/javascripts/cookies.js.coffee | 6 ------ 2 files changed, 7 deletions(-) diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index 9a50e623d..a7f7231b0 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -135,7 +135,6 @@ var initialize_modules = function() { App.SendAdminNotificationAlert.initialize(); App.ModalDownload.initialize(); App.Settings.initialize(); - App.Cookies.initialize(); if ( $('#js-columns-selector').length ) App.ColumnsSelector.initialize(); App.BudgetEditAssociations.initialize(); diff --git a/app/assets/javascripts/cookies.js.coffee b/app/assets/javascripts/cookies.js.coffee index fc1505b1f..4a1c84e2d 100644 --- a/app/assets/javascripts/cookies.js.coffee +++ b/app/assets/javascripts/cookies.js.coffee @@ -1,8 +1,5 @@ App.Cookies = - removeCookie: (name) -> - document.cookie("name", null, { path: '/' }) - saveCookie: (name, value, days) -> expires = undefined if days @@ -24,6 +21,3 @@ App.Cookies = c_end = document.cookie.length return unescape(document.cookie.substring(c_start, c_end)) '' - - initialize: -> - '' From f28a5cc49b807e6e4dc5c3d8c5cdb85e28a8200e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Tue, 2 Jul 2019 22:29:07 +0200 Subject: [PATCH 7/8] Remove unused piwik-related code This code requires the variable `_paq` to be set somewhere, but we never set it. In the past Decide Madrid added some custom JavaScript using this code. However, in CONSUL we're using Ahoy to track events, and we don't have any documentation about adding custom JavaScript to use piwik nor we've got any other piwik integration. --- app/assets/javascripts/application.js | 2 -- app/assets/javascripts/tracks.js.coffee | 28 ------------------------- 2 files changed, 30 deletions(-) delete mode 100644 app/assets/javascripts/tracks.js.coffee diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index a7f7231b0..9174fd0ff 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -46,7 +46,6 @@ //= require registration_form //= require suggest //= require forms -//= require tracks //= require valuation_budget_investment_form //= require embed_video //= require fixed_bar @@ -105,7 +104,6 @@ var initialize_modules = function() { App.RegistrationForm.initialize(); App.Suggest.initialize(); App.Forms.initialize(); - App.Tracks.initialize(); App.ValuationBudgetInvestmentForm.initialize(); App.EmbedVideo.initialize(); App.FixedBar.initialize(); diff --git a/app/assets/javascripts/tracks.js.coffee b/app/assets/javascripts/tracks.js.coffee deleted file mode 100644 index e3f44e7f1..000000000 --- a/app/assets/javascripts/tracks.js.coffee +++ /dev/null @@ -1,28 +0,0 @@ -App.Tracks = - - tracking_enabled: -> - _paq? - - set_custom_var: (id, name, value, scope) -> - _paq.push(["setCustomVariable", id, name, value, scope]) - _paq.push(["trackPageView"]) - - track_event: ($this) -> - category = $this.data("track-event-category") - action = $this.data("track-event-action") - _paq.push(["trackEvent", category, action]) - - initialize: -> - if App.Tracks.tracking_enabled() - $("[data-track-usertype]").each -> - $this = $(this) - usertype = $this.data("track-usertype") - App.Tracks.set_custom_var(1, "usertype", usertype, "visit") - - $("[data-track-event-category]").each -> - $this = $(this) - App.Tracks.track_event($this) - - $("[data-track-click]").on "click", -> - $this = $(this) - App.Tracks.track_event($this) From e4985d371d69ddeedbf44562eb2ebc330e904106 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Tue, 2 Jul 2019 23:06:43 +0200 Subject: [PATCH 8/8] Remove code added for debugging purposes --- app/assets/javascripts/votations.js.coffee | 1 - 1 file changed, 1 deletion(-) diff --git a/app/assets/javascripts/votations.js.coffee b/app/assets/javascripts/votations.js.coffee index 48f3873fd..ab22c2afa 100644 --- a/app/assets/javascripts/votations.js.coffee +++ b/app/assets/javascripts/votations.js.coffee @@ -25,7 +25,6 @@ App.Votations = $("#max_groups_answers").attr(disabled: true) setTraduction: (response) -> - console.log response $(".js-description_text").text(response["traduction"]) updateChecks: () ->