From 21187c0fb4fc559927a2f947f909dedd85969ffb Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Wed, 21 Feb 2007 00:29:44 +0000 Subject: Apply the rest of Chads patch git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6180 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/examples/address_book/index.erb | 33 +++++++++++ actionpack/examples/address_book/layout.erb | 8 +++ actionpack/examples/debate/index.erb | 14 +++++ actionpack/examples/debate/new_topic.erb | 22 +++++++ actionpack/examples/debate/topic.erb | 32 ++++++++++ .../templates/rescues/_request_and_response.erb | 44 ++++++++++++++ .../action_controller/templates/rescues/_trace.erb | 26 ++++++++ .../templates/rescues/diagnostics.erb | 11 ++++ .../action_controller/templates/rescues/layout.erb | 29 +++++++++ .../templates/rescues/missing_template.erb | 2 + .../templates/rescues/routing_error.erb | 10 ++++ .../templates/rescues/template_error.erb | 21 +++++++ .../templates/rescues/unknown_action.erb | 2 + .../action_controller/templates/scaffolds/edit.erb | 7 +++ .../templates/scaffolds/layout.erb | 69 ++++++++++++++++++++++ .../action_controller/templates/scaffolds/list.erb | 27 +++++++++ .../action_controller/templates/scaffolds/new.erb | 6 ++ .../action_controller/templates/scaffolds/show.erb | 9 +++ actionpack/test/fixtures/addresses/list.erb | 1 + .../_cookies_ivar.erb | 1 + .../_cookies_method.erb | 1 + .../deprecated_instance_variables/_flash_ivar.erb | 1 + .../_flash_method.erb | 1 + .../_headers_ivar.erb | 1 + .../_headers_method.erb | 1 + .../deprecated_instance_variables/_params_ivar.erb | 1 + .../_params_method.erb | 1 + .../_request_ivar.erb | 1 + .../_request_method.erb | 1 + .../_response_ivar.erb | 1 + .../_response_method.erb | 1 + .../_session_ivar.erb | 1 + .../_session_method.erb | 1 + actionpack/test/fixtures/fun/games/hello_world.erb | 1 + actionpack/test/fixtures/layouts/builder.builder | 3 + actionpack/test/fixtures/layouts/standard.erb | 1 + .../test/fixtures/layouts/talk_from_action.erb | 2 + actionpack/test/fixtures/layouts/yield.erb | 2 + .../test/fixtures/override/test/hello_world.erb | 1 + actionpack/test/fixtures/scope/test/modgreet.erb | 1 + actionpack/test/fixtures/test/_customer.erb | 1 + .../test/fixtures/test/_customer_greeting.erb | 1 + actionpack/test/fixtures/test/_hash_object.erb | 1 + actionpack/test/fixtures/test/_hello.builder | 1 + actionpack/test/fixtures/test/_partial_only.erb | 1 + actionpack/test/fixtures/test/_person.erb | 2 + .../test/fixtures/test/action_talk_to_layout.erb | 2 + .../test/fixtures/test/block_content_for.erb | 2 + actionpack/test/fixtures/test/capturing.erb | 4 ++ actionpack/test/fixtures/test/content_for.erb | 2 + .../test/dot.directory/render_file_with_ivar.erb | 1 + actionpack/test/fixtures/test/erb_content_for.erb | 2 + actionpack/test/fixtures/test/greeting.erb | 1 + actionpack/test/fixtures/test/hello.builder | 4 ++ actionpack/test/fixtures/test/hello_world.builder | 3 + actionpack/test/fixtures/test/hello_world.erb | 1 + .../fixtures/test/hello_world_container.builder | 3 + .../test/hello_world_with_layout_false.erb | 1 + .../test/fixtures/test/hello_xml_world.builder | 11 ++++ actionpack/test/fixtures/test/list.erb | 1 + .../test/non_erb_block_content_for.builder | 4 ++ .../test/fixtures/test/potential_conflicts.erb | 4 ++ .../test/fixtures/test/render_file_with_ivar.erb | 1 + .../test/fixtures/test/render_file_with_locals.erb | 1 + .../test/fixtures/test/render_to_string_test.erb | 1 + .../fixtures/test/update_element_with_capture.erb | 9 +++ 66 files changed, 463 insertions(+) create mode 100644 actionpack/examples/address_book/index.erb create mode 100644 actionpack/examples/address_book/layout.erb create mode 100644 actionpack/examples/debate/index.erb create mode 100644 actionpack/examples/debate/new_topic.erb create mode 100644 actionpack/examples/debate/topic.erb create mode 100644 actionpack/lib/action_controller/templates/rescues/_request_and_response.erb create mode 100644 actionpack/lib/action_controller/templates/rescues/_trace.erb create mode 100644 actionpack/lib/action_controller/templates/rescues/diagnostics.erb create mode 100644 actionpack/lib/action_controller/templates/rescues/layout.erb create mode 100644 actionpack/lib/action_controller/templates/rescues/missing_template.erb create mode 100644 actionpack/lib/action_controller/templates/rescues/routing_error.erb create mode 100644 actionpack/lib/action_controller/templates/rescues/template_error.erb create mode 100644 actionpack/lib/action_controller/templates/rescues/unknown_action.erb create mode 100644 actionpack/lib/action_controller/templates/scaffolds/edit.erb create mode 100644 actionpack/lib/action_controller/templates/scaffolds/layout.erb create mode 100644 actionpack/lib/action_controller/templates/scaffolds/list.erb create mode 100644 actionpack/lib/action_controller/templates/scaffolds/new.erb create mode 100644 actionpack/lib/action_controller/templates/scaffolds/show.erb create mode 100644 actionpack/test/fixtures/addresses/list.erb create mode 100644 actionpack/test/fixtures/deprecated_instance_variables/_cookies_ivar.erb create mode 100644 actionpack/test/fixtures/deprecated_instance_variables/_cookies_method.erb create mode 100644 actionpack/test/fixtures/deprecated_instance_variables/_flash_ivar.erb create mode 100644 actionpack/test/fixtures/deprecated_instance_variables/_flash_method.erb create mode 100644 actionpack/test/fixtures/deprecated_instance_variables/_headers_ivar.erb create mode 100644 actionpack/test/fixtures/deprecated_instance_variables/_headers_method.erb create mode 100644 actionpack/test/fixtures/deprecated_instance_variables/_params_ivar.erb create mode 100644 actionpack/test/fixtures/deprecated_instance_variables/_params_method.erb create mode 100644 actionpack/test/fixtures/deprecated_instance_variables/_request_ivar.erb create mode 100644 actionpack/test/fixtures/deprecated_instance_variables/_request_method.erb create mode 100644 actionpack/test/fixtures/deprecated_instance_variables/_response_ivar.erb create mode 100644 actionpack/test/fixtures/deprecated_instance_variables/_response_method.erb create mode 100644 actionpack/test/fixtures/deprecated_instance_variables/_session_ivar.erb create mode 100644 actionpack/test/fixtures/deprecated_instance_variables/_session_method.erb create mode 100644 actionpack/test/fixtures/fun/games/hello_world.erb create mode 100644 actionpack/test/fixtures/layouts/builder.builder create mode 100644 actionpack/test/fixtures/layouts/standard.erb create mode 100644 actionpack/test/fixtures/layouts/talk_from_action.erb create mode 100644 actionpack/test/fixtures/layouts/yield.erb create mode 100644 actionpack/test/fixtures/override/test/hello_world.erb create mode 100644 actionpack/test/fixtures/scope/test/modgreet.erb create mode 100644 actionpack/test/fixtures/test/_customer.erb create mode 100644 actionpack/test/fixtures/test/_customer_greeting.erb create mode 100644 actionpack/test/fixtures/test/_hash_object.erb create mode 100644 actionpack/test/fixtures/test/_hello.builder create mode 100644 actionpack/test/fixtures/test/_partial_only.erb create mode 100644 actionpack/test/fixtures/test/_person.erb create mode 100644 actionpack/test/fixtures/test/action_talk_to_layout.erb create mode 100644 actionpack/test/fixtures/test/block_content_for.erb create mode 100644 actionpack/test/fixtures/test/capturing.erb create mode 100644 actionpack/test/fixtures/test/content_for.erb create mode 100644 actionpack/test/fixtures/test/dot.directory/render_file_with_ivar.erb create mode 100644 actionpack/test/fixtures/test/erb_content_for.erb create mode 100644 actionpack/test/fixtures/test/greeting.erb create mode 100644 actionpack/test/fixtures/test/hello.builder create mode 100644 actionpack/test/fixtures/test/hello_world.builder create mode 100644 actionpack/test/fixtures/test/hello_world.erb create mode 100644 actionpack/test/fixtures/test/hello_world_container.builder create mode 100644 actionpack/test/fixtures/test/hello_world_with_layout_false.erb create mode 100644 actionpack/test/fixtures/test/hello_xml_world.builder create mode 100644 actionpack/test/fixtures/test/list.erb create mode 100644 actionpack/test/fixtures/test/non_erb_block_content_for.builder create mode 100644 actionpack/test/fixtures/test/potential_conflicts.erb create mode 100644 actionpack/test/fixtures/test/render_file_with_ivar.erb create mode 100644 actionpack/test/fixtures/test/render_file_with_locals.erb create mode 100644 actionpack/test/fixtures/test/render_to_string_test.erb create mode 100644 actionpack/test/fixtures/test/update_element_with_capture.erb (limited to 'actionpack') diff --git a/actionpack/examples/address_book/index.erb b/actionpack/examples/address_book/index.erb new file mode 100644 index 0000000000..217d39075c --- /dev/null +++ b/actionpack/examples/address_book/index.erb @@ -0,0 +1,33 @@ +

