Skip to content

Commit c61fd69

Browse files
author
Theresa
committed
Fix edge case when no account link is added
1 parent 99c200b commit c61fd69

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

app/views/exercises/show.html.erb

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,13 @@
6767
<dd>
6868
<%= form_tag(push_external_exercise_path(@exercise), method: "post") do |f| %>
6969

70-
<%= collection_select(:account_link, :id, AccountLink.all, :id, :account_name, {}, {class: 'btn btn-default dropdown-toggle'}) %>
71-
<%= button_tag 'Submit', class: 'btn btn-success btn-xs' %>
70+
<% if !current_user.account_links.empty?%>
71+
<%= collection_select(:account_link, :id, AccountLink.all, :id, :account_name, {}, {class: 'btn btn-default dropdown-toggle'}) %>
72+
<%= button_tag 'Submit', class: 'btn btn-success btn-xs' %>
73+
<% else %>
74+
<%= link_to 'Please define a account link first', new_user_account_link_path(current_user)%>
75+
<% end %>
76+
7277
<% end %>
7378
</dd>
7479

0 commit comments

Comments
 (0)