Skip to content

Commit 385cfae

Browse files
committed
Add policy check to calendar create button
1 parent fc7ccb3 commit 385cfae

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

app/views/better_together/calendars/index.html.erb

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
<div class="container mt-5">
22
<h1 class="mb-4 text-center"><i class="fas fa-calendar-alt"></i> Calendars</h1>
33

4-
<div class="text-center my-4">
5-
<%= link_to "New calendar", new_calendar_path, class: "btn btn-success" %>
6-
</div>
4+
<% if policy(resource_class).create? %>
5+
<div class="text-center my-4">
6+
<%= link_to "New calendar", new_calendar_path, class: "btn btn-success" %>
7+
</div>
8+
<% end %>
79

810
<div id="better_together_calendars" class="row row-cols-1 row-cols-md-2 g-4">
911
<%= render @calendars %>

0 commit comments

Comments
 (0)