From 3eda2de2d5b4076776fab2a8938e63994433f225 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Sat, 9 Nov 2019 23:50:07 +0100 Subject: [PATCH] Remove unused helper methods They aren't used since commits a6585361, 3752f3a5, 88a7a29d, eef8ad1b, f67f058b, 04910fea and 9181610d. The method `image_bytes_to_megabytes` was never used and is a duplicate of the method `bytes_to_megabytes`. --- .../concerns/dashboard/group_supports.rb | 11 ----------- app/helpers/application_helper.rb | 8 -------- app/helpers/documents_helper.rb | 4 ---- app/helpers/imageables_helper.rb | 4 ---- app/helpers/images_helper.rb | 4 ---- app/helpers/officers_helper.rb | 4 ---- app/helpers/polls_helper.rb | 16 ---------------- 7 files changed, 51 deletions(-) diff --git a/app/controllers/concerns/dashboard/group_supports.rb b/app/controllers/concerns/dashboard/group_supports.rb index f9dfe0fbc..3ca5d4826 100644 --- a/app/controllers/concerns/dashboard/group_supports.rb +++ b/app/controllers/concerns/dashboard/group_supports.rb @@ -39,17 +39,6 @@ module Dashboard::GroupSupports complete_grouped_votes end - - def previous_key_for(date) - grouping_key_for(date - interval) - end - - def interval - return 1.week if params[:group_by] == "week" - return 1.month if params[:group_by] == "month" - - 1.day - end end private diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 395faecff..255534a88 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,12 +1,4 @@ module ApplicationHelper - def home_page? - return false if user_signed_in? - - # Using path because fullpath yields false negatives since it contains - # parameters too - request.path == "/" - end - # if current path is /debates current_path_with_query_params(foo: "bar") returns /debates?foo=bar # notice: if query_params have a param which also exist in current path, # it "overrides" (query_params is merged last) diff --git a/app/helpers/documents_helper.rb b/app/helpers/documents_helper.rb index 46db4522d..1200b418a 100644 --- a/app/helpers/documents_helper.rb +++ b/app/helpers/documents_helper.rb @@ -11,10 +11,6 @@ module DocumentsHelper bytes / Numeric::MEGABYTE end - def document_nested_field_wrapper_id(index) - "document_#{index}" - end - def render_destroy_document_link(builder, document) if !document.persisted? && document.cached_attachment.present? link_to t("documents.form.delete_button"), diff --git a/app/helpers/imageables_helper.rb b/app/helpers/imageables_helper.rb index 529ee9cd7..f2ed56b09 100644 --- a/app/helpers/imageables_helper.rb +++ b/app/helpers/imageables_helper.rb @@ -3,10 +3,6 @@ module ImageablesHelper imageable.image.present? && can?(:destroy, imageable.image) end - def imageable_class(imageable) - imageable.class.name.parameterize(separator: "_") - end - def imageable_max_file_size bytes_to_megabytes(Setting["uploads.images.max_size"].to_i.megabytes) end diff --git a/app/helpers/images_helper.rb b/app/helpers/images_helper.rb index 179e02b1a..b265e10ad 100644 --- a/app/helpers/images_helper.rb +++ b/app/helpers/images_helper.rb @@ -17,10 +17,6 @@ module ImagesHelper image.errors[:attachment].join(", ") if image.errors.key?(:attachment) end - def image_bytes_to_megabytes(bytes) - bytes / Numeric::MEGABYTE - end - def image_class(image) image.persisted? ? "persisted-image" : "cached-image" end diff --git a/app/helpers/officers_helper.rb b/app/helpers/officers_helper.rb index 94eaf1145..9e6a6bb47 100644 --- a/app/helpers/officers_helper.rb +++ b/app/helpers/officers_helper.rb @@ -1,8 +1,4 @@ module OfficersHelper - def officer_label(officer) - truncate([officer.name, officer.email].compact.join(" - "), length: 100) - end - def vote_collection_shift? current_user.poll_officer.officer_assignments.voting_days.where(date: Time.current.to_date).any? end diff --git a/app/helpers/polls_helper.rb b/app/helpers/polls_helper.rb index a3de04ccf..b69a9368f 100644 --- a/app/helpers/polls_helper.rb +++ b/app/helpers/polls_helper.rb @@ -19,22 +19,6 @@ module PollsHelper end end - def poll_dates_select_options(poll) - options = [] - (poll.starts_at.to_date..poll.ends_at.to_date).each do |date| - options << [l(date, format: :long), l(date)] - end - options_for_select(options, params[:d]) - end - - def poll_booths_select_options(poll) - options = [] - poll.booths.each do |booth| - options << [booth_name_with_location(booth), booth.id] - end - options_for_select(options) - end - def booth_name_with_location(booth) location = booth.location.blank? ? "" : " (#{booth.location})" booth.name + location