Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Changeset 6180

Show
Ignore:
Timestamp:
02/21/07 00:29:44 (2 years ago)
Author:
david
Message:

Apply the rest of Chads patch

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/actionmailer/lib/action_mailer/base.rb

    r6097 r6180  
    5353  # Like ActionController, each mailer class has a corresponding view directory 
    5454  # in which each method of the class looks for a template with its name. 
    55   # To define a template to be used with a mailing, create an <tt>.rhtml</tt> file with the same name as the method 
     55  # To define a template to be used with a mailing, create an <tt>.erb</tt> file with the same name as the method 
    5656  # in your mailer model. For example, in the mailer defined above, the template at  
    57   # <tt>app/views/notifier/signup_notification.rhtml</tt> would be used to generate the email. 
     57  # <tt>app/views/notifier/signup_notification.erb</tt> would be used to generate the email. 
    5858  # 
    5959  # Variables defined in the model are accessible as instance variables in the view. 
     
    104104  # = HTML email 
    105105  # 
    106   # To send mail as HTML, make sure your view (the <tt>.rhtml</tt> file) generates HTML and 
     106  # To send mail as HTML, make sure your view (the <tt>.erb</tt> file) generates HTML and 
    107107  # set the content type to html. 
    108108  # 
     
    143143  #  
    144144  # For example, if the following templates existed: 
    145   # * signup_notification.text.plain.rhtml 
    146   # * signup_notification.text.html.rhtml 
    147   # * signup_notification.text.xml.rxml 
    148   # * signup_notification.text.x-yaml.rhtml 
     145  # * signup_notification.text.plain.erb 
     146  # * signup_notification.text.html.erb 
     147  # * signup_notification.text.xml.builder 
     148  # * signup_notification.text.x-yaml.erb 
    149149  #   
    150150  # Each would be rendered and added as a separate part to the message, 
     
    384384        # First, we look to see if there are any likely templates that match, 
    385385        # which include the content-type in their file name (i.e., 
    386         # "the_template_file.text.html.rhtml", etc.). Only do this if parts 
     386        # "the_template_file.text.html.erb", etc.). Only do this if parts 
    387387        # have not already been specified manually. 
    388388        if @parts.empty? 
    389389          templates = Dir.glob("#{template_path}/#{@template}.*") 
    390390          templates.each do |path| 
    391             # TODO: don't hardcode rhtml|rxml 
     391            # TODO: don't hardcode erb|builder 
    392392            basename = File.basename(path) 
    393             next unless md = /^([^\.]+)\.([^\.]+\.[^\.]+)\.(rhtml|rxml)$/.match(basename) 
     393            next unless md = /^([^\.]+)\.([^\.]+\.[^\.]+)\.(erb|builder|rhtml|rxml)$/.match(basename) 
    394394            template_name = basename 
    395395            content_type = md.captures[1].gsub('.', '/') 
  • trunk/actionmailer/test/fixtures/first_mailer/share.rhtml

    r4509 r6180  
    1 first mail 
  • trunk/actionmailer/test/fixtures/helper_mailer/use_example_helper.rhtml

    r5436 r6180  
    1 So, <%= example_format(@text) %> 
  • trunk/actionmailer/test/fixtures/helper_mailer/use_helper_method.rhtml

    r1446 r6180  
    1 This message brought to you by <%= name_of_the_mailer_class %>. 
  • trunk/actionmailer/test/fixtures/helper_mailer/use_helper.rhtml

    r1446 r6180  
    1 Hello, <%= person_name %>. Thanks for registering! 
  • trunk/actionmailer/test/fixtures/helper_mailer/use_mail_helper.rhtml

    r1446 r6180  
    1 From "Romeo and Juliet": 
    2  
    3 <%= block_format @text %> 
    4  
    5 Good ol' Shakespeare. 
  • trunk/actionmailer/test/fixtures/path.with.dots/funky_path_mailer/multipart_with_template_path_with_dots.rhtml

    r4509 r6180  
    1 Have a lovely picture, from me. Enjoy! 
  • trunk/actionmailer/test/fixtures/second_mailer/share.rhtml

    r4509 r6180  
    1 second mail 
  • trunk/actionmailer/test/fixtures/templates/signed_up.rhtml

    r4 r6180  
    1 Hello there,  
    2  
    3 Mr. <%= @recipient %> 
  • trunk/actionmailer/test/fixtures/test_mailer/implicitly_multipart_example.ignored.rhtml

    r3040 r6180  
    1 Ignored when searching for implicitly multipart parts. 
  • trunk/actionmailer/test/fixtures/test_mailer/implicitly_multipart_example.text.html.rhtml

    r1359 r6180  
    1 <html> 
    2   <body> 
    3     HTML formatted message to <strong><%= @recipient %></strong>. 
    4   </body> 
    5 </html> 
    6 <html> 
    7   <body> 
    8     HTML formatted message to <strong><%= @recipient %></strong>. 
    9   </body> 
    10 </html> 
  • trunk/actionmailer/test/fixtures/test_mailer/implicitly_multipart_example.text.plain.rhtml

    r1359 r6180  
    1 Plain text to <%= @recipient %>. 
    2 Plain text to <%= @recipient %>. 
  • trunk/actionmailer/test/fixtures/test_mailer/implicitly_multipart_example.text.yaml.rhtml

    r1586 r6180  
    1 yaml to: <%= @recipient %> 
  • trunk/actionmailer/test/fixtures/test_mailer/signed_up_with_url.rhtml

    r4818 r6180  
    1 Hello there,  
    2  
    3 Mr. <%= @recipient %>. Please see our greeting at <%= @welcome_url %> 
  • trunk/actionmailer/test/fixtures/test_mailer/signed_up.rhtml

    r4 r6180  
    1 Hello there,  
    2  
    3 Mr. <%= @recipient %> 
  • trunk/actionwebservice/lib/action_web_service/scaffolding.rb

    r5213 r6180  
    2626    # If you want to customize the default views, create the following views in "app/views": 
    2727    # 
    28     # * <tt>action_name/methods.rhtml</tt> 
    29     # * <tt>action_name/parameters.rhtml</tt> 
    30     # * <tt>action_name/result.rhtml</tt> 
    31     # * <tt>action_name/layout.rhtml</tt> 
     28    # * <tt>action_name/methods.erb</tt> 
     29    # * <tt>action_name/parameters.erb</tt> 
     30    # * <tt>action_name/result.erb</tt> 
     31    # * <tt>action_name/layout.erb</tt> 
    3232    # 
    3333    # Where <tt>action_name</tt> is the name of the action you gave to ClassMethods#web_service_scaffold. 
     
    123123 
    124124            def scaffold_path(template_name) 
    125               File.dirname(__FILE__) + "/templates/scaffolds/" + template_name + ".rhtml
     125              File.dirname(__FILE__) + "/templates/scaffolds/" + template_name + ".erb
    126126            end 
    127127 
  • trunk/actionwebservice/lib/action_web_service/templates/scaffolds/layout.rhtml

    r4164 r6180  
    1 <html> 
    2 <head> 
    3   <title><%= @scaffold_class.wsdl_service_name %> Web Service</title> 
    4   <style> 
    5     body { background-color: #fff; color: #333; } 
    6  
    7     body, p, ol, ul, td { 
    8       font-family: verdana, arial, helvetica, sans-serif; 
    9       font-size:   13px; 
    10       line-height: 18px; 
    11     } 
    12  
    13     pre { 
    14       background-color: #eee; 
    15       padding: 10px; 
    16       font-size: 11px; 
    17     } 
    18  
    19     a { color: #000; } 
    20     a:visited { color: #666; } 
    21     a:hover { color: #fff; background-color:#000; } 
    22  
    23     .fieldWithErrors { 
    24       padding: 2px; 
    25       background-color: red; 
    26       display: table; 
    27     } 
    28  
    29     #errorExplanation { 
    30       width: 400px; 
    31       border: 2px solid red; 
    32       padding: 7px; 
    33       padding-bottom: 12px; 
    34       margin-bottom: 20px; 
    35       background-color: #f0f0f0; 
    36     } 
    37  
    38     #errorExplanation h2 { 
    39       text-align: left; 
    40       font-weight: bold; 
    41       padding: 5px 5px 5px 15px; 
    42       font-size: 12px; 
    43       margin: -7px; 
    44       background-color: #c00; 
    45       color: #fff; 
    46     } 
    47  
    48     #errorExplanation p { 
    49       color: #333; 
    50       margin-bottom: 0; 
    51       padding: 5px; 
    52     } 
    53  
    54     #errorExplanation ul li { 
    55       font-size: 12px; 
    56       list-style: square; 
    57     } 
    58   </style> 
    59 </head> 
    60 <body> 
    61  
    62 <%= @content_for_layout %> 
    63  
    64 </body> 
    65 </html> 
  • trunk/actionwebservice/lib/action_web_service/templates/scaffolds/methods.rhtml

    r1037 r6180  
    1 <% @scaffold_container.services.each do |service| %> 
    2  
    3   <h4>API Methods for <%= service %></h4> 
    4   <%= service_method_list(service) %> 
    5  
    6 <% end %> 
  • trunk/actionwebservice/lib/action_web_service/templates/scaffolds/parameters.rhtml

    r5378 r6180  
    1 <h4>Method Invocation Details for <em><%= @scaffold_service %>#<%= @scaffold_method.public_name %></em></h4> 
    2  
    3 <% form_tag(:action => @scaffold_action_name + '_submit') do  -%> 
    4 <%= hidden_field_tag "service", @scaffold_service.name %> 
    5 <%= hidden_field_tag "method", @scaffold_method.public_name %> 
    6  
    7 <p> 
    8 <label for="protocol">Protocol:</label><br /> 
    9 <%= select_tag 'protocol', options_for_select([['SOAP', 'soap'], ['XML-RPC', 'xmlrpc']], params['protocol']) %> 
    10 </p> 
    11  
    12 <% if @scaffold_method.expects %> 
    13  
    14 <strong>Method Parameters:</strong><br /> 
    15 <% @scaffold_method.expects.each_with_index do |type, i| %> 
    16   <p> 
    17   <label for="method_params[<%= i %>]"><%= method_parameter_label(type.name, type) %> </label><br /> 
    18   <%= method_parameter_input_fields(@scaffold_method, type, "method_params", i) %> 
    19   </p> 
    20 <% end %> 
    21  
    22 <% end %> 
    23  
    24 <%= submit_tag "Invoke" %> 
    25 <% end -%> 
    26  
    27 <p> 
    28 <%= link_to "Back", :action => @scaffold_action_name %> 
    29 </p> 
  • trunk/actionwebservice/lib/action_web_service/templates/scaffolds/result.rhtml

    r1044 r6180  
    1 <h4>Method Invocation Result for <em><%= @scaffold_service %>#<%= @scaffold_method.public_name %></em></h4> 
    2  
    3 <p> 
    4 Invocation took <tt><%= '%f' % @method_elapsed %></tt> seconds 
    5 </p> 
    6  
    7 <p> 
    8 <strong>Return Value:</strong><br /> 
    9 <pre> 
    10 <%= h @method_return_value.inspect %> 
    11 </pre> 
    12 </p> 
    13  
    14 <p> 
    15 <strong>Request XML:</strong><br /> 
    16 <pre> 
    17 <%= h @method_request_xml %> 
    18 </pre> 
    19 </p> 
    20  
    21 <p> 
    22 <strong>Response XML:</strong><br /> 
    23 <pre> 
    24 <%= h @method_response_xml %> 
    25 </pre> 
    26 </p> 
    27  
    28 <p> 
    29 <%= link_to "Back", :action => @scaffold_action_name + '_method_params', :method => @scaffold_method.public_name, :service => @scaffold_service.name %> 
    30 </p> 
  • trunk/actionwebservice/test/scaffolded_controller_test.rb

    r6125 r6180  
    7474  def test_scaffold_invoke 
    7575    get :scaffold_invoke 
    76     assert_template 'methods.rhtml
     76    assert_template 'methods.erb
    7777  end 
    7878 
    7979  def test_scaffold_invoke_method_params 
    8080    get :scaffold_invoke_method_params, :service => 'scaffolded', :method => 'Hello' 
    81     assert_template 'parameters.rhtml
     81    assert_template 'parameters.erb
    8282  end 
    8383   
    8484  def test_scaffold_invoke_method_params_with_struct 
    8585    get :scaffold_invoke_method_params, :service => 'scaffolded', :method => 'HelloStructParam' 
    86     assert_template 'parameters.rhtml
     86    assert_template 'parameters.erb
    8787    assert_tag :tag => 'form' 
    8888    assert_tag :tag => 'input', :attributes => {:name => "method_params[0][name]"} 
     
    9191  def test_scaffold_invoke_submit_hello 
    9292    post :scaffold_invoke_submit, :service => 'scaffolded', :method => 'Hello', :method_params => {'0' => '5', '1' => 'hello world'} 
    93     assert_template 'result.rhtml
     93    assert_template 'result.erb
    9494    assert_equal false, @controller.instance_eval{ @method_return_value } 
    9595  end 
     
    9797  def test_scaffold_invoke_submit_bye 
    9898    post :scaffold_invoke_submit, :service => 'scaffolded', :method => 'Bye' 
    99     assert_template 'result.rhtml
     99    assert_template 'result.erb
    100100    persons = [ScaffoldPerson.new(:id => 1, :name => "leon"), ScaffoldPerson.new(:id => 2, :name => "paul")] 
    101101    assert_equal persons, @controller.instance_eval{ @method_return_value } 
  • trunk/railties/lib/rails_generator/commands.rb

    r5914 r6180  
    560560           end 
    561561 
    562            logger.refreshing "#{template_options[:insert].gsub(/\.rhtml/,'')} inside #{relative_destination}" 
     562           logger.refreshing "#{template_options[:insert].gsub(/\.erb/,'')} inside #{relative_destination}" 
    563563 
    564564           begin_mark = Regexp.quote(template_part_mark(template_options[:begin_mark], template_options[:mark_id])) 
  • trunk/railties/lib/rails_generator/generators/components/controller/controller_generator.rb

    r5326 r6180  
    2929      # View template for each action. 
    3030      actions.each do |action| 
    31         path = File.join('app/views', class_path, file_name, "#{action}.rhtml") 
    32         m.template 'view.rhtml', path, 
     31        path = File.join('app/views', class_path, file_name, "#{action}.erb") 
     32        m.template 'view.erb', path, 
    3333          :assigns => { :action => action, :path => path } 
    3434      end 
  • trunk/railties/lib/rails_generator/generators/components/controller/templates/view.rhtml

    r1828 r6180  
    1 <h1><%= class_name %>#<%= action %></h1> 
    2 <p>Find me in <%= path %></p> 
  • trunk/railties/lib/rails_generator/generators/components/controller/USAGE

    r518 r6180  
    1616    Credit card controller with URLs like /credit_card/debit. 
    1717        Controller: app/controllers/credit_card_controller.rb 
    18         Views:      app/views/credit_card/debit.rhtml [...] 
     18        Views:      app/views/credit_card/debit.erb [...] 
    1919        Helper:     app/helpers/credit_card_helper.rb 
    2020        Test:       test/functional/credit_card_controller_test.rb 
     
    2525    Credit card admin controller with URLs /admin/credit_card/suspend. 
    2626        Controller: app/controllers/admin/credit_card_controller.rb 
    27         Views:      app/views/admin/credit_card/debit.rhtml [...] 
     27        Views:      app/views/admin/credit_card/debit.erb [...] 
    2828        Helper:     app/helpers/admin/credit_card_helper.rb 
    2929        Test:       test/functional/admin/credit_card_controller_test.rb 
  • trunk/railties/lib/rails_generator/generators/components/mailer/mailer_generator.rb

    r5329 r6180  
    2222      actions.each do |action| 
    2323        relative_path = File.join(file_path, action) 
    24         view_path     = File.join('app/views', "#{relative_path}.rhtml") 
     24        view_path     = File.join('app/views', "#{relative_path}.erb") 
    2525        fixture_path  = File.join('test/fixtures', relative_path) 
    2626 
    27         m.template "view.rhtml", view_path, 
     27        m.template "view.erb", view_path, 
    2828                   :assigns => { :action => action, :path => view_path } 
    29         m.template "fixture.rhtml", fixture_path, 
     29        m.template "fixture.erb", fixture_path, 
    3030                   :assigns => { :action => action, :path => view_path } 
    3131      end 
  • trunk/railties/lib/rails_generator/generators/components/mailer/templates/fixture.rhtml

    r5326 r6180  
    1 <%= class_name %>#<%= action %> 
    2  
    3 Find me in <%= path %> 
  • trunk/railties/lib/rails_generator/generators/components/mailer/templates/view.rhtml

    r5326 r6180  
    1 <%= class_name %>#<%= action %> 
    2  
    3 Find me in <%= path %> 
  • trunk/railties/lib/rails_generator/generators/components/mailer/USAGE

    r3411 r6180  
    1313    This will create a Notifications mailer class: 
    1414        Mailer:     app/models/notifications.rb 
    15         Views:      app/views/notifications/signup.rhtml [...] 
     15        Views:      app/views/notifications/signup.erb [...] 
    1616        Test:       test/unit/test/unit/notifications_test.rb 
    1717        Fixtures:   test/fixtures/notifications/signup [...] 
  • trunk/railties/lib/rails_generator/generators/components/scaffold_resource/scaffold_resource_generator.rb

    r5565 r6180  
    4242      for action in scaffold_views 
    4343        m.template( 
    44           "view_#{action}.rhtml", 
    45           File.join('app/views', controller_class_path, controller_file_name, "#{action}.rhtml") 
     44          "view_#{action}.erb", 
     45          File.join('app/views', controller_class_path, controller_file_name, "#{action}.erb") 
    4646        ) 
    4747      end 
    4848 
    4949      # Layout and stylesheet. 
    50       m.template('layout.rhtml', File.join('app/views/layouts', controller_class_path, "#{controller_file_name}.rhtml")) 
     50      m.template('layout.erb', File.join('app/views/layouts', controller_class_path, "#{controller_file_name}.erb")) 
    5151      m.template('style.css', 'public/stylesheets/scaffold.css') 
    5252 
  • trunk/railties/lib/rails_generator/generators/components/scaffold_resource/templates/controller.rb

    r5633 r6180  
    66 
    77    respond_to do |format| 
    8       format.html # index.rhtml 
     8      format.html # index.erb 
    99      format.xml  { render :xml => @<%= table_name %>.to_xml } 
    1010    end 
     
    1717 
    1818    respond_to do |format| 
    19       format.html # show.rhtml 
     19      format.html # show.erb 
    2020      format.xml  { render :xml => @<%= file_name %>.to_xml } 
    2121    end 
  • trunk/railties/lib/rails_generator/generators/components/scaffold_resource/templates/layout.rhtml

    r5565 r6180  
    1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    2        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
    3  
    4 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> 
    5 <head> 
    6   <meta http-equiv="content-type" content="text/html;charset=UTF-8" /> 
    7   <title><%= controller_class_name %>: <%%= controller.action_name %></title> 
    8   <%%= stylesheet_link_tag 'scaffold' %> 
    9 </head> 
    10 <body> 
    11  
    12 <p style="color: green"><%%= flash[:notice] %></p> 
    13  
    14 <%%= yield  %> 
    15  
    16 </body> 
    17 </html> 
  • trunk/railties/lib/rails_generator/generators/components/scaffold_resource/templates/view_edit.rhtml

    r5565 r6180  
    1 <h1>Editing <%= singular_name %></h1> 
    2  
    3 <%%= error_messages_for :<%= singular_name %> %> 
    4  
    5 <%% form_for(:<%= singular_name %>, :url => <%= singular_name %>_path(@<%= singular_name %>), :html => { :method => :put }) do |f| %> 
    6 <% for attribute in attributes -%>&n