Skip to content

Commit

Permalink
Added condition for non admins (#7480)
Browse files Browse the repository at this point in the history
  • Loading branch information
sssash18 authored Feb 16, 2020
1 parent d432d1a commit 029229f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions app/views/features/index.html.erb
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
<h2>Features</h2>

<p>Features allow admins to edit/update text and images displayed around the site, for example banners, sidebar content, and alerts or notices.</p>

<% if current_user.admin? %>
<p><a class="btn btn-outline-secondary" href="/features/new">New feature</a></p>

<% end %>
<table class="table">
<tr>
<th>Title</th>
<% if current_user.admin? %>
<th>Edit</th>
<% end %>
<th>Last edited</th>
</tr>
<% @features.each do |feature| %>
<tr>
<td style="width:50%"><a href="/features/<%= feature.id %>"><%= feature.title %></a></td>
<% if current_user.admin? %>
<td><a href="/features/<%= feature.id %>/edit?t=<%= Time.now.to_i %>">edit</a></td>
<% end %>
<td><%= time_ago_in_words(feature.latest.created_at) %> ago by
<a href="/profile/<%= feature.latest.author.name %>"><%= feature.latest.author.name %></td>
</tr>
Expand Down

0 comments on commit 029229f

Please sign in to comment.