From db045dbbf60b53dbe013ef25554fd013baf88134 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Wed, 24 Nov 2004 01:04:44 +0000 Subject: Initial git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- .../templates/rescues/_request_and_response.rhtml | 28 +++++++++++++++++++++ .../templates/rescues/diagnostics.rhtml | 22 ++++++++++++++++ .../templates/rescues/layout.rhtml | 29 ++++++++++++++++++++++ .../templates/rescues/missing_template.rhtml | 2 ++ .../templates/rescues/template_error.rhtml | 26 +++++++++++++++++++ .../templates/rescues/unknown_action.rhtml | 2 ++ .../templates/scaffolds/edit.rhtml | 6 +++++ .../templates/scaffolds/layout.rhtml | 29 ++++++++++++++++++++++ .../templates/scaffolds/list.rhtml | 24 ++++++++++++++++++ .../templates/scaffolds/new.rhtml | 5 ++++ .../templates/scaffolds/show.rhtml | 9 +++++++ 11 files changed, 182 insertions(+) create mode 100644 actionpack/lib/action_controller/templates/rescues/_request_and_response.rhtml create mode 100644 actionpack/lib/action_controller/templates/rescues/diagnostics.rhtml create mode 100644 actionpack/lib/action_controller/templates/rescues/layout.rhtml create mode 100644 actionpack/lib/action_controller/templates/rescues/missing_template.rhtml create mode 100644 actionpack/lib/action_controller/templates/rescues/template_error.rhtml create mode 100644 actionpack/lib/action_controller/templates/rescues/unknown_action.rhtml create mode 100644 actionpack/lib/action_controller/templates/scaffolds/edit.rhtml create mode 100644 actionpack/lib/action_controller/templates/scaffolds/layout.rhtml create mode 100644 actionpack/lib/action_controller/templates/scaffolds/list.rhtml create mode 100644 actionpack/lib/action_controller/templates/scaffolds/new.rhtml create mode 100644 actionpack/lib/action_controller/templates/scaffolds/show.rhtml (limited to 'actionpack/lib/action_controller/templates') diff --git a/actionpack/lib/action_controller/templates/rescues/_request_and_response.rhtml b/actionpack/lib/action_controller/templates/rescues/_request_and_response.rhtml new file mode 100644 index 0000000000..f1b4a2a1dd --- /dev/null +++ b/actionpack/lib/action_controller/templates/rescues/_request_and_response.rhtml @@ -0,0 +1,28 @@ +<% + base_dir = File.expand_path(File.dirname(__FILE__)) + + request_parameters_without_action = @request.parameters.clone + request_parameters_without_action.delete("action") + request_parameters_without_action.delete("controller") + + request_dump = request_parameters_without_action.inspect.gsub(/,/, ",\n") + session_dump = @request.session.instance_variable_get("@data").inspect.gsub(/,/, ",\n") + response_dump = @response.inspect.gsub(/,/, ",\n") + + template_assigns = @response.template.instance_variable_get("@assigns") + %w( response exception template session request template_root template_class url ignore_missing_templates logger cookies headers params ).each { |t| template_assigns.delete(t) } + template_dump = template_assigns.inspect.gsub(/,/, ",\n") +%> + +

Request

+

Parameters: <%=h request_dump == "{}" ? "None" : request_dump %>

+ +

Show session dump

+ + + +

Response

+Headers: <%=h @response.headers.inspect.gsub(/,/, ",\n") %>
+ +

Show template parameters

+ diff --git a/actionpack/lib/action_controller/templates/rescues/diagnostics.rhtml b/actionpack/lib/action_controller/templates/rescues/diagnostics.rhtml new file mode 100644 index 0000000000..4eb1ed0439 --- /dev/null +++ b/actionpack/lib/action_controller/templates/rescues/diagnostics.rhtml @@ -0,0 +1,22 @@ +<% + base_dir = File.expand_path(File.dirname(__FILE__)) + + clean_backtrace = @exception.backtrace.collect { |line| line.gsub(base_dir, "").gsub("/../config/environments/../../", "") } + app_trace = clean_backtrace.reject { |line| line[0..6] == "vendor/" || line.include?("dispatch.cgi") } + framework_trace = clean_backtrace - app_trace +%> + +

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

+

<%=h @exception.message %>

