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: #[email protected]_name} #[email protected]_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

_______________________________________________
deltacloud-devel mailing list
[email protected]
https://fedorahosted.org/mailman/listinfo/deltacloud-devel

Reply via email to