Address Book

+ +<% if @people.empty? %> +

No people in the address book yet

+<% else %> + + + <% for person in @people %> + + <% end %> +
NameEmail AddressPhone Number
<%= person.name %><%= person.email_address %><%= person.phone_number %>
+<% end %> + +
+

+ Name:
+ +

+ +

+ Email address:
+ +

+ +

+ Phone number:
+ +

+ +

+ +

+
\ No newline at end of file diff --git a/actionpack/examples/address_book/layout.erb b/actionpack/examples/address_book/layout.erb new file mode 100644 index 0000000000..931e141c01 --- /dev/null +++ b/actionpack/examples/address_book/layout.erb @@ -0,0 +1,8 @@ + + + <%= @title || "Untitled" %> + + +<%= @content_for_layout %> + + \ No newline at end of file diff --git a/actionpack/examples/debate/index.erb b/actionpack/examples/debate/index.erb new file mode 100644 index 0000000000..ddaa87da57 --- /dev/null +++ b/actionpack/examples/debate/index.erb @@ -0,0 +1,14 @@ + + +

Topics

+ +<%= link_to "New topic", :action => "new_topic" %> + + + + + \ No newline at end of file diff --git a/actionpack/examples/debate/new_topic.erb b/actionpack/examples/debate/new_topic.erb new file mode 100644 index 0000000000..f52a69cc31 --- /dev/null +++ b/actionpack/examples/debate/new_topic.erb @@ -0,0 +1,22 @@ + + +

