--- src/app/controllers/portal_pool_controller.rb | 14 ++++++++++++++ src/app/views/portal_pool/edit.html.erb | 16 ++++++++++++++++ 2 files changed, 30 insertions(+), 0 deletions(-) create mode 100644 src/app/views/portal_pool/edit.html.erb
diff --git a/src/app/controllers/portal_pool_controller.rb b/src/app/controllers/portal_pool_controller.rb index 5e5ec5e..b1b3d33 100644 --- a/src/app/controllers/portal_pool_controller.rb +++ b/src/app/controllers/portal_pool_controller.rb @@ -76,6 +76,20 @@ class PortalPoolController < ApplicationController end end
+ def edit + @portal_pool = PortalPool.find params[:id] + end + + def update + @portal_pool = PortalPool.find params[:pool_id] + @name = params[:portal_pool][:name] + unless @portal_pool.nil? || @name.nil? + @portal_pool.name = @name + @portal_pool.save! + end + redirect_to :action => 'show', :id => @portal_pool.id + end + def delete end end diff --git a/src/app/views/portal_pool/edit.html.erb b/src/app/views/portal_pool/edit.html.erb new file mode 100644 index 0000000..4701626 --- /dev/null +++ b/src/app/views/portal_pool/edit.html.erb @@ -0,0 +1,16 @@ +<div class="dcloud_form"> + <%= error_messages_for 'portal_pool' %> + + <h2>Edit Pool</h2> + + <% form_tag :action => 'update' do -%> + <fieldset> + <input type="hidden" name="pool_id" value="<%= @portal_pool.id %>" /> + <legend>Pool</legend> + <ul> + <li><label>Name<span>Provide a descriptive name for this pool.</span></label><%= text_field :portal_pool, :name, :value => @portal_pool.name %></li> + </ul> + </fieldset> + <%= submit_tag "Save", :class => "submit" %> + <% end %> +</div>
On Wed, Mar 3, 2010 at 3:08 PM, Mohammed Morsi mmorsi@redhat.com wrote:
src/app/controllers/portal_pool_controller.rb | 14 ++++++++++++++ src/app/views/portal_pool/edit.html.erb | 16 ++++++++++++++++ 2 files changed, 30 insertions(+), 0 deletions(-) create mode 100644 src/app/views/portal_pool/edit.html.erb
diff --git a/src/app/controllers/portal_pool_controller.rb b/src/app/controllers/portal_pool_controller.rb index 5e5ec5e..b1b3d33 100644 --- a/src/app/controllers/portal_pool_controller.rb +++ b/src/app/controllers/portal_pool_controller.rb @@ -76,6 +76,20 @@ class PortalPoolController < ApplicationController end end
- def edit
@portal_pool = PortalPool.find params[:id]
- end
- def update
@portal_pool = PortalPool.find params[:pool_id]
@name = params[:portal_pool][:name]
unless @portal_pool.nil? || @name.nil?
@portal_pool.name = @name
@portal_pool.save!
end
redirect_to :action => 'show', :id => @portal_pool.id
- end
Recommend doing update method more like the one we have in user_controller. Also, please add tests to this patch, you can do either cucumber scenarios or rspec controller tests, whichever you prefer (there is some overlap in their ability to test controllers and views).
def delete end end diff --git a/src/app/views/portal_pool/edit.html.erb b/src/app/views/portal_pool/edit.html.erb new file mode 100644 index 0000000..4701626 --- /dev/null +++ b/src/app/views/portal_pool/edit.html.erb @@ -0,0 +1,16 @@ +<div class="dcloud_form">
- <%= error_messages_for 'portal_pool' %>
<h2>Edit Pool</h2>
- <% form_tag :action => 'update' do -%>
<fieldset>
<input type="hidden" name="pool_id" value="<%= @portal_pool.id %>" />
<legend>Pool</legend>
<ul>
<li><label>Name<span>Provide a descriptive name for this
pool.</span></label><%= text_field :portal_pool, :name, :value => @ portal_pool.name %></li>
</ul>
</fieldset>
- <%= submit_tag "Save", :class => "submit" %>
- <% end %>
+</div>
Again for this one, please use user_controller as a baseline. This form should be the same as whatever 'new' is. Few specific things: * Account stuff will be removed from this form and put in it's own very soon, so you might as well leave it for now, that way we dont have an extra copy of the form. * Actual for should be extracted from new and put in _form, wrapped from edit and new * Please use rails helpers rather than standard html tags (new is guilty of this too) * Please add perm checks, scott has put infrastructure in place and can guide you with details afa the planned pattern to call them, but I think you'll need pool_edit and account_edit on the form.
1.6.2.5
deltacloud-devel mailing list deltacloud-devel@lists.fedorahosted.org https://fedorahosted.org/mailman/listinfo/deltacloud-devel
deltacloud-devel@lists.fedorahosted.org