Files
grecia/app/helpers/communities_helper.rb
Javi Martín a1439d0790 Apply Layout/LineLength rubocop rule
Note we're excluding a few files:

* Configuration files that weren't generated by us
* Migration files that weren't generated by us
* The Gemfile, since it includes an important comment that must be on
  the same line as the gem declaration
* The Budget::Stats class, since the heading statistics are a mess and
  having shorter lines would require a lot of refactoring
2023-08-30 14:46:35 +02:00

46 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)
if community.from_proposal?
t("community.show.description.proposal")
else
t("community.show.description.investment")
end
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)
if community.from_proposal?
t("community.sidebar.description.proposal")
else
t("community.sidebar.description.investment")
end
end
def create_topic_link(community)
current_user.present? ? new_community_topic_path(community.id) : new_user_session_path
end
end