On 12/16/2011 01:18 PM, tsedovic(a)redhat.com wrote:
From: Tomas Sedovic<tomas(a)sedovic.cz>
When a user clicked on the Deployable XML link, they were shown the deployables
list instead of getting the xml.
---
src/app/controllers/deployables_controller.rb | 6 ++++++
src/app/views/deployments/_overview.html.haml | 2 +-
src/config/routes.rb | 1 +
3 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/src/app/controllers/deployables_controller.rb
b/src/app/controllers/deployables_controller.rb
index ef44628..07556fb 100644
--- a/src/app/controllers/deployables_controller.rb
+++ b/src/app/controllers/deployables_controller.rb
@@ -86,6 +86,12 @@ class DeployablesController< ApplicationController
end
end
+ def definition
+ @deployable = Deployable.find(params[:deployable_id])
+ require_privilege(Privilege::VIEW, @deployable)
+ render :xml => @deployable.xml
+ end
+
def create
if params[:cancel]
redirect_to catalog_deployables_path
diff --git a/src/app/views/deployments/_overview.html.haml
b/src/app/views/deployments/_overview.html.haml
index e68ee50..6a6ba3c 100644
--- a/src/app/views/deployments/_overview.html.haml
+++ b/src/app/views/deployments/_overview.html.haml
@@ -23,7 +23,7 @@
%p= @deployment.deployable_xml.description
%h3= t('.deployable_xml')
- =link_to @deployable.xml_filename,
catalog_deployable_path((a)deployable.catalogs.first, @deployable.catalog_entries.first.id,
:deployable_xml => true)
+ = link_to @deployable.xml_filename,
catalog_deployable_definition_path((a)deployable.catalogs.first, @deployable)
⇒
%h3= t('.image_ids')
diff --git a/src/config/routes.rb b/src/config/routes.rb
index 09e96be..4216027 100644
--- a/src/config/routes.rb
+++ b/src/config/routes.rb
@@ -204,6 +204,7 @@ Conductor::Application.routes.draw do
delete 'multi_destroy', :on => :collection
post :filter, :on => :collection
post :build
+ get :definition
end
end
ACK