ask 0.4.1 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. data/README.markdown +14 -0
  2. data/Rakefile +1 -1
  3. data/app/assets/javascripts/ask.js.coffee +7 -3
  4. data/app/assets/stylesheets/ask.css.scss +1 -1
  5. data/app/models/answer.rb +20 -2
  6. data/app/models/question.rb +6 -1
  7. data/app/models/upload_question.rb +7 -0
  8. data/app/uploaders/uploaded_file_uploader.rb +55 -0
  9. data/app/views/answerer/_answers.html.erb +22 -0
  10. data/app/views/answerer/_form.html.erb +34 -0
  11. data/app/views/asker/_choice_fields.html.erb +7 -0
  12. data/app/views/asker/_choices.html.erb +27 -0
  13. data/app/views/asker/_form.html.erb +7 -0
  14. data/app/views/asker/_form_preview.html.erb +11 -0
  15. data/app/views/asker/_question_fields.html.erb +46 -0
  16. data/app/views/questions/_checklist_question.html.erb +5 -0
  17. data/app/views/questions/_choose_one_question.html.erb +10 -0
  18. data/app/views/questions/_essay_question.html.erb +1 -0
  19. data/app/views/questions/_form_section.erb +4 -0
  20. data/app/views/questions/_label.html.erb +4 -0
  21. data/app/views/questions/_text_question.html.erb +1 -0
  22. data/app/views/questions/_upload_question.html.erb +6 -0
  23. data/db/migrate/20130202010401_add_upload_field_to_answers.rb +5 -0
  24. data/lib/ask.rb +10 -0
  25. data/lib/ask/acts_as_answerer.rb +4 -3
  26. data/lib/ask/configuration.rb +9 -0
  27. data/lib/ask/version.rb +1 -1
  28. metadata +50 -109
  29. data/app/views/answerer/_answers.html.haml +0 -11
  30. data/app/views/answerer/_form.html.haml +0 -37
  31. data/app/views/asker/_choice_fields.html.haml +0 -6
  32. data/app/views/asker/_choices.html.haml +0 -17
  33. data/app/views/asker/_form.html.haml +0 -5
  34. data/app/views/asker/_form_preview.html.haml +0 -35
  35. data/app/views/asker/_question_fields.html.haml +0 -33
  36. data/test/ask_test.rb +0 -7
  37. data/test/dummy/Rakefile +0 -7
  38. data/test/dummy/app/assets/javascripts/application.js +0 -9
  39. data/test/dummy/app/assets/stylesheets/application.css +0 -7
  40. data/test/dummy/app/controllers/application_controller.rb +0 -3
  41. data/test/dummy/app/helpers/application_helper.rb +0 -2
  42. data/test/dummy/app/views/layouts/application.html.erb +0 -14
  43. data/test/dummy/config.ru +0 -4
  44. data/test/dummy/config/application.rb +0 -45
  45. data/test/dummy/config/boot.rb +0 -10
  46. data/test/dummy/config/database.yml +0 -25
  47. data/test/dummy/config/environment.rb +0 -5
  48. data/test/dummy/config/environments/development.rb +0 -30
  49. data/test/dummy/config/environments/production.rb +0 -60
  50. data/test/dummy/config/environments/test.rb +0 -42
  51. data/test/dummy/config/initializers/backtrace_silencers.rb +0 -7
  52. data/test/dummy/config/initializers/inflections.rb +0 -10
  53. data/test/dummy/config/initializers/mime_types.rb +0 -5
  54. data/test/dummy/config/initializers/secret_token.rb +0 -7
  55. data/test/dummy/config/initializers/session_store.rb +0 -8
  56. data/test/dummy/config/initializers/wrap_parameters.rb +0 -14
  57. data/test/dummy/config/locales/en.yml +0 -5
  58. data/test/dummy/config/routes.rb +0 -58
  59. data/test/dummy/public/404.html +0 -26
  60. data/test/dummy/public/422.html +0 -26
  61. data/test/dummy/public/500.html +0 -26
  62. data/test/dummy/public/favicon.ico +0 -0
  63. data/test/dummy/script/rails +0 -6
  64. data/test/fixtures/answers.yml +0 -13
  65. data/test/fixtures/choices.yml +0 -9
  66. data/test/fixtures/questions.yml +0 -17
  67. data/test/fixtures/submissions.yml +0 -9
  68. data/test/functional/answers_controller_test.rb +0 -49
  69. data/test/functional/choices_controller_test.rb +0 -49
  70. data/test/functional/questions_controller_test.rb +0 -49
  71. data/test/integration/navigation_test.rb +0 -10
  72. data/test/test_helper.rb +0 -10
  73. data/test/unit/answer_test.rb +0 -7
  74. data/test/unit/choice_test.rb +0 -7
  75. data/test/unit/helpers/answers_helper_test.rb +0 -4
  76. data/test/unit/helpers/choices_helper_test.rb +0 -4
  77. data/test/unit/helpers/questions_helper_test.rb +0 -4
  78. data/test/unit/question_test.rb +0 -7
