Forked from anonymous/app_helpers_admin_permissions_helper.rb
Last active
December 14, 2015 01:19
-
-
Save tubbo/5005301 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
| module Admin::PermissionsHelper | |
| def permissions | |
| ['view', 'create tickets', 'edit tickets', 'delete tickets', 'change states'] | |
| end | |
| end |
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
| <h2>Permissions for <%= @user.email %></h2> | |
| <%= form_tag update_user_permissions_path, :method => :put do %> | |
| <table id="permissions" cellspacing="0"> | |
| <thead> | |
| <th>Project</th> | |
| <% permissions.each do |name| %> | |
| <th><%= name.titleize %></th> | |
| <% end %> | |
| </thead> | |
| <tbody> | |
| <% @projects.each do |project| %> | |
| <tr class="<%= cycle("odd", "even") %>" id="project_<%= project_id %>"> | |
| <td><%= project.name %></td> | |
| <% permissions.each do |name| %> | |
| <td><%= check_box_tag "permissions[#{project.id}][#{name.titleize}]", @ability.can?(name.to_sym, project) %></td> | |
| <% end %> | |
| </tr> | |
| <% end %> | |
| </tbody> | |
| </table> | |
| <%= submit_tag "Update" %> | |
| <% end %> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment