Guest User

Untitled

a guest
Dec 10th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. %h1= "Listing " + "#{resource_name}s"
  2.  
  3. .btn-group.pull-right
  4. = link_to "All #{resource_name(item: resource_class.superclass)}s", polymorphic_path([:admin, resource_class.superclass]), class: 'btn'
  5. = link_to "Add #{resource_name}", new_resource_path, class: 'btn-primary btn'
  6.  
  7. %br
  8. %br
  9.  
  10. %table.table.table-bordered.table-striped#sortable{:data => {update_url: polymorphic_path([:sort, :admin, resource_class])}}
  11. %thead
  12. %tr
  13. - attributes.each do |attr|
  14. %th= resource_class.human_attribute_name(attr)
  15. %th  
  16.  
  17. %tbody
  18. - collection.each do |resource|
  19. %tr{data: {item_id: "#{resource.id}"}}
  20. - attributes.each do |attr|
  21. %td= resource.public_send(attr).to_s.truncate(20)
  22. %td
  23. = link_to 'show', resource_path(resource), :class => 'btn'
  24. = link_to 'edit', edit_resource_path(resource), :class => 'btn btn-primary'
  25. = link_to 'destroy', resource_path(resource), method: :delete, confirm: "Are you sure?", :class => 'btn btn-danger'
Add Comment
Please, Sign In to add comment