@@ -0,0 +1,9 @@
1
+ module Ask
2
+ class Configuration
3
+ attr_accessor :upload_whitelist
4
+
5
+ def initialize
6
+ @upload_whitelist = %w(jpg jpeg gif png doc docx txt pdf xls xlsx zip)
7
+ end
8
+ end
9
+ end
@@ -1,3 +1,3 @@
1
1
  module Ask
2
- VERSION = "0.4.1"
2
+ VERSION = "0.5.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ask
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.5.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-10 00:00:00.000000000 Z
12
+ date: 2013-02-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -28,13 +28,13 @@ dependencies:
28
28
  - !ruby/object:Gem::Version
29
29
  version: 3.1.0
30
30
  - !ruby/object:Gem::Dependency
31
- name: haml
31
+ name: acts_as_list
32
32
  requirement: !ruby/object:Gem::Requirement
33
33
  none: false
34
34
  requirements:
35
35
  - - ! '>='
36
36
  - !ruby/object:Gem::Version
37
- version: 3.0.0
37
+ version: 0.1.2
38
38
  type: :runtime
39
39
  prerelease: false
40
40
  version_requirements: !ruby/object:Gem::Requirement
@@ -42,15 +42,15 @@ dependencies:
42
42
  requirements:
43
43
  - - ! '>='
44
44
  - !ruby/object:Gem::Version
45
- version: 3.0.0
45
+ version: 0.1.2
46
46
  - !ruby/object:Gem::Dependency
47
- name: acts_as_list
47
+ name: rails_autolink
48
48
  requirement: !ruby/object:Gem::Requirement
49
49
  none: false
50
50
  requirements:
51
51
  - - ! '>='
52
52
  - !ruby/object:Gem::Version
53
- version: 0.1.2
53
+ version: 1.0.2
54
54
  type: :runtime
55
55
  prerelease: false
56
56
  version_requirements: !ruby/object:Gem::Requirement
@@ -58,15 +58,15 @@ dependencies:
58
58
  requirements:
59
59
  - - ! '>='
60
60
  - !ruby/object:Gem::Version
61
- version: 0.1.2
61
+ version: 1.0.2
62
62
  - !ruby/object:Gem::Dependency
63
- name: rails_autolink
63
+ name: jquery-rails
64
64
  requirement: !ruby/object:Gem::Requirement
65
65
  none: false
66
66
  requirements:
67
67
  - - ! '>='
68
68
  - !ruby/object:Gem::Version
69
- version: 1.0.2
69
+ version: '0'
70
70
  type: :runtime
71
71
  prerelease: false
72
72
  version_requirements: !ruby/object:Gem::Requirement
@@ -74,15 +74,15 @@ dependencies:
74
74
  requirements:
