pundit: convert wiki pages to pundit.

This commit is contained in:
evazion
2020-03-17 04:36:05 -05:00
parent 5c6d26ea24
commit b3ff08fedf
7 changed files with 78 additions and 66 deletions

View File

@@ -7,7 +7,7 @@
<%= dtext_field "wiki_page", "body" %>
<% if CurrentUser.is_builder? %>
<% if policy(@wiki_page).can_edit_locked? %>
<%= f.input :is_locked, label: "Locked", hint: "Locked wikis can only be edited by Builders." %>
<% end %>

View File

@@ -2,7 +2,7 @@
<%= quick_search_form_for(:title_normalize, wiki_pages_path, "wiki pages", autocomplete: "wiki-page", redirect: true) %>
<%= subnav_link_to "Listing", wiki_pages_path %>
<%= subnav_link_to "Search", search_wiki_pages_path %>
<% if CurrentUser.is_member? %>
<% if policy(WikiPage).new? %>
<%= subnav_link_to "New", new_wiki_page_path %>
<% end %>
<%= subnav_link_to "Help", wiki_page_path("help:wiki") %>
@@ -13,7 +13,7 @@
<li>|</li>
<%= subnav_link_to "Posts (#{@wiki_page.tag.try(:post_count) || 0})", posts_path(:tags => @wiki_page.title) %>
<%= subnav_link_to "History", wiki_page_versions_path(:search => {:wiki_page_id => @wiki_page.id}) %>
<% if CurrentUser.is_member? %>
<% if policy(@wiki_page).edit? %>
<%= subnav_link_to "Edit", edit_wiki_page_path(@wiki_page.id), "data-shortcut": "e" %>
<% if @wiki_page.is_deleted? %>
@@ -28,7 +28,7 @@
<% if @wiki_page_version.previous %>
<%= subnav_link_to "Diff", diff_wiki_page_versions_path(:otherpage => @wiki_page_version.id, :thispage => @wiki_page_version.previous.id) %>
<% end %>
<% if CurrentUser.is_member? %>
<% if policy(@wiki_page_version.wiki_page).revert? %>
<%= subnav_link_to "Revert to", revert_wiki_page_path(@wiki_page_version.wiki_page_id, :version_id => @wiki_page_version.id), :method => :put, :data => {:confirm => "Are you sure you want to revert to this version?"} %>
<% end %>
<% end %>