You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@deltacloud.apache.org by mf...@redhat.com on 2011/10/27 13:17:26 UTC

[PATCH core 6/8] CIMI: Backported bread_crumb_ext helper. Added support for additional local variables for CIMI view

From: Michal Fojtik <mf...@redhat.com>


Signed-off-by: Michal fojtik <mf...@redhat.com>
---
 server/lib/cimi/helpers/cmwg_helper.rb |   16 +++++++++++++++-
 1 files changed, 15 insertions(+), 1 deletions(-)

diff --git a/server/lib/cimi/helpers/cmwg_helper.rb b/server/lib/cimi/helpers/cmwg_helper.rb
index 9dae5a1..e30ea17 100644
--- a/server/lib/cimi/helpers/cmwg_helper.rb
+++ b/server/lib/cimi/helpers/cmwg_helper.rb
@@ -16,14 +16,28 @@
 module ApplicationHelper
   include Deltacloud
 
-  def render_resource(object_name, data)
+  def bread_crumb_ext
+    s = "<ul class='breadcrumb'><li class='first'><a href='#{settings.root_url}'>&#948 home</a></li>"
+    s+="<li class='docs'>#{link_to_documentation}</li>"
+    s+="</ul>"
+  end
+
+  def render_resource(object_name, data, locals={})
     respond_to do |format|
       format.xml do
         report_error 404 unless data
+        locals.each { |key, value| eval "@#{key}=value" }
         @object = data
         content_type cimi_content_type_for(object_name.to_s.camelize, :xml)
         haml :"#{object_name.to_s.pluralize}/show", :layout => false
       end
+      format.html do
+        report_error 404 unless data
+        locals.each { |key, value| eval "@#{key}=value" }
+        @object = data
+        content_type 'application/xhtml+xml'
+        haml :"#{object_name.to_s.pluralize}/show", :layout => false
+      end
       format.json do
         report_error 404 unless data
         content_type cimi_content_type_for(object_name.to_s.camelize, :json)
-- 
1.7.4.4