From d8e9aad33136bf822518947d66850f7a366859e7 Mon Sep 17 00:00:00 2001 From: taitus Date: Fri, 1 Sep 2017 13:09:36 +0200 Subject: [PATCH] Fix community access text. --- app/helpers/communities_helper.rb | 4 ++++ app/views/budgets/investments/_investment_show.html.erb | 2 +- app/views/communities/_access_button.html.erb | 4 ++-- app/views/proposals/show.html.erb | 2 +- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/app/helpers/communities_helper.rb b/app/helpers/communities_helper.rb index 9e2b77b9c..1d50c5388 100644 --- a/app/helpers/communities_helper.rb +++ b/app/helpers/communities_helper.rb @@ -35,4 +35,8 @@ module CommunitiesHelper end end + def community_access_text(community) + community.from_proposal? ? t("community.sidebar.description.proposal") : t("community.sidebar.description.investment") + end + end diff --git a/app/views/budgets/investments/_investment_show.html.erb b/app/views/budgets/investments/_investment_show.html.erb index c2d5c97db..db2a2562d 100644 --- a/app/views/budgets/investments/_investment_show.html.erb +++ b/app/views/budgets/investments/_investment_show.html.erb @@ -123,7 +123,7 @@ <%= render 'follows/follow_button', follow: find_or_build_follow(current_user, investment) %> <% end %> - <%= render 'communities/access_button', community_id: investment.community_id %> + <%= render 'communities/access_button', community: investment.community %> diff --git a/app/views/communities/_access_button.html.erb b/app/views/communities/_access_button.html.erb index a5a55786e..6e1a6dc76 100644 --- a/app/views/communities/_access_button.html.erb +++ b/app/views/communities/_access_button.html.erb @@ -2,7 +2,7 @@

<%= t("community.sidebar.title") %>

- <%= t("community.sidebar.description") %> + <%= community_access_text(community) %>

- <%= link_to t("community.sidebar.button_to_access"), community_path(community_id), class: 'button hollow expanded' %> + <%= link_to t("community.sidebar.button_to_access"), community_path(community.id), class: 'button hollow expanded' %> <% end %> diff --git a/app/views/proposals/show.html.erb b/app/views/proposals/show.html.erb index 1c22b715f..177228d76 100644 --- a/app/views/proposals/show.html.erb +++ b/app/views/proposals/show.html.erb @@ -159,7 +159,7 @@ <%= render 'follows/follow_button', follow: find_or_build_follow(current_user, @proposal) %> <% end %> - <%= render 'communities/access_button', community_id: @proposal.community_id %> + <%= render 'communities/access_button', community: @proposal.community %>