New topic

+ +
" method="post"> +

+ Title:
+ +

+ +

+ Body:
+ +

+ +

+ +

+
+ + + \ No newline at end of file diff --git a/actionpack/examples/debate/topic.erb b/actionpack/examples/debate/topic.erb new file mode 100644 index 0000000000..e247c00f0d --- /dev/null +++ b/actionpack/examples/debate/topic.erb @@ -0,0 +1,32 @@ + + +

<%= @topic.title %>

+ +

<%= @topic.body %>

+ +<%= link_to "Back to topics", :action => "index" %> + +<% unless @topic.replies.empty? %> +

Replies

+
    + <% for reply in @topic.replies %> +
  1. <%= reply.body %>
  2. + <% end %> +
+<% end %> + +

Reply to this topic

+ +
" method="post"> + +

+ +

+ +

+ +

+
+ + + \ No newline at end of file diff --git a/actionpack/lib/action_controller/templates/rescues/_request_and_response.erb b/actionpack/lib/action_controller/templates/rescues/_request_and_response.erb new file mode 100644 index 0000000000..fe60bfdd40 --- /dev/null +++ b/actionpack/lib/action_controller/templates/rescues/_request_and_response.erb @@ -0,0 +1,44 @@ +<% unless @exception.blamed_files.blank? %> + <% if (hide = @exception.blamed_files.length > 8) %> + Show blamed files + <% end %> +
><%=h @exception.describe_blame %>
+<% end %> + +<% if false %> +

+ <% begin %> + <%= form_tag(request.request_uri, "method" => request.method) %> + + + <% for key, values in params %> + <% next if key == "BP-RETRY" %> + <% for value in Array(values) %> + + <% end %> + <% end %> + + + + <% rescue Exception => e %> + <%=h "Couldn't render breakpoint link due to #{e.class} #{e.message}" %> + <% end %> +<% end %> + +<% + clean_params = request.parameters.clone + clean_params.delete("action") + clean_params.delete("controller") + + request_dump = clean_params.empty? ? 'None' : clean_params.inspect.gsub(',', ",\n") +%> + +

Request

+

Parameters:

<%=h request_dump %>

+ +

Show session dump

+ + + +

Response

+

Headers:

<%=h response ? response.headers.inspect.gsub(',', ",\n") : 'None' %>

diff --git a/actionpack/lib/action_controller/templates/rescues/_trace.erb b/actionpack/lib/action_controller/templates/rescues/_trace.erb new file mode 100644 index 0000000000..b322b0aaae --- /dev/null +++ b/actionpack/lib/action_controller/templates/rescues/_trace.erb @@ -0,0 +1,26 @@ +<% + traces = [ + ["Application Trace", @exception.application_backtrace], + ["Framework Trace", @exception.framework_backtrace], + ["Full Trace", @exception.clean_backtrace] + ] + names = traces.collect {|name, trace| name} +%> + +

RAILS_ROOT: <%= defined?(RAILS_ROOT) ? RAILS_ROOT : "unset" %>

+ +
+ <% names.each do |name| -%> + <% + show = "document.getElementById('#{name.gsub /\s/, '-'}').style.display='block';" + hide = (names - [name]).collect {|hide_name| "document.getElementById('#{hide_name.gsub /\s/, '-'}').style.display='none';"} + %> + <%= name %> <%= '|' unless names.last == name %> + <% end -%> + + <% traces.each do |name, trace| -%> +
;"> +
<%= trace.join "\n" %>
+
+ <% end -%> +
\ No newline at end of file diff --git a/actionpack/lib/action_controller/templates/rescues/diagnostics.erb b/actionpack/lib/action_controller/templates/rescues/diagnostics.erb new file mode 100644 index 0000000000..032f945ed2 --- /dev/null +++ b/actionpack/lib/action_controller/templates/rescues/diagnostics.erb @@ -0,0 +1,11 @@ +

+ <%=h @exception.class.to_s %> + <% if request.parameters['controller'] %> + in <%=h request.parameters['controller'].humanize %>Controller<% if request.parameters['action'] %>#<%=h request.parameters['action'] %><% end %> + <% end %> +

