- Some cut and paste from users' controller
- removed subnav items, added tab highlighting for actions
- added a checkbox for each pool item
- added sidebar actions + javascript sensitivity
- made links go to edit pool page
---
src/app/controllers/pools_controller.rb | 16 ++++++++++++++++
src/app/views/pools/index.haml | 18 ++++++++++++++++--
src/config/navigation.rb | 6 +-----
3 files changed, 33 insertions(+), 7 deletions(-)
diff --git a/src/app/controllers/pools_controller.rb
b/src/app/controllers/pools_controller.rb
index 244be79..1fdc047 100644
--- a/src/app/controllers/pools_controller.rb
+++ b/src/app/controllers/pools_controller.rb
@@ -109,6 +109,22 @@ class PoolsController < ApplicationController
redirect_to :action => 'show', :id => @pool.id
end
+ def manage_pool
+ type = params[:commit]
+ pool_id = params[:pool_checkbox]
+ if type && Pool.exists?(pool_id)
+ if type == "edit"
+ redirect_to :action => 'edit', :id => pool_id
+ elsif type == "delete"
+ params[:id] = pool_id
+ destroy
+ end
+ else
+ flash[:notice] = "Error performing this operation"
+ redirect_to pool_path
+ end
+ end
+
def delete
end
diff --git a/src/app/views/pools/index.haml b/src/app/views/pools/index.haml
index b4001d3..bd2ee69 100644
--- a/src/app/views/pools/index.haml
+++ b/src/app/views/pools/index.haml
@@ -1,10 +1,17 @@
+= form_tag :action => 'manage_pool'
#pools_nav.grid_3.actionsidebar
%dl
%dt
Pools
+ %dd.edit
+ %span
+ = submit_tag "edit", :class => "submit linkbutton"
+ %dd.delete
+ %span
+ = submit_tag "delete", :class => "submit linkbutton"
%dd.add
%span
- =link_to 'New Pool', :action => :new, :class => "button"
+ =link_to 'new pool', :action => :new, :class => "button"
#details{:class => 'grid_13'}
%table
@@ -12,7 +19,9 @@
- @pools.each do |pool|
%tr
%td
- =link_to pool.name, pool_url(pool.id)
+ - is_first_pool = (pool == @pools.first)
+ %input{:checked => is_first_pool, :name => "pool_checkbox", :type =>
"checkbox", :value => pool.id, :id => "pool_checkbox_#{pool.id}" }
+ =link_to pool.name, {:action => 'edit', :id => pool.id}
%td
=((pool.quota.maximum_running_instances ||
0)/100)*pool.quota.total_instances
='%'
@@ -20,3 +29,8 @@
=pool.quota.total_instances
%td
=pool.zone.name
+
+:javascript
+ $(document).ready(function () {
+ $("input[type='checkbox']").buttonSensitivity();
+ });
diff --git a/src/config/navigation.rb b/src/config/navigation.rb
index c6d3014..1bba86e 100644
--- a/src/config/navigation.rb
+++ b/src/config/navigation.rb
@@ -15,7 +15,6 @@ SimpleNavigation::Configuration.run do |navigation|
fourth_level.item :map_profiles, t(:map_profiles), '#'
fourth_level.item :map_locales, t(:map_locales), '#'
end
- #third_level.item :self_service_settings, t(:self_service_settings),
:controller => 'settings', :action => 'self_service'
third_level.item :define_services, t(:define_services), '#'
third_level.item :define_services, t(:define_profiles), '#'
third_level.item :define_services, t(:define_locales), '#'
@@ -26,10 +25,7 @@ SimpleNavigation::Configuration.run do |navigation|
third_level.item :define_services, t(:permissions), '#'
third_level.item :general_settings, t(:general_settings), '#'
end
- second_level.item :pools_and_zones, t(:pools_and_zones), :controller =>
'pools' do |third_level|
- third_level.item :new_pool, t(:new_pool), :controller => 'pools',
:action => 'new'
- third_level.item :edit_pool, t(:edit_pool), :controller => 'pools',
:action => 'edit'
- end
+ second_level.item :pools_and_zones, t(:pools_and_zones), {:controller =>
'pools'}, :highlights_on => /\/pools/
second_level.item :audit_report, t(:audit_report), '#', :class =>
'disabled'
second_level.item :assistance_requests, t(:assistance_requests), '#',
:class => 'disabled'
end
--
1.7.2.3
_______________________________________________
deltacloud-devel mailing list
[email protected]
https://fedorahosted.org/mailman/listinfo/deltacloud-devel