Left links were not right, easier to find stuff now.
Signed-off-by: Jason Guiditta jason.guiditta@gmail.com --- src/app/controllers/portal_pool_controller.rb | 6 ++++-- src/app/controllers/provider_controller.rb | 3 ++- src/app/views/layouts/dcloud.rhtml | 7 ++++++- src/app/views/portal_pool/show.html.erb | 10 ++++++++-- src/app/views/provider/_form.html.erb | 13 +++++++++++++ src/app/views/provider/index.html.erb | 2 +- src/app/views/provider/new.html.erb | 14 +------------- src/app/views/provider/show.html.erb | 10 ++++++++-- 8 files changed, 43 insertions(+), 22 deletions(-) create mode 100644 src/app/views/provider/_form.html.erb
diff --git a/src/app/controllers/portal_pool_controller.rb b/src/app/controllers/portal_pool_controller.rb index 506885b..7c8d587 100644 --- a/src/app/controllers/portal_pool_controller.rb +++ b/src/app/controllers/portal_pool_controller.rb @@ -1,9 +1,11 @@ class PortalPoolController < ApplicationController def index - @pools = Provider.find(params[:id]).portal_pools + render :action => 'new' end
def show + @instances = Instance.find(:all, :conditions => {:portal_pool_id => params[:id]}) + @pool = params[:id] end
def new @@ -19,7 +21,7 @@ class PortalPoolController < ApplicationController @portal_pool = @account.portal_pools.build(params[:portal_pool]) if @portal_pool.save flash[:notice] = "Pool added." - redirect_to :action => 'index', :id => @account.provider_id + redirect_to :action => 'show', :id => @portal_pool.id else render :action => 'new' end diff --git a/src/app/controllers/provider_controller.rb b/src/app/controllers/provider_controller.rb index 31e6c2b..90d5a2d 100644 --- a/src/app/controllers/provider_controller.rb +++ b/src/app/controllers/provider_controller.rb @@ -1,9 +1,10 @@ class ProviderController < ApplicationController def index - @provider = Provider.find(params[:id]) + render :action => 'new' end
def show + @provider = Provider.find(:first, :conditions => {:id => params[:id]}) end
def new diff --git a/src/app/views/layouts/dcloud.rhtml b/src/app/views/layouts/dcloud.rhtml index 57cff85..4c2f103 100644 --- a/src/app/views/layouts/dcloud.rhtml +++ b/src/app/views/layouts/dcloud.rhtml @@ -71,7 +71,12 @@ <%#= render :partial => '/layouts/tree' %> <ul id="providers"> <% @providers.each { |provider| %> - <li><%= link_to provider.name, {:controller => "provider", :action => "index"}, :id => provider, :class => "providername"%> + <li><%= link_to provider.name, {:controller => "provider", :action => "show", :id => provider}, :class => "providername"%> + <% provider.portal_pools.each { |pool| %> + <ul id="portal_pool-<%=provider.id%>"> + <li><%= link_to pool.name, {:controller => "portal_pool", :action => "show", :id => pool}, :class => "poolname" %></li> + </ul> + <% } %> </li> <% } %> </ul> diff --git a/src/app/views/portal_pool/show.html.erb b/src/app/views/portal_pool/show.html.erb index f1c634a..cd19999 100644 --- a/src/app/views/portal_pool/show.html.erb +++ b/src/app/views/portal_pool/show.html.erb @@ -1,2 +1,8 @@ -<h1>ProviderController#show</h1> -<p>Find me in app/views/provider_controller/show.html.erb</p> +<% if @instances.size == 0 %> +<h1>There are no pools to display</h1> +<% else %> + <%@instances.each {|instance| %> + <%= instance.name %><br/> + <% } %> +<% end %> +<%= link_to "Add a pool", :controller => "instance", :action => "new", :pool => @pool%> diff --git a/src/app/views/provider/_form.html.erb b/src/app/views/provider/_form.html.erb new file mode 100644 index 0000000..7c00a4c --- /dev/null +++ b/src/app/views/provider/_form.html.erb @@ -0,0 +1,13 @@ +<div class="dcloud_form"> + <%= error_messages_for 'provider' %> + + <h2>Add a cloud provider</h2><br /> + <% form_for :provider do |f| %> + <ul> + <li><label>Name<span>Provide a descriptive name for this provider connection.</span></label><%= f.text_field :name, :class => "txtfield" %></li> + <li><label>Type<span>Choose the type of provider connection.</span></label><%= select :provider, :cloud_type, [["Mock","Mock"],["EC2", "EC2"],["RHEV-M", "RHEV-M"]], :class => "txtfield" %></li> + <li><label>URL<span>Enter the URL of the cloud provider.</span></label><%= f.text_field :url, :class => "txtfield" %></li> + </ul> + <%= submit_tag "Save", :class => "submit" %> + <% end %> +</div> \ No newline at end of file diff --git a/src/app/views/provider/index.html.erb b/src/app/views/provider/index.html.erb index ed4ddfc..786950e 100644 --- a/src/app/views/provider/index.html.erb +++ b/src/app/views/provider/index.html.erb @@ -1 +1 @@ -This will likely just have the 'New Provider' form for now. +<%= render :partial => 'form' %> diff --git a/src/app/views/provider/new.html.erb b/src/app/views/provider/new.html.erb index 7c00a4c..8353b17 100644 --- a/src/app/views/provider/new.html.erb +++ b/src/app/views/provider/new.html.erb @@ -1,13 +1 @@ -<div class="dcloud_form"> - <%= error_messages_for 'provider' %> - - <h2>Add a cloud provider</h2><br /> - <% form_for :provider do |f| %> - <ul> - <li><label>Name<span>Provide a descriptive name for this provider connection.</span></label><%= f.text_field :name, :class => "txtfield" %></li> - <li><label>Type<span>Choose the type of provider connection.</span></label><%= select :provider, :cloud_type, [["Mock","Mock"],["EC2", "EC2"],["RHEV-M", "RHEV-M"]], :class => "txtfield" %></li> - <li><label>URL<span>Enter the URL of the cloud provider.</span></label><%= f.text_field :url, :class => "txtfield" %></li> - </ul> - <%= submit_tag "Save", :class => "submit" %> - <% end %> -</div> \ No newline at end of file +<%= render :partial => 'form' %> \ No newline at end of file diff --git a/src/app/views/provider/show.html.erb b/src/app/views/provider/show.html.erb index f1c634a..8bc0334 100644 --- a/src/app/views/provider/show.html.erb +++ b/src/app/views/provider/show.html.erb @@ -1,2 +1,8 @@ -<h1>ProviderController#show</h1> -<p>Find me in app/views/provider_controller/show.html.erb</p> +<% if @provider.portal_pools.size == 0 %> +<h1>There are no pools to display</h1> +<% else %> + <%@provider.portal_pools.each {|pool| %> + <%= pool.name %><br/> + <% } %> +<% end %> +<%= link_to "Add a pool", :controller => "portal_pool", :action => "new", :provider => @provider%> \ No newline at end of file
deltacloud-devel@lists.fedorahosted.org