[PATCH conductor] Add a View Template XML option to Image Details
tsedovic at redhat.com
tsedovic at redhat.com
Thu Dec 15 15:20:26 UTC 2011
From: Tomas Sedovic <tomas at sedovic.cz>
https://bugzilla.redhat.com/show_bug.cgi?id=761545
---
src/app/controllers/images_controller.rb | 11 +++++++++++
src/app/views/images/show.html.haml | 2 ++
src/config/locales/en.yml | 2 ++
src/config/routes.rb | 1 +
4 files changed, 16 insertions(+), 0 deletions(-)
diff --git a/src/app/controllers/images_controller.rb b/src/app/controllers/images_controller.rb
index c706e51..8182912 100644
--- a/src/app/controllers/images_controller.rb
+++ b/src/app/controllers/images_controller.rb
@@ -54,6 +54,17 @@ class ImagesController < ApplicationController
redirect_to image_path(@image.id)
end
+ def template
+ image = Aeolus::Image::Warehouse::Image.find(params[:id])
+ template = Aeolus::Image::Warehouse::Template.find(image.template)
+ if template
+ render :xml => template.body
+ else
+ flash[:error] = t('images.flash.error.no_template')
+ redirect_to image_path(@image)
+ end
+ end
+
def new
if 'import' == params[:tab]
@providers = Provider.all
diff --git a/src/app/views/images/show.html.haml b/src/app/views/images/show.html.haml
index 898ba16..631ab02 100644
--- a/src/app/views/images/show.html.haml
+++ b/src/app/views/images/show.html.haml
@@ -6,6 +6,8 @@
= link_to t('images.index.images'), images_path, :class => 'rounded-link'
.button-group
= link_to t('.new_deployable_from_image'), new_deployable_path(:create_from_image => @image.id), :class => 'button pill'
+ - unless @image.imported?
+ = link_to t('.template_xml'), template_image_path(@image.uuid), :class => 'button'
= button_to t("delete"), image_path(@image.id), :method => 'delete', :confirm => "Are you sure you want to delete?", :class => 'button pill danger', :id => 'delete'
%section.admin-content-section
diff --git a/src/config/locales/en.yml b/src/config/locales/en.yml
index e3eef1c..9c9e4f5 100644
--- a/src/config/locales/en.yml
+++ b/src/config/locales/en.yml
@@ -708,6 +708,7 @@ en:
build_date: Build Completion Date
latest: Latest
select_build: Select
+ template_xml: View Template XML
flash:
notice:
deleted: Image Deleted
@@ -719,6 +720,7 @@ en:
error:
invalid_url: Could not load the provided URL
no_file: You must specify the template XML file
+ no_template: "The image doesn't have a template because it's been imported."
new:
new_image: New Image
description:
diff --git a/src/config/routes.rb b/src/config/routes.rb
index 09e96be..776c7f7 100644
--- a/src/config/routes.rb
+++ b/src/config/routes.rb
@@ -214,6 +214,7 @@ Conductor::Application.routes.draw do
resources :images do
member do
post 'rebuild_all'
+ get 'template'
end
collection do
post 'edit_xml'
--
1.7.6.4
More information about the aeolus-devel
mailing list