We were very inconsistent regarding these rules. Personally I prefer no empty lines around blocks, clases, etc... as recommended by the Ruby style guide [1], and they're the default values in rubocop, so those are the settings I'm applying. The exception is the `private` access modifier, since we were leaving empty lines around it most of the time. That's the default rubocop rule as well. Personally I don't have a strong preference about this one. [1] https://rubystyle.guide/#empty-lines-around-bodies
38 lines
1.2 KiB
Ruby
38 lines
1.2 KiB
Ruby
module CommunitiesHelper
|
|
def community_title(community)
|
|
community.from_proposal? ? community.proposal.title : community.investment.title
|
|
end
|
|
|
|
def community_text(community)
|
|
community.from_proposal? ? t("community.show.title.proposal") : t("community.show.title.investment")
|
|
end
|
|
|
|
def community_description(community)
|
|
community.from_proposal? ? t("community.show.description.proposal") : t("community.show.description.investment")
|
|
end
|
|
|
|
def author?(community, participant)
|
|
if community.from_proposal?
|
|
community.proposal.author_id == participant.id
|
|
else
|
|
community.investment.author_id == participant.id
|
|
end
|
|
end
|
|
|
|
def community_back_link_path(community)
|
|
if community.from_proposal?
|
|
proposal_path(community.proposal)
|
|
else
|
|
budget_investment_path(community.investment.budget_id, community.investment)
|
|
end
|
|
end
|
|
|
|
def community_access_text(community)
|
|
community.from_proposal? ? t("community.sidebar.description.proposal") : t("community.sidebar.description.investment")
|
|
end
|
|
|
|
def create_topic_link(community)
|
|
current_user.present? ? new_community_topic_path(community.id) : new_user_session_path
|
|
end
|
|
end
|