Mohammed Morsi wrote: > new ui / backend, cleaned up, and included tests > --- > src/app/controllers/portal_pool_controller.rb | 4 +++ > src/app/views/portal_pool/accounts.html.erb | 21 > ++++++++++++++++++++ > .../controllers/portal_pool_controller_spec.rb | 9 ++++++++ > 3 files changed, 34 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 d17eaac..584028c 100644 > --- a/src/app/controllers/portal_pool_controller.rb > +++ b/src/app/controllers/portal_pool_controller.rb > @@ -33,6 +33,10 @@ class PortalPoolController < ApplicationController > @instances = @pool.instances > end > > + def accounts > + @pool = PortalPool.find(params[:id]) > + end > + > You need to add the appropriate permissions check here. It should be the same check as we have in the 'show' action (i.e. checking for pool_view)
Scott > 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..b6042d6 > --- /dev/null > +++ b/src/app/views/portal_pool/accounts.html.erb > @@ -0,0 +1,21 @@ > +<% 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 "Add an account", {:controller => "portal_pool", :action => > "new_account", :pool => @pool.id}, :class => "actionlink" %> > diff --git a/src/spec/controllers/portal_pool_controller_spec.rb > b/src/spec/controllers/portal_pool_controller_spec.rb > index d409c3a..34b8eb3 100644 > --- a/src/spec/controllers/portal_pool_controller_spec.rb > +++ b/src/spec/controllers/portal_pool_controller_spec.rb > @@ -30,5 +30,14 @@ describe PortalPoolController do > response.should redirect_to('http://test.host/portal_pool/show/1') > 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 > _______________________________________________ deltacloud-devel mailing list [email protected] https://fedorahosted.org/mailman/listinfo/deltacloud-devel
