From 31b1dc3c31a4da59acd2deff2ded0d6d2aed8557 Mon Sep 17 00:00:00 2001 From: Phil Hughes Date: Tue, 26 Apr 2016 11:10:39 +0100 Subject: [PATCH] Fixed failing rubocop tests Fixed issue with issuable checkboxs not being init'd --- app/assets/javascripts/issuable.js.coffee | 11 +++++-- app/assets/javascripts/issues.js.coffee | 38 ----------------------- app/helpers/application_helper.rb | 2 +- 3 files changed, 10 insertions(+), 41 deletions(-) delete mode 100644 app/assets/javascripts/issues.js.coffee diff --git a/app/assets/javascripts/issuable.js.coffee b/app/assets/javascripts/issuable.js.coffee index eb785bf96eb..012c3e48014 100644 --- a/app/assets/javascripts/issuable.js.coffee +++ b/app/assets/javascripts/issuable.js.coffee @@ -5,6 +5,7 @@ issuable_created = false issuable_created = true Issuable.initTemplates() Issuable.initSearch() + Issuable.initChecks() initTemplates: -> Issuable.labelRow = _.template( @@ -62,11 +63,17 @@ issuable_created = false dataType: "json" reload: -> - if Issues.created - Issues.initChecks() + if Issuable.created + Issuable.initChecks() $('#filter_issue_search').val($('#issue_search').val()) + initChecks: -> + $('.check_all_issues').on 'click', -> + $('.selected_issue').prop('checked', @checked) + Issuable.checkChanged() + + $('.selected_issue').on 'change', Issuable.checkChanged updateStateFilters: -> stateFilters = $('.issues-state-filters, .dropdown-menu-sort') diff --git a/app/assets/javascripts/issues.js.coffee b/app/assets/javascripts/issues.js.coffee deleted file mode 100644 index 3330e6c68ad..00000000000 --- a/app/assets/javascripts/issues.js.coffee +++ /dev/null @@ -1,38 +0,0 @@ -@Issues = - init: -> - Issues.created = true - Issues.initChecks() - - $("body").on "ajax:success", ".close_issue, .reopen_issue", -> - t = $(this) - totalIssues = undefined - reopen = t.hasClass("reopen_issue") - $(".issue_counter").each -> - issue = $(this) - totalIssues = parseInt($(this).html(), 10) - if reopen and issue.closest(".main_menu").length - $(this).html totalIssues + 1 - else - $(this).html totalIssues - 1 - - initChecks: -> - $(".check_all_issues").click -> - $(".selected_issue").prop("checked", @checked) - Issues.checkChanged() - - $(".selected_issue").bind "change", Issues.checkChanged - - checkChanged: -> - checked_issues = $(".selected_issue:checked") - if checked_issues.length > 0 - ids = [] - $.each checked_issues, (index, value) -> - ids.push $(value).attr("data-id") - - $("#update_issues_ids").val ids - $(".issues-other-filters").hide() - $(".issues_bulk_update").show() - else - $("#update_issues_ids").val [] - $(".issues_bulk_update").hide() - $(".issues-other-filters").show() diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 27fae716216..59a04578c58 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -278,7 +278,7 @@ module ApplicationHelper path = request.path - if params != nil + if !params.nil? path << "?#{params.to_param}" if add_label if params[:label_name].present? and params[:label_name].respond_to?('any?')