diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2007-02-21 00:29:44 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2007-02-21 00:29:44 +0000 |
commit | 21187c0fb4fc559927a2f947f909dedd85969ffb (patch) | |
tree | efd0ceb5c3a88531916186e97aa106041c293975 /actionwebservice | |
parent | b5419cd66ea160d1ee94f3ca521bb44adf3a21ca (diff) | |
download | rails-21187c0fb4fc559927a2f947f909dedd85969ffb.tar.gz rails-21187c0fb4fc559927a2f947f909dedd85969ffb.tar.bz2 rails-21187c0fb4fc559927a2f947f909dedd85969ffb.zip |
Apply the rest of Chads patch
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6180 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionwebservice')
10 files changed, 140 insertions, 140 deletions
diff --git a/actionwebservice/lib/action_web_service/scaffolding.rb b/actionwebservice/lib/action_web_service/scaffolding.rb index e109857727..1ffe4eba77 100644 --- a/actionwebservice/lib/action_web_service/scaffolding.rb +++ b/actionwebservice/lib/action_web_service/scaffolding.rb @@ -25,10 +25,10 @@ module ActionWebService # # If you want to customize the default views, create the following views in "app/views": # - # * <tt>action_name/methods.rhtml</tt> - # * <tt>action_name/parameters.rhtml</tt> - # * <tt>action_name/result.rhtml</tt> - # * <tt>action_name/layout.rhtml</tt> + # * <tt>action_name/methods.erb</tt> + # * <tt>action_name/parameters.erb</tt> + # * <tt>action_name/result.erb</tt> + # * <tt>action_name/layout.erb</tt> # # Where <tt>action_name</tt> is the name of the action you gave to ClassMethods#web_service_scaffold. # @@ -122,7 +122,7 @@ module ActionWebService end def scaffold_path(template_name) - File.dirname(__FILE__) + "/templates/scaffolds/" + template_name + ".rhtml" + File.dirname(__FILE__) + "/templates/scaffolds/" + template_name + ".erb" end def reset_invocation_response diff --git a/actionwebservice/lib/action_web_service/templates/scaffolds/layout.erb b/actionwebservice/lib/action_web_service/templates/scaffolds/layout.erb new file mode 100644 index 0000000000..167613f681 --- /dev/null +++ b/actionwebservice/lib/action_web_service/templates/scaffolds/layout.erb @@ -0,0 +1,65 @@ +<html> +<head> + <title><%= @scaffold_class.wsdl_service_name %> Web Service</title> + <style> + body { background-color: #fff; color: #333; } + + body, p, ol, ul, td { + font-family: verdana, arial, helvetica, sans-serif; + font-size: 13px; + line-height: 18px; + } + + pre { + background-color: #eee; + padding: 10px; + font-size: 11px; + } + + a { color: #000; } + a:visited { color: #666; } + a:hover { color: #fff; background-color:#000; } + + .fieldWithErrors { + padding: 2px; + background-color: red; + display: table; + } + + #errorExplanation { + width: 400px; + border: 2px solid red; + padding: 7px; + padding-bottom: 12px; + margin-bottom: 20px; + background-color: #f0f0f0; + } + + #errorExplanation h2 { + text-align: left; + font-weight: bold; + padding: 5px 5px 5px 15px; + font-size: 12px; + margin: -7px; + background-color: #c00; + color: #fff; + } + + #errorExplanation p { + color: #333; + margin-bottom: 0; + padding: 5px; + } + + #errorExplanation ul li { + font-size: 12px; + list-style: square; + } + </style> +</head> +<body> + +<%= @content_for_layout %> + +</body> +</html> diff --git a/actionwebservice/lib/action_web_service/templates/scaffolds/layout.rhtml b/actionwebservice/lib/action_web_service/templates/scaffolds/layout.rhtml index 167613f681..e69de29bb2 100644 --- a/actionwebservice/lib/action_web_service/templates/scaffolds/layout.rhtml +++ b/actionwebservice/lib/action_web_service/templates/scaffolds/layout.rhtml @@ -1,65 +0,0 @@ -<html> -<head> - <title><%= @scaffold_class.wsdl_service_name %> Web Service</title> - <style> - body { background-color: #fff; color: #333; } - - body, p, ol, ul, td { - font-family: verdana, arial, helvetica, sans-serif; - font-size: 13px; - line-height: 18px; - } - - pre { - background-color: #eee; - padding: 10px; - font-size: 11px; - } - - a { color: #000; } - a:visited { color: #666; } - a:hover { color: #fff; background-color:#000; } - - .fieldWithErrors { - padding: 2px; - background-color: red; - display: table; - } - - #errorExplanation { - width: 400px; - border: 2px solid red; - padding: 7px; - padding-bottom: 12px; - margin-bottom: 20px; - background-color: #f0f0f0; - } - - #errorExplanation h2 { - text-align: left; - font-weight: bold; - padding: 5px 5px 5px 15px; - font-size: 12px; - margin: -7px; - background-color: #c00; - color: #fff; - } - - #errorExplanation p { - color: #333; - margin-bottom: 0; - padding: 5px; - } - - #errorExplanation ul li { - font-size: 12px; - list-style: square; - } - </style> -</head> -<body> - -<%= @content_for_layout %> - -</body> -</html> diff --git a/actionwebservice/lib/action_web_service/templates/scaffolds/methods.erb b/actionwebservice/lib/action_web_service/templates/scaffolds/methods.erb new file mode 100644 index 0000000000..60dfe23f07 --- /dev/null +++ b/actionwebservice/lib/action_web_service/templates/scaffolds/methods.erb @@ -0,0 +1,6 @@ +<% @scaffold_container.services.each do |service| %> + + <h4>API Methods for <%= service %></h4> + <%= service_method_list(service) %> + +<% end %> diff --git a/actionwebservice/lib/action_web_service/templates/scaffolds/methods.rhtml b/actionwebservice/lib/action_web_service/templates/scaffolds/methods.rhtml index 60dfe23f07..e69de29bb2 100644 --- a/actionwebservice/lib/action_web_service/templates/scaffolds/methods.rhtml +++ b/actionwebservice/lib/action_web_service/templates/scaffolds/methods.rhtml @@ -1,6 +0,0 @@ -<% @scaffold_container.services.each do |service| %> - - <h4>API Methods for <%= service %></h4> - <%= service_method_list(service) %> - -<% end %> diff --git a/actionwebservice/lib/action_web_service/templates/scaffolds/parameters.erb b/actionwebservice/lib/action_web_service/templates/scaffolds/parameters.erb new file mode 100644 index 0000000000..767284e0d4 --- /dev/null +++ b/actionwebservice/lib/action_web_service/templates/scaffolds/parameters.erb @@ -0,0 +1,29 @@ +<h4>Method Invocation Details for <em><%= @scaffold_service %>#<%= @scaffold_method.public_name %></em></h4> + +<% form_tag(:action => @scaffold_action_name + '_submit') do -%> +<%= hidden_field_tag "service", @scaffold_service.name %> +<%= hidden_field_tag "method", @scaffold_method.public_name %> + +<p> +<label for="protocol">Protocol:</label><br /> +<%= select_tag 'protocol', options_for_select([['SOAP', 'soap'], ['XML-RPC', 'xmlrpc']], params['protocol']) %> +</p> + +<% if @scaffold_method.expects %> + +<strong>Method Parameters:</strong><br /> +<% @scaffold_method.expects.each_with_index do |type, i| %> + <p> + <label for="method_params[<%= i %>]"><%= method_parameter_label(type.name, type) %> </label><br /> + <%= method_parameter_input_fields(@scaffold_method, type, "method_params", i) %> + </p> +<% end %> + +<% end %> + +<%= submit_tag "Invoke" %> +<% end -%> + +<p> +<%= link_to "Back", :action => @scaffold_action_name %> +</p> diff --git a/actionwebservice/lib/action_web_service/templates/scaffolds/parameters.rhtml b/actionwebservice/lib/action_web_service/templates/scaffolds/parameters.rhtml index 767284e0d4..e69de29bb2 100644 --- a/actionwebservice/lib/action_web_service/templates/scaffolds/parameters.rhtml +++ b/actionwebservice/lib/action_web_service/templates/scaffolds/parameters.rhtml @@ -1,29 +0,0 @@ -<h4>Method Invocation Details for <em><%= @scaffold_service %>#<%= @scaffold_method.public_name %></em></h4> - -<% form_tag(:action => @scaffold_action_name + '_submit') do -%> -<%= hidden_field_tag "service", @scaffold_service.name %> -<%= hidden_field_tag "method", @scaffold_method.public_name %> - -<p> -<label for="protocol">Protocol:</label><br /> -<%= select_tag 'protocol', options_for_select([['SOAP', 'soap'], ['XML-RPC', 'xmlrpc']], params['protocol']) %> -</p> - -<% if @scaffold_method.expects %> - -<strong>Method Parameters:</strong><br /> -<% @scaffold_method.expects.each_with_index do |type, i| %> - <p> - <label for="method_params[<%= i %>]"><%= method_parameter_label(type.name, type) %> </label><br /> - <%= method_parameter_input_fields(@scaffold_method, type, "method_params", i) %> - </p> -<% end %> - -<% end %> - -<%= submit_tag "Invoke" %> -<% end -%> - -<p> -<%= link_to "Back", :action => @scaffold_action_name %> -</p> diff --git a/actionwebservice/lib/action_web_service/templates/scaffolds/result.erb b/actionwebservice/lib/action_web_service/templates/scaffolds/result.erb new file mode 100644 index 0000000000..5317688fcd --- /dev/null +++ b/actionwebservice/lib/action_web_service/templates/scaffolds/result.erb @@ -0,0 +1,30 @@ +<h4>Method Invocation Result for <em><%= @scaffold_service %>#<%= @scaffold_method.public_name %></em></h4> + +<p> +Invocation took <tt><%= '%f' % @method_elapsed %></tt> seconds +</p> + +<p> +<strong>Return Value:</strong><br /> +<pre> +<%= h @method_return_value.inspect %> +</pre> +</p> + +<p> +<strong>Request XML:</strong><br /> +<pre> +<%= h @method_request_xml %> +</pre> +</p> + +<p> +<strong>Response XML:</strong><br /> +<pre> +<%= h @method_response_xml %> +</pre> +</p> + +<p> +<%= link_to "Back", :action => @scaffold_action_name + '_method_params', :method => @scaffold_method.public_name, :service => @scaffold_service.name %> +</p> diff --git a/actionwebservice/lib/action_web_service/templates/scaffolds/result.rhtml b/actionwebservice/lib/action_web_service/templates/scaffolds/result.rhtml index 5317688fcd..e69de29bb2 100644 --- a/actionwebservice/lib/action_web_service/templates/scaffolds/result.rhtml +++ b/actionwebservice/lib/action_web_service/templates/scaffolds/result.rhtml @@ -1,30 +0,0 @@ -<h4>Method Invocation Result for <em><%= @scaffold_service %>#<%= @scaffold_method.public_name %></em></h4> - -<p> -Invocation took <tt><%= '%f' % @method_elapsed %></tt> seconds -</p> - -<p> -<strong>Return Value:</strong><br /> -<pre> -<%= h @method_return_value.inspect %> -</pre> -</p> - -<p> -<strong>Request XML:</strong><br /> -<pre> -<%= h @method_request_xml %> -</pre> -</p> - -<p> -<strong>Response XML:</strong><br /> -<pre> -<%= h @method_response_xml %> -</pre> -</p> - -<p> -<%= link_to "Back", :action => @scaffold_action_name + '_method_params', :method => @scaffold_method.public_name, :service => @scaffold_service.name %> -</p> diff --git a/actionwebservice/test/scaffolded_controller_test.rb b/actionwebservice/test/scaffolded_controller_test.rb index 67e74a95ec..db73be17e3 100644 --- a/actionwebservice/test/scaffolded_controller_test.rb +++ b/actionwebservice/test/scaffolded_controller_test.rb @@ -73,30 +73,30 @@ class ScaffoldedControllerTest < Test::Unit::TestCase def test_scaffold_invoke get :scaffold_invoke - assert_template 'methods.rhtml' + assert_template 'methods.erb' end def test_scaffold_invoke_method_params get :scaffold_invoke_method_params, :service => 'scaffolded', :method => 'Hello' - assert_template 'parameters.rhtml' + assert_template 'parameters.erb' end def test_scaffold_invoke_method_params_with_struct get :scaffold_invoke_method_params, :service => 'scaffolded', :method => 'HelloStructParam' - assert_template 'parameters.rhtml' + assert_template 'parameters.erb' assert_tag :tag => 'form' assert_tag :tag => 'input', :attributes => {:name => "method_params[0][name]"} end def test_scaffold_invoke_submit_hello post :scaffold_invoke_submit, :service => 'scaffolded', :method => 'Hello', :method_params => {'0' => '5', '1' => 'hello world'} - assert_template 'result.rhtml' + assert_template 'result.erb' assert_equal false, @controller.instance_eval{ @method_return_value } end def test_scaffold_invoke_submit_bye post :scaffold_invoke_submit, :service => 'scaffolded', :method => 'Bye' - assert_template 'result.rhtml' + assert_template 'result.erb' persons = [ScaffoldPerson.new(:id => 1, :name => "leon"), ScaffoldPerson.new(:id => 2, :name => "paul")] assert_equal persons, @controller.instance_eval{ @method_return_value } end |