hides retire link if no author/admin

This commit is contained in:
Juanjo Bazán
2016-05-06 12:18:38 +02:00
parent 5f08d65152
commit fd8fb49015
2 changed files with 13 additions and 9 deletions

View File

@@ -3,6 +3,7 @@ class UsersController < ApplicationController
load_and_authorize_resource load_and_authorize_resource
helper_method :authorized_for_filter? helper_method :authorized_for_filter?
helper_method :author_or_admin?
def show def show
load_filtered_activity if valid_access? load_filtered_activity if valid_access?

View File

@@ -6,15 +6,18 @@
<br> <br>
<%= proposal.summary %> <%= proposal.summary %>
</td> </td>
<td class="text-center">
<% if proposal.retired? %> <% if author_or_admin? %>
<span class="label alert"><%= t('users.show.retired') %></span> <td class="text-center">
<% else %> <% if proposal.retired? %>
<%= link_to t('users.show.retire'), <span class="label alert"><%= t('users.show.retired') %></span>
retire_form_proposal_path(proposal), <% else %>
class: 'delete' %> <%= link_to t('users.show.retire'),
<% end %> retire_form_proposal_path(proposal),
</td> class: 'delete' %>
<% end %>
</td>
<% end %>
</tr> </tr>
<% end %> <% end %>
</table> </table>