pundit: convert posts to pundit.

This commit is contained in:
evazion
2020-03-20 01:55:51 -05:00
parent dd39913e55
commit a5418abb31
18 changed files with 178 additions and 95 deletions

View File

@@ -1,6 +1,6 @@
<ul>
<li id="post-info-id">ID: <%= post.id %></li>
<% if CurrentUser.is_moderator? %>
<% if policy(post).can_view_uploader? %>
<li id="post-info-uploader">Uploader: <%= link_to_user(post.uploader) %></li>
<% end %>
<li id="post-info-date">
@@ -11,7 +11,7 @@
<li id="post-info-approver">Approver: <%= link_to_user(post.approver) %></li>
<% end %>
<li id="post-info-size">
Size: <%= link_to_if post.visible?, number_to_human_size(post.file_size), post.tagged_file_url %>
Size: <%= link_to_if policy(post).visible?, number_to_human_size(post.file_size), post.tagged_file_url %>
<% if post.has_dimensions? %>
(<span itemprop="width"><%= post.image_width %></span>x<span itemprop="height"><%= post.image_height %></span>)
<% end %>
@@ -31,7 +31,7 @@
<% end %>
</li>
<li id="post-info-favorites">Favorites: <span id="favcount-for-post-<%= post.id %>"><%= post.fav_count %></span>
<% if CurrentUser.is_gold? %>
<% if policy(post).can_view_favlist? %>
<%= link_to "Show »", "#", id: "show-favlist-link", style: ("display: none;" if post.fav_count == 0) %>
<%= link_to "« Hide", "#", id: "hide-favlist-link", style: "display: none;" %>
<div id="favlist" style="display: none;"><%= post_favlist(post) %></div>