Changeset 1289

Show
Ignore:
Timestamp:
03/16/08 20:31:37 (8 months ago)
Author:
mikem836
Message:

fix Renderer -> Controller in the examples

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • ruport/trunk/examples/btree/commaleon/commaleon.rb

    r1083 r1289  
    1111# about new records ) 
    1212# 
    13 # It's a camping app, but the core of it is a renderer/formatter combo.  
     13# It's a camping app, but the core of it is a controller/formatter combo.  
    1414# (Marked by %%%%%%%%%%% below)      
    1515# 
     
    5252# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
    5353# This is the bulk of the Ruport code in this app 
    54 # (CSVDiffRenderer and CSVDiffFormatter) 
     54# (CSVDiffController and CSVDiffFormatter) 
    5555# The rest is just camping.  The interesting thing here is that 
    5656# you could easily define these in another file and just require 
     
    5858# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
    5959 
    60   class CSVDiffRenderer < Ruport::Renderer 
     60  class CSVDiffController < Ruport::Controller 
    6161     stage :diff_report 
    6262     option :key, :mcsv, :ccsv   
     
    6666     # rendering task to the formatters. 
    6767     #    
    68      # We're using grouping mainly for the renderer support, 
     68     # We're using grouping mainly for the controller support, 
    6969     # and rather than reducing a table, we're building up the 
    7070     # group objects via the helper methods missing_from_compare 
     
    134134  # http://stonecode.svnrepository.com/ruport/trac.cgi/wiki/F 
    135135  # 
    136   class CSVDiffFormatter < F([:html,:text,:csv,:pdf], :for => CSVDiffRenderer) 
     136  class CSVDiffFormatter < F([:html,:text,:csv,:pdf], :for => CSVDiffController) 
    137137    def build_diff_report         
    138138     # this is using the selective blocks for formatters that implement 
     
    184184    def post 
    185185      @state.key = @input.csv_id   
    186       @table = CSVDiffRenderer.render_html(:key =>  @state.key, 
     186      @table = CSVDiffController.render_html(:key =>  @state.key, 
    187187                                           :mcsv => @state.mfile, 
    188188                                           :ccsv => @state.cfile )   
     
    208208       case(format) 
    209209       when "csv" 
    210          text CSVDiffRenderer.render_csv(options)   
     210         text CSVDiffController.render_csv(options)   
    211211       when "pdf" 
    212          text CSVDiffRenderer.render_pdf(options.merge(:style => :justified))  
     212         text CSVDiffController.render_pdf(options.merge(:style => :justified))  
    213213       when "txt" 
    214          text CSVDiffRenderer.render_text(options) 
     214         text CSVDiffController.render_text(options) 
    215215       else 
    216216         text "no format!" 
  • ruport/trunk/examples/centered_pdf_text_box.rb

    r1210 r1289  
    11require "ruport"                              
    22  
    3 # Renderers can be though of as control classes or interface builders. 
     3# Controllers can be though of as control classes or interface builders. 
    44# Essentially, they define the options that formatters should implement 
    55# and the stages of rendering they should handle.  Ruport's formatting 
    6 # system is very forgiving, and the renderers do not force their 
     6# system is very forgiving, and the controllers do not force their 
    77# specs onto formatters that are attached to them.  
    88# 
    9 class Document < Ruport::Renderer 
     9class Document < Ruport::Controller 
    1010   
    1111  # Will throw an error if these options are not set at rendering time 
    1212  required_option :text, :author                                       
    1313   
    14   # The renderer will look for a build_document_body() method on the formatter, 
     14  # The controller will look for a build_document_body() method on the formatter, 
    1515  # but silently skip this stage if it is missing 
    1616  stage :document_body 
    1717   
    18   # The renderer will look for a finalize_document() method on the formatter, 
     18  # The controller will look for a finalize_document() method on the formatter, 
    1919  # but silently skip this stage if it is missing 
    2020  finalize :document                             
     
    6060end 
    6161 
    62 # All options passed to a renderer will be written onto the options object. 
     62# All options passed to a controller will be written onto the options object. 
    6363# In the block form, you may use explicit accessors  
    6464# (i.e. r.text instead of r.options.text ) for only things that have 
    6565# either been defined with option / required_option methods,  
    66 # or have explicit accessors in the Renderer. 
     66# or have explicit accessors in the Controller. 
    6767# 
    6868a = Document.render_pdf( :heading => "a good quote",  
  • ruport/trunk/examples/line_plotter.rb

    r930 r1289  
    11require "ruport" 
    22 
    3 class LinePlotter < Ruport::Renderer 
     3class LinePlotter < Ruport::Controller 
    44 
    55   options do |o| 
  • ruport/trunk/examples/pdf_report_with_common_base.rb

    r1224 r1289  
    99require "ruport"  
    1010 
    11 # only used for the titleize call in ClientRenderer#setup   
     11# only used for the titleize call in ClientController#setup   
    1212# tweak as needed if you don't want to install AS. 
    1313require "active_support"  
     
    1616# concern of wanting to have a standard template for reports. 
    1717# 
    18 class ClientRenderer < Ruport::Renderer 
     18class ClientController < Ruport::Controller 
    1919  prepare :standard_report 
    2020  stage :company_header, :client_header, :client_body, :client_footer 
     
    5252# 
    5353class ClientPDF < CompanyPDFBase 
    54   renders :pdf, :for => ClientRenderer 
     54  renders :pdf, :for => ClientController 
    5555 
    5656  def build_client_header 
     
    6969 
    7070File.open("example.pdf","w") do |f| 
    71   f << ClientRenderer.render_pdf(:data => table,:example => "apple") 
     71  f << ClientController.render_pdf(:data => table,:example => "apple") 
    7272end 
  • ruport/trunk/examples/png_embed.rb

    r1224 r1289  
    22require "ruport" 
    33 
    4 class RoadmapRenderer < Ruport::Renderer 
     4class RoadmapController < Ruport::Controller 
    55  stage :roadmap_image, :roadmap_text_body 
    66  finalize :roadmap 
     
    99class HTMLRoadmap < Ruport::Formatter 
    1010 
    11   renders :html, :for => RoadmapRenderer 
     11  renders :html, :for => RoadmapController 
    1212 
    1313  def layout 
     
    2929class PDFRoadmap < Ruport::Formatter::PDF 
    3030 
    31   renders :pdf, :for => RoadmapRenderer 
     31  renders :pdf, :for => RoadmapController 
    3232 
    3333  def build_roadmap_image 
     
    5050formats = [:html, :pdf] 
    5151formats.each do  |format| 
    52   RoadmapRenderer.render(format, :image_file => "roadmap.png",  
     52  RoadmapController.render(format, :image_file => "roadmap.png",  
    5353                                 :file => "roadmap.#{format}") 
    5454end 
  • ruport/trunk/examples/row_renderer.rb

    r1250 r1289  
    11require "ruport" 
    22 
    3 class CSV2Something < Ruport::Renderer 
     3class CSV2Something < Ruport::Controller 
    44  required_option :csv_file 
    55  stage :table_body 
  • ruport/trunk/examples/simple_pdf_lines.rb

    r933 r1289  
    33# draws pretty little lines all over the place on a PDF 
    44 
    5 class SimpleLines < Ruport::Renderer 
     5class SimpleLines < Ruport::Controller 
    66  stage :horizontal_lines 
    77end 
  • ruport/trunk/examples/trac_ticket_status.rb

    r1139 r1289  
    33class TracSummaryReport 
    44   
    5   include Ruport::Renderer::Hooks 
     5  include Ruport::Controller::Hooks 
    66   
    77  renders_as_table