Class: UsersController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/users_controller.rb

Instance Method Summary collapse

Instance Method Details

#checkObject

post /users/check



14
15
16
# File 'app/controllers/users_controller.rb', line 14

def check
  @entity = User.new(creation_parameters)
end

#createObject

post /users



24
25
26
27
28
29
30
31
32
33
# File 'app/controllers/users_controller.rb', line 24

def create
  @entity = User.new(creation_parameters)
  if @entity.save
    NetworkUserSyncJob.perform_later(@entity.id, false)

    form_processed_ok(admin_user_path(id: @entity.id))
  else
    form_processed_with_error(:new)
  end
end

#destroyObject

delete /users/:id



51
52
53
54
55
56
# File 'app/controllers/users_controller.rb', line 51

def destroy
  if @entity.destroy #update(deleted: true)
    flash[:notice] = t('users.destroy.success')
  end
  redirect_to admin_users_path
end

#editObject

get /users/:id/edit



36
37
# File 'app/controllers/users_controller.rb', line 36

def edit
end

#indexObject

get /users



8
9
10
11
# File 'app/controllers/users_controller.rb', line 8

def index
  @filter     = params[:filter] || Hash.new
  @collection = User.page_for_visitors(current_page, @filter)
end

#newObject

get /users/new



19
20
21
# File 'app/controllers/users_controller.rb', line 19

def new
  @entity = User.new(consent: true)
end

#updateObject

patch /users/:id



40
41
42
43
44
45
46
47
48
# File 'app/controllers/users_controller.rb', line 40

def update
  if @entity.update(entity_parameters)
    NetworkUserSyncJob.perform_later(@entity.id, true)

    form_processed_ok(admin_user_path(id: @entity.id))
  else
    form_processed_with_error(:edit)
  end
end