Skip to content

Instantly share code, notes, and snippets.

@juliend2
Created July 12, 2011 16:25
Show Gist options
  • Save juliend2/1078347 to your computer and use it in GitHub Desktop.
Save juliend2/1078347 to your computer and use it in GitHub Desktop.
Sinatra CRUD views
-# new.haml:
- form_for @acclaim, '/admin/acclaims/new', :multipart=>true, :method=>'post' do |f|
= f.error_messages
= f.crud_fields
%p.buttons
= f.submit "Create",:class=>'wymupdate'
= link_to 'Back', '/admin/acclaims'
-# index.haml:
%h1 Index of Reviews
%p= link_to "New Review", '/admin/acclaims/new'
%table#orderable{:"data-ajaxurl"=>"/admin/acclaims/reorder"}
%tr
%th French Title
%th{:colspan=>2}
- @acclaims.each do |acclaim|
%tr{:id=>acclaim.id}
%td= acclaim.title_fr
%td= link_to "Edit", "/admin/acclaims/edit/#{acclaim.id}"
%td= delete_button("/admin/acclaims/delete/#{acclaim.id}")
-# edit.haml:
- form_for @acclaim, "/admin/acclaims/edit/#{@acclaim.id}", :multipart=>true, :method=>'put' do |f|
= f.error_messages
= f.crud_fields
%p.buttons
= f.submit "Update",:class=>'wymupdate'
= link_to 'Back', '/admin/acclaims'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment