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
14
15
|
# File 'app/controllers/users_controller.rb', line 14
def edit
end
|
#print_swipecard ⇒ Object
37
38
39
40
41
42
43
44
45
46
|
# File 'app/controllers/users_controller.rb', line 37
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
29
30
31
|
# File 'app/controllers/users_controller.rb', line 29
def projects
@projects = Project.for_user(@user).page(params[:page])
end
|
#show ⇒ Object
9
10
11
12
|
# File 'app/controllers/users_controller.rb', line 9
def show
@page_name = @user.name
@printer_list = BarcodePrinter.alphabetical.where(barcode_printer_type: BarcodePrinterType96Plate.all).pluck(:name)
end
|
#study_reports ⇒ Object
33
34
35
|
# File 'app/controllers/users_controller.rb', line 33
def study_reports
@study_reports = StudyReport.for_user(@user).page(params[:page]).order(id: :desc)
end
|
#update ⇒ Object
rubocop:todo Metrics/AbcSize
17
18
19
20
21
22
23
24
25
26
27
|
# File 'app/controllers/users_controller.rb', line 17
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
|