pundit: convert favorite groups to pundit.

This commit is contained in:
evazion
2020-03-19 18:12:16 -05:00
parent 50fa674a3e
commit 2c4c29b81a
9 changed files with 80 additions and 54 deletions

View File

@@ -1,6 +1,6 @@
<% content_for(:secondary_links) do %>
<%= subnav_link_to "Listing", favorite_groups_path %>
<% if CurrentUser.is_member? %>
<% if policy(FavoriteGroup).create? %>
<%= subnav_link_to "New", new_favorite_group_path %>
<% end %>
<%= subnav_link_to "Help", wiki_page_path("help:favorite_groups") %>
@@ -9,7 +9,7 @@
<li>|</li>
<%= subnav_link_to "Show", favorite_group_path(@favorite_group) %>
<%= subnav_link_to "Posts", posts_path(:tags => "favgroup:#{@favorite_group.id}") %>
<% if @favorite_group.editable_by?(CurrentUser.user) %>
<% if policy(@favorite_group).update? %>
<%= subnav_link_to "Edit", edit_favorite_group_path(@favorite_group) %>
<%= subnav_link_to "Delete", favorite_group_path(@favorite_group), :method => :delete, :data => {:confirm => "Are you sure you want to delete this favorite group?"} %>
<% if @favorite_group.post_count <= 100 %>

View File

@@ -26,7 +26,7 @@
<%= time_ago_in_words_tagged(favgroup.updated_at) %>
<% end %>
<% t.column column: "control" do |favgroup| %>
<% if favgroup.editable_by?(CurrentUser.user) %>
<% if policy(favgroup).update? %>
<%= link_to "Edit", edit_favorite_group_path(favgroup) %> |
<%= link_to "Delete", favorite_group_path(favgroup), method: :delete, remote: true, "data-confirm": "Are you sure you want to delete this favgroup? This cannot be undone." %>
<% end %>