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.
-
#edit ⇒ Object
GET /:id/edit Resource edit screen.
-
#index ⇒ Object
GET / Lists all users.
-
#show ⇒ Object
GET /:id Show specific user.
-
#update ⇒ Object
PUT /:id Updating a user.
Methods inherited from BaseController
#activities, #activity, #destroy, #duplicate, #new
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 @resource = current_user @resource.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 @resource = User.invite!(resource_params, current_user) if @resource.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(@resource) end end |
#edit ⇒ Object
GET /:id/edit Resource edit screen
30 31 32 33 |
# File 'app/controllers/integral/backend/users_controller.rb', line 30 def edit @resource.name, :backend_user_path I18n.t('integral.navigation.edit'), "edit_backend_#{controller_name.singularize}_path".to_sym 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 |
#show ⇒ Object
GET /:id Show specific user
24 25 26 |
# File 'app/controllers/integral/backend/users_controller.rb', line 24 def show @resource.name, :backend_user_path end |
#update ⇒ Object
PUT /:id Updating a user
59 60 61 62 63 64 65 66 67 68 |
# File 'app/controllers/integral/backend/users_controller.rb', line 59 def update = resource_params .delete(:role_ids) unless policy(current_user).manager? if @resource.update() respond_successfully I18n.t('integral.backend.users.notification.edit_success'), backend_user_path(@resource) else respond_failure I18n.t('integral.backend.users.notification.edit_failure'), 'edit' end end |