helena 1.3.1 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (66) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +12 -7
  3. data/.travis.yml +11 -0
  4. data/Gemfile +6 -3
  5. data/Gemfile.lock +175 -188
  6. data/README.md +3 -4
  7. data/Rakefile +1 -2
  8. data/app/assets/javascripts/helena/application.js +0 -1
  9. data/app/assets/stylesheets/helena/{application.css.sass → application.scss} +0 -8
  10. data/app/controllers/helena/sessions_controller.rb +7 -1
  11. data/app/helpers/helena/application_helper.rb +18 -0
  12. data/app/models/helena/concerns/questions/validates_one_label.rb +1 -0
  13. data/app/models/helena/question.rb +1 -0
  14. data/app/models/helena/question_group.rb +8 -0
  15. data/app/models/helena/questions/static_text.rb +4 -0
  16. data/app/models/helena/session.rb +1 -19
  17. data/app/models/helena/sub_question.rb +1 -0
  18. data/app/models/helena/version.rb +4 -0
  19. data/app/views/helena/questions/_bipolar_radio_matrix.html.slim +36 -0
  20. data/app/views/helena/questions/{_checkbox_group.html.haml → _checkbox_group.html.slim} +6 -8
  21. data/app/views/helena/questions/_long_text.html.slim +9 -0
  22. data/app/views/helena/questions/{_radio_group.html.haml → _radio_group.html.slim} +5 -6
  23. data/app/views/helena/questions/_radio_matrix.html.slim +27 -0
  24. data/app/views/helena/questions/_short_text.html.slim +9 -0
  25. data/app/views/helena/questions/_static_text.html.slim +2 -4
  26. data/app/views/helena/sessions/_error_messages.html.slim +8 -0
  27. data/app/views/helena/sessions/edit.html.slim +11 -7
  28. data/app/views/helena/sessions/end_message.html.slim +1 -1
  29. data/config/locales/en.yml +13 -12
  30. data/config/locales/views/sessions/en.yml +1 -0
  31. data/gemfiles/rails_4.2.gemfile +18 -15
  32. data/gemfiles/rails_4.2.gemfile.lock +96 -117
  33. data/gemfiles/rails_5.1.gemfile +6 -3
  34. data/gemfiles/rails_5.1.gemfile.lock +127 -146
  35. data/helena.gemspec +16 -20
  36. data/lib/helena.rb +0 -3
  37. data/lib/helena/engine.rb +1 -1
  38. data/lib/helena/survey_importer.rb +4 -1
  39. data/lib/helena/version.rb +1 -1
  40. data/spec/controllers/helena/sessions_controller_spec.rb +2 -2
  41. data/spec/dummy/Rakefile +1 -1
  42. data/spec/dummy/app/views/layouts/{application.html.haml → application.html.slim} +10 -10
  43. data/spec/dummy/bin/bundle +1 -1
  44. data/spec/dummy/bin/rails +1 -1
  45. data/spec/dummy/config/application.rb +1 -2
  46. data/spec/dummy/config/boot.rb +2 -2
  47. data/spec/dummy/config/environment.rb +1 -1
  48. data/spec/factories/helena/surveys.rb +1 -1
  49. data/spec/features/helena/manage_session_spec.rb +40 -36
  50. data/spec/helpers/application_helper_spec.rb +10 -0
  51. data/spec/models/helena/session_spec.rb +1 -8
  52. data/spec/models/helena/sub_question_spec.rb +1 -1
  53. data/spec/spec_helper.rb +3 -1
  54. data/spec/support/rails_compatibility.rb +1 -1
  55. data/test_all_gemfiles.sh +7 -0
  56. metadata +72 -131
  57. data/.coveralls.yml +0 -2
  58. data/Appraisals +0 -12
  59. data/app/assets/stylesheets/helena/forms.css.sass +0 -13
  60. data/app/assets/stylesheets/helena/layout.css.sass +0 -3
  61. data/app/assets/stylesheets/helena/question_groups.css.sass +0 -4
  62. data/app/views/helena/questions/_bipolar_radio_matrix.html.haml +0 -56
  63. data/app/views/helena/questions/_long_text.html.haml +0 -8
  64. data/app/views/helena/questions/_radio_matrix.html.haml +0 -53
  65. data/app/views/helena/questions/_short_text.html.haml +0 -8
  66. data/config/initializers/simple_form_bootstrap.rb +0 -132