75
75
  - - ! '>='
76
76
  - !ruby/object:Gem::Version
77
- version: 1.0.2
77
+ version: '0'
78
78
  - !ruby/object:Gem::Dependency
79
- name: jquery-rails
79
+ name: carrierwave
80
80
  requirement: !ruby/object:Gem::Requirement
81
81
  none: false
82
82
  requirements:
83
83
  - - ! '>='
84
84
  - !ruby/object:Gem::Version
85
- version: '0'
85
+ version: 0.8.0
86
86
  type: :runtime
87
87
  prerelease: false
88
88
  version_requirements: !ruby/object:Gem::Requirement
@@ -90,7 +90,7 @@ dependencies:
90
90
  requirements:
91
91
  - - ! '>='
92
92
  - !ruby/object:Gem::Version
93
- version: '0'
93
+ version: 0.8.0
94
94
  - !ruby/object:Gem::Dependency
95
95
  name: sqlite3
96
96
  requirement: !ruby/object:Gem::Requirement
@@ -107,6 +107,22 @@ dependencies:
107
107
  - - ! '>='
108
108
  - !ruby/object:Gem::Version
109
109
  version: '0'
110
+ - !ruby/object:Gem::Dependency
111
+ name: rspec-rails
112
+ requirement: !ruby/object:Gem::Requirement
113
+ none: false
114
+ requirements:
115
+ - - ! '>='
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ! '>='
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
110
126
  description: Allow your site's maintainers to easily create forms.
111
127
  email:
112
128
  - adam@obledesign.com
@@ -127,67 +143,35 @@ files:
127
143
  - app/models/form_section.rb
128
144
  - app/models/question.rb
129
145
  - app/models/text_question.rb
130
- - app/views/answerer/_answers.html.haml
131
- - app/views/answerer/_form.html.haml
132
- - app/views/asker/_choice_fields.html.haml
133
- - app/views/asker/_choices.html.haml
134
- - app/views/asker/_form.html.haml
135
- - app/views/asker/_form_preview.html.haml
136
- - app/views/asker/_question_fields.html.haml
146
+ - app/models/upload_question.rb
147
+ - app/uploaders/uploaded_file_uploader.rb
148
+ - app/views/answerer/_answers.html.erb
149
+ - app/views/answerer/_form.html.erb
150
+ - app/views/asker/_choice_fields.html.erb
151
+ - app/views/asker/_choices.html.erb
152
+ - app/views/asker/_form.html.erb
153
+ - app/views/asker/_form_preview.html.erb
154
+ - app/views/asker/_question_fields.html.erb
155
+ - app/views/questions/_checklist_question.html.erb
156
+ - app/views/questions/_choose_one_question.html.erb
157
+ - app/views/questions/_essay_question.html.erb
158
+ - app/views/questions/_form_section.erb
159
+ - app/views/questions/_label.html.erb
160
+ - app/views/questions/_text_question.html.erb
161
+ - app/views/questions/_upload_question.html.erb
137
162
  - db/migrate/20110913214050_create_answers.rb
138
163
  - db/migrate/20110913214255_create_choices.rb
139
164
  - db/migrate/20110913214410_create_questions.rb
165
+ - db/migrate/20130202010401_add_upload_field_to_answers.rb
140
166
  - lib/ask/acts_as_answerer.rb
141
167
  - lib/ask/acts_as_asker.rb
168
+ - lib/ask/configuration.rb
142
169
  - lib/ask/engine.rb
143
170
  - lib/ask/version.rb
144
171
  - lib/ask.rb
145
172
  - MIT-LICENSE
146
173
  - Rakefile
147
174
  - README.markdown
