Class: Gaku::StudentDecorator

Inherits:
PersonDecorator show all
Defined in:
app/decorators/gaku/student_decorator.rb

Instance Method Summary collapse

Methods inherited from PersonDecorator

#formatted_name, #formatted_name_reading, #full_name, #full_name_reading, #sex_and_birth, #student_names

Instance Method Details

#badges_listObject



6
7
8
9
10
11
12
13
14
# File 'app/decorators/gaku/student_decorator.rb', line 6

def badges_list
  h.comma_separated_list(object.badges) do |badge|
    if badge.badge_type.badge_image_file_name.nil?
      badge.badge_type.name
    else
      "#{badge.badge_type.name} (#{h.resize_image(badge.badge_type.badge_image, size: 22)})"
    end
  end
end

#class_groupObject



28
29
30
31
# File 'app/decorators/gaku/student_decorator.rb', line 28

def class_group
  cg = object.class_groups.last
  cg.blank? ? 'Empty' : cg
end

#seat_numberObject



33
34
35
36
# File 'app/decorators/gaku/student_decorator.rb', line 33

def seat_number
  sn = object.class_group_enrollments.last
  sn.blank? ? '' : sn.seat_number
end

#simple_grades_listObject



16
17
18
19
20
# File 'app/decorators/gaku/student_decorator.rb', line 16

def simple_grades_list
  h.comma_separated_list(object.simple_grades) do |simple_grade|
    "#{simple_grade.simple_grade_type_name}"
  end
end

#student_specialties_listObject



22
23
24
25
26
# File 'app/decorators/gaku/student_decorator.rb', line 22

def student_specialties_list
  h.comma_separated_list(object.student_specialties) do |student_specialty|
    "#{student_specialty.specialty} (#{major_check(student_specialty)})"
  end
end