helena 0.3.3 → 1.0.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (120) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +2 -4
  3. data/Gemfile +1 -2
  4. data/Gemfile.lock +88 -95
  5. data/README.md +10 -25
  6. data/app/controllers/helena/application_controller.rb +0 -10
  7. data/app/controllers/helena/sessions_controller.rb +17 -6
  8. data/app/models/helena/answer.rb +1 -2
  9. data/app/models/helena/concerns/application_model.rb +0 -9
  10. data/app/models/helena/concerns/questions/validates_one_label.rb +1 -1
  11. data/app/models/helena/question.rb +5 -5
  12. data/app/models/helena/question_group.rb +4 -3
  13. data/app/models/helena/session.rb +27 -0
  14. data/app/models/helena/survey.rb +2 -7
  15. data/app/models/helena/version.rb +6 -4
  16. data/app/views/helena/questions/_static_text.html.slim +1 -0
  17. data/app/views/helena/sessions/_progressbar.html.slim +9 -0
  18. data/app/views/helena/sessions/edit.html.slim +18 -0
  19. data/app/views/helena/sessions/{end_message.html.haml → end_message.html.slim} +1 -1
  20. data/config/locales/models/question_group/en.yml +1 -0
  21. data/config/locales/models/session/en.yml +4 -0
  22. data/config/locales/models/survey/en.yml +3 -0
  23. data/config/locales/views/sessions/en.yml +4 -0
  24. data/config/routes.rb +1 -25
  25. data/db/seeds.rb +12 -140
  26. data/db/swls_survey.en.yml +67 -0
  27. data/helena.gemspec +1 -0
  28. data/lib/helena/engine.rb +11 -0
  29. data/lib/helena/survey_importer.rb +52 -0
  30. data/lib/helena/version.rb +1 -1
  31. data/lib/helena/version_publisher.rb +34 -2
  32. data/lib/helena.rb +3 -0
  33. data/spec/controllers/helena/sessions_controller_spec.rb +8 -3
  34. data/spec/dummy/app/controllers/application_controller.rb +0 -4
  35. data/spec/factories/helena/labels.rb +0 -1
  36. data/spec/factories/helena/question_groups.rb +0 -1
  37. data/spec/factories/helena/questions.rb +0 -1
  38. data/spec/factories/helena/sub_questions.rb +0 -1
  39. data/spec/factories/helena/surveys.rb +0 -1
  40. data/spec/features/helena/manage_session_spec.rb +76 -16
  41. data/spec/lib/survey_importer_spec.rb +14 -0
  42. data/spec/lib/version_publisher_spec.rb +5 -4
  43. data/spec/models/helena/answer_spec.rb +0 -1
  44. data/spec/models/helena/question_group_spec.rb +2 -1
  45. data/spec/models/helena/question_spec.rb +12 -4
  46. data/spec/models/helena/questions/checkbox_group_spec.rb +17 -0
  47. data/spec/models/helena/questions/radio_group_spec.rb +6 -0
  48. data/spec/models/helena/questions/radio_matrix_spec.rb +7 -0
  49. data/spec/models/helena/session_spec.rb +50 -0
  50. data/spec/models/helena/survey_spec.rb +12 -1
  51. data/spec/models/helena/version_spec.rb +11 -2
  52. metadata +26 -73
  53. data/app/assets/images/helena/icons/export.svg +0 -29
  54. data/app/assets/stylesheets/helena/admin/labels.css.sass +0 -7
  55. data/app/assets/stylesheets/helena/admin/layout.css.sass +0 -6
  56. data/app/assets/stylesheets/helena/admin/question_groups.css.sass +0 -7
  57. data/app/assets/stylesheets/helena/admin/questions.css.sass +0 -9
  58. data/app/assets/stylesheets/helena/admin/sessions.css.sass +0 -5
  59. data/app/assets/stylesheets/helena/admin/subquestions.css.sass +0 -7
  60. data/app/assets/stylesheets/helena/admin/versions.css.sass +0 -9
  61. data/app/controllers/helena/admin/application_controller.rb +0 -31
  62. data/app/controllers/helena/admin/question_groups_controller.rb +0 -78
  63. data/app/controllers/helena/admin/questions/checkbox_groups_controller.rb +0 -17
  64. data/app/controllers/helena/admin/questions/checkbox_matrix_controller.rb +0 -9
  65. data/app/controllers/helena/admin/questions/long_texts_controller.rb +0 -13
  66. data/app/controllers/helena/admin/questions/radio_groups_controller.rb +0 -17
  67. data/app/controllers/helena/admin/questions/radio_matrix_controller.rb +0 -9
  68. data/app/controllers/helena/admin/questions/short_texts_controller.rb +0 -13
  69. data/app/controllers/helena/admin/questions/static_texts_controller.rb +0 -13
  70. data/app/controllers/helena/admin/questions_controller.rb +0 -105
  71. data/app/controllers/helena/admin/sessions_controller.rb +0 -35
  72. data/app/controllers/helena/admin/surveys_controller.rb +0 -78
  73. data/app/controllers/helena/admin/versions_controller.rb +0 -71
  74. data/app/controllers/helena/surveys_controller.rb +0 -11
  75. data/app/views/helena/admin/question_groups/_form.html.haml +0 -3
  76. data/app/views/helena/admin/question_groups/edit.html.haml +0 -3
  77. data/app/views/helena/admin/question_groups/index.html.haml +0 -41
  78. data/app/views/helena/admin/question_groups/new.html.haml +0 -3
  79. data/app/views/helena/admin/questions/_form.html.haml +0 -15
  80. data/app/views/helena/admin/questions/_labels.html.haml +0 -24
  81. data/app/views/helena/admin/questions/_sub_questions.html.haml +0 -32
  82. data/app/views/helena/admin/questions/edit.html.haml +0 -3
  83. data/app/views/helena/admin/questions/index.html.haml +0 -49
  84. data/app/views/helena/admin/questions/new.html.haml +0 -3
  85. data/app/views/helena/admin/sessions/index.html.haml +0 -46
  86. data/app/views/helena/admin/surveys/_form.html.haml +0 -10
  87. data/app/views/helena/admin/surveys/edit.html.haml +0 -5
  88. data/app/views/helena/admin/surveys/index.html.haml +0 -35
  89. data/app/views/helena/admin/surveys/new.html.haml +0 -3
  90. data/app/views/helena/admin/versions/_form.html.haml +0 -5
  91. data/app/views/helena/admin/versions/default_session_report.html.haml +0 -17
  92. data/app/views/helena/admin/versions/edit.html.haml +0 -3
  93. data/app/views/helena/admin/versions/index.html.haml +0 -35
  94. data/app/views/helena/admin/versions/new.html.haml +0 -3
  95. data/app/views/helena/sessions/edit.html.haml +0 -16
  96. data/app/views/helena/surveys/_survey.html.haml +0 -3
  97. data/app/views/helena/surveys/index.html.haml +0 -2
  98. data/config/locales/views/admin/question_groups/en.yml +0 -12
  99. data/config/locales/views/admin/questions/en.yml +0 -16
  100. data/config/locales/views/admin/sessions/en.yml +0 -11
  101. data/config/locales/views/admin/surveys/en.yml +0 -10
  102. data/config/locales/views/admin/versions/en.yml +0 -8
  103. data/spec/controllers/helena/admin/question_group_controller_spec.rb +0 -59
  104. data/spec/controllers/helena/admin/questions_controller_spec.rb +0 -60
  105. data/spec/controllers/helena/admin/sessions_controller_spec.rb +0 -84
  106. data/spec/controllers/helena/admin/survey_controller_spec.rb +0 -89
  107. data/spec/controllers/helena/admin/versions_controller_spec.rb +0 -19
  108. data/spec/controllers/helena/application_controller_spec.rb +0 -15
  109. data/spec/features/helena/admin/manage_question_group_spec.rb +0 -101
  110. data/spec/features/helena/admin/manage_question_spec.rb +0 -105
  111. data/spec/features/helena/admin/manage_session_spec.rb +0 -40
  112. data/spec/features/helena/admin/manage_survey_spec.rb +0 -141
  113. data/spec/features/helena/admin/manage_version_spec.rb +0 -74
  114. data/spec/features/helena/admin/question_types/manage_checkbox_group_question_spec.rb +0 -55
  115. data/spec/features/helena/admin/question_types/manage_long_text_question_spec.rb +0 -21
  116. data/spec/features/helena/admin/question_types/manage_radio_group_question_spec.rb +0 -59
  117. data/spec/features/helena/admin/question_types/manage_radio_matrix_question_spec.rb +0 -80
  118. data/spec/features/helena/admin/question_types/manage_short_text_question_spec.rb +0 -19
  119. data/spec/features/helena/admin/question_types/manage_static_text_question_spec.rb +0 -17
  120. data/spec/features/helena/manage_survey_spec.rb +0 -24
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b437c38708db1df2a9450e6f5903a50d45ab176e
4
- data.tar.gz: 7a585918bb337d3af73d2ec6cefe580880e2b994
3
+ metadata.gz: 99c25cfaf9b02dab3d017489cfee174c802b6049
4
+ data.tar.gz: 26f27f12b6d08d631418cc7e7846f5b726f53c0a
5
5
  SHA512:
