Created
January 8, 2010 22:57
-
-
Save ssamuel68/272542 to your computer and use it in GitHub Desktop.
This file contains 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
<table width="690" border="0" align="center"> | |
<tr valign="top"> | |
<td height="40" align="left" class="dato" background="/images/topHeader.gif" colspan="4"><%= @category.name %></td> | |
</tr> | |
<tr><td> </td></tr> | |
<tr> | |
<td colspan="4" align="center" background="/images/vg.jpg"><span class="subdatos">Información de eventos del <%= Time.now.strftime("%d-%b") %> al <%= Time.now.advance(:weeks => 1).strftime("%d-%b") %></span></td> | |
</tr> | |
<tr><td> </td></tr> | |
<% @datacategoryparam = Event.find_all_by_category_idf @category.id, :conditions => ["eventstart between ? and ?",Time.now ,Time.now.advance(:months => 1) ] %> | |
<tr align="center"> | |
<td width="250" align="left"><h1>Evento</h1<</td> | |
<td width="150" align="left"><h1>Hora</h1></td> | |
</tr> | |
<% for event in @datacategoryparam %> | |
<tr align="center"> | |
<td width="250" align="left"><%= link_to event.name, event, :class => "navbar" %></td> | |
<td width="150" align="left"><%= event.eventstart.strftime("%d-%b-%y") %> -- <%= event.eventstart.strftime("%I:%M%p") %> </td> | |
<% end %> | |
</tr> | |
<tr><td> </td></tr> | |
<tr> | |
<td> <%= link_to "Ver Todos", "/categories/all/"+@category.id.to_s, :class => "navbar" %></td> | |
</tr> | |
<tr><td> </td></tr> | |
<tr> | |
<td><% CalendarDateSelect.format=(:iso_date)%> | |
<%= calendar_date_select_includes %> | |
<%= calendar_date_select_tag :birthdate %> | |
</td> | |
</tr> | |
<tr> | |
<td> | |
<%= link_to "Ver hasta", :action => 'partial', :id => @category.id, :date => "2010-02-28" , :class => "navbar" %></td> | |
</tr> | |
</table> |
This file contains 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
def self.draw(products) | |
pdf = PDF::Writer.new | |
products.each do |product| | |
pdf.text product.name | |
end | |
pdf.render | |
end |
This file contains 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
def index | |
@products = Product.find(:all) | |
respond_to do |format| | |
format.html | |
format.pdf do | |
send_data ProductDrawer.draw(@products), :filename => 'products.pdf', :type => 'application/pdf', :disposition => 'inline' | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment