Created
September 17, 2012 03:56
-
-
Save epitron/18970e86ded35f4478e5 to your computer and use it in GitHub Desktop.
Demo of "easy_table()" (a DSL for turning a collection of Ruby objects into an HTML table), created for a Rails app in 2006.
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
<%= easy_table(items, :class=>"table-style1", :tbody_id=>@table_id) do | |
col("Name") {|o| o.drug_price.name} | |
col("Qty", :quantity) | |
col("Price") {|o| number_to_currency(o.price) } | |
col("Actions") do |o| | |
link_to image_tag('small/delete.png'), | |
:action => "return_package_item", | |
:package_item => o.id, | |
:id => @order.id | |
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
<% for package in @order.packages %> | |
<h2>Package for <%= package.pharmacy.name %> <%= package.pharmacy.country.flag_image_tag %></h2> | |
<%= render :partial => "table_of_package_items", :locals => {:items => package.items} %> | |
<div id="package<%= package.id %>_totals"> | |
<%= render :partial => "package_totals", :locals => {:package => package} %> | |
</div> | |
<h3>current status: <%= package.state %></h3> | |
<% end %> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment