incubator-deltacloud-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfoj...@redhat.com
Subject [PATCH core 6/8] CIMI: Backported bread_crumb_ext helper. Added support for additional local variables for CIMI view
Date Thu, 27 Oct 2011 11:17:26 GMT
From: Michal Fojtik <mfojtik@redhat.com>


Signed-off-by: Michal fojtik <mfojtik@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


Mime
View raw message