[PATCH conductor 2/3] fixed bug with updating deployable xml
jtomasek at redhat.com
jtomasek at redhat.com
Fri Dec 9 15:06:26 UTC 2011
From: Jiri Tomasek <jtomasek at redhat.com>
---
src/app/controllers/deployables_controller.rb | 3 +-
src/app/views/deployables/_form.html.haml | 45 ++++++++++++-------------
2 files changed, 24 insertions(+), 24 deletions(-)
diff --git a/src/app/controllers/deployables_controller.rb b/src/app/controllers/deployables_controller.rb
index c49071c..241ebb2 100644
--- a/src/app/controllers/deployables_controller.rb
+++ b/src/app/controllers/deployables_controller.rb
@@ -143,6 +143,7 @@ class DeployablesController < ApplicationController
def update
@deployable = Deployable.find(params[:id])
+ @catalog = Catalog.find(params[:catalog_id])
require_privilege(Privilege::MODIFY, @deployable)
params[:deployable].delete(:owner_id) if params[:deployable]
@@ -150,7 +151,7 @@ class DeployablesController < ApplicationController
flash[:notice] = t"catalog_entries.flash.notice.updated"
redirect_to catalog_deployable_path(params[:catalog_id], @deployable)
else
- render :action => 'edit'
+ render :action => 'edit', :edit_xml => params[:edit_xml]
end
end
diff --git a/src/app/views/deployables/_form.html.haml b/src/app/views/deployables/_form.html.haml
index 1c50786..e6a123f 100644
--- a/src/app/views/deployables/_form.html.haml
+++ b/src/app/views/deployables/_form.html.haml
@@ -1,26 +1,25 @@
- if @deployable.errors.any?
= render 'layouts/error_messages', :object => @deployable
-= form_for @deployable do |form|
- %fieldset
- - if params[:edit_xml]
- %p
- %h2= t('.deployable_xml')
- = form.text_area :xml, :class => 'edit_xml'
- - else
- %p
- = label_tag :catalog_id, t('catalog_entries.form.catalog')
- %span.text_instead_input= @catalog.name
- .clear
- %p
- = form.label :name, t('catalog_entries.index.name')
- = form.text_field :name, :class => 'em long'
- %p
- = form.label :description, t('.description')
- = form.text_area :description, :class => 'long'
- %p
- = form.label :xml, t('.deployable_xml')
- %span.text_instead_input= link_to t("catalog_entries.properties.edit_deployable_xml"), edit_catalog_deployable_path(@catalog.id, @deployable.id, :edit_xml=>true)
+%fieldset
+ - if params[:edit_xml]
+ = hidden_field_tag :edit_xml, true
+ %p
+ %h2= t('.deployable_xml')
+ = form.text_area :xml, :class => 'edit_xml'
+ - else
+ %p
+ = label_tag :catalog_id, t('catalog_entries.form.catalog')
+ %span.text_instead_input= @catalog.name
+ %p
+ = form.label :name, t('catalog_entries.index.name')
+ = form.text_field :name, :class => 'em long'
+ %p
+ = form.label :description, t('.description')
+ = form.text_area :description, :class => 'long'
+ %p
+ = form.label :xml, t('.deployable_xml')
+ %span.text_instead_input= link_to t("catalog_entries.properties.edit_deployable_xml"), edit_catalog_deployable_path(@catalog.id, @deployable.id, :edit_xml=>true)
- %fieldset.align-center
- = link_to t('cancel'), catalog_path(@catalog), :class => 'button danger'
- = submit_tag t('save'), :name => 'save', :class => 'button', :id => 'save_button'
+%fieldset.align-center
+ = link_to t('cancel'), catalog_path(@catalog), :class => 'button danger'
+ = submit_tag t('save'), :name => 'save', :class => 'button', :id => 'save_button'
--
1.7.7.3
More information about the aeolus-devel
mailing list