You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@deltacloud.apache.org by lu...@redhat.com on 2011/03/19 01:03:12 UTC

[PATCH 2/4] Show parameters added by features in the docs

From: David Lutterkort <lu...@redhat.com>

---
 server/lib/sinatra/rabbit.rb          |    1 +
 server/views/docs/operation.html.haml |   16 +++++++++++++++-
 2 files changed, 16 insertions(+), 1 deletions(-)

diff --git a/server/lib/sinatra/rabbit.rb b/server/lib/sinatra/rabbit.rb
index f8d9e3d..a465ed6 100644
--- a/server/lib/sinatra/rabbit.rb
+++ b/server/lib/sinatra/rabbit.rb
@@ -74,6 +74,7 @@ module Sinatra
         coll, oper = @collection, self
         ::Sinatra::Application.get("/api/docs/#{@collection.name}/#{@name}") do
           @collection, @operation = coll, oper
+          @features = driver.features_for_operation(coll.name, oper.name)
           respond_to do |format|
             format.html { haml :'docs/operation' }
             format.xml { haml :'docs/operation' }
diff --git a/server/views/docs/operation.html.haml b/server/views/docs/operation.html.haml
index b7c3538..927b331 100644
--- a/server/views/docs/operation.html.haml
+++ b/server/views/docs/operation.html.haml
@@ -25,5 +25,19 @@
           %em #{p.name}
         %td{:style => "width:10em"} #{p.type}
         %td #{p.klass}
-        %td{:style => "width:10em"} #{p.options.join(',')}
+        %td{:style => "width:10em"} #{p.options.join(', ')}
         %td #{p.description}
+    - @features.sort { |a,b| a.name.to_s <=> b.name.to_s }.each do |f|
+      %tr
+        %th{:colspan => 4}
+          Feature #{f.name}
+        %th{:colspan => 1}
+          %em= f.description
+      - f.decl.operation(@operation.name).each_param do |p|
+        %tr
+          %td{:style => "width:15em"}
+            %em #{p.name}
+          %td{:style => "width:10em"} #{p.type}
+          %td #{p.klass}
+          %td{:style => "width:10em"} #{p.options.join(', ')}
+          %td #{p.description}
-- 
1.7.4


Re: [PATCH 2/4] Show parameters added by features in the docs

Posted by Michal Fojtik <mi...@mifo.sk>.
On Mar 19, 2011, at 1:03 AM, lutter@redhat.com wrote:

ACK.

  -- Michal

> From: David Lutterkort <lu...@redhat.com>
> 
> ---
> server/lib/sinatra/rabbit.rb          |    1 +
> server/views/docs/operation.html.haml |   16 +++++++++++++++-
> 2 files changed, 16 insertions(+), 1 deletions(-)
> 
> diff --git a/server/lib/sinatra/rabbit.rb b/server/lib/sinatra/rabbit.rb
> index f8d9e3d..a465ed6 100644
> --- a/server/lib/sinatra/rabbit.rb
> +++ b/server/lib/sinatra/rabbit.rb
> @@ -74,6 +74,7 @@ module Sinatra
>         coll, oper = @collection, self
>         ::Sinatra::Application.get("/api/docs/#{@collection.name}/#{@name}") do
>           @collection, @operation = coll, oper
> +          @features = driver.features_for_operation(coll.name, oper.name)
>           respond_to do |format|
>             format.html { haml :'docs/operation' }
>             format.xml { haml :'docs/operation' }
> diff --git a/server/views/docs/operation.html.haml b/server/views/docs/operation.html.haml
> index b7c3538..927b331 100644
> --- a/server/views/docs/operation.html.haml
> +++ b/server/views/docs/operation.html.haml
> @@ -25,5 +25,19 @@
>           %em #{p.name}
>         %td{:style => "width:10em"} #{p.type}
>         %td #{p.klass}
> -        %td{:style => "width:10em"} #{p.options.join(',')}
> +        %td{:style => "width:10em"} #{p.options.join(', ')}
>         %td #{p.description}
> +    - @features.sort { |a,b| a.name.to_s <=> b.name.to_s }.each do |f|
> +      %tr
> +        %th{:colspan => 4}
> +          Feature #{f.name}
> +        %th{:colspan => 1}
> +          %em= f.description
> +      - f.decl.operation(@operation.name).each_param do |p|
> +        %tr
> +          %td{:style => "width:15em"}
> +            %em #{p.name}
> +          %td{:style => "width:10em"} #{p.type}
> +          %td #{p.klass}
> +          %td{:style => "width:10em"} #{p.options.join(', ')}
> +          %td #{p.description}
> -- 
> 1.7.4
>