If the deployables#new form submitted with the Upload XML tab selected but without uploading any file, the form would switch to the 'From URL' tab. This patch fixes this issue.
From: Imre Farkas ifarkas@redhat.com
--- src/Gemfile.lock | 2 ++ src/app/controllers/deployables_controller.rb | 2 +- src/app/views/deployables/_from_url.html.haml | 1 + src/app/views/deployables/_upload.html.haml | 1 + 4 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/src/Gemfile.lock b/src/Gemfile.lock index 1c19f6a..b6c8dfb 100644 --- a/src/Gemfile.lock +++ b/src/Gemfile.lock @@ -135,6 +135,7 @@ GEM ffi (>= 1.0.7) json_pure rubyzip + silent-postgres (0.1.1) simple-navigation (3.0.0) activesupport (>= 2.3.2) sqlite3 (1.3.3) @@ -188,6 +189,7 @@ DEPENDENCIES rspec-rails ruby-net-ldap sass + silent-postgres simple-navigation sqlite3 thin diff --git a/src/app/controllers/deployables_controller.rb b/src/app/controllers/deployables_controller.rb index 13d4f3e..4033b96 100644 --- a/src/app/controllers/deployables_controller.rb +++ b/src/app/controllers/deployables_controller.rb @@ -151,7 +151,7 @@ class DeployablesController < ApplicationController else @catalog = @selected_catalogs.first params.delete(:edit_xml) if params[:edit_xml] - @form_option = params[:deployable].has_key?(:xml) ? 'upload' : 'from_url' + @form_option = params[:form_option].eql?('upload') ? 'upload' : 'from_url' end render :new end diff --git a/src/app/views/deployables/_from_url.html.haml b/src/app/views/deployables/_from_url.html.haml index de7d253..89fc825 100644 --- a/src/app/views/deployables/_from_url.html.haml +++ b/src/app/views/deployables/_from_url.html.haml @@ -2,6 +2,7 @@ - if @deployable.errors.any? = render 'layouts/error_messages', :object => @deployable %fieldset + = hidden_field_tag('form_option', @form_option) %p = form.label :catalog_id, t('deployables.form.catalog') %span.text_instead_input diff --git a/src/app/views/deployables/_upload.html.haml b/src/app/views/deployables/_upload.html.haml index 103ccf6..7f87a60 100644 --- a/src/app/views/deployables/_upload.html.haml +++ b/src/app/views/deployables/_upload.html.haml @@ -2,6 +2,7 @@ - if @deployable.errors.any? = render 'layouts/error_messages', :object => @deployable %fieldset + = hidden_field_tag('form_option', @form_option) %p = label_tag :catalog_id, t('deployables.form.catalog') %span.text_instead_input
On 12/29/2011 02:20 PM, ifarkas@redhat.com wrote:
From: Imre Farkasifarkas@redhat.com
src/Gemfile.lock | 2 ++ src/app/controllers/deployables_controller.rb | 2 +- src/app/views/deployables/_from_url.html.haml | 1 + src/app/views/deployables/_upload.html.haml | 1 + 4 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/src/Gemfile.lock b/src/Gemfile.lock index 1c19f6a..b6c8dfb 100644 --- a/src/Gemfile.lock +++ b/src/Gemfile.lock @@ -135,6 +135,7 @@ GEM ffi (>= 1.0.7) json_pure rubyzip
- silent-postgres (0.1.1)
Our policy is not to push rubygem dependencies that are not packaged for Fedora. Silent-postgres doesn't seem to be.
It doesn't seem to do anything with this fix anyway so please remove it before pushing. If you want to get it in in the future, please try to get it packaged first.
simple-navigation (3.0.0) activesupport (>= 2.3.2) sqlite3 (1.3.3)
@@ -188,6 +189,7 @@ DEPENDENCIES rspec-rails ruby-net-ldap sass
- silent-postgres
Same here ^
simple-navigation sqlite3 thin
diff --git a/src/app/controllers/deployables_controller.rb b/src/app/controllers/deployables_controller.rb index 13d4f3e..4033b96 100644 --- a/src/app/controllers/deployables_controller.rb +++ b/src/app/controllers/deployables_controller.rb @@ -151,7 +151,7 @@ class DeployablesController< ApplicationController else @catalog = @selected_catalogs.first params.delete(:edit_xml) if params[:edit_xml]
@form_option = params[:deployable].has_key?(:xml) ? 'upload' : 'from_url'
@form_option = params[:form_option].eql?('upload') ? 'upload' : 'from_url' end render :new end
diff --git a/src/app/views/deployables/_from_url.html.haml b/src/app/views/deployables/_from_url.html.haml index de7d253..89fc825 100644 --- a/src/app/views/deployables/_from_url.html.haml +++ b/src/app/views/deployables/_from_url.html.haml @@ -2,6 +2,7 @@ - if @deployable.errors.any? = render 'layouts/error_messages', :object => @deployable %fieldset
- = hidden_field_tag('form_option', @form_option) %p = form.label :catalog_id, t('deployables.form.catalog') %span.text_instead_input
diff --git a/src/app/views/deployables/_upload.html.haml b/src/app/views/deployables/_upload.html.haml index 103ccf6..7f87a60 100644 --- a/src/app/views/deployables/_upload.html.haml +++ b/src/app/views/deployables/_upload.html.haml @@ -2,6 +2,7 @@ - if @deployable.errors.any? = render 'layouts/error_messages', :object => @deployable %fieldset
- = hidden_field_tag('form_option', @form_option) %p = label_tag :catalog_id, t('deployables.form.catalog') %span.text_instead_input
ACK, before pushing see the notes inline.
On 01/03/2012 01:58 PM, Tomas Sedovic wrote:
On 12/29/2011 02:20 PM, ifarkas@redhat.com wrote:
From: Imre Farkasifarkas@redhat.com
src/Gemfile.lock | 2 ++ src/app/controllers/deployables_controller.rb | 2 +- src/app/views/deployables/_from_url.html.haml | 1 + src/app/views/deployables/_upload.html.haml | 1 + 4 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/src/Gemfile.lock b/src/Gemfile.lock index 1c19f6a..b6c8dfb 100644 --- a/src/Gemfile.lock +++ b/src/Gemfile.lock @@ -135,6 +135,7 @@ GEM ffi (>= 1.0.7) json_pure rubyzip
- silent-postgres (0.1.1)
Our policy is not to push rubygem dependencies that are not packaged for Fedora. Silent-postgres doesn't seem to be.
It doesn't seem to do anything with this fix anyway so please remove it before pushing. If you want to get it in in the future, please try to get it packaged first.
Sorry about that, I have left it there accidentally. You are right, it has nothing to do with the issue. Thanks for catching it!
simple-navigation (3.0.0) activesupport (>= 2.3.2) sqlite3 (1.3.3) @@ -188,6 +189,7 @@ DEPENDENCIES rspec-rails ruby-net-ldap sass
- silent-postgres
Same here ^
simple-navigation sqlite3 thin diff --git a/src/app/controllers/deployables_controller.rb b/src/app/controllers/deployables_controller.rb index 13d4f3e..4033b96 100644 --- a/src/app/controllers/deployables_controller.rb +++ b/src/app/controllers/deployables_controller.rb @@ -151,7 +151,7 @@ class DeployablesController< ApplicationController else @catalog = @selected_catalogs.first params.delete(:edit_xml) if params[:edit_xml]
- @form_option = params[:deployable].has_key?(:xml) ? 'upload' :
'from_url'
- @form_option = params[:form_option].eql?('upload') ? 'upload' :
'from_url' end render :new end diff --git a/src/app/views/deployables/_from_url.html.haml b/src/app/views/deployables/_from_url.html.haml index de7d253..89fc825 100644 --- a/src/app/views/deployables/_from_url.html.haml +++ b/src/app/views/deployables/_from_url.html.haml @@ -2,6 +2,7 @@
- if @deployable.errors.any?
= render 'layouts/error_messages', :object => @deployable %fieldset
- = hidden_field_tag('form_option', @form_option)
%p = form.label :catalog_id, t('deployables.form.catalog') %span.text_instead_input diff --git a/src/app/views/deployables/_upload.html.haml b/src/app/views/deployables/_upload.html.haml index 103ccf6..7f87a60 100644 --- a/src/app/views/deployables/_upload.html.haml +++ b/src/app/views/deployables/_upload.html.haml @@ -2,6 +2,7 @@
- if @deployable.errors.any?
= render 'layouts/error_messages', :object => @deployable %fieldset
- = hidden_field_tag('form_option', @form_option)
%p = label_tag :catalog_id, t('deployables.form.catalog') %span.text_instead_input
ACK, before pushing see the notes inline.
aeolus-devel@lists.fedorahosted.org