@@ -3,38 +3,38 @@ class QuestionnaireDatatable < ApplicationDatatable
3
3
4
4
def view_columns
5
5
@view_columns ||= {
6
- id : { source : ' Questionnaire.id' , cond : :eq } ,
7
- first_name : { source : ' Questionnaire.first_name' } ,
8
- last_name : { source : ' Questionnaire.last_name' } ,
9
- email : { source : ' User.email' } ,
10
- phone : { source : ' Questionnaire.phone' } ,
11
- gender : { source : ' Questionnaire.gender' } ,
12
- date_of_birth : { source : ' Questionnaire.date_of_birth' , searchable : false } ,
13
- role : { source : ' User.role' , cond : :eq , searchable : false } ,
14
- acc_status : { source : ' Questionnaire.acc_status' , searchable : true } ,
15
- checked_in : { source : ' Questionnaire.checked_in_at' , searchable : false } ,
16
- school : { source : ' School.name' } ,
17
- created_at : { source : ' Questionnaire.created_at' , searchable : false } ,
18
- dietary_restrictions : { source : ' Questionnaire.dietary_restrictions' , searchable : true } ,
19
- special_needs : { source : ' Questionnaire.special_needs' , searchable : true }
6
+ id : { source : " Questionnaire.id" , cond : :eq } ,
7
+ first_name : { source : " Questionnaire.first_name" } ,
8
+ last_name : { source : " Questionnaire.last_name" } ,
9
+ email : { source : " User.email" } ,
10
+ phone : { source : " Questionnaire.phone" } ,
11
+ gender : { source : " Questionnaire.gender" } ,
12
+ date_of_birth : { source : " Questionnaire.date_of_birth" , searchable : false } ,
13
+ role : { source : " User.role" , cond : :eq , searchable : false } ,
14
+ acc_status : { source : " Questionnaire.acc_status" , searchable : true } ,
15
+ checked_in : { source : " Questionnaire.checked_in_at" , searchable : false } ,
16
+ school : { source : " School.name" } ,
17
+ created_at : { source : " Questionnaire.created_at" , searchable : false } ,
18
+ dietary_restrictions : { source : " Questionnaire.dietary_restrictions" , searchable : true } ,
19
+ special_needs : { source : " Questionnaire.special_needs" , searchable : true } ,
20
20
}
21
21
end
22
22
23
23
private
24
24
25
25
def note ( record )
26
- output = ''
26
+ output = ""
27
27
output += '<i class="fa fa-exclamation-triangle icon-space-r"></i> <small>Minor</small>' if record . minor?
28
28
output += '<i class="fa fa-bus icon-space-r" title="Riding bus"></i>' if record . bus_list_id?
29
- output += ' <small>Captain</small>' if record . is_bus_captain?
30
- output = '<div class="center">' + output + ' </div>' if output . present?
29
+ output += " <small>Captain</small>" if record . is_bus_captain?
30
+ output = '<div class="center">' + output + " </div>" if output . present?
31
31
output . html_safe
32
32
end
33
33
34
34
def data
35
35
records . map do |record |
36
36
{
37
- bulk : current_user . admin? ? "<input type=\" checkbox\" data-bulk-row-edit=\" #{ record . id } \" >" . html_safe : '' ,
37
+ bulk : current_user . admin? ? "<input type=\" checkbox\" data-bulk-row-edit=\" #{ record . id } \" >" . html_safe : "" ,
38
38
link : link_to ( '<i class="fa fa-search"></i>' . html_safe , manage_questionnaire_path ( record ) ) ,
39
39
note : note ( record ) ,
40
40
id : record . id ,
@@ -45,11 +45,11 @@ def data
45
45
gender : record . gender ,
46
46
date_of_birth : record . date_of_birth_formatted ,
47
47
acc_status : "<span class=\" text-#{ acc_status_class ( record . acc_status ) } \" >#{ record . acc_status . titleize } </span>" . html_safe ,
48
- checked_in : record . checked_in? ? '<span class="text-success">Yes</span>' . html_safe : 'No' ,
48
+ checked_in : record . checked_in? ? '<span class="text-success">Yes</span>' . html_safe : "No" ,
49
49
school : link_to ( record . school . name , manage_school_path ( record . school ) ) ,
50
- created_at : record . created_at . present? ? display_datetime ( record . created_at ) : '' ,
50
+ created_at : record . created_at . present? ? display_datetime ( record . created_at ) : "" ,
51
51
dietary_restrictions : record . dietary_restrictions ,
52
- special_needs : record . special_needs
52
+ special_needs : record . special_needs ,
53
53
}
54
54
end
55
55
end
0 commit comments