surveyor 1.2.0 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (93) hide show
  1. data/CHANGELOG.md +26 -0
  2. data/README.md +67 -168
  3. data/app/models/survey_translation.rb +5 -0
  4. data/app/views/partials/_answer.html.haml +9 -5
  5. data/app/views/partials/_question.html.haml +3 -3
  6. data/app/views/partials/_question_group.html.haml +9 -8
  7. data/app/views/partials/_section.html.haml +1 -1
  8. data/app/views/surveyor/edit.html.haml +3 -3
  9. data/app/views/surveyor/export.json.rabl +12 -8
  10. data/app/views/surveyor/new.html.haml +9 -14
  11. data/app/views/surveyor/show.html.haml +2 -2
  12. data/doc/surveyor_models.png +0 -0
  13. data/doc/surveyor_models2.png +0 -0
  14. data/features/export_to_json.feature +97 -1
  15. data/features/internationalization.feature +55 -0
  16. data/features/step_definitions/parser_steps.rb +7 -0
  17. data/features/step_definitions/surveyor_steps.rb +43 -6
  18. data/features/step_definitions/ui_steps.rb +22 -0
  19. data/features/support/env.rb +2 -0
  20. data/features/support/hooks.rb +4 -0
  21. data/features/surveyor.feature +117 -1
  22. data/features/surveyor_dependencies.feature +56 -2
  23. data/features/surveyor_parser.feature +10 -10
  24. data/lib/assets/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  25. data/lib/assets/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
  26. data/lib/assets/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
  27. data/lib/assets/images/ui-bg_glass_75_dadada_1x400.png +0 -0
  28. data/lib/assets/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  29. data/lib/assets/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  30. data/lib/assets/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
  31. data/lib/assets/images/{ui-icons_ef8c08_256x240.png → ui-icons_222222_256x240.png} +0 -0
  32. data/lib/assets/images/ui-icons_2e83ff_256x240.png +0 -0
  33. data/lib/assets/images/{ui-icons_ffffff_256x240.png → ui-icons_454545_256x240.png} +0 -0
  34. data/lib/assets/images/ui-icons_888888_256x240.png +0 -0
  35. data/lib/assets/images/ui-icons_cd0a0a_256x240.png +0 -0
  36. data/lib/assets/javascripts/surveyor/jquery-1.9.0.js +9555 -0
  37. data/lib/assets/javascripts/surveyor/jquery-ui-1.10.0.custom.js +14850 -0
  38. data/lib/assets/javascripts/surveyor/jquery-ui-timepicker-addon.js +1795 -1153
  39. data/lib/assets/javascripts/surveyor/jquery.maskedinput.js +338 -0
  40. data/lib/assets/javascripts/surveyor/jquery.surveyor.js +8 -0
  41. data/lib/assets/stylesheets/surveyor.sass +2 -2
  42. data/lib/assets/stylesheets/surveyor/jquery-ui-1.10.0.custom.css +1174 -0
  43. data/lib/assets/stylesheets/surveyor/jquery-ui-timepicker-addon.css +7 -2
  44. data/lib/assets/stylesheets/surveyor/reset.css +24 -26
  45. data/lib/generators/surveyor/install_generator.rb +4 -0
  46. data/lib/generators/surveyor/templates/app/assets/javascripts/surveyor_all.js +4 -3
  47. data/lib/generators/surveyor/templates/app/assets/stylesheets/surveyor_all.css +2 -2
  48. data/lib/generators/surveyor/templates/config/locales/surveyor_en.yml +1 -0
  49. data/lib/generators/surveyor/templates/config/locales/surveyor_he.yml +1 -1
  50. data/lib/generators/surveyor/templates/config/locales/surveyor_ko.yml +18 -0
  51. data/lib/generators/surveyor/templates/db/migrate/add_input_mask_attributes_to_answer.rb +12 -0
  52. data/lib/generators/surveyor/templates/db/migrate/create_survey_translations.rb +19 -0
  53. data/lib/generators/surveyor/templates/surveys/kitchen_sink_survey.rb +5 -0
  54. data/lib/generators/surveyor/templates/surveys/languages.rb +10 -0
  55. data/lib/generators/surveyor/templates/surveys/translations/languages.es.yml +14 -0
  56. data/lib/generators/surveyor/templates/surveys/translations/languages.he.yml +14 -0
  57. data/lib/generators/surveyor/templates/surveys/translations/languages.ko.yml +14 -0
  58. data/lib/surveyor/helpers/formtastic_custom_input.rb +4 -8
  59. data/lib/surveyor/helpers/surveyor_helper_methods.rb +22 -26
  60. data/lib/surveyor/models/answer_methods.rb +41 -10
  61. data/lib/surveyor/models/question_group_methods.rb +17 -3
  62. data/lib/surveyor/models/question_methods.rb +32 -5
  63. data/lib/surveyor/models/response_methods.rb +7 -7
  64. data/lib/surveyor/models/survey_methods.rb +20 -4
  65. data/lib/surveyor/models/survey_section_methods.rb +10 -5
  66. data/lib/surveyor/models/survey_translation_methods.rb +33 -0
  67. data/lib/surveyor/mustache_context.rb +11 -0
  68. data/lib/surveyor/parser.rb +15 -2
  69. data/lib/surveyor/surveyor_controller_methods.rb +19 -17
  70. data/lib/surveyor/version.rb +1 -1
  71. data/spec/controllers/surveyor_controller_spec.rb +3 -3
  72. data/spec/factories.rb +21 -7
  73. data/spec/helpers/formtastic_custom_input_spec.rb +2 -3
  74. data/spec/helpers/surveyor_helper_spec.rb +64 -100
  75. data/spec/models/answer_spec.rb +166 -58
  76. data/spec/models/question_group_spec.rb +84 -38
  77. data/spec/models/question_spec.rb +188 -116
  78. data/spec/models/survey_section_spec.rb +77 -40
  79. data/spec/models/survey_spec.rb +176 -145
  80. data/spec/spec_helper.rb +3 -0
  81. data/stacktests.sh +52 -0
  82. metadata +36 -18
  83. data/lib/assets/images/ui-bg_glass_100_f6f6f6_1x400.png +0 -0
  84. data/lib/assets/images/ui-bg_glass_100_fdf5ce_1x400.png +0 -0
  85. data/lib/assets/images/ui-bg_gloss-wave_35_f6a828_500x100.png +0 -0
  86. data/lib/assets/images/ui-bg_highlight-soft_100_eeeeee_1x100.png +0 -0
  87. data/lib/assets/images/ui-bg_highlight-soft_75_ffe45c_1x100.png +0 -0
  88. data/lib/assets/javascripts/surveyor/jquery-ui.js +0 -11729
  89. data/lib/assets/javascripts/surveyor/jquery.tools.min.js +0 -204
  90. data/lib/assets/stylesheets/surveyor/dateinput.css +0 -149
  91. data/lib/assets/stylesheets/surveyor/jquery-ui.custom.css +0 -572
  92. data/lib/surveyor/render_text.rb +0 -23
  93. data/lib/surveyor/surveyor_admin_controller_methods.rb +0 -55
