Skip to content

Instantly share code, notes, and snippets.

@andrebras
Created January 26, 2012 18:10
Show Gist options
  • Save andrebras/1684109 to your computer and use it in GitHub Desktop.
Save andrebras/1684109 to your computer and use it in GitHub Desktop.
HAML index example
.form_holder
%h3.button#label_new_project Novo Projeto
%div{class: "form_fields", id: "new_project", style: "display:none"}
- @project = Project.new
= render partial: 'form'
:javascript
$('.button#label_new_project').click(function(e) {
e.preventDefault();
$('.form_fields').toggle('slow');
});
%br
.content.twelvecol
-#%h2= Project.model_name.human(:count => 0)
.row.header
%p.twocol= Project.human_attribute_name 'Code'
%p.threecol= Project.human_attribute_name 'Reference'
%p.threecol= Project.human_attribute_name 'customer'
%p.onecol= Project.human_attribute_name 'priority_level'
%p.onecol= Project.human_attribute_name 'StartDate'
%p.twocol.last= Project.human_attribute_name 'ResponsabilityCenter'
- @projects.each do |p|
%div{ :class => ['row holder', "#{cycle('odd', 'even', :name => 'row_class')}"] }
%p.twocol= link_to p.Code, project_path(p)
%p.threecol= p.Reference
%p.threecol= link_to p.customer.Name, entities_customers_path(p.customer) unless p.customer.nil?
%p.onecol= p.priority_level.Description unless p.priority_level.nil?
%p.onecol= l p.StartDate.to_date
%p.twocol.last= p.responsability_center.Description unless p.responsability_center.nil?
= paginate @projects
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment