From: Tomas Sedovic <[email protected]>
https://bugzilla.redhat.com/show_bug.cgi?id=645390
This replaces the checkboxes to radiobuttons in the list of Users, Pools,
Instances and Deployables.
---
src/app/controllers/templates_controller.rb | 21 +++++++++++++++++----
src/app/views/instance/index.haml | 2 +-
src/app/views/pools/index.haml | 6 ++++--
src/app/views/templates/_templates.haml | 2 +-
src/app/views/users/index.haml | 4 ++--
5 files changed, 25 insertions(+), 10 deletions(-)
diff --git a/src/app/controllers/templates_controller.rb
b/src/app/controllers/templates_controller.rb
index 4fe34bb..9b696e5 100644
--- a/src/app/controllers/templates_controller.rb
+++ b/src/app/controllers/templates_controller.rb
@@ -30,9 +30,19 @@ class TemplatesController < ApplicationController
elsif params[:delete]
redirect_to :action => 'delete', :ids => params[:ids].to_a
elsif params[:edit]
- redirect_to :action => 'new', :id => get_selected_id
+ begin
+ redirect_to :action => 'new', :id => get_selected_id
+ rescue
+ flash[:notice] = "No template selected"
+ redirect_to :action => 'index'
+ end
elsif params[:build]
- redirect_to :action => 'build_form', 'template_id' => get_selected_id
+ begin
+ redirect_to :action => 'build_form', 'template_id' => get_selected_id
+ rescue
+ flash[:notice] = "No template selected"
+ redirect_to :action => 'index'
+ end
else
raise "Unknown action"
end
@@ -218,8 +228,11 @@ add account on <a href=\"#{url_for :controller =>
'provider', \
def delete
ids = params[:ids].to_a
- raise "No Template Selected" if ids.empty?
- Template.destroy(ids)
+ if ids.empty?
+ flash[:notice] = "No Template Selected"
+ else
+ Template.destroy(ids)
+ end
redirect_to :action => 'index'
end
diff --git a/src/app/views/instance/index.haml
b/src/app/views/instance/index.haml
index 258f512..8024a2f 100644
--- a/src/app/views/instance/index.haml
+++ b/src/app/views/instance/index.haml
@@ -117,7 +117,7 @@
- else
- instances.each do |inst|
%tr
- %td= check_box_tag 'id[]', inst.id
+ %td= radio_button_tag 'id[]', inst.id
%td= inst.state
%td= inst.name
%td= inst.hardware_profile.name
diff --git a/src/app/views/pools/index.haml b/src/app/views/pools/index.haml
index 81a6b5f..61cec18 100644
--- a/src/app/views/pools/index.haml
+++ b/src/app/views/pools/index.haml
@@ -26,7 +26,7 @@
%tr
%td
- is_first_pool = (pool == @pools.first)
- %input{:checked => is_first_pool, :name => "pool_checkbox", :type =>
"checkbox", :value => pool.id, :id => "pool_checkbox_#{pool.id}" }
+ %input{:checked => is_first_pool, :name => "pool_checkbox", :type =>
"radio", :value => pool.id, :id => "pool_checkbox_#{pool.id}" }
= pool.name
%td
=((pool.quota.maximum_running_instances ||
0)/100)*pool.quota.total_instances
@@ -38,5 +38,7 @@
:javascript
$(document).ready(function () {
- $("input[type='checkbox']").buttonSensitivity().change();
+ /* NOTE: once we support bulk actions on multiple pools selected at once,
+ uncomment this line:
+ $("input[type='checkbox']").buttonSensitivity().change(); */
});
diff --git a/src/app/views/templates/_templates.haml
b/src/app/views/templates/_templates.haml
index d885efe..54dc222 100644
--- a/src/app/views/templates/_templates.haml
+++ b/src/app/views/templates/_templates.haml
@@ -16,7 +16,7 @@
- else
- @templates.each do |tpl|
%tr
- %td= check_box_tag 'ids[]', tpl.id
+ %td= radio_button_tag 'ids[]', tpl.id
%td
= image_tag "blnk.png", :alt => tpl.platform, :class => "icon
platform #{tpl.platform}"
= tpl.name
diff --git a/src/app/views/users/index.haml b/src/app/views/users/index.haml
index 3643ba4..111375f 100644
--- a/src/app/views/users/index.haml
+++ b/src/app/views/users/index.haml
@@ -29,7 +29,7 @@
[email protected] do |user|
%tr
%td
- %input{:name => "user_checkbox", :type => "checkbox", :value =>
user.id, :id => "user_checkbox_#{user.id}" }
+ %input{:name => "user_checkbox", :type => "radio", :value =>
user.id, :id => "user_checkbox_#{user.id}" }
%td= link_to user.login, {:action => "edit", :id => user.id}
%td= user.last_name
%td= user.first_name
@@ -39,5 +39,5 @@
:javascript
$(document).ready(function () {
- $("input[type='checkbox']").buttonSensitivity().change();
+ //$("input[type='checkbox']").buttonSensitivity().change();
});
--
1.7.2.3
_______________________________________________
deltacloud-devel mailing list
[email protected]
https://fedorahosted.org/mailman/listinfo/deltacloud-devel