study_engine 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Rakefile +42 -0
- data/app/assets/images/study_engine/spinner.gif +0 -0
- data/app/assets/images/study_engine/sprite/delete.png +0 -0
- data/app/assets/images/study_engine/sprite/download.png +0 -0
- data/app/assets/images/study_engine/sprite/edit.png +0 -0
- data/app/assets/images/study_engine/sprite/incomplete.png +0 -0
- data/app/assets/images/study_engine/sprite/metrc-sm.png +0 -0
- data/app/assets/images/study_engine/sprite/metrc.png +0 -0
- data/app/assets/images/study_engine/sprite/new.png +0 -0
- data/app/assets/javascripts/study_engine/admin_notes.js.coffee +12 -0
- data/app/assets/javascripts/study_engine/assessment_notifications.js.coffee +36 -0
- data/app/assets/javascripts/study_engine/assessment_timeout.js.coffee +24 -0
- data/app/assets/javascripts/study_engine/disable_buttons_after_click.js.coffee +6 -0
- data/app/assets/javascripts/study_engine/fire_click_event_immediately_on_mobile.js.coffee.erb +10 -0
- data/app/assets/javascripts/study_engine/response_validation.js.coffee +8 -0
- data/app/assets/javascripts/study_engine/restart_assessment_button.js.coffee +3 -0
- data/app/assets/javascripts/study_engine/study_engine.js.coffee +9 -0
- data/app/assets/javascripts/study_engine/study_id_picker.js.coffee +28 -0
- data/app/assets/stylesheets/study_engine.sass +1 -0
- data/app/assets/stylesheets/study_engine/_constant.sass +52 -0
- data/app/assets/stylesheets/study_engine/_mobile.sass +8 -0
- data/app/assets/stylesheets/study_engine/_tablet.sass +36 -0
- data/app/assets/stylesheets/study_engine/application.sass +101 -0
- data/app/assets/stylesheets/study_engine/base/_form.sass +131 -0
- data/app/assets/stylesheets/study_engine/base/_list.sass +38 -0
- data/app/assets/stylesheets/study_engine/base/_tables.sass +33 -0
- data/app/assets/stylesheets/study_engine/base/_text.sass +78 -0
- data/app/assets/stylesheets/study_engine/components/-fields/_login-fields.sass +14 -0
- data/app/assets/stylesheets/study_engine/components/-fields/_start-fields.sass +101 -0
- data/app/assets/stylesheets/study_engine/components/-nav/_global-nav.sass +19 -0
- data/app/assets/stylesheets/study_engine/components/-table/_results-table.sass +75 -0
- data/app/assets/stylesheets/study_engine/components/-table/_users-table.sass +11 -0
- data/app/assets/stylesheets/study_engine/components/_assessment-questions.sass +30 -0
- data/app/assets/stylesheets/study_engine/components/_form-buttons.sass +102 -0
- data/app/assets/stylesheets/study_engine/components/_helpt-text.sass +2 -0
- data/app/assets/stylesheets/study_engine/components/_method-icons.sass +15 -0
- data/app/assets/stylesheets/study_engine/components/_notes-modal.sass +65 -0
- data/app/assets/stylesheets/study_engine/components/_progress-bar.sass +25 -0
- data/app/assets/stylesheets/study_engine/components/_sortable-columns.sass +26 -0
- data/app/assets/stylesheets/study_engine/components/_table-actions.sass +8 -0
- data/app/assets/stylesheets/study_engine/components/_table-buttons.sass +17 -0
- data/app/assets/stylesheets/study_engine/components/_user-privileges.sass +3 -0
- data/app/assets/stylesheets/study_engine/mixins/_actions-table.sass +11 -0
- data/app/assets/stylesheets/study_engine/mixins/_buttons.sass +55 -0
- data/app/assets/stylesheets/study_engine/mixins/_checkbox-columns.sass +50 -0
- data/app/assets/stylesheets/study_engine/mixins/_custom-radios.sass +47 -0
- data/app/assets/stylesheets/study_engine/mixins/_icons.sass +38 -0
- data/app/assets/stylesheets/study_engine/mixins/_notification-text.sass +23 -0
- data/app/controllers/study_engine/admin/application_controller.rb +6 -0
- data/app/controllers/study_engine/admin/assessments_controller.rb +79 -0
- data/app/controllers/study_engine/admin/notes_controller.rb +17 -0
- data/app/controllers/study_engine/application_controller.rb +12 -0
- data/app/controllers/study_engine/assessments_controller.rb +94 -0
- data/app/helpers/study_engine/helpers.rb +15 -0
- data/app/helpers/study_engine/mailer_helpers.rb +11 -0
- data/app/mailers/study_engine/mailer.rb +25 -0
- data/app/models/study_engine/answer.rb +36 -0
- data/app/models/study_engine/assessment.rb +118 -0
- data/app/models/study_engine/begin_assessment_form.rb +110 -0
- data/app/models/study_engine/existing_assessments_form.rb +99 -0
- data/app/models/study_engine/form.rb +59 -0
- data/app/models/study_engine/report.rb +69 -0
- data/app/models/study_engine/result.rb +46 -0
- data/app/models/study_engine/screen_results.rb +54 -0
- data/app/models/study_engine/study_id.rb +47 -0
- data/app/models/study_engine/study_id/bank.rb +38 -0
- data/app/models/study_engine/study_id/sync.rb +52 -0
- data/app/models/study_engine/update_assessments_form.rb +53 -0
- data/app/views/study_engine/_progress_bar.html.slim +4 -0
- data/app/views/study_engine/admin/assessments/_assessment.html.slim +36 -0
- data/app/views/study_engine/admin/assessments/domain_results.csv.csvbuilder +17 -0
- data/app/views/study_engine/admin/assessments/edit.html.slim +68 -0
- data/app/views/study_engine/admin/assessments/index.html.slim +26 -0
- data/app/views/study_engine/admin/assessments/item_results.csv.csvbuilder +24 -0
- data/app/views/study_engine/admin/assessments/new.html.slim +46 -0
- data/app/views/study_engine/admin/assessments/screen_results.csv.csvbuilder +2 -0
- data/app/views/study_engine/assessments/complete.html.slim +25 -0
- data/app/views/study_engine/assessments/create.html.slim +46 -0
- data/app/views/study_engine/assessments/index.html.slim +43 -0
- data/app/views/study_engine/assessments/restart.html.slim +28 -0
- data/app/views/study_engine/assessments/show.html.slim +60 -0
- data/app/views/study_engine/mailer/assessment_recorded_notification.erb +8 -0
- data/app/views/study_engine/mailer/assessment_url_notification.erb +6 -0
- data/config/routes.rb +15 -0
- data/db/migrate/20160422185859_create_tables.rb +52 -0
- data/lib/study_engine.rb +5 -0
- data/lib/study_engine/config.rb +37 -0
- data/lib/study_engine/cucumber.rb +96 -0
- data/lib/study_engine/engine.rb +7 -0
- data/lib/study_engine/version.rb +3 -0
- data/lib/tasks/study_engine_tasks.rake +10 -0
- data/spec/ar_helper.rb +30 -0
- data/spec/models/study_engine/answer_spec.rb +28 -0
- data/spec/models/study_engine/assessment_spec.rb +250 -0
- data/spec/models/study_engine/begin_assessment_form_spec.rb +87 -0
- data/spec/models/study_engine/existing_assessments_form_spec.rb +171 -0
- data/spec/models/study_engine/report_spec.rb +48 -0
- data/spec/models/study_engine/result_spec.rb +102 -0
- data/spec/models/study_engine/screen_results_spec.rb +69 -0
- data/spec/models/study_engine/study_id/bank_spec.rb +72 -0
- data/spec/models/study_engine/study_id/sync_spec.rb +61 -0
- data/spec/models/study_engine/study_id_spec.rb +7 -0
- data/spec/models/study_engine/update_assessments_form_spec.rb +38 -0
- data/spec/rails_helper.rb +50 -0
- data/spec/schema.rb +65 -0
- data/spec/spec_helper.rb +72 -0
- data/spec/support/CATEngine3.exe +0 -0
- data/spec/support/forms/01. Physical Function Bank.xml +1213 -0
- data/spec/support/forms/02. Pain Interference Bank.xml +443 -0
- data/spec/support/forms/03. Anxiety Bank.xml +322 -0
- data/spec/support/forms/04. Depression Bank.xml +311 -0
- data/spec/support/forms/05. Ability to Participate Social bank Version 2.xml +353 -0
- data/spec/support/forms/06. Psychosocial Illness Impact Pos Bank.xml +900 -0
- data/spec/support/forms/07. Applied Cognition Gen Concerns Bank.xml +377 -0
- data/spec/support/forms/08. Satisfaction with Roles and Activities Bank Version 2.xml +443 -0
- data/spec/support/forms/09. Sleep Disturbance Bank.xml +300 -0
- data/spec/support/forms/10. Emotional Support Bank.xml +163 -0
- data/spec/support/forms/A - 07. Psychosocial Illness Impact Pos Bank.xml +471 -0
- data/spec/support/forms/A - 08. Pain interference Bank.xml +443 -0
- data/spec/support/forms/A - 09. Depression Bank.xml +311 -0
- data/spec/support/forms/B - 07. Physical Function Short Form.xml +123 -0
- data/spec/support/forms/B - 08. Physical Function Remainder A.xml +543 -0
- data/spec/support/forms/B - 09. Ability to Participate Social bank Version 2.xml +353 -0
- data/spec/support/forms/C - 07. Physical Function Short Form.xml +123 -0
- data/spec/support/forms/C - 08. Physical Function Remainder B.xml +553 -0
- data/spec/support/forms/C - 09. Anxiety Bank.xml +322 -0
- data/spec/support/parameters/01. Physical Function Bank.xml +682 -0
- data/spec/support/parameters/02. Pain Interference Bank.xml +256 -0
- data/spec/support/parameters/03. Anxiety Bank.xml +190 -0
- data/spec/support/parameters/04. Depression Bank.xml +184 -0
- data/spec/support/parameters/05. Ability to Participate Social bank Version 2.xml +226 -0
- data/spec/support/parameters/06. Psychosocial Illness Impact Pos Bank.xml +211 -0
- data/spec/support/parameters/07. Applied Cognition Gen Concerns Bank.xml +1 -0
- data/spec/support/parameters/08. Satisfaction with Roles and Activities Bank Version 2.xml +1 -0
- data/spec/support/parameters/09. Sleep Disturbance Bank.xml +1 -0
- data/spec/support/parameters/10. Emotional Support Bank.xml +1 -0
- metadata +394 -0
@@ -0,0 +1,65 @@
|
|
1
|
+
.note-wrapper
|
2
|
+
display: inline-block
|
3
|
+
position: relative
|
4
|
+
margin-top: -1px
|
5
|
+
|
6
|
+
.toggle-note
|
7
|
+
position: absolute
|
8
|
+
opacity: 0.001
|
9
|
+
cursor: pointer
|
10
|
+
z-index: 3
|
11
|
+
&:checked
|
12
|
+
& ~ .note::before
|
13
|
+
color: #1a1a1a
|
14
|
+
& ~ .note.-saved::before
|
15
|
+
color: $primaryColor
|
16
|
+
& ~ .note-modal
|
17
|
+
display: block
|
18
|
+
&:hover
|
19
|
+
& ~ .note::before
|
20
|
+
color: #666
|
21
|
+
|
22
|
+
.note
|
23
|
+
+icon("tag")
|
24
|
+
margin: 0
|
25
|
+
height: 20px
|
26
|
+
line-height: 20px
|
27
|
+
z-index: 2
|
28
|
+
&.-saved
|
29
|
+
&:before
|
30
|
+
color: $primaryColor
|
31
|
+
&.-saving
|
32
|
+
@extend .fa-spin
|
33
|
+
@extend .fa-spinner
|
34
|
+
&:before
|
35
|
+
color: $primaryColor
|
36
|
+
|
37
|
+
.note-modal
|
38
|
+
display: none
|
39
|
+
position: absolute
|
40
|
+
z-index: 5
|
41
|
+
background: #fcfcfc
|
42
|
+
box-shadow: #666 0 1px 6px
|
43
|
+
border-radius: 3px
|
44
|
+
padding: 20px
|
45
|
+
right: -100px
|
46
|
+
textarea
|
47
|
+
width: 400px
|
48
|
+
min-width: 400px
|
49
|
+
max-width: 90%
|
50
|
+
height: 200px
|
51
|
+
min-height: 200px
|
52
|
+
max-height: 500px
|
53
|
+
|
54
|
+
.close
|
55
|
+
position: absolute
|
56
|
+
top: 10px
|
57
|
+
right: 10px
|
58
|
+
font-size: 1.2em
|
59
|
+
@extend .fa
|
60
|
+
@extend .fa-close
|
61
|
+
color: #ccc
|
62
|
+
cursor: pointer
|
63
|
+
&:hover
|
64
|
+
color: red
|
65
|
+
|
@@ -0,0 +1,25 @@
|
|
1
|
+
.progress
|
2
|
+
float: left
|
3
|
+
clear: both
|
4
|
+
width: 100%
|
5
|
+
height: 2px
|
6
|
+
background: #ededed
|
7
|
+
background-image: linear-gradient(#ededed, #fcfcfc)
|
8
|
+
position: relative
|
9
|
+
margin: 20px 0 30px
|
10
|
+
border-radius: 1px
|
11
|
+
.bar
|
12
|
+
background: $primaryColor
|
13
|
+
background-image: linear-gradient(lighten($primaryColor, 10%), $primaryColor)
|
14
|
+
height: 2px
|
15
|
+
position: absolute
|
16
|
+
left: 0
|
17
|
+
border-radius: 1px
|
18
|
+
.percentage
|
19
|
+
font: 400 1.2em $default
|
20
|
+
color: $primaryColor
|
21
|
+
width: 30px
|
22
|
+
text-align: center
|
23
|
+
margin-left: -15px
|
24
|
+
position: absolute
|
25
|
+
top: 4px
|
@@ -0,0 +1,26 @@
|
|
1
|
+
// ADD TO <TH>
|
2
|
+
.sortable-column, .sortable
|
3
|
+
color: #333
|
4
|
+
display: block
|
5
|
+
@extend .fa-sort
|
6
|
+
&:before
|
7
|
+
@extend .fa
|
8
|
+
font-size: 1.4em
|
9
|
+
position: absolute
|
10
|
+
right: 0px
|
11
|
+
color: #d0d0d0
|
12
|
+
margin-left: 4px
|
13
|
+
&:hover, &:hover::before
|
14
|
+
color: $secondaryColor
|
15
|
+
&.asc, &.desc
|
16
|
+
i
|
17
|
+
color: #1a1a1a
|
18
|
+
&.asc, &.current-asc
|
19
|
+
@extend .fa-sort-asc
|
20
|
+
&:before
|
21
|
+
color: #333
|
22
|
+
&.desc, &.current-desc
|
23
|
+
@extend .fa-sort-desc
|
24
|
+
&:before
|
25
|
+
color: #333
|
26
|
+
|
@@ -0,0 +1,17 @@
|
|
1
|
+
.table-buttons
|
2
|
+
text-align: right
|
3
|
+
clear: both
|
4
|
+
|
5
|
+
.buttons-left
|
6
|
+
display: inline-block
|
7
|
+
float: left
|
8
|
+
.buttons-right
|
9
|
+
display: inline-block
|
10
|
+
float: right
|
11
|
+
|
12
|
+
.add, .add-button
|
13
|
+
+button(#fff, #666, 1.2em, true, "plus-circle")
|
14
|
+
.download
|
15
|
+
+button(#fff, #666, 1.2em, true, "download")
|
16
|
+
|
17
|
+
|
@@ -0,0 +1,55 @@
|
|
1
|
+
@mixin button( $bg: $primaryColor, $text-color: #fcfcfc, $font-size: 1.6em, $hover: true, $fa: false )
|
2
|
+
display: inline-block
|
3
|
+
font-size: $font-size
|
4
|
+
font-weight: 700
|
5
|
+
line-height: 3.0em
|
6
|
+
color: $text-color
|
7
|
+
border: 1px solid darken( $bg, 5% )
|
8
|
+
background-color: $bg
|
9
|
+
background: linear-gradient( $bg, darken( $bg, 5% ) )
|
10
|
+
border-radius: 2px
|
11
|
+
padding: 0 20px
|
12
|
+
text-align: center
|
13
|
+
text-decoration: none
|
14
|
+
cursor: default
|
15
|
+
@if $hover
|
16
|
+
cursor: pointer
|
17
|
+
&:hover
|
18
|
+
background: darken( $bg, 5% )
|
19
|
+
color: $text-color
|
20
|
+
@if $fa
|
21
|
+
@extend .fa-#{$fa}
|
22
|
+
&:before
|
23
|
+
@extend .fa
|
24
|
+
margin-right: 5px
|
25
|
+
|
26
|
+
// input wrapper buttons
|
27
|
+
|
28
|
+
=input-button($bg: $primaryColor, $text-color: #fcfcfc, $fa: false, $size: 1em)
|
29
|
+
+button($bg, $text-color)
|
30
|
+
padding: 0
|
31
|
+
line-height: 1
|
32
|
+
input, button
|
33
|
+
font-size: $size
|
34
|
+
border: none
|
35
|
+
background: none
|
36
|
+
padding: 0px 20px
|
37
|
+
line-height: 3em
|
38
|
+
cursor: pointer
|
39
|
+
color: $text-color
|
40
|
+
font-weight: 700
|
41
|
+
&:hover
|
42
|
+
input
|
43
|
+
color: $text-color
|
44
|
+
@if $fa
|
45
|
+
@extend .fa-#{$fa}
|
46
|
+
input, button
|
47
|
+
padding-left: 2em
|
48
|
+
&:before
|
49
|
+
@extend .fa
|
50
|
+
position: absolute
|
51
|
+
top: 50%
|
52
|
+
margin-top: -0.5em
|
53
|
+
left: 10px
|
54
|
+
font-size: $size
|
55
|
+
|
@@ -0,0 +1,50 @@
|
|
1
|
+
%inline-label
|
2
|
+
display: inline-block
|
3
|
+
color: #404040
|
4
|
+
font: 200 1.0rem $default
|
5
|
+
vertical-align: top
|
6
|
+
font-size: 2.1em
|
7
|
+
|
8
|
+
=checkbox-columns($h: 40px, $cols: 1)
|
9
|
+
width: 100%
|
10
|
+
display: flex
|
11
|
+
flex-wrap: wrap
|
12
|
+
vertical-align: top
|
13
|
+
line-height: 1em
|
14
|
+
padding-top: 2px
|
15
|
+
.field
|
16
|
+
display: inline-block
|
17
|
+
line-height: $h
|
18
|
+
min-height: $h
|
19
|
+
padding: 0
|
20
|
+
margin: 0 0 10px 1%
|
21
|
+
border: none
|
22
|
+
clear: none
|
23
|
+
.checkbox, .radio
|
24
|
+
line-height: $h
|
25
|
+
& + label
|
26
|
+
line-height: $h
|
27
|
+
label
|
28
|
+
line-height: $h
|
29
|
+
.other
|
30
|
+
width: 100%
|
31
|
+
clear: both
|
32
|
+
label
|
33
|
+
@extend %inline-label
|
34
|
+
line-height: 40px
|
35
|
+
margin: 0 0 0 10px
|
36
|
+
.text
|
37
|
+
width: 70%
|
38
|
+
margin: 0px 0 0 8px
|
39
|
+
@if $cols == 1
|
40
|
+
.field
|
41
|
+
flex-basis: 100%
|
42
|
+
@if $cols == 2
|
43
|
+
.field
|
44
|
+
flex-basis: 48%
|
45
|
+
@if $cols == 3
|
46
|
+
.field
|
47
|
+
flex-basis: 32%
|
48
|
+
@if $cols == 4
|
49
|
+
.field
|
50
|
+
flex-basis: 24%
|
@@ -0,0 +1,47 @@
|
|
1
|
+
=custom-radio($h: 46px)
|
2
|
+
+button( #fff, #444 )
|
3
|
+
box-shadow: darken( #f9f9f9, 10% ) 0 1px 6px 0 inset
|
4
|
+
border: 1px solid darken( #f9f9f9, 15% )
|
5
|
+
min-height: $h
|
6
|
+
height: $h
|
7
|
+
line-height: $h
|
8
|
+
text-align: left
|
9
|
+
padding: 0px
|
10
|
+
position: relative
|
11
|
+
width: 100%
|
12
|
+
font-weight: 700
|
13
|
+
//+bp_tablet_portrait
|
14
|
+
//font-size: 1.4em
|
15
|
+
input[type="checkbox"], input[type="radio"]
|
16
|
+
opacity: 0.001
|
17
|
+
position: absolute
|
18
|
+
top: 0
|
19
|
+
left: 0
|
20
|
+
z-index: 2
|
21
|
+
cursor: pointer
|
22
|
+
&:checked
|
23
|
+
& + .custom-symbol
|
24
|
+
color: #f5f5f5
|
25
|
+
background: $primaryColor
|
26
|
+
box-shadow: darken($primaryColor, 10% ) -1px 0 4px 0 inset
|
27
|
+
span
|
28
|
+
display: inline-block
|
29
|
+
vertical-align: top
|
30
|
+
margin-top: -2px
|
31
|
+
.custom-symbol
|
32
|
+
display: inline-block
|
33
|
+
color: #e0e0e0
|
34
|
+
border-right: 1px solid #e0e0e0
|
35
|
+
padding: 0 8px
|
36
|
+
margin-right: 5px
|
37
|
+
vertical-align: top
|
38
|
+
line-height: $h - 2px
|
39
|
+
font-size: 1.2em
|
40
|
+
border-left-radius: 2px
|
41
|
+
&:before
|
42
|
+
@extend .fa
|
43
|
+
&.checked
|
44
|
+
color: #f5f5f5
|
45
|
+
background: $primaryColor
|
46
|
+
box-shadow: darken($primaryColor, 10% ) -1px 0 4px 0 inset
|
47
|
+
|
@@ -0,0 +1,38 @@
|
|
1
|
+
// Icons with hidden text
|
2
|
+
|
3
|
+
=icon($fa, $hover: true)
|
4
|
+
display: inline-block
|
5
|
+
margin: 0 6px
|
6
|
+
text-align: left
|
7
|
+
position: relative
|
8
|
+
font-size: 1.4em
|
9
|
+
width: 1em
|
10
|
+
text-indent: -9999px
|
11
|
+
color: #ccc
|
12
|
+
@extend .fa
|
13
|
+
@extend .fa-#{$fa}
|
14
|
+
&:before
|
15
|
+
text-indent: 0
|
16
|
+
position: absolute
|
17
|
+
top: 50%
|
18
|
+
right: 50%
|
19
|
+
margin: -0.5em -0.5em 0 0
|
20
|
+
z-index: 2
|
21
|
+
@if $hover
|
22
|
+
cursor: pointer
|
23
|
+
&:hover
|
24
|
+
&:before
|
25
|
+
color: $primaryColor
|
26
|
+
|
27
|
+
|
28
|
+
// Icons with text
|
29
|
+
|
30
|
+
=icon_text($fa, $font-size: 1.3em)
|
31
|
+
display: inline-block
|
32
|
+
margin: 0 20px 0 0
|
33
|
+
@extend .fa-#{$fa}
|
34
|
+
font-size: $font-size
|
35
|
+
&:before
|
36
|
+
margin-right: 4px
|
37
|
+
@extend .fa
|
38
|
+
|
@@ -0,0 +1,23 @@
|
|
1
|
+
=notification-text( $color, $fa )
|
2
|
+
margin: 10px 0
|
3
|
+
position: relative
|
4
|
+
clear: both
|
5
|
+
padding: 10px 10px 10px 40px
|
6
|
+
border: 1px dashed $color
|
7
|
+
color: $color
|
8
|
+
font-size: 1.3em
|
9
|
+
font-style: italic
|
10
|
+
line-height: 1.4em
|
11
|
+
border-radius: 2px
|
12
|
+
@extend .fa-#{$fa}
|
13
|
+
&:before
|
14
|
+
@extend .fa
|
15
|
+
font-size: 1.8em
|
16
|
+
position: absolute
|
17
|
+
left: 10px
|
18
|
+
top: 50%
|
19
|
+
margin-top: -0.5em
|
20
|
+
ul
|
21
|
+
font-size: 1em
|
22
|
+
list-style: inside circle
|
23
|
+
|
@@ -0,0 +1,79 @@
|
|
1
|
+
require "study_engine/config"
|
2
|
+
|
3
|
+
module StudyEngine
|
4
|
+
class Admin::AssessmentsController < Admin::ApplicationController
|
5
|
+
before_action :require_admin, unless: -> { action_name == "index" && request.format.html? }
|
6
|
+
|
7
|
+
expose :assessments, :study_name, :study_url, :events, :assessment, :report
|
8
|
+
|
9
|
+
def index
|
10
|
+
respond_to do |format|
|
11
|
+
@assessments = current_user.admin? ? Assessment.find_each : Assessment.by_site(current_user.site_id).find_each
|
12
|
+
@report = Report.new(assessments, params[:field] || "study_id", params[:direction] || "ASC")
|
13
|
+
|
14
|
+
format.csv do
|
15
|
+
@csv_options = { force_quotes: true }
|
16
|
+
@output_encoding = "UTF-8"
|
17
|
+
@streaming = true
|
18
|
+
|
19
|
+
@filename = "#{params[:report]}-#{Time.now.utc.to_s(:db).parameterize.underscore}.csv"
|
20
|
+
render params[:report]
|
21
|
+
end
|
22
|
+
format.html
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def new
|
27
|
+
@assessments = ExistingAssessmentsForm.new
|
28
|
+
end
|
29
|
+
|
30
|
+
def create
|
31
|
+
@assessments = ExistingAssessmentsForm.new(params[:study_engine_assessment])
|
32
|
+
if assessments.save
|
33
|
+
redirect_to [:admin, :assessments], notice: "Assessment created!"
|
34
|
+
else
|
35
|
+
flash.now[:alert] = assessments.errors.full_messages.join(", ")
|
36
|
+
render :new
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def edit
|
41
|
+
if StudyID.new(params[:id]).valid?
|
42
|
+
@assessments = UpdateAssessmentsForm.new(params[:id])
|
43
|
+
else
|
44
|
+
@assessment = Assessment.find(params[:id])
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
def update
|
49
|
+
if StudyID.new(params[:id]).valid?
|
50
|
+
@assessments = UpdateAssessmentsForm.new(params[:id])
|
51
|
+
assessments.update_attributes! params[:study_engine_assessment]
|
52
|
+
else
|
53
|
+
@assessment = Assessment.find(params[:id])
|
54
|
+
assessment.update_attributes! params[:assessment].permit(:method_applied)
|
55
|
+
end
|
56
|
+
redirect_to [:admin, :assessments], notice: "Assessment has been updated!"
|
57
|
+
end
|
58
|
+
|
59
|
+
def destroy
|
60
|
+
Assessment.destroy params[:id]
|
61
|
+
redirect_to [:admin, :assessments], notice: "Assessment has been deleted!"
|
62
|
+
end
|
63
|
+
|
64
|
+
private
|
65
|
+
|
66
|
+
def study_name
|
67
|
+
StudyEngine.study_name
|
68
|
+
end
|
69
|
+
|
70
|
+
def study_url
|
71
|
+
StudyEngine.study_url
|
72
|
+
end
|
73
|
+
|
74
|
+
def events
|
75
|
+
StudyEngine.events
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|