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
@@ -1,80 +0,0 @@
1
- require 'spec_helper'
2
-
3
- feature 'Radio matrix question management' do
4
- let!(:draft_version) { create :version, survey: create(:survey), version: 0 }
5
- let!(:question_group) { create(:question_group, version: draft_version) }
6
-
7
- scenario 'edits a question' do
8
- question = create :radio_matrix_question, question_group: question_group
9
- question.labels.create text: 'Strongly disagree', value: '-1', position: 1
10
- question.sub_questions.create code: 'aperto', text: 'Aperto Snacks', value: 'Aperto', position: 1
11
-
12
- visit helena.edit_admin_survey_question_group_question_path(draft_version.survey, question.question_group, question)
13
-
14
- check 'Required'
15
-
16
- fill_in 'questions_radio_matrix_labels_attributes_0_position', with: '2'
17
- fill_in 'questions_radio_matrix_labels_attributes_0_text', with: 'Strongly agree'
18
- fill_in 'questions_radio_matrix_labels_attributes_0_value', with: '1'
19
- check 'questions_radio_matrix_labels_attributes_0_preselected'
20
-
21
- fill_in 'questions_radio_matrix_sub_questions_attributes_0_position', with: '2'
22
- fill_in 'questions_radio_matrix_sub_questions_attributes_0_text', with: 'Avec Shop'
23
- fill_in 'questions_radio_matrix_sub_questions_attributes_0_code', with: 'avec'
24
-
25
- click_button 'Save'
26
-
27
- expect(question.reload.labels.first.position).to eq 2
28
- expect(question.reload.labels.first.text).to eq 'Strongly agree'
29
- expect(question.reload.labels.first.value).to eq '1'
30
- expect(question.reload.labels.first.preselected).to eq true
31
-
32
- expect(question.reload.sub_questions.first.position).to eq 2
33
- expect(question.reload.sub_questions.first.text).to eq 'Avec Shop'
34
- expect(question.reload.sub_questions.first.code).to eq 'avec'
35
-
36
- expect(question.reload.required).to eq true
37
- end
38
-
39
- scenario 'adds a an option' do
40
- question = create :radio_matrix_question, question_group: question_group
41
-
42
- visit helena.edit_admin_survey_question_group_questions_radio_matrix_path(draft_version.survey, question.question_group, question)
43
-
44
- fill_in 'questions_radio_matrix_labels_attributes_0_position', with: '2'
45
- fill_in 'questions_radio_matrix_labels_attributes_0_text', with: 'Strongly agree'
46
- fill_in 'questions_radio_matrix_labels_attributes_0_value', with: '1'
47
- check 'questions_radio_matrix_labels_attributes_0_preselected'
48
-
49
- fill_in 'questions_radio_matrix_sub_questions_attributes_0_position', with: '2'
50
- fill_in 'questions_radio_matrix_sub_questions_attributes_0_text', with: 'Avec Shop'
51
- fill_in 'questions_radio_matrix_sub_questions_attributes_0_code', with: 'avec'
52
-
53
- click_button 'Save'
54
-
55
- expect(question.reload.labels.first.position).to eq 2
56
- expect(question.reload.labels.first.text).to eq 'Strongly agree'
57
- expect(question.reload.labels.first.value).to eq '1'
58
- expect(question.reload.labels.first.preselected).to eq true
59
-
60
- expect(question.reload.sub_questions.first.position).to eq 2
61
- expect(question.reload.sub_questions.first.text).to eq 'Avec Shop'
62
- expect(question.reload.sub_questions.first.code).to eq 'avec'
63
- end
64
-
65
- scenario 'removes an option' do
66
- question = create :radio_matrix_question, question_group: question_group
67
- question.labels.create text: 'Male', value: 'm', position: 1
68
- question.sub_questions.create code: 'aperto', text: 'Aperto Snacks', value: 'Aperto', position: 1
69
-
70
- visit helena.edit_admin_survey_question_group_questions_radio_matrix_path(draft_version.survey, question.question_group, question)
71
-
72
- check 'questions_radio_matrix_labels_attributes_0__destroy'
73
- check 'questions_radio_matrix_sub_questions_attributes_0__destroy'
74
-
75
- click_button 'Save'
76
-
77
- expect(question.reload.labels).to be_empty
78
- expect(question.reload.sub_questions).to be_empty
79
- end
80
- end
@@ -1,19 +0,0 @@
1
- require 'spec_helper'
2
-
3
- feature 'Short text question management' do
4
- let!(:draft_version) { create :version, survey: create(:survey), version: 0 }
5
-
6
- scenario 'edits a question' do
7
- question = create :short_text_question, question_group: create(:question_group, version: draft_version)
8
-
9
- visit helena.edit_admin_survey_question_group_question_path(question.question_group.version.survey, question.question_group, question)
10
-
11
- fill_in 'Default value', with: 'Hey Hey!'
12
- check 'Required'
13
-
14
- click_button 'Save'
15
-
16
- expect(question.reload.default_value).to eq 'Hey Hey!'
17
- expect(question.reload.required).to eq true
18
- end
19
- end
@@ -1,17 +0,0 @@
1
- require 'spec_helper'
2
-
3
- feature 'Static text question management' do
4
- let!(:draft_version) { create :version, survey: create(:survey), version: 0 }
5
-
6
- scenario 'edits a question' do
7
- question = create :static_text_question, question_group: create(:question_group, version: draft_version)
8
-
9
- visit helena.edit_admin_survey_question_group_question_path(draft_version.survey, question.question_group, question)
10
-
11
- fill_in 'Static text', with: 'This text will be displayed instead of an input'
12
-
13
- click_button 'Save'
14
-
15
- expect(question.reload.default_value).to eq 'This text will be displayed instead of an input'
16
- end
17
- end
@@ -1,24 +0,0 @@
1
- require 'spec_helper'
2
-
3
- feature 'Survey management' do
4
- scenario 'lists all surveys' do
5
- first_survey = create :survey, name: 'first'
6
- first_survey.versions.create version: 0
7
- first_survey.versions.first.survey_detail = Helena::SurveyDetail.new(title: 'My first survey', description: 'I am very proud of it')
8
- second_survey = create :survey, name: 'second'
9
- second_survey.versions.create version: 0
10
- second_survey.versions.first.survey_detail = Helena::SurveyDetail.new(title: 'Another cool survey', description: 'Everybody likes it')
11
-
12
- visit helena.surveys_path
13
-
14
- within "#helena_#{dom_id first_survey}" do
15
- expect(page).to have_text 'My first survey'
16
- expect(page).to have_text 'I am very proud of it'
17
- end
18
-
19
- within "#helena_#{dom_id second_survey}" do
20
- expect(page).to have_text 'Another cool survey'
21
- expect(page).to have_text 'Everybody likes it'
22
- end
23
- end
24
- end