pundit: convert post versions to pundit.
This commit is contained in:
@@ -4,9 +4,9 @@
|
||||
<% end %>
|
||||
|
||||
<%= table_for @post_versions, {id: "post-versions-table", class: "striped autofit"} do |t| %>
|
||||
<% if CurrentUser.user.is_builder? %>
|
||||
<% if policy(@post_versions).can_mass_undo? %>
|
||||
<% t.column tag.label(tag.input type: :checkbox, id: "post-version-select-all-checkbox", class: "post-version-select-checkbox"), column: "post-version-select" do |post_version| %>
|
||||
<input type="checkbox" class="post-version-select-checkbox" <%= "disabled" unless post_version.can_undo?(CurrentUser.user) %>>
|
||||
<input type="checkbox" class="post-version-select-checkbox" <%= "disabled" unless policy(post_version).undo? %>>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% if listing_type(:post_id) == :standard %>
|
||||
@@ -31,10 +31,10 @@
|
||||
</div>
|
||||
<% end %>
|
||||
<% t.column do |post_version| %>
|
||||
<% if post_version.can_undo?(CurrentUser.user) %>
|
||||
<% if policy(post_version).can_undo? %>
|
||||
<%= link_to "Undo", undo_post_version_path(post_version), method: :put, remote: true, class: "post-version-undo-link" %>
|
||||
<% end %>
|
||||
<% if listing_type(:post_id) == :revert && post_version.can_revert_to?(CurrentUser.user) %>
|
||||
<% if listing_type(:post_id) == :revert && policy(post_version.post).revert? %>
|
||||
| <%= link_to "Revert to", revert_post_path(post_version.post_id, version_id: post_version.id), method: :put, remote: true %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
Reference in New Issue
Block a user