Advertisement
Guest User

Untitled

a guest
May 25th, 2016
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.68 KB | None | 0 0
  1. <%= simple_form_for @profile, html: { class: 'form-horizontal' } do |f| %>
  2. <%= f.error_notification %>
  3.  
  4. <%= f.input :name %>
  5.  
  6. <div class="well">
  7. <div class="checkbox">
  8. <label>
  9. <input type="checkbox" id="checkAll">
  10. <i class="input-helper"></i>
  11. Marcar Todos
  12. </label>
  13. </div>
  14. <hr>
  15. <ul style="list-style: none; padding: 0;">
  16. <% @auth_controllers.each do |controller| %>
  17. <li>
  18. <div class="checkbox">
  19. <label>
  20. <input type="checkbox" class="checkAll">
  21. <i class="input-helper"></i>
  22. <%= controller.alias %>
  23. </label>
  24. </div>
  25. <ul style="list-style: none; padding: 10px 0 10px 30px;">
  26. <% controller.auth_actions.each do |action| %>
  27. <li>
  28. <div class="checkbox">
  29. <label>
  30. <input type="checkbox" name="profile[auth_action_ids][]" value="<%= action.id %>" <%= 'checked="checked"' if action.id.in? @profile.auth_actions.collect(&:id) %>>
  31. <i class="input-helper"></i>
  32. <%= action.description || action.name %>
  33. </label>
  34. </div>
  35. </li>
  36. <% end %>
  37. </ul>
  38. </li>
  39. <% end %>
  40. </ul>
  41. </div>
  42.  
  43. <%= link_to "Voltar", :back, class: 'btn btn-default waves-effect' %>
  44. <button class="btn btn-primary waves-effect">Salvar</button>
  45. <% end %>
  46.  
  47. <script>
  48. $("#checkAll").click(function(){
  49. $(this).parent().parent().parent().find('ul li input:checkbox').not(this).prop('checked', this.checked);
  50. });
  51. $(".checkAll").click(function(){
  52. $(this).parent().parent().parent().find('ul li input:checkbox').not(this).prop('checked', this.checked);
  53. });
  54. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement