[refs #270] fix some errors
This commit is contained in:
parent
baf7fdac04
commit
b0eeb4f260
|
@ -9,7 +9,6 @@ class Admin::UsersController < ApplicationController
|
|||
end
|
||||
|
||||
def new
|
||||
@user = User.new
|
||||
end
|
||||
|
||||
def create
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
class UsersController < ApplicationController
|
||||
before_filter :authenticate_user!
|
||||
|
||||
load_and_authorize_resource
|
||||
before_filter {@user = current_user}
|
||||
load_and_authorize_resource :only => :show
|
||||
before_filter :set_current_user, :only => [:profile, :update, :private]
|
||||
autocomplete :user, :uname
|
||||
|
||||
def show
|
||||
|
@ -13,11 +13,9 @@ class UsersController < ApplicationController
|
|||
end
|
||||
|
||||
def profile
|
||||
@user = current_user
|
||||
end
|
||||
|
||||
def update
|
||||
@user = current_user
|
||||
if @user.update_without_password(params[:user])
|
||||
if @user.avatar && params[:delete_avatar] == '1'
|
||||
@user.avatar = nil
|
||||
|
@ -45,4 +43,10 @@ class UsersController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def set_current_user
|
||||
@user = current_user
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
.admin-preferences
|
||||
%ul
|
||||
- if can? :edit, @user
|
||||
%li{:class => (act == :edit && :users == contr) ? 'active' : ''}
|
||||
%li{:class => (act == :profile && :users == contr) ? 'active' : ''}
|
||||
= link_to t("layout.users.profile"), @user == current_user ? edit_profile_path : edit_user_path(@user)
|
||||
- if can? :private, @user
|
||||
%li{:class => (act == :private && contr == :users) ? 'active' : ''}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
.left
|
||||
= image_tag avatar_url(@user, :big)
|
||||
%br
|
||||
= link_to t("layout.users.settings"), edit_user_path(@user), :class => 'button width81' if can? :edit, @user
|
||||
= link_to t("layout.users.settings"), current_user == @user ? edit_profile_path : edit_user_path(@user), :class => 'button width81' if can? :edit, @user
|
||||
.left
|
||||
%h3= @user.uname
|
||||
= @user.name
|
||||
|
|
Loading…
Reference in New Issue