+
<%=h @exception.clean_message %>
+ +<%= render_file(@rescues_path + "/_trace.erb", false) %> + +<%= render_file(@rescues_path + "/_request_and_response.erb", false) %> diff --git a/actionpack/lib/action_controller/templates/rescues/layout.erb b/actionpack/lib/action_controller/templates/rescues/layout.erb new file mode 100644 index 0000000000..d38f3e67f9 --- /dev/null +++ b/actionpack/lib/action_controller/templates/rescues/layout.erb @@ -0,0 +1,29 @@ + + + Action Controller: Exception caught + + + + +<%= @contents %> + + + \ No newline at end of file diff --git a/actionpack/lib/action_controller/templates/rescues/missing_template.erb b/actionpack/lib/action_controller/templates/rescues/missing_template.erb new file mode 100644 index 0000000000..dbfdf76947 --- /dev/null +++ b/actionpack/lib/action_controller/templates/rescues/missing_template.erb @@ -0,0 +1,2 @@ +

Template is missing

+

<%=h @exception.message %>

diff --git a/actionpack/lib/action_controller/templates/rescues/routing_error.erb b/actionpack/lib/action_controller/templates/rescues/routing_error.erb new file mode 100644 index 0000000000..ccfa858cce --- /dev/null +++ b/actionpack/lib/action_controller/templates/rescues/routing_error.erb @@ -0,0 +1,10 @@ +

Routing Error

+

<%=h @exception.message %>

+<% unless @exception.failures.empty? %>

+

Failure reasons:

+
    + <% @exception.failures.each do |route, reason| %> +
  1. <%=h route.inspect.gsub('\\', '') %> failed because <%=h reason.downcase %>
  2. + <% end %> +
+

<% end %> diff --git a/actionpack/lib/action_controller/templates/rescues/template_error.erb b/actionpack/lib/action_controller/templates/rescues/template_error.erb new file mode 100644 index 0000000000..eda64db3e9 --- /dev/null +++ b/actionpack/lib/action_controller/templates/rescues/template_error.erb @@ -0,0 +1,21 @@ +

+ <%=h @exception.original_exception.class.to_s %> in + <%=h request.parameters["controller"].capitalize if request.parameters["controller"]%>#<%=h request.parameters["action"] %> +

+ +

+ Showing <%=h @exception.file_name %> where line #<%=h @exception.line_number %> raised: +

<%=h @exception.message %>
+

+ +