data/CHANGELOG.md CHANGED
@@ -1,6 +1,32 @@
1
1
  History for Surveyor
2
2
  ====================
3
3
 
4
+ 1.3.0
5
+ -----
6
+
7
+ ### Features
8
+
9
+ - Upgrade to jQuery UI 1.10.0, jQuery 1.9.0, jQueryUI timepicker addons 1.2, and remove jQuery tools (#409)
10
+ - Upgrade reset css
11
+ - Added surveyor_translations table to support YAML-based localizations of surveys. (#420)
12
+ - Add extension point for pre-JSON-export survey modifications (#416)
13
+ - Add input mask for text entry fields (#415)
14
+
15
+ ### Fixes
16
+
17
+ - Export null when datetime response has null datetime value
18
+ - Move the help text to be after the answer text (#401)
19
+ - Fix response serialization for date pick one answers (#400)
20
+ - Remove ordering default scope on survey section methods (#417, #290)
21
+ - Answers of labels should not be shown, within or without groups (#304)
22
+ - Inline group questions should display inline (#303)
23
+ - Evaluate all submitted questions for depdencies (#396)
24
+ - Pick one answers with dates should display their dates correctly (#378)
25
+
26
+ ### Infrastructure
27
+
28
+ - Added stacktests.sh shell script for testing different stacks
29
+
4
30
  1.2.0
5
31
  -----
6
32
 
data/README.md CHANGED
@@ -1,240 +1,137 @@
1
- # Surveys On Rails
1
+ ## Why surveyor?
2
2
 
3
- Surveyor is a developer tool that brings surveys into Rails
4
- applications. Surveys are written in the Surveyor DSL (Domain Specific
5
- Language). Internally, Surveyor is a Rails engine distributed as a
6
- ruby gem, meaning it is straightforward to override or extend its
7
- behaviors in your Rails app without maintaining a fork.
3
+ Surveyor is a developer tool to deliver surveys in Rails applications.
4
+ Surveys are written in the surveyor DSL (Domain Specific
5
+ Language). A DSL makes it significantly easier to import long surveys
6
+ (one of the motivations for building surveyor was copy/paste fatigue).
7
+ It enables non-programmers to write out, edit, and review surveys.
8
8
 
9
- ## Why you might want to use Surveyor
9
+ If your Rails app needs to asks users questions as part of a survey, quiz,
10
+ or questionnaire then you should consider using surveyor. This gem was
11
+ designed to deliver clinical research surveys to large populations,
12
+ but it can be used for any type of survey.
10
13
 
11
- If your Rails app needs to asks users questions as part of a survey, quiz, or questionnaire then you should consider using Surveyor. This gem was designed to deliver clinical research surveys to large populations, but it can be used for any type of survey.
14
+ Surveyor is a Rails engine distributed as a ruby gem, meaning it is
15
+ straightforward to override or extend its behaviors in your Rails app
16
+ without maintaining a fork.
12
17
 
13
- The Surveyor DSL defines questions, answers, question groups, survey sections, dependencies (e.g. if response to question 4 is A, then show question 5), and validations. Answers are the options available for each question - user input is called "responses" and are grouped into "response sets". A DSL makes it significantly easier to import long surveys (no more click/copy/paste). It also enables non-programmers to write out, edit, re-edit... any number of surveys.
18
+ ## Requirements
14
19
 
15
- ## DSL example
16
-
17
- The Surveyor DSL supports a wide range of question types (too many to list here) and complex dependency logic. Here are the first few questions of the "kitchen sink" survey which should give you and idea of how it works. The full example with all the types of questions available if you follow the installation instructions below.
18
-
19
- survey "Kitchen Sink survey" do
20
-
21
- section "Basic questions" do
22
- # A label is a question that accepts no answers
23
- label "These questions are examples of the basic supported input types"
24
-
25
- # A basic question with radio buttons
26
- question_1 "What is your favorite color?", :pick => :one
27
- answer "red"
28
- answer "blue"
29
- answer "green"
30
- answer "yellow"
31
- answer :other
20
+ Surveyor works with:
32
21
 
33
- # A basic question with checkboxes
34
- # "question" and "answer" may be abbreviated as "q" and "a"
35
- q_2 "Choose the colors you don't like", :pick => :any
36
- a_1 "red"
37
- a_2 "blue"
38
- a_3 "green"
39
- a_4 "yellow"
40
- a :omit
22
+ * Ruby 1.8.7, 1.9.2, and 1.9.3
23
+ * Rails 3.0-3.2
41
24
 
42
- # A dependent question, with conditions and rule to logically join them
43
- # the question's reference identifier is "2a", and the answer's reference_identifier is "1"
44
- # question reference identifiers used in conditions need to be unique on a survey for the lookups to work
45
- q_2a "Please explain why you don't like this color?"
46
- a_1 "explanation", :text
47
- dependency :rule => "A or B or C or D"
48
- condition_A :q_2, "==", :a_1
49
- condition_B :q_2, "==", :a_2
50
- condition_C :q_2, "==", :a_3
51
- condition_D :q_2, "==", :a_4
25
+ Some key dependencies are:
52
26
 
53
- # ... other question, sections and such. See surveys/kitchen_sink_survey.rb for more.
54
- end
27
+ * HAML
28
+ * Sass
29
+ * Formtastic
55
30
 
56
- end
31
+ A more exhaustive list can be found in the [gemspec][].
57
32
 
58
- The first question is "pick one" (radio buttons) with "other". The second question is "pick any" (checkboxes) with the option to "omit". It also features a dependency with a follow up question. Notice the dependency rule is defined as a string. We support complex dependency such as "A and (B or C) and D" or "A or ((B and C) or D)". The conditions are evaluated separately using the operators "==","!=","<>", ">=","<" the substituted by letter into to the dependency rule and evaluated.
33
+ [gemspec]: https://github.com/NUBIC/surveyor/blob/master/surveyor.gemspec
59
34
 
60
- # Installation
35
+ ## Install
61
36
 
62
37
  Add surveyor to your Gemfile:
63
38
 
64
39
  gem "surveyor"
65
40
 
66
- Then run:
41
+ Bundle, install, and migrate:
67
42
 
68
43
  bundle install
69
-
70
- Generate assets, run migrations:
71
-
72
44
  script/rails generate surveyor:install
73
45
  bundle exec rake db:migrate
74
46
 
75
- Try out the "kitchen sink" survey. The rake task above generates surveys from our custom survey DSL (a good format for end users and stakeholders).
47
+ Parse the "kitchen sink" survey ([kitchen sink](http://en.wiktionary.org/wiki/everything_but_the_kitchen_sink) means almost everything)
76
48
 
77
49
  bundle exec rake surveyor FILE=surveys/kitchen_sink_survey.rb
78
50
 
79
- Start up your app and visit http://localhost:3000/surveys
80
-
81
- Try taking the survey and compare it to the contents of the DSL file kitchen\_sink\_survey.rb. See how the DSL maps to what you see.
51
+ Start up your app, visit `/surveys`, compare what you see to [kitchen\_sink\_survey.rb][kitchensink] and try responding to the survey.
82
52
 
83
- There are two other useful rake tasks:
53
+ [kitchensink]: http://github.com/NUBIC/surveyor/blob/master/lib/generators/surveyor/templates/surveys/kitchen_sink_survey.rb
84
54
 
85
- * `surveyor:remove` removes all unused surveys.
86
- * `rake surveyor:unparse` exports a survey from the application into a
87
- file in the surveyor DSL.
55
+ ## Customize surveyor
88
56
 
89
- # Upgrading
57
+ Surveyor's controller, helper, models, and views may be overridden by classes in your `app` folder. To generate a sample custom controller and layout run:
90
58
 
91
- When you are ready to update to the latest version of Surveyor, just do
59
+ script/rails generate surveyor:custom
92
60
 
93
- bundle update surveyor
61
+ and read `surveys/EXTENDING\_SURVEYOR`
94
62
 
95
- and you'll get the latest version that bundler thinks you can use based on the
96
- constraints in your Gemfile.
63
+ ## Upgrade
97
64
 
98
- After you've installed a new version, you should always re-run the surveyor
99
- generator:
65
+ To get the latest version of surveyor, bundle, install and migrate:
100
66
 
67
+ bundle update surveyor
101
68
  script/rails generate surveyor:install
69
+ bundle exec rake db:migrate
102
70
 
103
- This will copy over any new or updated assets and new migrations. Use your VCS'
104
- utilities to review what's changed, then commit the new versions.
71
+ and review the [changelog][] for changes that may affect your customizations.
105
72
 
106
- git status
107
- git diff
108
- [...]
109
- git add -A
110
- git commit
73
+ [changelog]: https://github.com/NUBIC/surveyor/blob/master/CHANGELOG.md
111
74
 
112
- If there were new migrations, you'll want to be sure to run them before the next
113
- time you start your app:
75
+ ## Users of spork
114
76
 
115
- bundle exec rake db:migrate
77
+ There is [an issue with spork and custom inputs in formatstic (#851)][851]. A workaround (thanks rmm5t!):
116
78
 
117
- Finally, review the [changelog][] entries corresponding to the versions between
118
- your original version and the version you've updated to. There may be changes
119
- which will affect your customizations. There should be hints in the changelog
120
- or the referenced issues for what to update when necessary.
79
+ Spork.prefork do
80
+ # ...
81
+ surveyor_path = Gem.loaded_specs['surveyor'].full_gem_path
82
+ Dir["#{surveyor_path}/app/inputs/*_input.rb"].each { |f| require File.basename(f) }
83
+ # ...
84
+ end
121
85
 
122
- [changelog]: https://github.com/NUBIC/surveyor/blob/master/CHANGELOG.md
86
+ [851]: https://github.com/justinfrench/formtastic/issues/851
123
87
 
124
- ## Following master
88
+ ## Follow master
125
89
 
126
- If you are following along with pre-release versions of Surveyor using a `:git`
90
+ If you are following pre-release versions of surveyor using a `:git`
127
91
  source in your Gemfile, be particularly careful about reviewing migrations after
128
- updating Surveyor and re-running the generator. We will never change a migration
129
- between two released versions of Surveyor. However, we may on rare occasions
92
+ updating surveyor and re-running the generator. We will never change a migration
93
+ between two released versions of surveyor. However, we may on rare occasions
130
94
  change a migration which has been merged into master. When this happens, you'll
131
95
  need to assess the differences and decide on an appropriate course of action for
132
- your app.
133
-
134
- If you aren't sure what this means, we do not recommend that you deploy an app
96
+ your app. If you aren't sure what this means, we do not recommend that you deploy an app
135
97
  that's locked to surveyor master into production.
136
98
 
137
- # Customizing surveyor
138
-
139
- Surveyor's controller, models, and views may be customized via classes in your app/models, app/helpers and app/controllers directories. To generate a sample custom controller and layout, run:
140
-
141
- script/rails generate surveyor:custom
142
-
143
- and read surveys/EXTENDING\_SURVEYOR
144
-
145
- # The asset pipeline
146
-
147
- Surveyor is now aware of the Rails asset pipeline (http://guides.rubyonrails.org/asset_pipeline.html). With the asset pipeline enabled `Rails.application.config.assets.enabled == true`, then the `surveyor:install` generator will generate `app/assets/stylesheets/surveyor_all.css` and `app/assets/javascripts/surveyor_all.js` manifest files and link them from the surveyor\_default layout. Assets remain in the gem and are picked up for inclusion and pre-compilation from there if `config/environments/production.rb` is set to include surveyor assets.
148
-
149
- # Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
150
- config.assets.precompile += %w( surveyor_all.js surveyor_all.css )
151
-
152
- The previous copy-to-application behavior still exists in the case where the asset pipeline is missing or disabled.
153
-
154
- # PDF support
155
-
156
- * Add the following lines to your Gemfile:
157
-
158
- <pre>
159
- gem 'pdfkit'
160
- gem 'wkhtmltopdf'
161
- </pre>
162
-
163
- or on OSX:
164
-
165
- <pre>
166
- gem 'pdfkit'
167
- gem 'wkhtmltopdf-binary'
168
- </pre>
169
-
170
- * Add the following to your application.rb:
171
-
172
- <pre>
173
- config.middleware.use PDFKit::Middleware
174
- </pre>
175
-
176
- * Create links with :format => 'pdf' in them, for example:
177
-
178
- <pre>
179
- %li= link_to "PDF", view_my_survey_path(:survey_code => response_set.survey.access_code, :response_set_code => response_set.access_code, :format => 'pdf')
180
- </pre>
181
-
182
- # Requirements
183
-
184
- Surveyor works with:
185
-
186
- * Ruby 1.8.7, 1.9.2, and 1.9.3
187
- * Rails 3.0-3.2
188
-
189
- Some key library dependencies are:
190
-
191
- * HAML
192
- * Sass
193
- * Formtastic
194
-
195
- A more exhaustive list can be found in the gemspec.
196
-
197
- # Support
99
+ ## Support
198
100
 
199
101
  For general discussion (e.g., "how do I do this?"), please send a message to the
200
102
  [surveyor-dev][] group. This group is moderated to keep out spam; don't be
201
103
  surprised if your message isn't posted immediately.
202
104
 
203
- For reproducible bugs, please file an issue on the [GitHub issue
204
- tracker][issues]. Please include a minimal test case (a detailed description of
105
+ For reproducible bugs, please file an issue on the [GitHub issue tracker][issues].
106
+ Please include a minimal test case (a detailed description of
205
107
  how to trigger the bug in a clean rails application). If you aren't sure how to
206
108
  isolate the bug, send a message to [surveyor-dev][] with what you know and we'll
207
109
  try to help.
208
110
 
111
+ For build status see our [continuous integration page][ci].
112
+
113
+ Take a look at our [screencast][] (a bit dated now).
114
+
209
115
  [surveyor-dev]: https://groups.google.com/group/surveyor-dev
210
116
  [issues]: https://github.com/NUBIC/surveyor/issues
117
+ [ci]:https://public-ci.nubic.northwestern.edu/job/surveyor/
118
+ [screencast]:http://vimeo.com/7051279
211
119
 
212
- # Contributing, testing
120
+ ## Contribute, test
213
121
 
214
122
  To work on the code, fork this github project. Install [bundler][] if
215
- you don't have it, then run
123
+ you don't have it, then bundle, generate the app in `testbed`, and run the specs and features
216
124
 
217
125
  $ bundle update
218
-
219
- to install all the necessary gems. Then
220
-
221
126
  $ bundle exec rake testbed
222
-
223
- to generate a test app in `testbed`. Now you can run
224
-
225
127
  $ bundle exec rake spec
226
-
227
- to run the specs and
228
-
229
128
  $ bundle exec rake cucumber
230
129
 
231
- to run the features and start writing tests!
232
-
233
130
  [bundler]: http://gembundler.com/
234
131
 
235
132
  ## Selenium
236
133
 
237
- Some of Surveyor's integration tests use Selenium WebDriver and Capybara. The
134
+ Some of surveyor's integration tests use Selenium WebDriver and Capybara. The
238
135
  WebDriver-based tests default to running in Chrome due to an unfortunate
239
136
  [Firefox bug][FF566671]. For them to run, you'll either need:
240
137
 
@@ -253,4 +150,6 @@ Firefox to retain focus, otherwise some tests will fail.
253
150
  [FF566671]: https://bugzilla.mozilla.org/show_bug.cgi?id=566671
254
151
  [chromedriver]: http://code.google.com/p/selenium/wiki/ChromeDriver
255
152
 
256
- Copyright (c) 2008-2011 Brian Chamberlain and Mark Yoon, released under the MIT license
153
+ Copyright (c) 2008-2013 Brian Chamberlain and Mark Yoon, released under the [MIT license][mit]
154
+
155
+ [mit]: https://github.com/NUBIC/surveyor/blob/master/MIT-LICENSE
@@ -0,0 +1,5 @@
1
+ class SurveyTranslation < ActiveRecord::Base
2
+ unloadable
3
+ include Surveyor::Models::SurveyTranslationMethods
4
+ end
5
+
@@ -4,18 +4,22 @@
4
4
  - i = response_idx(q.pick != "one") # argument will be false (don't increment i) if we're on radio buttons
5
5
  - disabled = defined?(disableFlag) ? disableFlag : false
6
6
  = f.semantic_fields_for i, r do |ff|
7
- %span.help= render_help_text(a, @render_context) unless g && g.display_type == "grid"
8
7
  = ff.input :question_id, :as => :quiet unless q.pick == "one" # don't repeat question_id if we're on radio buttons
9
8
  = ff.input :api_id, :as => :quiet unless q.pick == "one"
10
9
  = ff.input :response_group, :value => rg, :as => :quiet if q.pick != "one" && g && g.display_type == "repeater"
11
10
  - case q.pick
12
11
  - when "one"
13
- = ff.input :answer_id, :as => :surveyor_radio, :collection => [[a_text(a, nil, @render_context), a.id]], :label => false, :input_html => {:class => a.css_class, :disabled => disabled}, :response_class => a.response_class
12
+ = ff.input :answer_id, :as => :surveyor_radio, :collection => [[a.text_for(nil, @render_context, I18n.locale), a.id]], :label => false, :input_html => {:class => a.css_class, :disabled => disabled}, :response_class => a.response_class
14
13
  - when "any"
15
- = ff.input :answer_id, :as => :surveyor_check_boxes, :collection => [[a_text(a, nil, @render_context), a.id]], :label => false, :input_html => {:class => a.css_class, :disabled => disabled}, :response_class => a.response_class
14
+ = ff.input :answer_id, :as => :surveyor_check_boxes, :collection => [[a.text_for(nil, @render_context, I18n.locale), a.id]], :label => false, :input_html => {:class => a.css_class, :disabled => disabled}, :response_class => a.response_class
16
15
  - when "none"
17
16
  - if %w(date datetime time float integer string text).include? a.response_class
18
17
  = ff.input :answer_id, :as => :quiet, :input_html => {:class => a.css_class, :value => a.id}
19
- = ff.input rc_to_attr(a.response_class), :as => rc_to_as(a.response_class), :label => a_text(a, :pre, @render_context).blank? ? false : a_text(a, :pre, @render_context), :hint => a_text(a, :post, @render_context), :input_html => generate_pick_none_input_html(r.as(a.response_class), a.default_value, a.css_class, a.response_class, disabled)
18
+ = ff.input rc_to_attr(a.response_class),
19
+ :as => rc_to_as(a.response_class),
20
+ :label => a.text_for(:pre, @render_context, I18n.locale).blank? ? false : a.text_for(:pre, @render_context, I18n.locale),
21
+ :hint => a.text_for(:post, @render_context, I18n.locale),
22
+ :input_html => generate_pick_none_input_html(r.as(a.response_class), a.default_value_for(@render_context, I18n.locale), a.css_class, a.response_class, disabled, a.input_mask, a.input_mask_placeholder)
20
23
  - else
21
- = a_text(a, nil, @render_context)
24
+ = a.text_for(nil, @render_context, I18n.locale)
25
+ %span.help= a.help_text_for(@render_context, I18n.locale) unless g && g.display_type == "grid"
@@ -3,10 +3,10 @@
3
3
  - renderer = q.renderer(g ||= nil)
4
4
  - disabled = defined?(disableFlag) ? disableFlag : false
5
5
  - unless q.display_type == "hidden"
6
- = f.inputs q_text(q, @render_context), :id => rg ? "q_#{q.id}_#{rg}" : "q_#{q.id}", :class => "q_#{renderer} #{q.css_class(@response_set)}" do
7
- %span.help= render_help_text(q, @render_context)
6
+ = f.inputs q_text(q, @render_context, I18n.locale), :id => rg ? "q_#{q.id}_#{rg}" : "q_#{q.id}", :class => "q_#{renderer} #{q.css_class(@response_set)}" do
7
+ %span.help= q.help_text_for(@render_context, I18n.locale)
8
8
  - case renderer
9
- - when :image, :label
9
+ - when :image, :label, :default_label, :inline_label, :repeater_label
10
10
  - when :dropdown, :inline_dropdown, :default_dropdown, :slider, :repeater_dropdown
11
11
  - r = response_for(@response_set, q, nil, rg)
12
12
  - i = response_idx
@@ -1,7 +1,7 @@
1
1
  - renderer = g.renderer
2
2
  - unless g.display_type == "hidden"
3
- = f.inputs q_text(g, @render_context), :id => "g_#{g.id}", :class => "g_#{renderer} #{g.css_class(@response_set)}" do
4
- %li.help= render_help_text(g, @render_context)
3
+ = f.inputs "#{next_question_number(g)}#{g.text_for(@render_context, I18n.locale)}", :id => "g_#{g.id}", :class => "g_#{renderer} #{g.css_class(@response_set)}" do
4
+ %li.help= g.help_text_for(@render_context, I18n.locale)
5
5
  - case renderer
6
6
  - when :grid
7
7
  %li
@@ -16,22 +16,23 @@
16
16
  %th &nbsp;
17
17
  - ten_questions.first.answers.each do |a|
18
18
  %th
19
- =a_text(a)
20
- %span.help= render_help_text(a, @render_context)
19
+ = a.text_for(nil, @render_context, I18n.locale)
20
+ %span.help= a.help_text_for(@render_context, I18n.locale)
21
21
  %th &nbsp;
22
22
  - ten_questions.each_with_index do |q, i|
23
23
  %tr{:id => "q_#{q.id}", :class => "q_#{renderer} #{q.css_class(@response_set)}"}
24
24
  %th
25
- = q.split_text(:pre)
25
+ = q.text_for(:pre, @render_context, I18n.locale)
26
+ = q.help_text_for(@render_context, I18n.locale)
26
27
  - if q.pick == "one"
27
28
  - r = response_for(@response_set, q, nil, g)
28
29
  - i = response_idx # increment the response index since the answer partial skips for q.pick == one
29
30
  = f.semantic_fields_for i, r do |ff|
30
31
  = ff.input :question_id, :as => :quiet
31
32
  = ff.input :api_id, :as => :quiet
32
- - q.answers.each do |a|
33
- %td= render a.custom_renderer || '/partials/answer', :g => g, :q => q, :a => a, :f => f
34
- %th= q.split_text(:post)
33
+ - q.answers.each do |a|
34
+ %td= render(a.custom_renderer || '/partials/answer', :g => g, :q => q, :a => a, :f => f) unless q.display_type == "label"
35
+ %th= q.text_for(:post, @render_context, I18n.locale)
35
36
  - when :repeater
36
37
  - (@response_set.count_group_responses(qs) + 1).times do |rg|
37
38
  %li
@@ -1,5 +1,5 @@
1
1
  = div_for @section, :class => @section.custom_class do
2
- %span.title= @section.title
2
+ %span.title= @section.translation(I18n.locale)[:title]
3
3
  - qs ||= []
4
4
  - (questions = @section.questions).each_with_index do |q, i|
5
5
  - if q.part_of_group?
@@ -4,11 +4,11 @@
4
4
  = flash_messages(types)
5
5
  .close
6
6
  = semantic_form_for(@response_set, :as => :r, :url => update_my_survey_path, :html => {:method => :put, :id => "survey_form", :class => @survey.custom_class}) do |f|
7
-
7
+
8
8
  = hidden_field_tag :surveyor_javascript_enabled, false
9
-
9
+
10
10
  = render 'partials/section_menu' # unless @sections.size < 3
11
- .survey_title= @survey.title
11
+ .survey_title= @survey.translation(I18n.locale)[:title]
12
12
  .previous_section= previous_section
13
13
  = render 'partials/dependents' unless @dependents.empty?
14
14
  - if false #@response_set.no_responses_for_section?(@section) # cache if response_set has no responses for current section