-
-
Save xander-miller/9d05ade05d9b7f4e4dcd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<h1>My wikis</h1> | |
<div class="row"> | |
<% if policy(Wiki.new).create? %> <%#added policy instead of if user %> | |
<%= link_to 'New', new_wiki_path, class: 'btn btn-primary btn-large' %> | |
<% end %> | |
<% if current_user.role?("free") %> | |
<h2><%= link_to "Upgrade Account", new_charge_path, class: 'btn btn-primary btn-large' %></h2> | |
</div> | |
<% end %> | |
<table class="table table-bordered"> | |
<thead> | |
<tr class="info"> | |
<th>User</th> | |
<th>Name</th> | |
<th>Body</th> | |
<th>Actions</th> | |
</tr> | |
</thead> | |
<tbody> | |
<% @wikis.each do |wiki| %> | |
<tr class="active"> | |
<td><%= wiki.user.name if wiki.user %></td> | |
<td><%= wiki.name %></td> | |
<td><%= wiki.body %></td> | |
<td><%= link_to 'Show', wiki %> | | |
<% if policy(wiki).edit? %> | |
<%= link_to 'Edit', edit_wiki_path(wiki) %> | |
<% end %> | | |
<% if policy(wiki).destroy? %> | |
<%= link_to 'Destroy', wiki, method: :delete, data: { confirm: 'Are you sure?' } %> | |
<% end %> | |
<%# if current_user.role?("premium") %> | |
<%# link_to 'Add Collaborators', new_wiki_collaborator_path(wiki) %> | |
<%# end %> | |
</td> | |
</tr> | |
<% end %> | |
</tbody> | |
</table> | |
<br> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment