Class: Integral::Backend::UsersController
- Inherits:
-
BaseController
- Object
- ActionController::Base
- BaseController
- Integral::Backend::UsersController
- Defined in:
- app/controllers/integral/backend/users_controller.rb
Overview
Users controller
Instance Method Summary collapse
-
#account ⇒ Object
GET /account Show specific users account page.
-
#create ⇒ Object
POST / User creation.
-
#destroy ⇒ Object
DELETE /:id.
-
#edit ⇒ Object
GET /:id/edit User edit form.
-
#index ⇒ Object
GET / Lists all users.
-
#new ⇒ Object
GET /new User creation form.
-
#show ⇒ Object
GET /:id Show specific user.
-
#update ⇒ Object
PUT /:id Updating a user.
Instance Method Details
#account ⇒ Object
GET /account Show specific users account page
38 39 40 41 42 43 |
# File 'app/controllers/integral/backend/users_controller.rb', line 38 def account @user = current_user @user.name, :backend_account_path render :show end |
#create ⇒ Object
POST / User creation
47 48 49 50 51 52 53 54 55 |
# File 'app/controllers/integral/backend/users_controller.rb', line 47 def create @user = User.invite!(user_params, current_user) if @user.errors.present? respond_failure I18n.t('integral.backend.users.notification.creation_failure'), 'new' else respond_successfully I18n.t('integral.backend.users.notification.creation_success'), backend_user_path(@user) end end |
#destroy ⇒ Object
DELETE /:id
78 79 80 81 82 |
# File 'app/controllers/integral/backend/users_controller.rb', line 78 def destroy @user.destroy respond_successfully I18n.t('integral.backend.users.notification.delete_success'), backend_users_path end |
#edit ⇒ Object
GET /:id/edit User edit form
59 60 61 62 |
# File 'app/controllers/integral/backend/users_controller.rb', line 59 def edit @user.name, :backend_user_path I18n.t('integral.navigation.edit'), :edit_backend_user_path end |
#index ⇒ Object
GET / Lists all users
12 13 14 15 16 17 18 19 |
# File 'app/controllers/integral/backend/users_controller.rb', line 12 def index respond_to do |format| format.html format.json do render json: { content: render_to_string(partial: 'integral/backend/users/grid', locals: { grid: @grid }) } end end end |
#new ⇒ Object
GET /new User creation form
23 24 25 26 |
# File 'app/controllers/integral/backend/users_controller.rb', line 23 def new I18n.t('integral.navigation.new'), :new_backend_user_path @user = User.new end |
#show ⇒ Object
GET /:id Show specific user
31 32 33 |
# File 'app/controllers/integral/backend/users_controller.rb', line 31 def show @user.name, :backend_user_path end |
#update ⇒ Object
PUT /:id Updating a user
66 67 68 69 70 71 72 73 74 75 |
# File 'app/controllers/integral/backend/users_controller.rb', line 66 def update = user_params .delete(:role_ids) unless policy(@user).manager? if @user.update() respond_successfully I18n.t('integral.backend.users.notification.edit_success'), backend_user_path(@user) else respond_failure I18n.t('integral.backend.users.notification.edit_failure'), 'edit' end end |