[refs #257] add ability to destroy avatar
This commit is contained in:
parent
de62aaad53
commit
5f6ca140d9
|
@ -46,6 +46,10 @@ class UsersController < ApplicationController
|
|||
end
|
||||
@user ||= current_user
|
||||
if @user.update_without_password(params[:user])
|
||||
if @user.avatar && params[:delete_avatar] == '1'
|
||||
@user.avatar = nil
|
||||
@user.save
|
||||
end
|
||||
flash[:notice] = t('flash.user.saved')
|
||||
redirect_to edit_user_path(@user)
|
||||
else
|
||||
|
|
|
@ -32,8 +32,13 @@
|
|||
= f.label :avatar, t("activerecord.attributes.user.avatar")
|
||||
.rightlist
|
||||
= image_tag(avatar_url(@user, :medium))
|
||||
%br
|
||||
%br
|
||||
.leftlist
|
||||
.rightlist
|
||||
.check
|
||||
%span#niceCheckbox1.niceCheck-main
|
||||
= check_box_tag "delete_avatar", 1, false, :class => 'niceCheckbox1'
|
||||
.forcheck= t('layout.users.delete_avatar')
|
||||
.both
|
||||
= f.file_field :avatar
|
||||
.both
|
||||
.leftlist
|
||||
|
|
|
@ -22,6 +22,7 @@ en:
|
|||
delete_warning: Warning! Deleted account can not be recovered.
|
||||
private_settings_header: Password change
|
||||
avatar_notice: Without uploaded avatar will be used avatar from gravar web service.
|
||||
delete_avatar: Delete avatar
|
||||
|
||||
activerecord:
|
||||
attributes:
|
||||
|
|
|
@ -22,6 +22,7 @@ ru:
|
|||
delete_warning: Внимание! Удаленный аккаунт восстановлению не подлежит.
|
||||
private_settings_header: Изменение пароля
|
||||
avatar_notice: При отсутствии загруженной аватарки будет использована Ваша аватарка на сервисе gravatar.
|
||||
delete_avatar: Удалить аватар
|
||||
|
||||
activerecord:
|
||||
attributes:
|
||||
|
|
Loading…
Reference in New Issue