From ed1cb5a0e7f44863227409d7580e2f100632c6cd Mon Sep 17 00:00:00 2001 From: danielvincent Date: Thu, 7 Oct 2010 18:52:46 -0700 Subject: [PATCH] DG MS; moved change password to account page; fixed the styling on password inputs --- app/controllers/users_controller.rb | 14 +++++++----- app/views/albums/edit.html.haml | 2 +- app/views/users/_account.haml | 29 ++++++++++++++++++++++++ app/views/users/_profile.haml | 11 ++------- app/views/users/_services.haml | 1 + app/views/users/edit.html.haml | 4 +--- public/stylesheets/application.css | 6 +++-- public/stylesheets/sass/application.sass | 6 +++-- 8 files changed, 50 insertions(+), 23 deletions(-) create mode 100644 app/views/users/_account.haml diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index df4519f65..e5239129b 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -23,10 +23,6 @@ class UsersController < ApplicationController def update @user = current_user - data = clean_hash params[:user] - prep_image_url(data) - - params[:user].delete(:password) if params[:user][:password].blank? params[:user].delete(:password_confirmation) if params[:user][:password].blank? and params[:user][:password_confirmation].blank? @@ -36,10 +32,16 @@ class UsersController < ApplicationController else flash[:error] = "Password Change Failed" end + else + data = clean_hash params[:user] + prep_image_url(data) + if @user.update_profile data + flash[:notice] = "Profile updated" + else + flash[:error] = "Failed to update profile" + end end - - @user.update_profile data redirect_to edit_user_path(@user) end diff --git a/app/views/albums/edit.html.haml b/app/views/albums/edit.html.haml index 0f96bc1cd..4969227e4 100644 --- a/app/views/albums/edit.html.haml +++ b/app/views/albums/edit.html.haml @@ -19,7 +19,7 @@ - for photo in @album.photos .photo_edit_block= image_tag photo.url(:thumb_medium) - #submit_block + .submit_block = link_to t('.cancel'), root_path or = a.submit diff --git a/app/views/users/_account.haml b/app/views/users/_account.haml new file mode 100644 index 000000000..8bd19d72d --- /dev/null +++ b/app/views/users/_account.haml @@ -0,0 +1,29 @@ +-# Copyright (c) 2010, Diaspora Inc. This file is +-# licensed under the Affero General Public License version 3 or later. See +-# the COPYRIGHT file. + + +%h2 Account + +%h3 Change Password + += form_for @user do |f| + = f.error_messages + + %p + = f.label :password, "New Password" + = f.password_field :password + %p + = f.label :password_confirmation + = f.password_field :password_confirmation + + .submit_block + = link_to "Cancel", edit_user_path(current_user) + or + = f.submit 'Change password' + +%h3 Export Data + += link_to "download my xml", users_export_path, :class => "button" += link_to "download my photos", users_export_photos_path, :class => "button" + diff --git a/app/views/users/_profile.haml b/app/views/users/_profile.haml index 7f935972b..9b415a720 100644 --- a/app/views/users/_profile.haml +++ b/app/views/users/_profile.haml @@ -47,16 +47,9 @@ %p = p.label :last_name = p.text_field :last_name, :value => @profile.last_name - %p - = f.label :password - = f.password_field :password - %p - = f.label :password_confirmation - = f.password_field :password_confirmation - - #submit_block - = link_to t('.cancel'), root_path + .submit_block + = link_to t('.cancel'), edit_user_path(current_user) = t('.or') = f.submit t('.update_profile') diff --git a/app/views/users/_services.haml b/app/views/users/_services.haml index 07173ecd8..80cf33663 100644 --- a/app/views/users/_services.haml +++ b/app/views/users/_services.haml @@ -23,3 +23,4 @@ #content_bottom .back = link_to "⇧ home", root_path + diff --git a/app/views/users/edit.html.haml b/app/views/users/edit.html.haml index 78076e789..80d426202 100644 --- a/app/views/users/edit.html.haml +++ b/app/views/users/edit.html.haml @@ -26,10 +26,8 @@ = render 'users/profile' #account.settings_pane - = link_to "download my xml", users_export_path, :class => "button" - = link_to "download my photos", users_export_photos_path, :class => "button" + = render 'users/account' #services.settings_pane = render 'users/services' - diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css index 39427a4f4..80d0dfe39 100644 --- a/public/stylesheets/application.css +++ b/public/stylesheets/application.css @@ -347,7 +347,9 @@ ul.comment_set { #debug_info h5 { color: #cccccc; } -input[type='text'], textarea { +input[type='text'], +input[type='password'], +textarea { font-family: "lucida grande", "lucida sans", "sans-serif"; font-size: 14px; padding: 0.3em; @@ -362,7 +364,7 @@ input[type='text'], textarea { -moz-box-shadow: 0 1px 2px white; -webkit-box-shadow: 0 1px 2px white; } -#submit_block { +.submit_block { text-align: right; font-size: 12px; } diff --git a/public/stylesheets/sass/application.sass b/public/stylesheets/sass/application.sass index 83465d57e..e50888c9d 100644 --- a/public/stylesheets/sass/application.sass +++ b/public/stylesheets/sass/application.sass @@ -467,7 +467,9 @@ ul.comment_set :color #ccc -input[type='text'], textarea +input[type='text'], +input[type='password'], +textarea :font :family 'lucida grande', 'lucida sans', 'sans-serif' :size 14px @@ -485,7 +487,7 @@ input[type='text'], textarea :-moz-box-shadow 0 1px 2px #fff :-webkit-box-shadow 0 1px 2px #fff -#submit_block +.submit_block :text :align right :font