On 03/18/2010 04:59 PM, Mohammed Morsi wrote:
> ---
>   src/app/controllers/portal_pool_controller.rb      |    5 ++++
>   src/app/views/portal_pool/accounts.html.erb        |   23 
> ++++++++++++++++++++
>   .../controllers/portal_pool_controller_spec.rb     |    8 +++++++
>   3 files changed, 36 insertions(+), 0 deletions(-)
>   create mode 100644 src/app/views/portal_pool/accounts.html.erb
>
> diff --git a/src/app/controllers/portal_pool_controller.rb 
> b/src/app/controllers/portal_pool_controller.rb
> index 5e42d55..1897fc9 100644
> --- a/src/app/controllers/portal_pool_controller.rb
> +++ b/src/app/controllers/portal_pool_controller.rb
> @@ -44,6 +44,11 @@ class PortalPoolController<  ApplicationController
>       require_privilege(Privilege::POOL_VIEW, @pool)
>     end
>
> +  def accounts
> +    @pool = PortalPool.find(params[:id])
> +    require_privilege(Privilege::ACCOUNT_VIEW,@pool)
> +  end
> +
>     def new
>       require_privilege(Privilege::POOL_MODIFY)
>       @portal_pool = PortalPool.new
> diff --git a/src/app/views/portal_pool/accounts.html.erb 
> b/src/app/views/portal_pool/accounts.html.erb
> new file mode 100644
> index 0000000..81a8a76
> --- /dev/null
> +++ b/src/app/views/portal_pool/accounts.html.erb
> @@ -0,0 +1,23 @@
> +<% if @pool.cloud_accounts.size == 0 %>
> +<h1>There are no accounts to display</h1>
> +<% else %>
> +<table>
> +<thead>
> +<tr>
> +<th scope="col">Provider</th>
> +<th scope="col">Username</th>
> +</tr>
> +</thead>
> +<tbody>
> +<%[email protected]_accounts.each {|account| %>
> +<tr>
> +<td><%= account.provider.name %></td>
> +<td><%= account.username %></td>
> +</tr>
> +<% } %>
> +</tbody>
> +</table>
> +<% end %>
> +<%= link_to "View/Add Existing Cloud Accounts", {:controller =>  
> "cloud_accounts",:action =>  "accounts_for_pool", :pool_id =>  @pool}, 
> :class=>"actionlink" %>
> +<%= link_to "Add a New Cloud Account", {:controller =>  
> "cloud_accounts",:action =>  "new_from_pool", :pool_id =>  @pool}, 
> :class=>"actionlink" %><br/>
> +
> diff --git a/src/spec/controllers/portal_pool_controller_spec.rb 
> b/src/spec/controllers/portal_pool_controller_spec.rb
> index 512127d..802017f 100644
> --- a/src/spec/controllers/portal_pool_controller_spec.rb
> +++ b/src/spec/controllers/portal_pool_controller_spec.rb
> @@ -39,5 +39,13 @@ describe PortalPoolController do
>        response.should render_template("hardware_profiles")
>     end
>
> +  it "should get cloud accounts" do
> +     @pool  = Factory :tpool
> +     UserSession.create(@admin)
> +     get :accounts, :id =>  @pool.id
> +     response.should be_success
> +     response.should render_template("accounts")
> +     @pool.should_not == nil
> +  end
>
>   end
>    
Please ignore this one, it is missing the link on the pool show page to 
the pool accounts page.

    -Mo
_______________________________________________
deltacloud-devel mailing list
[email protected]
https://fedorahosted.org/mailman/listinfo/deltacloud-devel

Reply via email to