|
19 | 19 | </p>
|
20 | 20 | </div>
|
21 | 21 | <div class="col-sm-4 text-right">
|
22 |
| - <%= link_to 'Edit', edit_hunt_home_path(@hunt, @home), class: 'btn btn-warning' %> |
| 22 | + <% if user_signed_in? %> |
| 23 | + <%= link_to 'Edit', edit_hunt_home_path(@hunt, @home), class: 'btn btn-warning' %> |
| 24 | + <% else %> |
| 25 | + <%= link_to 'Log in', new_session_path('user'), class: 'btn btn-warning' %> |
| 26 | + <% end %> |
23 | 27 | <% if @home.disabled? %>
|
24 | 28 | <%= link_to 'Restore',
|
25 | 29 | restore_hunt_home_path(@hunt, @home),
|
|
32 | 36 | method: :patch,
|
33 | 37 | class: 'btn btn-info' %>
|
34 | 38 | <% end %>
|
35 |
| - <%= link_to 'Archive', |
36 |
| - hunt_home_path(@hunt, @home), |
37 |
| - method: :delete, |
38 |
| - data: { confirm: 'Really archive this home?' }, |
39 |
| - class: 'btn btn-danger' %> |
| 39 | + <% if user_signed_in? %> |
| 40 | + <%= link_to 'Archive', |
| 41 | + hunt_home_path(@hunt, @home), |
| 42 | + method: :delete, |
| 43 | + data: { confirm: 'Really archive this home?' }, |
| 44 | + class: 'btn btn-danger' %> |
| 45 | + <% end %> |
40 | 46 | <% end %>
|
41 | 47 |
|
42 | 48 | <h3><%= @home.price_display %></h3>
|
|
64 | 70 | </div>
|
65 | 71 | <div class="col-12 col-lg-4">
|
66 | 72 | <%= render 'comments/list', comments: @home.comments %>
|
67 |
| - <%= render 'comments/form', comment: @home.comments.new %> |
| 73 | + <% if user_signed_in? %> |
| 74 | + <%= render 'comments/form', comment: @home.comments.new %> |
| 75 | + <% else %> |
| 76 | + <p> |
| 77 | + <%= link_to 'Log in', new_session_path('user') %> |
| 78 | + to leave a comment or rating. |
| 79 | + </p> |
| 80 | + <% end %> |
68 | 81 |
|
69 | 82 | <% @ratings.each do |rating| %>
|
70 | 83 | <br>
|
|
0 commit comments