148
- - test/ask_test.rb
149
- - test/dummy/app/assets/javascripts/application.js
150
- - test/dummy/app/assets/stylesheets/application.css
151
- - test/dummy/app/controllers/application_controller.rb
152
- - test/dummy/app/helpers/application_helper.rb
153
- - test/dummy/app/views/layouts/application.html.erb
154
- - test/dummy/config/application.rb
155
- - test/dummy/config/boot.rb
156
- - test/dummy/config/database.yml
157
- - test/dummy/config/environment.rb
158
- - test/dummy/config/environments/development.rb
159
- - test/dummy/config/environments/production.rb
160
- - test/dummy/config/environments/test.rb
161
- - test/dummy/config/initializers/backtrace_silencers.rb
162
- - test/dummy/config/initializers/inflections.rb
163
- - test/dummy/config/initializers/mime_types.rb
164
- - test/dummy/config/initializers/secret_token.rb
165
- - test/dummy/config/initializers/session_store.rb
166
- - test/dummy/config/initializers/wrap_parameters.rb
167
- - test/dummy/config/locales/en.yml
168
- - test/dummy/config/routes.rb
169
- - test/dummy/config.ru
170
- - test/dummy/public/404.html
171
- - test/dummy/public/422.html
172
- - test/dummy/public/500.html
173
- - test/dummy/public/favicon.ico
174
- - test/dummy/Rakefile
175
- - test/dummy/script/rails
176
- - test/fixtures/answers.yml
177
- - test/fixtures/choices.yml
178
- - test/fixtures/questions.yml
179
- - test/fixtures/submissions.yml
180
- - test/functional/answers_controller_test.rb
181
- - test/functional/choices_controller_test.rb
182
- - test/functional/questions_controller_test.rb
183
- - test/integration/navigation_test.rb
184
- - test/test_helper.rb
185
- - test/unit/answer_test.rb
186
- - test/unit/choice_test.rb
187
- - test/unit/helpers/answers_helper_test.rb
188
- - test/unit/helpers/choices_helper_test.rb
189
- - test/unit/helpers/questions_helper_test.rb
190
- - test/unit/question_test.rb
191
175
  homepage: https://github.com/biola/ask
192
176
  licenses: []
193
177
  post_install_message:
@@ -208,51 +192,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
208
192
  version: '0'
209
193
  requirements: []
210
194
  rubyforge_project:
211
- rubygems_version: 1.8.24
195
+ rubygems_version: 1.8.25
212
196
  signing_key:
213
197
  specification_version: 3
214
198
  summary: End-user form creation engine for Rails
