Remove unused helper methods
They aren't used since commitsa6585361,3752f3a5,88a7a29d,eef8ad1b,f67f058b,04910feaand9181610d. The method `image_bytes_to_megabytes` was never used and is a duplicate of the method `bytes_to_megabytes`.
This commit is contained in:
@@ -39,17 +39,6 @@ module Dashboard::GroupSupports
|
|||||||
|
|
||||||
complete_grouped_votes
|
complete_grouped_votes
|
||||||
end
|
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
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|||||||
@@ -1,12 +1,4 @@
|
|||||||
module ApplicationHelper
|
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
|
# 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,
|
# notice: if query_params have a param which also exist in current path,
|
||||||
# it "overrides" (query_params is merged last)
|
# it "overrides" (query_params is merged last)
|
||||||
|
|||||||
@@ -11,10 +11,6 @@ module DocumentsHelper
|
|||||||
bytes / Numeric::MEGABYTE
|
bytes / Numeric::MEGABYTE
|
||||||
end
|
end
|
||||||
|
|
||||||
def document_nested_field_wrapper_id(index)
|
|
||||||
"document_#{index}"
|
|
||||||
end
|
|
||||||
|
|
||||||
def render_destroy_document_link(builder, document)
|
def render_destroy_document_link(builder, document)
|
||||||
if !document.persisted? && document.cached_attachment.present?
|
if !document.persisted? && document.cached_attachment.present?
|
||||||
link_to t("documents.form.delete_button"),
|
link_to t("documents.form.delete_button"),
|
||||||
|
|||||||
@@ -3,10 +3,6 @@ module ImageablesHelper
|
|||||||
imageable.image.present? && can?(:destroy, imageable.image)
|
imageable.image.present? && can?(:destroy, imageable.image)
|
||||||
end
|
end
|
||||||
|
|
||||||
def imageable_class(imageable)
|
|
||||||
imageable.class.name.parameterize(separator: "_")
|
|
||||||
end
|
|
||||||
|
|
||||||
def imageable_max_file_size
|
def imageable_max_file_size
|
||||||
bytes_to_megabytes(Setting["uploads.images.max_size"].to_i.megabytes)
|
bytes_to_megabytes(Setting["uploads.images.max_size"].to_i.megabytes)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -17,10 +17,6 @@ module ImagesHelper
|
|||||||
image.errors[:attachment].join(", ") if image.errors.key?(:attachment)
|
image.errors[:attachment].join(", ") if image.errors.key?(:attachment)
|
||||||
end
|
end
|
||||||
|
|
||||||
def image_bytes_to_megabytes(bytes)
|
|
||||||
bytes / Numeric::MEGABYTE
|
|
||||||
end
|
|
||||||
|
|
||||||
def image_class(image)
|
def image_class(image)
|
||||||
image.persisted? ? "persisted-image" : "cached-image"
|
image.persisted? ? "persisted-image" : "cached-image"
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,8 +1,4 @@
|
|||||||
module OfficersHelper
|
module OfficersHelper
|
||||||
def officer_label(officer)
|
|
||||||
truncate([officer.name, officer.email].compact.join(" - "), length: 100)
|
|
||||||
end
|
|
||||||
|
|
||||||
def vote_collection_shift?
|
def vote_collection_shift?
|
||||||
current_user.poll_officer.officer_assignments.voting_days.where(date: Time.current.to_date).any?
|
current_user.poll_officer.officer_assignments.voting_days.where(date: Time.current.to_date).any?
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -19,22 +19,6 @@ module PollsHelper
|
|||||||
end
|
end
|
||||||
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)
|
def booth_name_with_location(booth)
|
||||||
location = booth.location.blank? ? "" : " (#{booth.location})"
|
location = booth.location.blank? ? "" : " (#{booth.location})"
|
||||||
booth.name + location
|
booth.name + location
|
||||||
|
|||||||
Reference in New Issue
Block a user