Extracted source (around line #<%=h @exception.line_number %>): +

<%=h @exception.source_extract %>

+ +

<%=h @exception.sub_template_message %>

+ +<% @real_exception = @exception + @exception = @exception.original_exception || @exception %> +<%= render_file(@rescues_path + "/_trace.erb", false) %> +<% @exception = @real_exception %> + +<%= render_file(@rescues_path + "/_request_and_response.erb", false) %> diff --git a/actionpack/lib/action_controller/templates/rescues/unknown_action.erb b/actionpack/lib/action_controller/templates/rescues/unknown_action.erb new file mode 100644 index 0000000000..683379da10 --- /dev/null +++ b/actionpack/lib/action_controller/templates/rescues/unknown_action.erb @@ -0,0 +1,2 @@ +

Unknown action

+

<%=h @exception.message %>

diff --git a/actionpack/lib/action_controller/templates/scaffolds/edit.erb b/actionpack/lib/action_controller/templates/scaffolds/edit.erb new file mode 100644 index 0000000000..63dff602a1 --- /dev/null +++ b/actionpack/lib/action_controller/templates/scaffolds/edit.erb @@ -0,0 +1,7 @@ +

Editing <%= @scaffold_singular_name %>

+ +<%= error_messages_for(@scaffold_singular_name) %> +<%= form(@scaffold_singular_name, :action => "update#{@scaffold_suffix}") %> + +<%= link_to "Show", :action => "show#{@scaffold_suffix}", :id => instance_variable_get("@#{@scaffold_singular_name}") %> | +<%= link_to "Back", :action => "list#{@scaffold_suffix}" %> diff --git a/actionpack/lib/action_controller/templates/scaffolds/layout.erb b/actionpack/lib/action_controller/templates/scaffolds/layout.erb new file mode 100644 index 0000000000..759781e0e7 --- /dev/null +++ b/actionpack/lib/action_controller/templates/scaffolds/layout.erb @@ -0,0 +1,69 @@ + + + + Scaffolding + + + + +

<%= flash[:notice] %>

+ +<%= yield %> + + + diff --git a/actionpack/lib/action_controller/templates/scaffolds/list.erb b/actionpack/lib/action_controller/templates/scaffolds/list.erb new file mode 100644 index 0000000000..fea23dc66f --- /dev/null +++ b/actionpack/lib/action_controller/templates/scaffolds/list.erb @@ -0,0 +1,27 @@ +

Listing <%= @scaffold_plural_name %>

+ + + + <% for column in @scaffold_class.content_columns %> + + <% end %> + + +<% for entry in instance_variable_get("@#{@scaffold_plural_name}") %> + + <% for column in @scaffold_class.content_columns %> + + <% end %> + + + + +<% end %> +
<%= column.human_name %>
<%= entry.send(column.name) %><%= link_to "Show", :action => "show#{@scaffold_suffix}", :id => entry %><%= link_to "Edit", :action => "edit#{@scaffold_suffix}", :id => entry %><%= link_to "Destroy", {:action => "destroy#{@scaffold_suffix}", :id => entry}, { :confirm => "Are you sure?", :method => :post } %>
+ +<%= link_to "Previous page", { :page => instance_variable_get("@#{@scaffold_singular_name}_pages").current.previous } if instance_variable_get("@#{@scaffold_singular_name}_pages").current.previous %> +<%= link_to "Next page", { :page => instance_variable_get("@#{@scaffold_singular_name}_pages").current.next } if instance_variable_get("@#{@scaffold_singular_name}_pages").current.next %> + +
+ +<%= link_to "New #{@scaffold_singular_name}", :action => "new#{@scaffold_suffix}" %> diff --git a/actionpack/lib/action_controller/templates/scaffolds/new.erb b/actionpack/lib/action_controller/templates/scaffolds/new.erb new file mode 100644 index 0000000000..66f6626f4e --- /dev/null +++ b/actionpack/lib/action_controller/templates/scaffolds/new.erb @@ -0,0 +1,6 @@ +

New <%= @scaffold_singular_name %>

+ +<%= error_messages_for(@scaffold_singular_name) %> +<%= form(@scaffold_singular_name, :action => "create#{@scaffold_suffix}") %> + +<%= link_to "Back", :action => "list#{@scaffold_suffix}" %> diff --git a/actionpack/lib/action_controller/templates/scaffolds/show.erb b/actionpack/lib/action_controller/templates/scaffolds/show.erb new file mode 100644 index 0000000000..46cdfdb493 --- /dev/null +++ b/actionpack/lib/action_controller/templates/scaffolds/show.erb @@ -0,0 +1,9 @@ +<% for column in @scaffold_class.content_columns %> +

+ <%= column.human_name %>: + <%= instance_variable_get("@#{@scaffold_singular_name}").send(column.name) %> +

+<% end %> + +<%= link_to "Edit", :action => "edit#{@scaffold_suffix}", :id => instance_variable_get("@#{@scaffold_singular_name}") %> | +<%= link_to "Back", :action => "list#{@scaffold_suffix}" %> diff --git a/actionpack/test/fixtures/addresses/list.erb b/actionpack/test/fixtures/addresses/list.erb new file mode 100644 index 0000000000..c75e01eece --- /dev/null +++ b/actionpack/test/fixtures/addresses/list.erb @@ -0,0 +1 @@ +We only need to get this far! diff --git a/actionpack/test/fixtures/deprecated_instance_variables/_cookies_ivar.erb b/actionpack/test/fixtures/deprecated_instance_variables/_cookies_ivar.erb new file mode 100644 index 0000000000..4e8a2d804c --- /dev/null +++ b/actionpack/test/fixtures/deprecated_instance_variables/_cookies_ivar.erb @@ -0,0 +1 @@ +<%= @cookies[:test] %> diff --git a/actionpack/test/fixtures/deprecated_instance_variables/_cookies_method.erb b/actionpack/test/fixtures/deprecated_instance_variables/_cookies_method.erb new file mode 100644 index 0000000000..68e88bb746 --- /dev/null +++ b/actionpack/test/fixtures/deprecated_instance_variables/_cookies_method.erb @@ -0,0 +1 @@ +<%= cookies[:test] %> diff --git a/actionpack/test/fixtures/deprecated_instance_variables/_flash_ivar.erb b/actionpack/test/fixtures/deprecated_instance_variables/_flash_ivar.erb new file mode 100644 index 0000000000..4b4782b287 --- /dev/null +++ b/actionpack/test/fixtures/deprecated_instance_variables/_flash_ivar.erb @@ -0,0 +1 @@ +<%= @flash[:test] %> diff --git a/actionpack/test/fixtures/deprecated_instance_variables/_flash_method.erb b/actionpack/test/fixtures/deprecated_instance_variables/_flash_method.erb new file mode 100644 index 0000000000..f7f9d0913a --- /dev/null +++ b/actionpack/test/fixtures/deprecated_instance_variables/_flash_method.erb @@ -0,0 +1 @@ +<%= flash[:test] %> diff --git a/actionpack/test/fixtures/deprecated_instance_variables/_headers_ivar.erb b/actionpack/test/fixtures/deprecated_instance_variables/_headers_ivar.erb new file mode 100644 index 0000000000..1176c93ad8 --- /dev/null +++ b/actionpack/test/fixtures/deprecated_instance_variables/_headers_ivar.erb @@ -0,0 +1 @@ +<%= @headers[:test] %> diff --git a/actionpack/test/fixtures/deprecated_instance_variables/_headers_method.erb b/actionpack/test/fixtures/deprecated_instance_variables/_headers_method.erb new file mode 100644 index 0000000000..308c4eb6ba --- /dev/null +++ b/actionpack/test/fixtures/deprecated_instance_variables/_headers_method.erb @@ -0,0 +1 @@ +<%= headers[:test] %> diff --git a/actionpack/test/fixtures/deprecated_instance_variables/_params_ivar.erb b/actionpack/test/fixtures/deprecated_instance_variables/_params_ivar.erb new file mode 100644 index 0000000000..1eea68757f --- /dev/null +++ b/actionpack/test/fixtures/deprecated_instance_variables/_params_ivar.erb @@ -0,0 +1 @@ +<%= @params[:test] %> diff --git a/actionpack/test/fixtures/deprecated_instance_variables/_params_method.erb b/actionpack/test/fixtures/deprecated_instance_variables/_params_method.erb new file mode 100644 index 0000000000..7e349b4ca0 --- /dev/null +++ b/actionpack/test/fixtures/deprecated_instance_variables/_params_method.erb @@ -0,0 +1 @@ +<%= params[:test] %> diff --git a/actionpack/test/fixtures/deprecated_instance_variables/_request_ivar.erb b/actionpack/test/fixtures/deprecated_instance_variables/_request_ivar.erb new file mode 100644 index 0000000000..a1680c23d5 --- /dev/null +++ b/actionpack/test/fixtures/deprecated_instance_variables/_request_ivar.erb @@ -0,0 +1 @@ +<%= @request.method %> diff --git a/actionpack/test/fixtures/deprecated_instance_variables/_request_method.erb b/actionpack/test/fixtures/deprecated_instance_variables/_request_method.erb new file mode 100644 index 0000000000..0c74cf1c1b --- /dev/null +++ b/actionpack/test/fixtures/deprecated_instance_variables/_request_method.erb @@ -0,0 +1 @@ +<%= request.method %> diff --git a/actionpack/test/fixtures/deprecated_instance_variables/_response_ivar.erb b/actionpack/test/fixtures/deprecated_instance_variables/_response_ivar.erb new file mode 100644 index 0000000000..2f12d2ce32 --- /dev/null +++ b/actionpack/test/fixtures/deprecated_instance_variables/_response_ivar.erb @@ -0,0 +1 @@ +<%= @response.body %> diff --git a/actionpack/test/fixtures/deprecated_instance_variables/_response_method.erb b/actionpack/test/fixtures/deprecated_instance_variables/_response_method.erb new file mode 100644 index 0000000000..948c75929a --- /dev/null +++ b/actionpack/test/fixtures/deprecated_instance_variables/_response_method.erb @@ -0,0 +1 @@ +<%= response.body %> diff --git a/actionpack/test/fixtures/deprecated_instance_variables/_session_ivar.erb b/actionpack/test/fixtures/deprecated_instance_variables/_session_ivar.erb new file mode 100644 index 0000000000..3acc1b8529 --- /dev/null +++ b/actionpack/test/fixtures/deprecated_instance_variables/_session_ivar.erb @@ -0,0 +1 @@ +<%= @session[:test] %> diff --git a/actionpack/test/fixtures/deprecated_instance_variables/_session_method.erb b/actionpack/test/fixtures/deprecated_instance_variables/_session_method.erb new file mode 100644 index 0000000000..a899387c47 --- /dev/null +++ b/actionpack/test/fixtures/deprecated_instance_variables/_session_method.erb @@ -0,0 +1 @@ +<%= session[:test] %> diff --git a/actionpack/test/fixtures/fun/games/hello_world.erb b/actionpack/test/fixtures/fun/games/hello_world.erb new file mode 100644 index 0000000000..1ebfbe2539 --- /dev/null +++ b/actionpack/test/fixtures/fun/games/hello_world.erb @@ -0,0 +1 @@ +Living in a nested world \ No newline at end of file diff --git a/actionpack/test/fixtures/layouts/builder.builder b/actionpack/test/fixtures/layouts/builder.builder new file mode 100644 index 0000000000..729af4b8bc --- /dev/null +++ b/actionpack/test/fixtures/layouts/builder.builder @@ -0,0 +1,3 @@ +xml.wrapper do + xml << @content_for_layout +end \ No newline at end of file diff --git a/actionpack/test/fixtures/layouts/standard.erb b/actionpack/test/fixtures/layouts/standard.erb new file mode 100644 index 0000000000..368764e6f4 --- /dev/null +++ b/actionpack/test/fixtures/layouts/standard.erb @@ -0,0 +1 @@ +<%= @content_for_layout %><%= @variable_for_layout %> \ No newline at end of file diff --git a/actionpack/test/fixtures/layouts/talk_from_action.erb b/actionpack/test/fixtures/layouts/talk_from_action.erb new file mode 100644 index 0000000000..187aab07a2 --- /dev/null +++ b/actionpack/test/fixtures/layouts/talk_from_action.erb @@ -0,0 +1,2 @@ +<%= @title || @content_for_title %> +<%= @content_for_layout -%> \ No newline at end of file diff --git a/actionpack/test/fixtures/layouts/yield.erb b/actionpack/test/fixtures/layouts/yield.erb new file mode 100644 index 0000000000..482dc9022e --- /dev/null +++ b/actionpack/test/fixtures/layouts/yield.erb @@ -0,0 +1,2 @@ +<%= yield :title %> +<%= yield %> diff --git a/actionpack/test/fixtures/override/test/hello_world.erb b/actionpack/test/fixtures/override/test/hello_world.erb new file mode 100644 index 0000000000..3e308d3d86 --- /dev/null +++ b/actionpack/test/fixtures/override/test/hello_world.erb @@ -0,0 +1 @@ +Hello overridden world! \ No newline at end of file diff --git a/actionpack/test/fixtures/scope/test/modgreet.erb b/actionpack/test/fixtures/scope/test/modgreet.erb new file mode 100644 index 0000000000..8947726e89 --- /dev/null +++ b/actionpack/test/fixtures/scope/test/modgreet.erb @@ -0,0 +1 @@ +

Beautiful modules!

\ No newline at end of file diff --git a/actionpack/test/fixtures/test/_customer.erb b/actionpack/test/fixtures/test/_customer.erb new file mode 100644 index 0000000000..872d8c44e6 --- /dev/null +++ b/actionpack/test/fixtures/test/_customer.erb @@ -0,0 +1 @@ +Hello: <%= customer.name %> \ No newline at end of file diff --git a/actionpack/test/fixtures/test/_customer_greeting.erb b/actionpack/test/fixtures/test/_customer_greeting.erb new file mode 100644 index 0000000000..6acbcb20c4 --- /dev/null +++ b/actionpack/test/fixtures/test/_customer_greeting.erb @@ -0,0 +1 @@ +<%= greeting %>: <%= customer_greeting.name %> \ No newline at end of file diff --git a/actionpack/test/fixtures/test/_hash_object.erb b/actionpack/test/fixtures/test/_hash_object.erb new file mode 100644 index 0000000000..037a7368d6 --- /dev/null +++ b/actionpack/test/fixtures/test/_hash_object.erb @@ -0,0 +1 @@ +<%= hash_object[:first_name] %> \ No newline at end of file diff --git a/actionpack/test/fixtures/test/_hello.builder b/actionpack/test/fixtures/test/_hello.builder new file mode 100644 index 0000000000..ef52f632d1 --- /dev/null +++ b/actionpack/test/fixtures/test/_hello.builder @@ -0,0 +1 @@ +xm.hello \ No newline at end of file diff --git a/actionpack/test/fixtures/test/_partial_only.erb b/actionpack/test/fixtures/test/_partial_only.erb new file mode 100644 index 0000000000..a44b3eed40 --- /dev/null +++ b/actionpack/test/fixtures/test/_partial_only.erb @@ -0,0 +1 @@ +only partial \ No newline at end of file diff --git a/actionpack/test/fixtures/test/_person.erb b/actionpack/test/fixtures/test/_person.erb new file mode 100644 index 0000000000..b2e5688956 --- /dev/null +++ b/actionpack/test/fixtures/test/_person.erb @@ -0,0 +1,2 @@ +Second: <%= name %> +Third: <%= @name %> diff --git a/actionpack/test/fixtures/test/action_talk_to_layout.erb b/actionpack/test/fixtures/test/action_talk_to_layout.erb new file mode 100644 index 0000000000..36e896daa8 --- /dev/null +++ b/actionpack/test/fixtures/test/action_talk_to_layout.erb @@ -0,0 +1,2 @@ +<% @title = "Talking to the layout" -%> +Action was here! \ No newline at end of file diff --git a/actionpack/test/fixtures/test/block_content_for.erb b/actionpack/test/fixtures/test/block_content_for.erb new file mode 100644 index 0000000000..9510337365 --- /dev/null +++ b/actionpack/test/fixtures/test/block_content_for.erb @@ -0,0 +1,2 @@ +<% block_content_for :title do 'Putting stuff in the title!' end %> +Great stuff! \ No newline at end of file diff --git a/actionpack/test/fixtures/test/capturing.erb b/actionpack/test/fixtures/test/capturing.erb new file mode 100644 index 0000000000..1addaa40d9 --- /dev/null +++ b/actionpack/test/fixtures/test/capturing.erb @@ -0,0 +1,4 @@ +<% days = capture do %> + Dreamy days +<% end %> +<%= days %> \ No newline at end of file diff --git a/actionpack/test/fixtures/test/content_for.erb b/actionpack/test/fixtures/test/content_for.erb new file mode 100644 index 0000000000..0e47ca8c3d --- /dev/null +++ b/actionpack/test/fixtures/test/content_for.erb @@ -0,0 +1,2 @@ +<% content_for :title do %>Putting stuff in the title!<% end %> +Great stuff! \ No newline at end of file diff --git a/actionpack/test/fixtures/test/dot.directory/render_file_with_ivar.erb b/actionpack/test/fixtures/test/dot.directory/render_file_with_ivar.erb new file mode 100644 index 0000000000..8b8a449236 --- /dev/null +++ b/actionpack/test/fixtures/test/dot.directory/render_file_with_ivar.erb @@ -0,0 +1 @@ +The secret is <%= @secret %> diff --git a/actionpack/test/fixtures/test/erb_content_for.erb b/actionpack/test/fixtures/test/erb_content_for.erb new file mode 100644 index 0000000000..c3bdd13643 --- /dev/null +++ b/actionpack/test/fixtures/test/erb_content_for.erb @@ -0,0 +1,2 @@ +<% erb_content_for :title do %>Putting stuff in the title!<% end %> +Great stuff! \ No newline at end of file diff --git a/actionpack/test/fixtures/test/greeting.erb b/actionpack/test/fixtures/test/greeting.erb new file mode 100644 index 0000000000..62fb0293f0 --- /dev/null +++ b/actionpack/test/fixtures/test/greeting.erb @@ -0,0 +1 @@ +

This is grand!

diff --git a/actionpack/test/fixtures/test/hello.builder b/actionpack/test/fixtures/test/hello.builder new file mode 100644 index 0000000000..82a4a310d3 --- /dev/null +++ b/actionpack/test/fixtures/test/hello.builder @@ -0,0 +1,4 @@ +xml.html do + xml.p "Hello #{@name}" + xml << render_file("test/greeting") +end \ No newline at end of file diff --git a/actionpack/test/fixtures/test/hello_world.builder b/actionpack/test/fixtures/test/hello_world.builder new file mode 100644 index 0000000000..bffd2191ba --- /dev/null +++ b/actionpack/test/fixtures/test/hello_world.builder @@ -0,0 +1,3 @@ +xml.html do + xml.p "Hello" +end \ No newline at end of file diff --git a/actionpack/test/fixtures/test/hello_world.erb b/actionpack/test/fixtures/test/hello_world.erb new file mode 100644 index 0000000000..6769dd60bd --- /dev/null +++ b/actionpack/test/fixtures/test/hello_world.erb @@ -0,0 +1 @@ +Hello world! \ No newline at end of file diff --git a/actionpack/test/fixtures/test/hello_world_container.builder b/actionpack/test/fixtures/test/hello_world_container.builder new file mode 100644 index 0000000000..e48d75c405 --- /dev/null +++ b/actionpack/test/fixtures/test/hello_world_container.builder @@ -0,0 +1,3 @@ +xml.test do + render :partial => 'hello', :locals => { :xm => xml } +end \ No newline at end of file diff --git a/actionpack/test/fixtures/test/hello_world_with_layout_false.erb b/actionpack/test/fixtures/test/hello_world_with_layout_false.erb new file mode 100644 index 0000000000..6769dd60bd --- /dev/null +++ b/actionpack/test/fixtures/test/hello_world_with_layout_false.erb @@ -0,0 +1 @@ +Hello world! \ No newline at end of file diff --git a/actionpack/test/fixtures/test/hello_xml_world.builder b/actionpack/test/fixtures/test/hello_xml_world.builder new file mode 100644 index 0000000000..02b14fe87c --- /dev/null +++ b/actionpack/test/fixtures/test/hello_xml_world.builder @@ -0,0 +1,11 @@ +xml.html do + xml.head do + xml.title "Hello World" + end + + xml.body do + xml.p "abes" + xml.p "monks" + xml.p "wiseguys" + end +end \ No newline at end of file diff --git a/actionpack/test/fixtures/test/list.erb b/actionpack/test/fixtures/test/list.erb new file mode 100644 index 0000000000..cd0ab45d26 --- /dev/null +++ b/actionpack/test/fixtures/test/list.erb @@ -0,0 +1 @@ +<%= @test_unchanged = 'goodbye' %><%= render_collection_of_partials "customer", @customers %><%= @test_unchanged %> diff --git a/actionpack/test/fixtures/test/non_erb_block_content_for.builder b/actionpack/test/fixtures/test/non_erb_block_content_for.builder new file mode 100644 index 0000000000..6ff6db0f95 --- /dev/null +++ b/actionpack/test/fixtures/test/non_erb_block_content_for.builder @@ -0,0 +1,4 @@ +content_for :title do + 'Putting stuff in the title!' +end +xml << "\nGreat stuff!" \ No newline at end of file diff --git a/actionpack/test/fixtures/test/potential_conflicts.erb b/actionpack/test/fixtures/test/potential_conflicts.erb new file mode 100644 index 0000000000..a5e964e359 --- /dev/null +++ b/actionpack/test/fixtures/test/potential_conflicts.erb @@ -0,0 +1,4 @@ +First: <%= @name %> +<%= render :partial => "person", :locals => { :name => "Stephan" } -%> +Fourth: <%= @name %> +Fifth: <%= name %> \ No newline at end of file diff --git a/actionpack/test/fixtures/test/render_file_with_ivar.erb b/actionpack/test/fixtures/test/render_file_with_ivar.erb new file mode 100644 index 0000000000..8b8a449236 --- /dev/null +++ b/actionpack/test/fixtures/test/render_file_with_ivar.erb @@ -0,0 +1 @@ +The secret is <%= @secret %> diff --git a/actionpack/test/fixtures/test/render_file_with_locals.erb b/actionpack/test/fixtures/test/render_file_with_locals.erb new file mode 100644 index 0000000000..ebe09faee6 --- /dev/null +++ b/actionpack/test/fixtures/test/render_file_with_locals.erb @@ -0,0 +1 @@ +The secret is <%= secret %> diff --git a/actionpack/test/fixtures/test/render_to_string_test.erb b/actionpack/test/fixtures/test/render_to_string_test.erb new file mode 100644 index 0000000000..6e267e8634 --- /dev/null +++ b/actionpack/test/fixtures/test/render_to_string_test.erb @@ -0,0 +1 @@ +The value of foo is: ::<%= @foo %>:: diff --git a/actionpack/test/fixtures/test/update_element_with_capture.erb b/actionpack/test/fixtures/test/update_element_with_capture.erb new file mode 100644 index 0000000000..fa3ef200f9 --- /dev/null +++ b/actionpack/test/fixtures/test/update_element_with_capture.erb @@ -0,0 +1,9 @@ +<% replacement_function = update_element_function("products", :action => :update) do %> +

Product 1

+

Product 2

+<% end %> +<%= javascript_tag(replacement_function) %> + +<% update_element_function("status", :action => :update, :binding => binding) do %> + You bought something! +<% end %> -- cgit v1.2.3