This repository has been archived on 2024-03-16. You can view files and clone it, but cannot push or open issues or pull requests.
2013-11-25 12:24:56 +00:00
|
|
|
class BasicInfosController < ApplicationController
|
|
|
|
layout "devise"
|
|
|
|
def index
|
2013-11-26 11:14:24 +00:00
|
|
|
if current_user.nil?
|
|
|
|
redirect_to "/users/sign_up"
|
|
|
|
end
|
|
|
|
@user = current_user
|
2013-11-25 12:24:56 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def form_page
|
2013-11-26 11:14:24 +00:00
|
|
|
@user = User.find(params[:user_id])
|
|
|
|
end
|
|
|
|
|
|
|
|
def basic_info_update
|
|
|
|
@user = User.find(params[:id])
|
|
|
|
if @user.update_attributes(params[:user])
|
|
|
|
redirect_to basic_infos_role_page_path(:user_id => @user.id.to_s)
|
|
|
|
else
|
|
|
|
render :action=> "form_page"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def role_page
|
|
|
|
@roles = Role.where(:disabled => false)
|
|
|
|
@user_id = params[:user_id]
|
|
|
|
end
|
|
|
|
|
|
|
|
def role_update
|
|
|
|
user = User.find(params[:id])
|
|
|
|
if user.update_attributes(params[:user])
|
|
|
|
redirect_to root_path
|
|
|
|
else
|
|
|
|
@roles = Role.where(:disabled => false)
|
|
|
|
render :action => "role_page"
|
|
|
|
end
|
2013-11-25 12:24:56 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|