selection model (rev. 1)
by Jan Provazník
Hi,
sending updated version of selection model.
TODO:
- styling (multicolumns, loadmasks)
- (maybe?) grouping packages by groups (as in previous model)
- pagination
- type-ahead search enhancement of previous suggestion (quite difficult)
Jan
13 years, 8 months
[PATCH] Use 'text' field for error messages.
by Ian Main
Turns out some error messages are longer than the 255 chars in the
'string' type, so switch last_error in instances to be a 'text' field.
This fixes a bug we were seeing where long error messages weren't
getting into the db.
Signed-off-by: Ian Main <imain(a)redhat.com>
---
.../migrate/20101021172441_use_text_for_errors.rb | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
create mode 100644 src/db/migrate/20101021172441_use_text_for_errors.rb
diff --git a/src/db/migrate/20101021172441_use_text_for_errors.rb b/src/db/migrate/20101021172441_use_text_for_errors.rb
new file mode 100644
index 0000000..c09ec38
--- /dev/null
+++ b/src/db/migrate/20101021172441_use_text_for_errors.rb
@@ -0,0 +1,9 @@
+class UseTextForErrors < ActiveRecord::Migration
+ def self.up
+ change_column :instances, :last_error, :text
+ end
+
+ def self.down
+ change_column :instances, :last_error, :string
+ end
+end
--
1.7.2.3
13 years, 8 months
[PATCH aggregator] BZ 643121/642535 fixes to add/edit user form
by Mo Morsi
This patch merges Jakub's and Tomas's patches for #642535 to
un-modalize the user form as well as my patch for #643121
to display errors on it.
Also added one line to the users controller so as to allow
admins to set user quotas when creating and editing users
(this field is only able to be set if the current user
has the user_modify priv)
---
src/app/controllers/users_controller.rb | 15 ++++--
src/app/stylesheets/aggregator.scss | 3 +-
src/app/views/users/_form.haml | 83 +++++++++++++++++--------------
src/app/views/users/edit.haml | 19 +------
src/app/views/users/new.haml | 14 ++---
5 files changed, 68 insertions(+), 66 deletions(-)
diff --git a/src/app/controllers/users_controller.rb b/src/app/controllers/users_controller.rb
index 9bd037c..7dd5e1d 100644
--- a/src/app/controllers/users_controller.rb
+++ b/src/app/controllers/users_controller.rb
@@ -25,12 +25,18 @@ class UsersController < ApplicationController
def new
@user = User.new
+ @user.quota = Quota.new
end
def create
require_privilege(Privilege::USER_MODIFY) unless current_user.nil?
@user = User.new(params[:user])
+ if params[:commit] == "Reset"
+ redirect_to :action => :new
+ return
+ end
+
@registration = RegistrationService.new(@user)
if @registration.save
if @current_user
@@ -56,6 +62,7 @@ class UsersController < ApplicationController
def edit
@user = params[:id] ? User.find(params[:id]) : @current_user
+
if @user
if @user != @current_user
if !BasePermissionObject.general_permission_scope.can_modify_users(@current_user)
@@ -67,8 +74,8 @@ class UsersController < ApplicationController
end
def update
- if params[:make_changes] || params[:save]
- @user = params[:user][:id] ? User.find(params[:user][:id]) : @current_user
+ @user = params[:user][:id] ? User.find(params[:user][:id]) : @current_user
+ if params[:commit] == "Save"
if @user
if @user != @current_user
if !BasePermissionObject.general_permission_scope.can_modify_users(@current_user)
@@ -83,8 +90,8 @@ class UsersController < ApplicationController
render :action => :edit
end
end
- elsif params[:reset]
- redirect_to :action => "edit", :user => @user
+ elsif params[:commit] == "Reset"
+ redirect_to :action => "edit", :id => @user.id
end
end
diff --git a/src/app/stylesheets/aggregator.scss b/src/app/stylesheets/aggregator.scss
index 76021c2..1b43b88 100644
--- a/src/app/stylesheets/aggregator.scss
+++ b/src/app/stylesheets/aggregator.scss
@@ -121,6 +121,7 @@ input[type='submit'],button,.button {
display: inline-block;
margin-left: 3px;
margin: 40px 4px 4px;
+ float: left;
}
&.actionlink {
margin: 40px 0 0;
@@ -861,7 +862,7 @@ fieldset.gap {
padding: 4px 10px 0 0;
max-width: 10em;
}
- input {
+ input[type='text'], input[type='password'], textarea {
display: inline-block;
width: 20em;
}
diff --git a/src/app/views/users/_form.haml b/src/app/views/users/_form.haml
index 1e5dc59..8d87a2f 100644
--- a/src/app/views/users/_form.haml
+++ b/src/app/views/users/_form.haml
@@ -1,38 +1,47 @@
-%fieldset.clear
- = form.label :login, t(:choose_name), :class => "grid_3 alpha"
- = form.text_field :login, :class => "grid_5"
-%fieldset.clear
- = form.label :password, form.object.new_record? ? t(:choose_password) : t(:change_password), :class => "grid_3 alpha"
- = form.password_field :password, :class => "grid_5"
-%fieldset
- = form.label :password_confirmation, t(:confirm_password), :class => "grid_3 alpha"
- = form.password_field :password_confirmation, :class => "grid_5"
--if has_user_modify?
- %fieldset.clear
- = form.label :user_status, "User Status:", :class => "alpha grid_3"
- .grid_5
- = radio_button_tag "user_status","Active",true
- = label_tag "user_status_active", "Active"
- = radio_button_tag "user_status","Inactive", false, :disabled => true
- = label_tag "user_status_inactive", "Inactive"
-%fieldset.clear
- = form.label :first_name, t(:first_name), :class => "alpha grid_3"
- = form.text_field :first_name, :class => "grid_5"
-%fieldset.clear
- = form.label :last_name, t(:last_name), :class => "alpha grid_3"
- = form.text_field :last_name, :class => "grid_5"
-%fieldset.clear
- = form.label :email, t(:email), :class => "alpha grid_3"
- = form.text_field :email, :class => "grid_5"
--if has_user_modify?
- %h3.grid_16 User Treatment
- = label_tag 'apply_treatment', t(:apply_treatment), :class => "alpha grid_3"
- = select_tag 'user_treatment', options_for_select([t(:choose_treatment)]), :class => "grid_5"
- = submit_tag t(:apply), :disabled => true
-
- - form.fields_for :quota do |quota_form|
+.dcloud_form
+ - form_for @user, :url => account_path do |form|
+ = hidden_field :user, :id, :value => @user.id
+ = form.error_messages
+ %fieldset.clear
+ = form.label :login, t(:choose_name), :class => "grid_3 alpha"
+ = form.text_field :login, :class => "grid_5"
+ %fieldset.clear
+ = form.label :password, form.object.new_record? ? t(:choose_password) : t(:change_password), :class => "grid_3 alpha"
+ = form.password_field :password, :class => "grid_5"
+ %fieldset
+ = form.label :password_confirmation, t(:confirm_password), :class => "grid_3 alpha"
+ = form.password_field :password_confirmation, :class => "grid_5"
+ -if has_user_modify?
+ %fieldset.clear
+ = form.label :user_status, "User Status:", :class => "alpha grid_3"
+ .grid_5
+ = radio_button_tag "user_status","Active",true
+ = label_tag "user_status_active", "Active"
+ = radio_button_tag "user_status","Inactive", false, :disabled => true
+ = label_tag "user_status_inactive", "Inactive"
%fieldset.clear
- = quota_form.label :maximum_running_instances, t(:maximum_running_instances), :class => "alpha grid_3"
- = quota_form.text_field :maximum_running_instances, :class => "grid_5"
- (instances)
- = quota_form.error_message_on :maximum_running_instances, 'Maximum Running Instances '
\ No newline at end of file
+ = form.label :first_name, t(:first_name), :class => "alpha grid_3"
+ = form.text_field :first_name, :class => "grid_5"
+ %fieldset.clear
+ = form.label :last_name, t(:last_name), :class => "alpha grid_3"
+ = form.text_field :last_name, :class => "grid_5"
+ %fieldset.clear
+ = form.label :email, t(:email), :class => "alpha grid_3"
+ = form.text_field :email, :class => "grid_5"
+ -if has_user_modify?
+ %h3.grid_16 User Treatment
+ %fieldset.clearfix
+ = label_tag 'apply_treatment', t(:apply_treatment), :class => "alpha grid_3"
+ = select_tag 'user_treatment', options_for_select([t(:choose_treatment)]), :class => "grid_5"
+ = submit_tag t(:apply), :disabled => true, :class => "grid_2"
+
+ - form.fields_for :quota do |quota_form|
+ %fieldset.clear
+ = quota_form.label :maximum_running_instances, t(:maximum_running_instances), :class => "alpha grid_3"
+ = quota_form.text_field :maximum_running_instances, :class => "grid_5"
+ (instances)
+ = quota_form.error_message_on :maximum_running_instances, 'Maximum Running Instances '
+ %fieldset.clearfix
+ = form.submit "Save", :class => "submit formbutton"
+ = form.submit "Reset", :class => "submit formbutton"
+ = link_to t(:cancel), cancel_path, :class => 'button formbutton'
diff --git a/src/app/views/users/edit.haml b/src/app/views/users/edit.haml
index 0228ab4..0551bee 100644
--- a/src/app/views/users/edit.haml
+++ b/src/app/views/users/edit.haml
@@ -1,19 +1,6 @@
.formwindow
- if has_user_modify?
- %h2.grid_16
- Editing User:
- = @user.first_name + " " + @user.last_name
- %h3.grid_16 Basic User Information
+ %h2 Editing User: #{(a)user.first_name} #{(a)user.last_name}
- else
- %h2.grid_16 Edit an Account
-- form_for @user, :url => { :action => 'update' } do |f|
- = f.error_messages
- = hidden_field :user, :id, :value => @user.id
- = render :partial => "form", :object => f
- %fieldset.clear
- = link_to "Cancel", users_path, :class => "formbutton button clear"
- - if has_user_modify?
- = f.submit "Reset", :class => "formbutton button", :name => "reset"
- = f.submit "Save", :class => "formbutton button", :name => "save"
- - else
- = f.submit "Make Changes", :class => "formbutton button", :name => "make_changes"
+ %h2 Editing Account
+= render :partial => "form", :object => @user, :locals => { :cancel_path => users_path}
diff --git a/src/app/views/users/new.haml b/src/app/views/users/new.haml
index b6ed86b..792d7c4 100644
--- a/src/app/views/users/new.haml
+++ b/src/app/views/users/new.haml
@@ -1,8 +1,6 @@
-.modalbox
- %h2 New Account
- .dcloud_form
- - form_for @user, :url => account_path do |f|
- = f.error_messages
- = render :partial => "form", :object => f
- = f.submit t(:create_account), :class => "submit dialogbutton"
- = link_to t(:cancel), :class => 'actionlink button dialogbutton'
+%h2 New Account
+-if (current_user)
+ = render :partial => "form", :locals => { :cancel_path => users_path}
+-else
+ .modalbox
+ = render :partial => "form", :locals => { :cancel_path => login_path}
--
1.7.2.3
13 years, 8 months
[PATCH docs 1/1] Updated download/installation instructions.
by Mike Orazi
---
deltacloud.org/content/download.mdown | 70 +++++++++++++++++++++++++++++----
1 files changed, 62 insertions(+), 8 deletions(-)
diff --git a/deltacloud.org/content/download.mdown b/deltacloud.org/content/download.mdown
index 26db1c3..9f07dc0 100644
--- a/deltacloud.org/content/download.mdown
+++ b/deltacloud.org/content/download.mdown
@@ -10,23 +10,77 @@ Download
Deltacloud Core provides the API server and drivers necessary for connecting
to the cloud providers.
-Presently, it is packaged as a Ruby gem. You can install it by typing the
-following command:
-
- $ sudo gem install deltacloud-core
-
-We plan to release RPM version for Fedora soon.
+The appropriate version of Deltacloud Core will be retrieved as part of the
+Cloud Engine installation process.
<h3 id="deltacloud-aggregator">Deltacloud Aggregator</h3>
Deltacloud Aggregator provides a web-based user interface for managing your
-cloud instances.
-
-We're working on releasing a downloadable package soon. In the meantime, you
+cloud instances.
+
+ + **NOTE:** The current installation process **deletes** any existing data in your postrgresql database.
+Either ensure that your data is backed up and restorable or consider installing Deltacloud
+Aggregator on a box that does not need postgresql for any other purpose.
+
+ + **NOTE:** The current installation process calls for selinux to be in permissive mode.
+This is not recommended on a mission-critical machine.
+
+#### Installation Steps ####
+
+1. Deltacloud Aggregator requires specific versions of the livecd-tools and python-imgcreate packages.
+Remove any existing version before installing.
+
+ $ sudo yum remove livecd-tools python-imgcreate
+
+1. In order to integrate with the Amazon Elastic Compute Cloud (EC2), Deltacloud Aggregator uses ec2-ami-tools.
+This package is freely available, but can not be bundled with Deltacloud Aggregator
+due to licensing concerns. Before installing the Deltacloud Aggregator, install ec2-ami-tools.
+
+ $ sudo yum localinstall http://s3.amazonaws.com/ec2-downloads/ec2-ami-tools.noarch.rpm --nogpg
+
+
+1. Set up the deltacloud repository.
+ $ sudo wget -O /etc/yum.repos.d/fedora-deltacloud.repo \
+ http://repos.fedorapeople.org/repos/deltacloud/appliance/fedora-appliance...
+
+1. Now install the configuration tool:
+ $ sudo yum install policycoreutils-python deltacloud-configure
+
+#### Deltacloud Aggregator Configuration ####
+
+1. Open port 80 on the firewall so that web traffic may be served.
+
+1. Set SELinux to permissive mode.
+ sudo setenforce 0
+
+1. Ensure that the time is set correctly. Failure to do so cause connectivity issues
+with Amazon Elastic Cloud Compute (EC2)
+
+1. Clean up any existing remanents from an older installation.
+**Note**: this will destroy any existing data in the postgres database.
+ sudo /usr/sbin/deltacloud-cleanup
+
+1. Configure Deltacloud Aggregator.
+ sudo /usr/sbin/deltacloud-configure
+
+#### Verify Installation ####
+
+1. Browse to: http://<machine_name>/deltacloud
+A default administrative account has been created with a username "admin"
+and a password "password" (no quotes)
+
+1. Browse to: http://localhost:3002/api
+Ensure that a page is visible. This URL should be used as the
+"Provider URL" in the "Manage Providers" screen within the Deltacloud Aggregator application.
+
+### Become a contributor ###
+If you would like to examine the source code or contribute to the project, you
can get the source code on our [Contribute page][Contribute].
[Contribute]: ./contribute.html
+
+
Additional Tools
----------------
These are complementary to the essential Core/Aggregator components.
--
1.7.2.3
13 years, 8 months
rebased pending patches
by Jan Provazník
Hi,
since there have been many changes in the templates stuff last week, most of
my pending patches are not applicable on current next branch. So sending them
again in one big patchset which should be applicable on current next branch (at
least next few hours ;) ). Note that there are 2 patches which are not in
bugzilla, these patches are independent and it's not necessary to apply them now.
Jan
13 years, 8 months
[PATCH aggregator] small fix to users/update, on success redirect to dashboard if user doesn't have user_modify
by Mo Morsi
---
src/app/controllers/users_controller.rb | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/app/controllers/users_controller.rb b/src/app/controllers/users_controller.rb
index 7dd5e1d..7047517 100644
--- a/src/app/controllers/users_controller.rb
+++ b/src/app/controllers/users_controller.rb
@@ -77,15 +77,20 @@ class UsersController < ApplicationController
@user = params[:user][:id] ? User.find(params[:user][:id]) : @current_user
if params[:commit] == "Save"
if @user
+ has_users_modify= BasePermissionObject.general_permission_scope.can_modify_users(@current_user)
if @user != @current_user
- if !BasePermissionObject.general_permission_scope.can_modify_users(@current_user)
+ if !has_users_modify
flash[:notice] = "Invalid Permission to perform this operation"
redirect_to :dashboard
end
end
if @user.update_attributes(params[:user])
flash[:notice] = "User updated!"
- redirect_to users_path
+ if has_users_modify
+ redirect_to users_path
+ else
+ redirect_to :dashboard
+ end
else
render :action => :edit
end
--
1.7.2.3
13 years, 8 months
Re: [deltacloud-devel] [PATCH aggregator] BZ #643121: small tweak to edit user form style
by Jakub Steiner
----- "Mohammed Morsi" <mmorsi(a)redhat.com> wrote:
> The real problem isn't that the form is in a modal box, its that the
> input field size was set too small. Granted I'll admit I should've
> considered other elements on the site affected by this change and
> simply
> added a new style rule which just applies to the large buttons on the
Hi there.
Sorry I wasn't quite clear on that modalbox part. The state of the form before your patch was not the ultimate intended behaviour so your patch didn't really introduce the broken behavior wrt to wrapping in .modalbox. The fact that the fields don't fit in the modal dialog which your patch tried to address by shrinking the width of the input fields is not something that needs addressing though (and it fails for the login dialog thus me not liking it). What I think should have been done is not to use the modalbox when you have the navigation tabs visible already and have the forms inline like all the others. Which is what I tried to suggest in bug https://bugzilla.redhat.com/show_bug.cgi?id=642535
> Lets try to work together to come up with a solution that works for
> everyone, perhaps through the combination of both our patches.
Nod. I'm pretty sure there is a more elegant way to combine the new/edit/logged in/logged out case, but my rails skills are limited so take the attached patch with a grain of salt.
--
Jakub Steiner
http://jimmac.musichall.cz
13 years, 8 months
[PATCH aggregator] BZ 643121/642535 fixes to add/edit user form
by Mo Morsi
This patch merges Jakub's patch for #642535 to
un-modalize the user form as well as my patch for #643121
to display errors on it.
Also added one line to the users controller so as to allow
admins to set user quotas when creating and editing users
(this field is only able to be set if the current user
has the user_modify priv)
---
src/app/controllers/users_controller.rb | 1 +
src/app/stylesheets/aggregator.scss | 3 +-
src/app/views/users/_form.haml | 9 ++++---
src/app/views/users/edit.haml | 32 ++++++++++++++----------------
src/app/views/users/new.haml | 16 ++++++++++++--
5 files changed, 36 insertions(+), 25 deletions(-)
diff --git a/src/app/controllers/users_controller.rb b/src/app/controllers/users_controller.rb
index 9bd037c..9d101fe 100644
--- a/src/app/controllers/users_controller.rb
+++ b/src/app/controllers/users_controller.rb
@@ -25,6 +25,7 @@ class UsersController < ApplicationController
def new
@user = User.new
+ @user.quota = Quota.new
end
def create
diff --git a/src/app/stylesheets/aggregator.scss b/src/app/stylesheets/aggregator.scss
index 76021c2..1b43b88 100644
--- a/src/app/stylesheets/aggregator.scss
+++ b/src/app/stylesheets/aggregator.scss
@@ -121,6 +121,7 @@ input[type='submit'],button,.button {
display: inline-block;
margin-left: 3px;
margin: 40px 4px 4px;
+ float: left;
}
&.actionlink {
margin: 40px 0 0;
@@ -861,7 +862,7 @@ fieldset.gap {
padding: 4px 10px 0 0;
max-width: 10em;
}
- input {
+ input[type='text'], input[type='password'], textarea {
display: inline-block;
width: 20em;
}
diff --git a/src/app/views/users/_form.haml b/src/app/views/users/_form.haml
index 1e5dc59..a34d8c1 100644
--- a/src/app/views/users/_form.haml
+++ b/src/app/views/users/_form.haml
@@ -26,13 +26,14 @@
= form.text_field :email, :class => "grid_5"
-if has_user_modify?
%h3.grid_16 User Treatment
- = label_tag 'apply_treatment', t(:apply_treatment), :class => "alpha grid_3"
- = select_tag 'user_treatment', options_for_select([t(:choose_treatment)]), :class => "grid_5"
- = submit_tag t(:apply), :disabled => true
+ %fieldset.clearfix
+ = label_tag 'apply_treatment', t(:apply_treatment), :class => "alpha grid_3"
+ = select_tag 'user_treatment', options_for_select([t(:choose_treatment)]), :class => "grid_5"
+ = submit_tag t(:apply), :disabled => true, :class => "grid_2"
- form.fields_for :quota do |quota_form|
%fieldset.clear
= quota_form.label :maximum_running_instances, t(:maximum_running_instances), :class => "alpha grid_3"
= quota_form.text_field :maximum_running_instances, :class => "grid_5"
(instances)
- = quota_form.error_message_on :maximum_running_instances, 'Maximum Running Instances '
\ No newline at end of file
+ = quota_form.error_message_on :maximum_running_instances, 'Maximum Running Instances '
diff --git a/src/app/views/users/edit.haml b/src/app/views/users/edit.haml
index 0228ab4..7a81209 100644
--- a/src/app/views/users/edit.haml
+++ b/src/app/views/users/edit.haml
@@ -1,19 +1,17 @@
-.formwindow
- if has_user_modify?
- %h2.grid_16
- Editing User:
- = @user.first_name + " " + @user.last_name
- %h3.grid_16 Basic User Information
+ %h2 Editing User: #{(a)user.first_name} #{(a)user.last_name}
- else
- %h2.grid_16 Edit an Account
-- form_for @user, :url => { :action => 'update' } do |f|
- = f.error_messages
- = hidden_field :user, :id, :value => @user.id
- = render :partial => "form", :object => f
- %fieldset.clear
- = link_to "Cancel", users_path, :class => "formbutton button clear"
- - if has_user_modify?
- = f.submit "Reset", :class => "formbutton button", :name => "reset"
- = f.submit "Save", :class => "formbutton button", :name => "save"
- - else
- = f.submit "Make Changes", :class => "formbutton button", :name => "make_changes"
+ %h2 Editing Account
+
+.dcloud_form
+ - form_for @user, :url => { :action => 'update' } do |f|
+ = f.error_messages
+ = hidden_field :user, :id, :value => @user.id
+ = render :partial => "form", :object => f
+ %fieldset.clearfix
+ = link_to "Cancel", users_path, :class => "formbutton button clear"
+ - if has_user_modify?
+ = f.submit "Reset", :class => "formbutton button", :name => "reset"
+ = f.submit "Save", :class => "formbutton button", :name => "save"
+ - else
+ = f.submit "Make Changes", :class => "formbutton button", :name => "make_changes"
diff --git a/src/app/views/users/new.haml b/src/app/views/users/new.haml
index b6ed86b..fa5784b 100644
--- a/src/app/views/users/new.haml
+++ b/src/app/views/users/new.haml
@@ -1,8 +1,18 @@
-.modalbox
+-if (current_user)
%h2 New Account
.dcloud_form
- form_for @user, :url => account_path do |f|
= f.error_messages
= render :partial => "form", :object => f
- = f.submit t(:create_account), :class => "submit dialogbutton"
- = link_to t(:cancel), :class => 'actionlink button dialogbutton'
+ %fieldset.clearfix
+ = f.submit t(:create_account), :class => "submit formbutton"
+ = link_to t(:cancel), {:controller => 'users'}, :class => 'button formbutton'
+-else
+ .modalbox
+ %h2 New Account
+ .dcloud_form
+ - form_for @user, :url => account_path do |f|
+ = f.error_messages
+ = render :partial => "form", :object => f
+ = f.submit t(:create_account), :class => "submit dialogbutton"
+ = link_to t(:cancel), {:controller => 'users'}, :class => 'button dialogbutton'
--
1.7.2.3
13 years, 8 months
[PATCH cloud engine] BZ #645390: 'multi-select from list' problems
by Tomas Sedovic
From: Tomas Sedovic <tsedovic(a)redhat.com>
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 12cea95..5e74d9b 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', 'image[template_id]' => get_selected_id
+ begin
+ redirect_to :action => 'build_form', 'image[template_id]' => get_selected_id
+ rescue
+ flash[:notice] = "No template selected"
+ redirect_to :action => 'index'
+ end
else
raise "Unknown action"
end
@@ -167,8 +177,11 @@ class TemplatesController < ApplicationController
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 3a94c5e..fa90690 100644
--- a/src/app/views/instance/index.haml
+++ b/src/app/views/instance/index.haml
@@ -102,7 +102,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 df9def1..34338df 100644
--- a/src/app/views/users/index.haml
+++ b/src/app/views/users/index.haml
@@ -29,7 +29,7 @@
-(a)users.each 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
13 years, 8 months