Redirect anonymous user to sign in on create topic link

This commit is contained in:
Bertocq
2017-12-14 13:50:42 +01:00
parent 8c9585480b
commit 831ca1dd67
2 changed files with 5 additions and 2 deletions

View File

@@ -32,4 +32,7 @@ module CommunitiesHelper
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

View File

@@ -17,7 +17,7 @@
<aside class="small-12 column show-for-small-only">
<div class="sidebar-divider"></div>
<h2><%= t("community.show.sidebar.participate") %></h2>
<%= link_to t("community.show.sidebar.new_topic"), new_community_topic_path(@community.id), class: "button expanded" %>
<%= link_to t("community.show.sidebar.new_topic"), create_topic_link(@community) , class: "button expanded" %>
</aside>
<div class="small-12 medium-9 column">
@@ -30,7 +30,7 @@
<aside class="small-12 medium-3 column hide-for-small-only">
<div class="sidebar-divider"></div>
<h2><%= t("community.show.sidebar.participate") %></h2>
<%= link_to t("community.show.sidebar.new_topic"), new_community_topic_path(@community.id), class: "button expanded" %>
<%= link_to t("community.show.sidebar.new_topic"), create_topic_link(@community) , class: "button expanded" %>
</aside>
</div>
</div>