Class: UsersController
Constant Summary
FlashTruncation::STRING_OVERHEAD
Instance Method Summary
collapse
#block_api_access, #evil_parameter_hack!, #extract_header_info, #set_cache_disabled!
#max_flash_size, #truncate_flash, #truncate_flash_array
Instance Method Details
#edit ⇒ Object
13
14
|
# File 'app/controllers/users_controller.rb', line 13
def edit
end
|
#print_swipecard ⇒ Object
36
37
38
39
40
41
42
43
44
45
|
# File 'app/controllers/users_controller.rb', line 36
def print_swipecard
swipecard = params[:swipecard]
printer = params[:printer]
if swipecard.strip.present?
print_swipecard_with_pmb(swipecard, printer)
else
flash[:error] = 'Cannot print empty swipecard'
end
redirect_to action: :show, id: @user.id
end
|
#projects ⇒ Object
28
29
30
|
# File 'app/controllers/users_controller.rb', line 28
def projects
@projects = Project.for_user(@user).page(params[:page])
end
|
#study_reports ⇒ Object
32
33
34
|
# File 'app/controllers/users_controller.rb', line 32
def study_reports
@study_reports = StudyReport.for_user(@user).page(params[:page]).order(id: :desc)
end
|
#update ⇒ Object
rubocop:todo Metrics/AbcSize
16
17
18
19
20
21
22
23
24
25
26
|
# File 'app/controllers/users_controller.rb', line 16
def update params[:user].delete(:swipecard_code) if params[:user][:swipecard_code].blank?
@user = User.find(params[:id])
@user.update(params[:user]) if @user.id == params[:id].to_i
if @user.save
flash[:notice] = 'Profile updated'
else
flash[:error] = 'Problem updating profile.'
end
redirect_to action: :show, id: @user.id
end
|