@@ -1,13 +0,0 @@
1
- form
2
- .error
3
- .help-inline
4
- @extend .text-danger !optional
5
- padding: 5px
6
-
7
- label.checkbox
8
- display: inline
9
- padding: 0px
10
-
11
- .form-control
12
- width: auto
13
- height: auto
@@ -1,3 +0,0 @@
1
- .container
2
- padding-bottom: 10px
3
- margin-top: 20px
@@ -1,4 +0,0 @@
1
- table.question_groups
2
-
3
- td:last-child
4
- text-align: right
@@ -1,56 +0,0 @@
1
- - label_width = "#{60 / question.labels.count}%"
2
- - mobile = (browser.device.mobile? || browser.device.tablet?) # Use a special layout for this devices
3
-
4
- .radio_matrix.form-group{ class: "#{'has-error' if errors.present?}" }
5
- %label{class: "#{'text-danger' if errors.present?}"}
6
- != question.question_text
7
- = ' *' if question.required
8
- - unless mobile
9
- .table-responsive
10
- %table.table
11
- %thead
12
- %tr
13
- %th
14
- - question.labels.each do |label|
15
- %th{ width: label_width }
16
- = label.text
17
- %th
18
-
19
- %tbody
20
- - question.sub_questions.each do |sub_question|
21
- %tr
22
- %td.text-right
23
- = sub_question.parts.first
24
- - if errors[sub_question.code]
25
- .help-block.text-danger= errors[sub_question.code]
26
- - question.labels.each do |label|
27
- - checked = answers[sub_question.code].to_s == label.value.to_s if answers[sub_question.code].present?
28
- - checked ||= (label.preselected? ? true : false)
29
- %td{ width: label_width }
30
- %label
31
- = form.simple_fields_for :answers do |answer_form|
32
- = answer_form.radio_button sub_question.code, label.value, checked: checked
33
- %span.hide-text= label.text
34
- %td
35
- = sub_question.parts.last if sub_question.splitted?
36
- - if mobile
37
- .mobile
38
- - question.sub_questions.each do |sub_question|
39
- %table.table.well
40
- %tbody
41
- %tr
42
- %td.part= sub_question.parts.first
43
- %tr
44
- %td
45
- - question.labels.each do |label|
46
- - checked = answers[sub_question.code].to_s == label.value.to_s if answers[sub_question.code].present?
47
- - checked ||= (label.preselected? ? true : false)
48
- .radio
49
- %label.responsive_label
50
- = form.simple_fields_for :answers do |answer_form|
51
- = answer_form.radio_button sub_question.code, label.value, checked: checked
52
- = label.text
53
-  
54
- - if sub_question.splitted?
55
- %tr
56
- %td.part= sub_question.parts.last
@@ -1,8 +0,0 @@
1
- .long_text.form-group{ class: "#{'has-error' if errors[question.code]}" }
2
- %label
3
- != question.question_text
4
- = ' *' if question.required
5
- = form.simple_fields_for :answers do |answer_form|
6
- = answer_form.text_area question.code, value: answers[question.code], class: 'form-control'
7
- - if errors[question.code]
8
- .help-block.text-danger= errors[question.code]
@@ -1,53 +0,0 @@
1
- - label_width = "#{80 / question.labels.count}%"
2
- - mobile = (browser.device.mobile? || browser.device.tablet?) # Use a special layout for this devices
3
-
4
- .radio_matrix.form-group{ class: "#{'has-error' if errors.present?}" }
5
- %label{class: "#{'text-danger' if errors.present?}"}
6
- != question.question_text
7
- = ' *' if question.required
8
- - unless mobile
9
- .table-responsive
10
- %table.table
11
- %thead
12
- %tr
13
- %th
14
- - question.labels.each do |label|
15
- %th{ width: label_width }
16
- = label.text
17
- %tbody
18
- - question.sub_questions.each do |sub_question|
19
- %tr
20
- %td
21
- = sub_question.parts.first
22
- - if errors[sub_question.code]
23
- .help-block.text-danger= errors[sub_question.code]
24
- - question.labels.each do |label|
25
- - checked = answers[sub_question.code].to_s == label.value.to_s if answers[sub_question.code].present?
26
- - checked ||= (label.preselected? ? true : false)
27
- %td{ width: label_width }
28
- %label
29
- = form.simple_fields_for :answers do |answer_form|
30
- = answer_form.radio_button sub_question.code, label.value, checked: checked
31
- %span.hide-text= label.text
32
-
33
- - if mobile
34
- .mobile
35
- - question.sub_questions.each do |sub_question|
36
- %table.table.well
37
- %tbody
38
- %tr
39
- %td.part= sub_question.parts.first
40
- %tr
41
- %td
42
- - question.labels.each do |label|
43
- - checked = answers[sub_question.code].to_s == label.value.to_s if answers[sub_question.code].present?
44
- - checked ||= (label.preselected? ? true : false)
45
- .radio
46
- %label.responsive_label
47
- = form.simple_fields_for :answers do |answer_form|
48
- = answer_form.radio_button sub_question.code, label.value, checked: checked
49
- = label.text
50
-  
51
- - if sub_question.splitted?
52
- %tr
53
- %td.part= sub_question.parts.last
@@ -1,8 +0,0 @@
1
- .short_text.form-group{ class: "#{'has-error' if errors[question.code]}" }
2
- %label
3
- != question.question_text
4
- = ' *' if question.required
5
- = form.simple_fields_for :answers do |answer_form|
6
- = answer_form.text_field question.code, value: answers[question.code], class: 'form-control'
7
- - if errors[question.code]
8
- .help-block.text-danger= errors[question.code]
@@ -1,132 +0,0 @@
1
- # Use this setup block to configure all options available in SimpleForm.
2
- SimpleForm.setup do |config| # rubocop:disable Metrics/BlockLength
3
- config.error_notification_class = 'alert alert-danger'
4
- config.button_class = 'btn btn-default'
5
- config.boolean_label_class = nil
6
-
7
- config.wrapper_mappings = { boolean: :vertical_boolean }
8
-
9
- config.wrappers :vertical_form, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
10
- b.use :html5
11
- b.use :placeholder
12
- b.optional :maxlength
13
- b.optional :pattern
14
- b.optional :min_max
15
- b.optional :readonly
16
- b.use :label, class: 'control-label'
17
-
18
- b.use :input, class: 'form-control'
19
- b.use :error, wrap_with: { tag: 'span', class: 'help-block' }
20
- b.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
21
- end
22
-
23
- config.wrappers :vertical_file_input, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
24
- b.use :html5
25
- b.use :placeholder
26
- b.optional :maxlength
27
- b.optional :readonly
28
- b.use :label, class: 'control-label'
29
-
30
- b.use :input
31
- b.use :error, wrap_with: { tag: 'span', class: 'help-block' }
32
- b.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
33
- end
34
-
35
- config.wrappers :vertical_boolean, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
36
- b.use :html5
37
- b.optional :readonly
38
-
39
- b.wrapper tag: 'div', class: 'checkbox' do |ba|
40
- ba.use :label_input
41
- end
42
-
43
- b.use :error, wrap_with: { tag: 'span', class: 'help-block' }
44
- b.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
45
- end
46
-
47
- config.wrappers :vertical_radio_and_checkboxes, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
48
- b.use :html5
49
- b.optional :readonly
50
- b.use :label, class: 'control-label'
51
- b.use :input
52
- b.use :error, wrap_with: { tag: 'span', class: 'help-block' }
53
- b.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
54
- end
55
-
56
- config.wrappers :horizontal_form, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
57
- b.use :html5
58
- b.use :placeholder
59
- b.optional :maxlength
60
- b.optional :pattern
61
- b.optional :min_max
62
- b.optional :readonly
63
- b.use :label, class: 'col-sm-3 control-label'
64
-
65
- b.wrapper tag: 'div', class: 'col-sm-9' do |ba|
66
- ba.use :input, class: 'form-control'
67
- ba.use :error, wrap_with: { tag: 'span', class: 'help-block' }
68
- ba.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
69
- end
70
- end
71
-
72
- config.wrappers :horizontal_file_input, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
73
- b.use :html5
74
- b.use :placeholder
75
- b.optional :maxlength
76
- b.optional :readonly
77
- b.use :label, class: 'col-sm-3 control-label'
78
-
79
- b.wrapper tag: 'div', class: 'col-sm-9' do |ba|
80
- ba.use :input
81
- ba.use :error, wrap_with: { tag: 'span', class: 'help-block' }
82
- ba.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
83
- end
84
- end
85
-
86
- config.wrappers :horizontal_boolean, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
87
- b.use :html5
88
- b.optional :readonly
89
-
90
- b.wrapper tag: 'div', class: 'col-sm-offset-3 col-sm-9' do |wr|
91
- wr.wrapper tag: 'div', class: 'checkbox' do |ba|
92
- ba.use :label_input, class: 'col-sm-9'
93
- end
94
-
95
- wr.use :error, wrap_with: { tag: 'span', class: 'help-block' }
96
- wr.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
97
- end
98
- end
99
-
100
- config.wrappers :horizontal_radio_and_checkboxes, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
101
- b.use :html5
102
- b.optional :readonly
103
-
104
- b.use :label, class: 'col-sm-3 control-label'
105
-
106
- b.wrapper tag: 'div', class: 'col-sm-9' do |ba|
107
- ba.use :input
108
- ba.use :error, wrap_with: { tag: 'span', class: 'help-block' }
109
- ba.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
110
- end
111
- end
112
-
113
- config.wrappers :inline_form, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
114
- b.use :html5
115
- b.use :placeholder
116
- b.optional :maxlength
117
- b.optional :pattern
118
- b.optional :min_max
119
- b.optional :readonly
120
- b.use :label, class: 'sr-only'
121
-
122
- b.use :input, class: 'form-control'
123
- b.use :error, wrap_with: { tag: 'span', class: 'help-block' }
124
- b.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
125
- end
126
-
127
- # Wrappers for forms and inputs using the Bootstrap toolkit.
128
- # Check the Bootstrap docs (http://getbootstrap.com)
129
- # to learn about the different styles for forms and inputs,
130
- # buttons and other elements.
131
- config.default_wrapper = :vertical_form
132
- end