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