6
- metadata.gz: 307348d59085becee14ac75a03707bf3c6b00d3a52b39ca33c6fe4b593bc08a975af0a365fbe95b2c6cdd65db4f63e01561c96ae7f572b2d11e21de9b25fd7ca
7
- data.tar.gz: 9528c955ea867ab92e369d8d80e480ec9ced8862cc6cde8b35b8f6dca47d64ebc242beb652cde0b8052f917740d14592446c77bf6b43150f17e80ce0c844a5e0
6
+ metadata.gz: 61ac7c30e3374da1053c12c35c05825cb7b812fdc66c5ea3118f20cce9345616c2c1e07d260eedc0dc380a04b4b5f62180c1cf54723909fe17aca6d622d1bc39
7
+ data.tar.gz: a7c729ae4775d4928e8934b4fef8fde8cc14e8fcf946522f22c8fbdb8b28d9ed4b05b3ec149f8e6326631c499b7aef39b80f90b8716f382c89fd7e024971fd4f
data/.rubocop.yml CHANGED
@@ -4,13 +4,11 @@ AllCops:
4
4
  - '**/config.ru'
5
5
  Exclude:
6
6
  - bin/**
7
- - spec/dummy/db/schema.rb
8
7
  - spec/dummy/config/initializers/secret_token.rb
9
- - db/migrate/**
10
- - db/seeds.rb
11
8
  Documentation:
12
9
  Enabled: false
13
10
  LineLength:
14
11
  Enabled: true
15
12
  Max: 160
16
-
13
+ AbcSize:
14
+ Enabled: false
data/Gemfile CHANGED
@@ -15,8 +15,7 @@ group :development, :test do
15
15
  gem 'pry'
16
16
  gem 'pry-byebug'
17
17
  gem 'ruby-progressbar'
18
- gem 'mongoid-rspec', github: 'gurix/mongoid-rspec' # TODO: replace when https://github.com/mongoid-rspec/mongoid-rspec/pull/128 is merged
19
- gem 'colorize'
18
+ gem 'mongoid-rspec', '~> 2.0.0.rc1'
20
19
  gem 'quiet_assets'
21
20
  gem 'better_errors'
22
21
  gem 'launchy'
data/Gemfile.lock CHANGED
@@ -1,16 +1,7 @@
1
- GIT
2
- remote: git://github.com/gurix/mongoid-rspec.git
3
- revision: d73b0e544f500a18444190193f942687a54e8e87
4
- specs:
5
- mongoid-rspec (2.0.0)
6
- mongoid (~> 4.0.0)
7
- rake
8
- rspec (>= 2.14)
9
-
10
1
  PATH
11
2
  remote: .
12
3
  specs:
13
- helena (0.3.3)
4
+ helena (1.0.0.rc1)
14
5
  bootstrap-sass (~> 3.2)
15
6
  breadcrumbs_on_rails (~> 2.3)
16
7
  haml-rails (~> 0.5)
@@ -22,31 +13,32 @@ PATH
22
13
  rails-i18n (~> 4.0)
23
14
  sass-rails (~> 4.0.3)
24
15
  simple_form (~> 3.1.0.rc2)
16
+ slim (~> 2.1.0)
25
17
 
26
18
  GEM
27
19
  remote: https://rubygems.org/
28
20
  specs:
29
- actionmailer (4.1.5)
30
- actionpack (= 4.1.5)
31
- actionview (= 4.1.5)
32
- mail (~> 2.5.4)
33
- actionpack (4.1.5)
34
- actionview (= 4.1.5)
35
- activesupport (= 4.1.5)
21
+ actionmailer (4.1.7)
22
+ actionpack (= 4.1.7)
23
+ actionview (= 4.1.7)
24
+ mail (~> 2.5, >= 2.5.4)
25
+ actionpack (4.1.7)
26
+ actionview (= 4.1.7)
27
+ activesupport (= 4.1.7)
36
28
  rack (~> 1.5.2)
37
29
  rack-test (~> 0.6.2)
38
- actionview (4.1.5)
39
- activesupport (= 4.1.5)
30
+ actionview (4.1.7)
31
+ activesupport (= 4.1.7)
40
32
  builder (~> 3.1)
41
33
  erubis (~> 2.7.0)
42
- activemodel (4.1.5)
43
- activesupport (= 4.1.5)
34
+ activemodel (4.1.7)
35
+ activesupport (= 4.1.7)
44
36
  builder (~> 3.1)
45
- activerecord (4.1.5)
46
- activemodel (= 4.1.5)
47
- activesupport (= 4.1.5)
37
+ activerecord (4.1.7)
38
+ activemodel (= 4.1.7)
39
+ activesupport (= 4.1.7)
48
40
  arel (~> 5.0.0)
49
- activesupport (4.1.5)
41
+ activesupport (4.1.7)
50
42
  i18n (~> 0.6, >= 0.6.9)
51
43
  json (~> 1.7, >= 1.7.7)
52
44
  minitest (~> 5.1)
@@ -60,25 +52,24 @@ GEM
60
52
  rack (>= 0.9.0)
61
53
  binding_of_caller (0.7.2)
62
54
  debug_inspector (>= 0.0.1)
63
- bootstrap-sass (3.2.0.1)
55
+ bootstrap-sass (3.3.0.1)
64
56
  sass (~> 3.2)
65
57
  breadcrumbs_on_rails (2.3.0)
66
58
  bson (2.3.0)
67
59
  builder (3.2.2)
68
- byebug (3.4.0)
60
+ byebug (3.5.1)
69
61
  columnize (~> 0.8)
70
62
  debugger-linecache (~> 1.2)
71
63
  slop (~> 3.6)
72
- capybara (2.4.1)
64
+ capybara (2.4.4)
73
65
  mime-types (>= 1.16)
74
66
  nokogiri (>= 1.3.3)
75
67
  rack (>= 1.0.0)
76
68
  rack-test (>= 0.5.4)
77
69
  xpath (~> 2.0)
78
- childprocess (0.5.3)
70
+ childprocess (0.5.5)
79
71
  ffi (~> 1.0, >= 1.0.11)
80
72
  coderay (1.1.0)
81
- colorize (0.7.3)
82
73
  columnize (0.8.9)
83
74
  connection_pool (2.0.0)
84
75
  coveralls (0.7.1)
@@ -97,13 +88,13 @@ GEM
97
88
  thread
98
89
  thread_safe
99
90
  erubis (2.7.0)
100
- factory_girl (4.4.0)
91
+ factory_girl (4.5.0)
101
92
  activesupport (>= 3.0.0)
102
- factory_girl_rails (4.4.1)
103
- factory_girl (~> 4.4.0)
93
+ factory_girl_rails (4.5.0)
94
+ factory_girl (~> 4.5.0)
104
95
  railties (>= 3.0.0)
105
96
  ffaker (1.25.0)
106
- ffi (1.9.3)
97
+ ffi (1.9.6)
107
98
  haml (4.0.5)
108
99
  tilt
109
100
  haml-rails (0.5.3)
@@ -114,7 +105,7 @@ GEM
114
105
  highline (1.6.21)
115
106
  hike (1.2.3)
116
107
  i18n (0.6.11)
117
- i18n-tasks (0.7.4)
108
+ i18n-tasks (0.7.8)
118
109
  activesupport
119
110
  easy_translate (>= 0.5.0)
120
111
  erubis
@@ -127,36 +118,38 @@ GEM
127
118
  railties (>= 3.0, < 5.0)
128
119
  thor (>= 0.14, < 2.0)
129
120
  json (1.8.1)
130
- launchy (2.4.2)
121
+ launchy (2.4.3)
131
122
  addressable (~> 2.3)
132
- mail (2.5.4)
133
- mime-types (~> 1.16)
134
- treetop (~> 1.4.8)
123
+ mail (2.6.3)
124
+ mime-types (>= 1.16, < 3)
135
125
  method_source (0.8.2)
136
- mime-types (1.25.1)
137
- mini_portile (0.6.0)
138
- minitest (5.4.1)
126
+ mime-types (2.4.3)
127
+ mini_portile (0.6.1)
128
+ minitest (5.4.2)
139
129
  mongoid (4.0.0)
140
130
  activemodel (~> 4.0)
141
131
  moped (~> 2.0.0)
142
132
  origin (~> 2.1)
143
133
  tzinfo (>= 0.3.37)
134
+ mongoid-rspec (2.0.0.rc1)
135
+ mongoid (~> 4.0.0)
136
+ rake
137
+ rspec (~> 3.0)
144
138
  mongoid-simple-tags (0.1.3)
145
139
  json (~> 1.8)
146
140
  mongoid (>= 3.0.3)
147
141
  mongoid_orderable (4.1.0)
148
142
  mongoid
149
- moped (2.0.0)
143
+ moped (2.0.1)
150
144
  bson (~> 2.2)
151
145
  connection_pool (~> 2.0)
152
146
  optionable (~> 0.2.0)
153
147
  multi_json (1.10.1)
154
- netrc (0.7.7)
155
- nokogiri (1.6.3.1)
156
- mini_portile (= 0.6.0)
148
+ netrc (0.8.0)
149
+ nokogiri (1.6.4.1)
150
+ mini_portile (~> 0.6.0)
157
151
  optionable (0.2.0)
158
152
  origin (2.1.1)
159
- polyglot (0.3.5)
160
153
  pry (0.10.1)
161
154
  coderay (~> 1.1.0)
162
155
  method_source (~> 0.8.1)
@@ -169,81 +162,85 @@ GEM
169
162
  rack (1.5.2)
170
163
  rack-test (0.6.2)
171
164
  rack (>= 1.0)
172
- rails (4.1.5)
173
- actionmailer (= 4.1.5)
174
- actionpack (= 4.1.5)
175
- actionview (= 4.1.5)
176
- activemodel (= 4.1.5)
177
- activerecord (= 4.1.5)
178
- activesupport (= 4.1.5)
165
+ rails (4.1.7)
166
+ actionmailer (= 4.1.7)
167
+ actionpack (= 4.1.7)
168
+ actionview (= 4.1.7)
169
+ activemodel (= 4.1.7)
170
+ activerecord (= 4.1.7)
171
+ activesupport (= 4.1.7)
179
172
  bundler (>= 1.3.0, < 2.0)
180
- railties (= 4.1.5)
173
+ railties (= 4.1.7)
181
174
  sprockets-rails (~> 2.0)
182
- rails-i18n (4.0.2)
175
+ rails-i18n (4.0.3)
183
176
  i18n (~> 0.6)
184
- rails (>= 4.0)
185
- railties (4.1.5)
186
- actionpack (= 4.1.5)
187
- activesupport (= 4.1.5)
177
+ railties (~> 4.0)
178
+ railties (4.1.7)
179
+ actionpack (= 4.1.7)
180
+ activesupport (= 4.1.7)
188
181
  rake (>= 0.8.7)
189
182
  thor (>= 0.18.1, < 2.0)
190
183
  rake (10.3.2)
191
184
  rest-client (1.7.2)
192
185
  mime-types (>= 1.16, < 3.0)
193
186
  netrc (~> 0.7)
194
- rspec (3.0.0)
195
- rspec-core (~> 3.0.0)
196
- rspec-expectations (~> 3.0.0)
197
- rspec-mocks (~> 3.0.0)
187
+ rspec (3.1.0)
188
+ rspec-core (~> 3.1.0)
189
+ rspec-expectations (~> 3.1.0)
190
+ rspec-mocks (~> 3.1.0)
198
191
  rspec-collection_matchers (1.0.0)
199
192
  rspec-expectations (>= 2.99.0.beta1)
200
- rspec-core (3.0.4)
201
- rspec-support (~> 3.0.0)
202
- rspec-expectations (3.0.4)
193
+ rspec-core (3.1.7)
194
+ rspec-support (~> 3.1.0)
195
+ rspec-expectations (3.1.2)
203
196
  diff-lcs (>= 1.2.0, < 2.0)
204
- rspec-support (~> 3.0.0)
205
- rspec-mocks (3.0.4)
206
- rspec-support (~> 3.0.0)
207
- rspec-rails (3.0.2)
197
+ rspec-support (~> 3.1.0)
198
+ rspec-mocks (3.1.3)
199
+ rspec-support (~> 3.1.0)
200
+ rspec-rails (3.1.0)
208
201
  actionpack (>= 3.0)
209
202
  activesupport (>= 3.0)
210
203
  railties (>= 3.0)
211
- rspec-core (~> 3.0.0)
212
- rspec-expectations (~> 3.0.0)
213
- rspec-mocks (~> 3.0.0)
214
- rspec-support (~> 3.0.0)
215
- rspec-support (3.0.4)
216
- ruby-progressbar (1.5.1)
204
+ rspec-core (~> 3.1.0)
205
+ rspec-expectations (~> 3.1.0)
206
+ rspec-mocks (~> 3.1.0)
207
+ rspec-support (~> 3.1.0)
208
+ rspec-support (3.1.2)
209
+ ruby-progressbar (1.7.0)
217
210
  rubyzip (1.1.6)
218
211
  sass (3.2.19)
219
- sass-rails (4.0.3)
212
+ sass-rails (4.0.4)
220
213
  railties (>= 4.0.0, < 5.0)
221
- sass (~> 3.2.0)
222
- sprockets (~> 2.8, <= 2.11.0)
214
+ sass (~> 3.2.2)
215
+ sprockets (~> 2.8, < 2.12)
223
216
  sprockets-rails (~> 2.0)
224
- selenium-webdriver (2.42.0)
225
- childprocess (>= 0.5.0)
217
+ selenium-webdriver (2.44.0)
218
+ childprocess (~> 0.5)
226
219
  multi_json (~> 1.0)
227
220
  rubyzip (~> 1.0)
228
- websocket (~> 1.0.4)
221
+ websocket (~> 1.0)
229
222
  simple_form (3.1.0.rc2)
230
223
  actionpack (~> 4.0)
231
224
  activemodel (~> 4.0)
232
- simplecov (0.9.0)
225
+ simplecov (0.9.1)
233
226
  docile (~> 1.1.0)
234
- multi_json
227
+ multi_json (~> 1.0)
235
228
  simplecov-html (~> 0.8.0)
236
229
  simplecov-html (0.8.0)
230
+ slim (2.1.0)
231
+ temple (~> 0.6.9)
232
+ tilt (>= 1.3.3, < 2.1)
237
233
  slop (3.6.0)
238
- sprockets (2.11.0)
234
+ sprockets (2.11.3)
239
235
  hike (~> 1.2)
240
236
  multi_json (~> 1.0)
241
237
  rack (~> 1.0)
242
238
  tilt (~> 1.1, != 1.3.0)
243
- sprockets-rails (2.1.3)
239
+ sprockets-rails (2.2.0)
244
240
  actionpack (>= 3.0)
245
241
  activesupport (>= 3.0)
246
- sprockets (~> 2.8)
242
+ sprockets (>= 2.8, < 4.0)
243
+ temple (0.6.10)
247
244
  term-ansicolor (1.3.0)
248
245
  tins (~> 1.0)
249
246
  terminal-table (1.4.5)
@@ -251,13 +248,10 @@ GEM
251
248
  thread (0.1.4)
252
249
  thread_safe (0.3.4)
253
250
  tilt (1.4.1)
254
- tins (1.3.2)
255
- treetop (1.4.15)
256
- polyglot
257
- polyglot (>= 0.3.1)
251
+ tins (1.3.3)
258
252
  tzinfo (1.2.2)
259
253
  thread_safe (~> 0.1)
260
- websocket (1.0.7)
254
+ websocket (1.2.1)
261
255
  xpath (2.0.0)
262
256
  nokogiri (~> 1.3)
263
257
 
@@ -270,7 +264,6 @@ DEPENDENCIES
270
264
  bootstrap-sass
271
265
  breadcrumbs_on_rails
272
266
  capybara (~> 2.3)
273
- colorize
274
267
  coveralls
275
268
  database_cleaner (~> 1.3)
276
269
  factory_girl_rails (~> 4.4)
@@ -279,7 +272,7 @@ DEPENDENCIES
279
272
  i18n-tasks
280
273
  jquery-rails
281
274
  launchy
282
- mongoid-rspec!
275
+ mongoid-rspec (~> 2.0.0.rc1)
283
276
  pry
284
277
  pry-byebug
285
278
  quiet_assets
data/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  [![Build Status](https://img.shields.io/travis/gurix/helena/master.svg?style=flat)](https://travis-ci.org/gurix/helena)
2
2
  [![Code Climate](https://img.shields.io/codeclimate/github/gurix/helena.svg?style=flat)](https://codeclimate.com/github/gurix/helena)
3
3
  [![Dependency Status](https://img.shields.io/gemnasium/gurix/helena.svg?style=flat)](https://gemnasium.com/gurix/helena)
4
+ [![Dependency Status](https://img.shields.io/gem/v/helena.svg?style=flat)](https://rubygems.org/gems/helena)
5
+ [![Gitter](https://badges.gitter.im/Join Chat.svg)](https://gitter.im/gurix/helena?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
4
6
  # Helena
5
7
  Helena is an online survey/test framework designed for agile survey/test development, longitudinal studies and instant feedback.
6
8
 
@@ -10,7 +12,7 @@ Demo: http://helena-demo.herokuapp.com (https://github.com/gurix/helena-demo)
10
12
  ## Requirements
11
13
  * Rails (4.1 or higher)
12
14
  * Mongoid (4.0.0 or higher)
13
- * MongoDB 2.4.10 (2.6 does not work atm because of an intolerance with mongoid https://github.com/mongoid/mongoid/issues/3611)
15
+ * MongoDB (2.4.10 or higher)
14
16
 
15
17
  ## Installation
16
18
  Add this line to your application's Gemfile:
@@ -27,35 +29,12 @@ Add this line to your routes will and you will be good to go!
27
29
 
28
30
  mount Helena::Engine => '/helena'
29
31
 
30
- All helena controllers inherit from your `ApplicationController`. So define the `can_administer?` method in your `ApplicationController`. `can_administer?` determines whether current user can create/update survey questions.
31
-
32
- Typical implementation would be:
33
-
34
- ```ruby
35
- class ApplicationController < ActionController::Base
36
- def current_user
37
- @current_user ||= User.find(session[:user_id])
38
- end
39
-
40
- def can_administer?
41
- current_user.try(:admin?)
42
- end
43
- end
44
- ```
32
+ Since Version 1.0 the admin interface is no longer a part of the gem and was extracted to http://github.com/gurix/helena-admin.
45
33
 
46
34
  ## TODOS
47
35
  * Support more question types, i.e Dates, Numeric inputs with validation, emails, ...
48
36
  * Customize question type views for each survey
49
- * Better admininterface with much better usability
50
-
51
- ## Dummy site for development
52
37
 
53
- ```
54
- rake -f spec/dummy/Rakefile db:seed
55
- cd spec/dummy
56
- rails s
57
- open http://localhost:3000/helena/admin/surveys
58
- ```
59
38
  ## Contributing
60
39
 
61
40
  1. Fork it
@@ -64,6 +43,12 @@ open http://localhost:3000/helena/admin/surveys
64
43
  4. Push to the branch (`git push origin my-new-feature`)
65
44
  5. Create new Pull Request
66
45
 
46
+ ## Contact
47
+
48
+ [info@markusgraf.ch](mailto: info@markusgraf.ch)
49
+
50
+ Or at [#HelenaFramework](irc://chat.freenode.net/HelenaFramework) on freenode.net
51
+
67
52
  ## Support
68
53
 
69
54
  If you like helena and want to support the development, I would appreciate a donation:
@@ -1,15 +1,5 @@
1
1
  module Helena
2
2
  class ApplicationController < ::ApplicationController
3
3
  helper Helena::Engine.helpers
4
-
5
- helper_method :can_administer?
6
-
7
- def authenticate_administrator
8
- fail(ActionController::RoutingError, 'Access Denied') unless can_administer?
9
- end
10
-
11
- def add_breadcrumb(name, path = nil, options = {})
12
- super(name.presence || t('shared.untitled'), path, options)
13
- end
14
4
  end
15
5
  end
@@ -3,6 +3,7 @@ module Helena
3
3
  respond_to :html
4
4
 
5
5
  before_filter :load_session, only: [:edit, :update]
6
+ after_filter :update_last_question_group_id, only: :update
6
7
 
7
8
  def show
8
9
  @session = Helena::Session.find_by view_token: params[:token]
@@ -11,7 +12,7 @@ module Helena
11
12
  @question_group = question_group
12
13
 
13
14
  respond_to do |format|
14
- format.html { render html: @version.session_report.html_safe, layout: true }
15
+ format.html { render html: session_report }
15
16
  format.json { render json: @session }
16
17
  end
17
18
  end
@@ -46,8 +47,9 @@ module Helena
46
47
  end
47
48
 
48
49
  def question_group
49
- if params[:question_group]
50
- @version.question_groups.find params[:question_group]
50
+ question_group_id = params[:question_group] || @session.last_question_group_id
51
+ if question_group_id
52
+ @version.question_groups.find question_group_id
51
53
  else
52
54
  @version.question_groups.asc(:position).first
53
55
  end
@@ -67,15 +69,16 @@ module Helena
67
69
  end
68
70
 
69
71
  def update_answers
72
+ return session_answers unless session_params
73
+
70
74
  @question_group.question_codes.each do |question_code|
71
75
  @session.answers.where(code: question_code).delete
72
76
 
73
- value = session_params[:answers][question_code] if session_params
77
+ value = session_params[:answers][question_code]
74
78
 
75
79
  next if value.blank?
76
80
 
77
- answer = Helena::Answer.build_generic(question_code, value, request.remote_ip)
78
- @session.answers << answer
81
+ @session.answers << Helena::Answer.build_generic(question_code, value, request.remote_ip)
79
82
  end
80
83
  session_answers
81
84
  end
@@ -89,5 +92,13 @@ module Helena
89
92
  end
90
93
  errors
91
94
  end
95
+
96
+ def session_report
97
+ Slim::Template.new { @version.session_report }.render.html_safe if @version.session_report
98
+ end
99
+
100
+ def update_last_question_group_id
101
+ @session.update_attribute :last_question_group_id, @question_group.id
102
+ end
92
103
  end
93
104
  end
@@ -8,8 +8,7 @@ module Helena
8
8
 
9
9
  embedded_in :session, inverse_of: :answers
10
10
 
11
- validates :code, :ip_address, presence: true
12
- validates :code, uniqueness: true
11
+ validates :code, presence: true, uniqueness: true
13
12
 
14
13
  def self.build_generic(code, value, ip_address)
15
14
  value = cast_value(value)
@@ -5,15 +5,6 @@ module Helena
5
5
 
6
6
  include Mongoid::Document
7
7
  include Mongoid::Timestamps
8
-
9
- included do
10
- before_destroy :removable?
11
-
12
- # Removable is given by default. Override for custom behaviour
13
- def removable?
14
- true
15
- end
16
- end
17
8
  end
18
9
  end
19
10
  end
@@ -14,7 +14,7 @@ module Helena
14
14
  selected_labels = labels.select { |label| label.preselected == true }
15
15
  return if selected_labels.size <= 1
16
16
  selected_labels.each { |label| label.errors.add(:preselected, I18n.t(:taken, scope: 'activerecord.errors.messages')) }
17
- errors.add(:labels, I18n.t('helena.admin.radio_group.only_one_preselection_allowed'))
17
+ errors.add(:labels, I18n.t('helena.admin.radio_group.only_one_preselection_allowed')) # TODO: How to manage this translation?
18
18
  end
19
19
  end
20
20
  end
@@ -14,7 +14,7 @@ module Helena
14
14
  Helena::Questions::RadioMatrix
15
15
  ]
16
16
 
17
- embedded_in :question_group, inverse_of: :questions
17
+ belongs_to :question_group, inverse_of: :questions
18
18
 
19
19
  embeds_many :labels, class_name: 'Helena::Label'
20
20
  embeds_many :sub_questions, class_name: 'Helena::SubQuestion'
@@ -25,7 +25,7 @@ module Helena
25
25
  field :code, type: String
26
26
  field :question_text, type: String
27
27
 
28
- orderable
28
+ orderable scope: :question_group
29
29
 
30
30
  validates :code, presence: true
31
31
 
@@ -51,13 +51,13 @@ module Helena
51
51
 
52
52
  def reject_labels(attributed)
53
53
  attributed['text'].blank? &&
54
- attributed['value'].blank?
54
+ attributed['value'].blank?
55
55
  end
56
56
 
57
57
  def reject_sub_questions(attributed)
58
58
  attributed['code'].blank? &&
59
- attributed['default_value'].blank? &&
60
- attributed['question_text'].blank?
59
+ attributed['default_value'].blank? &&
60
+ attributed['question_text'].blank?
61
61
  end
62
62
  end
63
63
  end
@@ -3,13 +3,14 @@ module Helena
3
3
  include Helena::Concerns::ApplicationModel
4
4
  include Mongoid::Orderable
5
5
 
6
- embedded_in :version
6
+ belongs_to :version
7
7
 
8
- embeds_many :questions, class_name: 'Helena::Question'
8
+ has_many :questions, inverse_of: :question_group, class_name: 'Helena::Question', dependent: :destroy
9
9
 
10
- orderable
10
+ orderable scope: :version
11
11
 
12
12
  field :title, type: String
13
+ field :allow_to_go_back, type: Boolean
13
14
 
14
15
  def question_codes
15
16
  questions.map { |question| [question.code] + question.sub_questions.map(&:code) }.flatten
@@ -5,6 +5,7 @@ module Helena
5
5
  field :token, type: String
6
6
  field :view_token, type: String
7
7
  field :completed, type: Boolean, default: false
8
+ field :last_question_group_id, type: BSON::ObjectId
8
9
 
9
10
  belongs_to :survey, inverse_of: :sessions, class_name: 'Helena::Survey'
10
11
  belongs_to :version, inverse_of: :sessions, class_name: 'Helena::Version'
@@ -15,6 +16,16 @@ module Helena
15
16
 
16
17
  before_create :reset_tokens
17
18
 
19
+ def answers_as_yaml
20
+ Hash[answers.map { | answer | [answer.code, answer.value] }.sort].to_yaml
21
+ end
22
+
23
+ def answers_as_yaml=(yaml)
24
+ parsed_answers = YAML.load yaml
25
+ update_answers parsed_answers
26
+ remove_unparsed_answers parsed_answers
27
+ end
28
+
18
29
  def reset_tokens
19
30
  # NOTE: there are (2*26+10)^k tokens available
20
31
  # To not run into performance issues we could pregenerate unique tokens in the future
@@ -72,5 +83,21 @@ module Helena
72
83
  def unique_token_for?(field = :token)
73
84
  self.class.where(field => send(field)).blank? && send(field).present?
74
85
  end
86
+
87
+ def update_answers(parsed_answers)
88
+ parsed_answers.each do | code, value |
89
+ answer = answers.where(code: code).first
90
+ if answer
91
+ next if answer.value == value
92
+ answer.delete
93
+ end
94
+ answers << Helena::Answer.build_generic(code, value, '')
95
+ end
96
+ end
97
+
98
+ def remove_unparsed_answers(parsed_answers)
99
+ unparsed_answers = answers.map(&:code) - parsed_answers.keys
100
+ answers.in(code: unparsed_answers).destroy
101
+ end
75
102
  end
76
103
  end
@@ -8,9 +8,8 @@ module Helena
8
8
 
9
9
  field :name, type: String
10
10
  field :language, type: String
11
- field :description, type: String
12
11
 
13
- embeds_many :versions, inverse_of: :survey, class_name: 'Helena::Version'
12
+ has_many :versions, inverse_of: :survey, dependent: :destroy, class_name: 'Helena::Version'
14
13
  has_many :sessions, inverse_of: :survey, dependent: :destroy, class_name: 'Helena::Session'
15
14
 
16
15
  accepts_nested_attributes_for :versions
@@ -18,12 +17,8 @@ module Helena
18
17
  validates :name, presence: true, uniqueness: true
19
18
  validates :language, presence: true
20
19
 
21
- def draft_version
22
- versions.find_by version: 0
23
- end
24
-
25
20
  def newest_version
26
- versions.find_by version: versions.max(:version)
21
+ versions.find_by version: versions.max(:version) if versions.any?
27
22
  end
28
23
  end
29
24
  end