orbit-basic/app/controllers/basic_infos_controller.rb

38 lines
763 B
Ruby
Raw Normal View History

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 "/users/sign_in"
2013-11-26 11:14:24 +00:00
else
@roles = Role.where(:disabled => false)
render :action => "role_page"
end
2013-11-25 12:24:56 +00:00
end
end