The current tracking section had a few issues: * When browsing as an admin, this section becomes useless since no investments are shown * Browsing investments in the admin section, you're suddenly redirected to the tracking section, making navigation confusing * One test related to the officing dashboard failed due to these changes and had been commented * Several views and controller methods were copied from other sections, leading to duplication and making the code harder to maintain * Tracking routes were defined for proposals and legislation processes, but in the tracking section only investments were shown * Probably many more things, since these issues were detected after only an hour reviewing and testing the code So we're removing this untested section before releasing version 1.1. We might add it back afterwards.
73 lines
1.7 KiB
Ruby
73 lines
1.7 KiB
Ruby
module UsersHelper
|
|
def humanize_document_type(document_type)
|
|
case document_type
|
|
when "1"
|
|
t "verification.residence.new.document_type.spanish_id"
|
|
when "2"
|
|
t "verification.residence.new.document_type.passport"
|
|
when "3"
|
|
t "verification.residence.new.document_type.residence_card"
|
|
end
|
|
end
|
|
|
|
def comment_commentable_title(comment)
|
|
commentable = comment.commentable
|
|
if commentable.nil?
|
|
deleted_commentable_text(comment)
|
|
elsif commentable.hidden?
|
|
content_tag(:del, commentable.title) + " " +
|
|
content_tag(:span, "(" + deleted_commentable_text(comment) + ")", class: "small")
|
|
else
|
|
link_to(commentable.title, comment)
|
|
end
|
|
end
|
|
|
|
def deleted_commentable_text(comment)
|
|
case comment.commentable_type
|
|
when "Proposal"
|
|
t("users.show.deleted_proposal")
|
|
when "Debate"
|
|
t("users.show.deleted_debate")
|
|
when "Budget::Investment"
|
|
t("users.show.deleted_budget_investment")
|
|
else
|
|
t("users.show.deleted")
|
|
end
|
|
end
|
|
|
|
def current_administrator?
|
|
current_user&.administrator?
|
|
end
|
|
|
|
def current_moderator?
|
|
current_user&.moderator?
|
|
end
|
|
|
|
def current_valuator?
|
|
current_user&.valuator?
|
|
end
|
|
|
|
def current_manager?
|
|
current_user&.manager?
|
|
end
|
|
|
|
def current_poll_officer?
|
|
current_user&.poll_officer?
|
|
end
|
|
|
|
def show_admin_menu?(user = nil)
|
|
unless namespace == "officing"
|
|
current_administrator? || current_moderator? || current_valuator? || current_manager? ||
|
|
(user&.administrator?) || current_poll_officer?
|
|
end
|
|
end
|
|
|
|
def interests_title_text(user)
|
|
if current_user == user
|
|
t("account.show.public_interests_my_title_list")
|
|
else
|
|
t("account.show.public_interests_user_title_list")
|
|
end
|
|
end
|
|
end
|