215
- test_files:
216
- - test/ask_test.rb
217
- - test/dummy/app/assets/javascripts/application.js
218
- - test/dummy/app/assets/stylesheets/application.css
219
- - test/dummy/app/controllers/application_controller.rb
220
- - test/dummy/app/helpers/application_helper.rb
221
- - test/dummy/app/views/layouts/application.html.erb
222
- - test/dummy/config/application.rb
223
- - test/dummy/config/boot.rb
224
- - test/dummy/config/database.yml
225
- - test/dummy/config/environment.rb
226
- - test/dummy/config/environments/development.rb
227
- - test/dummy/config/environments/production.rb
228
- - test/dummy/config/environments/test.rb
229
- - test/dummy/config/initializers/backtrace_silencers.rb
230
- - test/dummy/config/initializers/inflections.rb
231
- - test/dummy/config/initializers/mime_types.rb
232
- - test/dummy/config/initializers/secret_token.rb
233
- - test/dummy/config/initializers/session_store.rb
234
- - test/dummy/config/initializers/wrap_parameters.rb
235
- - test/dummy/config/locales/en.yml
236
- - test/dummy/config/routes.rb
237
- - test/dummy/config.ru
238
- - test/dummy/public/404.html
239
- - test/dummy/public/422.html
240
- - test/dummy/public/500.html
241
- - test/dummy/public/favicon.ico
242
- - test/dummy/Rakefile
243
- - test/dummy/script/rails
244
- - test/fixtures/answers.yml
245
- - test/fixtures/choices.yml
246
- - test/fixtures/questions.yml
247
- - test/fixtures/submissions.yml
248
- - test/functional/answers_controller_test.rb
249
- - test/functional/choices_controller_test.rb
250
- - test/functional/questions_controller_test.rb
251
- - test/integration/navigation_test.rb
252
- - test/test_helper.rb
253
- - test/unit/answer_test.rb
254
- - test/unit/choice_test.rb
255
- - test/unit/helpers/answers_helper_test.rb
256
- - test/unit/helpers/choices_helper_test.rb
257
- - test/unit/helpers/questions_helper_test.rb
258
- - test/unit/question_test.rb
199
+ test_files: []
@@ -1,11 +0,0 @@
1
- -raise 'You must pass in an "answerer" to use this partial' unless defined? answerer
2
-
3
- -answerer.questions_by_section.each do |section, questions|
4
- -unless section.nil?
5
- %h3= section.name
6
- %p= section.instructions
7
- %dl
8
- -questions.each do |question|
9
- %dt= question.name
10
- -answerer.answers_to(question).each do |answer|
11
- %dd= answer.answer
@@ -1,37 +0,0 @@
1
- -last_question = Question.new
2
- =f.fields_for(:answers) do |a|
3
- -question = a.object.question
4
- -if(question.rhetorical?)
5
- %h3.section
6
- =question.name
7
- %p.section.instructions
8
- =question.instructions
9
- -else
10
- =a.hidden_field(:question_id, :value=>question.id)
11
- -if question.name != last_question.name
12
- %dt{:class => question.required?? 'required' : nil}
13
- =question_label(question, a)
14
- =question_instructions(question)
15
- -case(question.type.to_sym)
16
-
17
- -when :TextQuestion
18
- %dd=a.text_field(:answer)
19
-
20
- -when :EssayQuestion
21
- %dd=a.text_area(:answer)
22
-
23
- -when :ChooseOneQuestion
24
- -if question.choices.count > 5
25
- %dd=a.collection_select(:answer, question.choice_names, :to_s, :to_s, :include_blank=>!question.required)
26
- -else
27
- -question.choices.each do |choice|
28
- %dd
29
- =a.radio_button(:answer, choice.name)
30
- =a.label(:answer, choice.name, :value=>choice.name)
31
-
32
- -when :ChecklistQuestion
33
- %dd
34
- =a.hidden_field(:choice_id, :value=>a.object.choice_id)
35
- =a.check_box(:answer, {}, a.object.choice.try(:name), '')
36
- =a.label(:answer, a.object.choice.try(:name))
37
- -last_question = question
@@ -1,6 +0,0 @@
1
- %fieldset.choice
2
- %input.radio-preview{type: 'radio', disabled: "true"}
3
- %input.checkbox-preview{type: 'checkbox', disabled: "true"}
4
- = f.text_field :name, :placeholder=>'Choice'
5
- = f.hidden_field :_destroy
6
- = link_to "remove", '#', class: "remove_fields"
@@ -1,17 +0,0 @@
1
- .question-type.TextQuestion
2
- %input.askwidget-disabledpreview{:disabled => "true", :name => "undefined", :type => "text", :value => "Their answer"}
3
-
4
- .question-type.EssayQuestion.start-hidden
5
- %textarea.askwidget-disabledpreview{:disabled => "true", :name => "undefined", :type => "text", :value => "Their answer"}
6
-
7
- .question-type.ChooseOneQuestion.ChecklistQuestion.start-hidden
8
- = f.fields_for(:choices) do |choice|
9
- = render 'asker/choice_fields', f: choice
10
-
11
- = link_to_add_fields "Add Choice", f, :choices
12
-
13
- .question-type.FormSection.start-hidden
14
- %h4 Name of section
15
- %p
16
- This will provide a divider between form sections
17
-
@@ -1,5 +0,0 @@
1
- .ask.questions
2
- =f.fields_for(:questions) do |f|
3
- =render 'asker/question_fields', f: f
4
-
5
- = link_to_add_fields "Add Question", f, :questions
@@ -1,35 +0,0 @@
1
- %form(action="#")
2
- -@form.questions.each do |question|
3
- -last_question = Question.new
4
- -if(question.rhetorical?)
5
- %h3.section
6
- =question.name
7
- %p.section.instructions
8
- =question.instructions
9
- -else
10
- -if question.name != last_question.name
11
- %dt
12
- =question_label(question)
13
- =question_instructions(question)
14
- -if question.required
15
- %strong{:style=>"color:red;"} *
16
- -case(question.type.to_sym)
17
- -when :TextQuestion
18
- %dd=text_field_tag(question.name.parameterize)
19
- -when :EssayQuestion
20
- %dd=text_area_tag(question.name.parameterize)
21
- -when :ChooseOneQuestion
22
- -if question.choices.count > 5
23
- %dd=select_tag(question.name.parameterize, options_for_select((question.required ? [] : ['']) + question.choice_names))
24
- -else
25
- -question.choices.each do |choice|
26
- %dd
27
- =radio_button_tag(question.name.parameterize, choice.name)
28
- =label_tag(question.name.parameterize, choice.name, :value=>choice.name)
29
- -when :ChecklistQuestion
30
- -question.choices.each do |choice|
31
- %dd
32
- =check_box_tag(question.name.parameterize, choice.name)
33
- =label_tag(question.name.parameterize, choice.name)
34
-
35
- -last_question = question
@@ -1,33 +0,0 @@
1
- %fieldset.question.preview
2
- .question-action-links
3
- =link_to 'Edit', '#', class: 'edit-question-link'
4
- |
5
- = f.hidden_field :_destroy
6
- = link_to "Remove", '#', class: "remove_fields"
7
- .hidden.position-wrapper
8
- =f.hidden_field(:position)
9
- .edit-question-fields
10
- %table.question-details
11
- %tbody
12
- %tr
13
- %th
14
- %span.askwidget-fieldlabel=f.label(:name)
15
- %td=f.text_field :name, class: 'askwidget-inputfield'
16
- %tr
17
- %th
18
- %span.askwidget-fieldlabel= f.label(:instructions, 'Help Text')
19
- %td=f.text_field :instructions, class: 'askwidget-inputfield'
20
- %tr.select-question-type
21
- %th
22
- %span.askwidget-fieldlabel=f.label(:type)
23
- %td=f.collection_select :type, Question::TYPES, :to_s, :titleize, class: 'askwidget-inputfield'
24
-
25
-
26
- .edit-question-choices
27
- =render 'asker/choices', f: f
28
-
29
- .askwidget-buttons
30
- =link_to "Done", "#", class: 'edit-question-link btn'
31
- .required-option
32
- =f.check_box :required, class: 'askwidget-inputfield'
33
- %span.askwidget-fieldlabel=f.label(:required, "Make this a required question")
@@ -1,7 +0,0 @@
1
- require 'test_helper'
2
-
3
- class AskTest < ActiveSupport::TestCase
4
- test "truth" do
5
- assert_kind_of Module, Ask
6
- end
7
- end
@@ -1,7 +0,0 @@
1
- #!/usr/bin/env rake
2
- # Add your own tasks in files placed in lib/tasks ending in .rake,
3
- # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
4
-
5
- require File.expand_path('../config/application', __FILE__)
6
-
7
- Dummy::Application.load_tasks
@@ -1,9 +0,0 @@
1
- // This is a manifest file that'll be compiled into including all the files listed below.
2
- // Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
3
- // be included in the compiled file accessible from http://example.com/assets/application.js
4
- // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
5
- // the compiled file.
6
- //
7
- //= require jquery
8
- //= require jquery_ujs
9
- //= require_tree .