From 059b6fca8468e7b9a2507f24b84e09ce4b8c3ddd Mon Sep 17 00:00:00 2001 From: Azul Date: Thu, 6 Dec 2012 16:03:59 +0100 Subject: seperated login and password changes in settings --- users/app/views/users/_form.html.haml | 18 ++++++++++++------ users/app/views/users/edit.html.haml | 11 +++-------- 2 files changed, 15 insertions(+), 14 deletions(-) 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 -- cgit v1.2.3 From f65b0bc32fd2785458d4076faf89683effca5031 Mon Sep 17 00:00:00 2001 From: Azul Date: Thu, 6 Dec 2012 17:00:53 +0100 Subject: forgot to add new partial --- users/app/views/users/_cancel_account.html.haml | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 users/app/views/users/_cancel_account.html.haml 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 -- cgit v1.2.3