summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAzul <azul@leap.se>2012-12-07 08:18:42 +0100
committerAzul <azul@leap.se>2012-12-07 08:18:42 +0100
commita3dce077881c7e97090e5e560b1fb004952d5b23 (patch)
tree0d5d05052fa320e4eb038828572c074211b6edce
parent2885145729cbba9a933a8a2ff33c4fd99f08e0fb (diff)
parentf65b0bc32fd2785458d4076faf89683effca5031 (diff)
Merge branch 'feature/improve-editing-user-settings' into develop
-rw-r--r--users/app/views/users/_cancel_account.html.haml6
-rw-r--r--users/app/views/users/_form.html.haml18
-rw-r--r--users/app/views/users/edit.html.haml11
3 files changed, 21 insertions, 14 deletions
diff --git a/users/app/views/users/_cancel_account.html.haml b/users/app/views/users/_cancel_account.html.haml
new file mode 100644
index 0000000..41580b0
--- /dev/null
+++ b/users/app/views/users/_cancel_account.html.haml
@@ -0,0 +1,6 @@
+%legend
+ =t :cancel_account
+ %small You will not be able to login anymore.
+= link_to user_path(@user), :method => :delete, :class => "btn btn-danger" do
+ %i.icon-remove.icon-white
+ Remove my Account
diff --git a/users/app/views/users/_form.html.haml b/users/app/views/users/_form.html.haml
index fc835af..39e26a6 100644
--- a/users/app/views/users/_form.html.haml
+++ b/users/app/views/users/_form.html.haml
@@ -1,9 +1,15 @@
+- only = local_assigns[:only]
- html = {:class => 'form-horizontal user form ' + (@user.new_record? ? 'new' : 'edit')}
= simple_form_for @user, :validate => true, :format => :json, :html => html do |f|
%legend
- = @user.new_record? ? t(:signup_message) : t(:edit_settings)
- = f.input :login, :input_html => { :id => :srp_username }
- = f.input :password, :required => true, :validate => true, :input_html => { :id => :srp_password }
- = f.input :password_confirmation, :required => true, :input_html => { :id => :srp_password_confirmation }
- = f.button :submit, :class => 'btn-primary'
- = link_to t(:cancel), root_url, :class => :btn
+ = t(only || :signup_message)
+ - if !only || only == :change_login
+ = f.input :login, :input_html => { :id => :srp_username }
+ - if !only || only == :change_password
+ = f.input :password, :required => true, :validate => true, :input_html => { :id => :srp_password }
+ = f.input :password_confirmation, :required => true, :input_html => { :id => :srp_password_confirmation }
+ .pull-right
+ = f.button :submit, :class => 'btn-primary'
+ - unless only
+ = link_to t(:cancel), root_url, :class => :btn
+ .clearfix
diff --git a/users/app/views/users/edit.html.haml b/users/app/views/users/edit.html.haml
index cfcf220..25da71a 100644
--- a/users/app/views/users/edit.html.haml
+++ b/users/app/views/users/edit.html.haml
@@ -1,10 +1,5 @@
.span8.offset2
%h2=t :settings
- = render 'form'
- - if @user == current_user
- %legend
- =t :cancel_account
- %small You will not be able to login anymore.
- = link_to user_path(@user), :method => :delete, :class => "btn btn-danger" do
- %i.icon-remove.icon-white
- Remove my Account
+ = render :partial => 'form', :locals => {:only => :change_login}
+ = render :partial => 'form', :locals => {:only => :change_password}
+ = render 'cancel_account' if @user == current_user