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/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..9174fd0ff 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -42,12 +42,10 @@ //= require users //= require votes //= require allow_participation -//= require annotatable //= require advanced_search //= require registration_form //= require suggest //= require forms -//= require tracks //= require valuation_budget_investment_form //= require embed_video //= require fixed_bar @@ -102,12 +100,10 @@ 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(); App.Forms.initialize(); - App.Tracks.initialize(); App.ValuationBudgetInvestmentForm.initialize(); App.EmbedVideo.initialize(); App.FixedBar.initialize(); @@ -137,7 +133,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/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) 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/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: -> - '' 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/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/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/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/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/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/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) 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/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..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: () -> @@ -41,5 +40,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 693a68d0e..f2ee99569 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,10 +21,8 @@ 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) form.data("watchChanges", form.serialize()) - - false 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)