+ +<% unless app_trace.empty? %>
<%=h app_trace.collect { |line| line.gsub("/../", "") }.join("\n") %>
<% end %> + +<% unless framework_trace.empty? %> + Show framework trace + +<% end %> + +<%= render_file(@rescues_path + "/_request_and_response.rhtml", false) %> diff --git a/actionpack/lib/action_controller/templates/rescues/layout.rhtml b/actionpack/lib/action_controller/templates/rescues/layout.rhtml new file mode 100644 index 0000000000..d38f3e67f9 --- /dev/null +++ b/actionpack/lib/action_controller/templates/rescues/layout.rhtml @@ -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.rhtml b/actionpack/lib/action_controller/templates/rescues/missing_template.rhtml new file mode 100644 index 0000000000..dbfdf76947 --- /dev/null +++ b/actionpack/lib/action_controller/templates/rescues/missing_template.rhtml @@ -0,0 +1,2 @@ +

Template is missing

+

<%=h @exception.message %>

diff --git a/actionpack/lib/action_controller/templates/rescues/template_error.rhtml b/actionpack/lib/action_controller/templates/rescues/template_error.rhtml new file mode 100644 index 0000000000..326fd0b057 --- /dev/null +++ b/actionpack/lib/action_controller/templates/rescues/template_error.rhtml @@ -0,0 +1,26 @@ +<% + base_dir = File.expand_path(File.dirname(__FILE__)) + + framework_trace = @exception.original_exception.backtrace.collect do |line| + line.gsub(base_dir, "").gsub("/../config/environments/../../", "") + end +%> + +

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

+ +

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

+ +
<%=h @exception.source_extract %>
+ +

<%=h @exception.sub_template_message %>

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

Unknown action

+

<%=h @exception.message %>

diff --git a/actionpack/lib/action_controller/templates/scaffolds/edit.rhtml b/actionpack/lib/action_controller/templates/scaffolds/edit.rhtml new file mode 100644 index 0000000000..1c7f4d9770 --- /dev/null +++ b/actionpack/lib/action_controller/templates/scaffolds/edit.rhtml @@ -0,0 +1,6 @@ +

Editing <%= @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}").id %> | +<%= link_to "Back", :action => "list#{@scaffold_suffix}" %> diff --git a/actionpack/lib/action_controller/templates/scaffolds/layout.rhtml b/actionpack/lib/action_controller/templates/scaffolds/layout.rhtml new file mode 100644 index 0000000000..511054abe8 --- /dev/null +++ b/actionpack/lib/action_controller/templates/scaffolds/layout.rhtml @@ -0,0 +1,29 @@ + + + Scaffolding + + + + +<%= @content_for_layout %> + + + \ No newline at end of file diff --git a/actionpack/lib/action_controller/templates/scaffolds/list.rhtml b/actionpack/lib/action_controller/templates/scaffolds/list.rhtml new file mode 100644 index 0000000000..33af7079b2 --- /dev/null +++ b/actionpack/lib/action_controller/templates/scaffolds/list.rhtml @@ -0,0 +1,24 @@ +

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.id %><%= link_to "Edit", :action => "edit#{@scaffold_suffix}", :id => entry.id %><%= link_to "Destroy", :action => "destroy#{@scaffold_suffix}", :id => entry.id %>
+ +
+ +<%= link_to "New #{@scaffold_singular_name}", :action => "new#{@scaffold_suffix}" %> diff --git a/actionpack/lib/action_controller/templates/scaffolds/new.rhtml b/actionpack/lib/action_controller/templates/scaffolds/new.rhtml new file mode 100644 index 0000000000..02f52e72f5 --- /dev/null +++ b/actionpack/lib/action_controller/templates/scaffolds/new.rhtml @@ -0,0 +1,5 @@ +

New <%= @scaffold_singular_name %>

+ +<%= form(@scaffold_singular_name, :action => "create" + @scaffold_suffix) %> + +<%= link_to "Back", :action => "list#{@scaffold_suffix}" %> \ No newline at end of file diff --git a/actionpack/lib/action_controller/templates/scaffolds/show.rhtml b/actionpack/lib/action_controller/templates/scaffolds/show.rhtml new file mode 100644 index 0000000000..10c46342fd --- /dev/null +++ b/actionpack/lib/action_controller/templates/scaffolds/show.rhtml @@ -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}").id %> | +<%= link_to "Back", :action => "list#{@scaffold_suffix}" %> -- cgit v1.2.3