ask 0.1.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 (77) hide show
  1. data/MIT-LICENSE +20 -0
  2. data/README.markdown +64 -0
  3. data/Rakefile +39 -0
  4. data/app/assets/images/add.png +0 -0
  5. data/app/assets/images/delete.png +0 -0
  6. data/app/assets/javascripts/ask.js +2 -0
  7. data/app/assets/javascripts/ask/forms.js +100 -0
  8. data/app/assets/stylesheets/ask.css +4 -0
  9. data/app/assets/stylesheets/ask/forms.css.sass +139 -0
  10. data/app/assets/stylesheets/ask/submissions.css.sass +60 -0
  11. data/app/helpers/ask_helper.rb +23 -0
  12. data/app/models/answer.rb +20 -0
  13. data/app/models/checklist_question.rb +11 -0
  14. data/app/models/choice.rb +7 -0
  15. data/app/models/choose_one_question.rb +7 -0
  16. data/app/models/essay_question.rb +3 -0
  17. data/app/models/form_section.rb +7 -0
  18. data/app/models/question.rb +43 -0
  19. data/app/models/text_question.rb +3 -0
  20. data/app/views/answerer/_answers.html.haml +9 -0
  21. data/app/views/answerer/_form.html.haml +39 -0
  22. data/app/views/asker/_form.html.haml +27 -0
  23. data/app/views/asker/_form_preview.html.haml +35 -0
  24. data/db/migrate/20110913214050_create_answers.rb +15 -0
  25. data/db/migrate/20110913214255_create_choices.rb +11 -0
  26. data/db/migrate/20110913214410_create_questions.rb +15 -0
  27. data/lib/ask.rb +6 -0
  28. data/lib/ask/acts_as_answerer.rb +84 -0
  29. data/lib/ask/acts_as_asker.rb +8 -0
  30. data/lib/ask/engine.rb +4 -0
  31. data/lib/ask/version.rb +3 -0
  32. data/lib/assets/javascripts/jquery.handle-nesting.js +113 -0
  33. data/test/ask_test.rb +7 -0
  34. data/test/dummy/Rakefile +7 -0
  35. data/test/dummy/app/assets/javascripts/application.js +9 -0
  36. data/test/dummy/app/assets/stylesheets/application.css +7 -0
  37. data/test/dummy/app/controllers/application_controller.rb +3 -0
  38. data/test/dummy/app/helpers/application_helper.rb +2 -0
  39. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  40. data/test/dummy/config.ru +4 -0
  41. data/test/dummy/config/application.rb +45 -0
  42. data/test/dummy/config/boot.rb +10 -0
  43. data/test/dummy/config/database.yml +25 -0
  44. data/test/dummy/config/environment.rb +5 -0
  45. data/test/dummy/config/environments/development.rb +30 -0
  46. data/test/dummy/config/environments/production.rb +60 -0
  47. data/test/dummy/config/environments/test.rb +42 -0
  48. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  49. data/test/dummy/config/initializers/inflections.rb +10 -0
  50. data/test/dummy/config/initializers/mime_types.rb +5 -0
  51. data/test/dummy/config/initializers/secret_token.rb +7 -0
  52. data/test/dummy/config/initializers/session_store.rb +8 -0
  53. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  54. data/test/dummy/config/locales/en.yml +5 -0
  55. data/test/dummy/config/routes.rb +58 -0
  56. data/test/dummy/log/development.log +0 -0
  57. data/test/dummy/public/404.html +26 -0
  58. data/test/dummy/public/422.html +26 -0
  59. data/test/dummy/public/500.html +26 -0
  60. data/test/dummy/public/favicon.ico +0 -0
  61. data/test/dummy/script/rails +6 -0
  62. data/test/fixtures/answers.yml +13 -0
  63. data/test/fixtures/choices.yml +9 -0
  64. data/test/fixtures/questions.yml +17 -0
  65. data/test/fixtures/submissions.yml +9 -0
  66. data/test/functional/answers_controller_test.rb +49 -0
  67. data/test/functional/choices_controller_test.rb +49 -0
  68. data/test/functional/questions_controller_test.rb +49 -0
  69. data/test/integration/navigation_test.rb +10 -0
  70. data/test/test_helper.rb +10 -0
  71. data/test/unit/answer_test.rb +7 -0
  72. data/test/unit/choice_test.rb +7 -0
  73. data/test/unit/helpers/answers_helper_test.rb +4 -0
  74. data/test/unit/helpers/choices_helper_test.rb +4 -0
  75. data/test/unit/helpers/questions_helper_test.rb +4 -0
  76. data/test/unit/question_test.rb +7 -0
  77. metadata +231 -0
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The change you wanted was rejected (422)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/422.html -->
21
+ <div class="dialog">
22
+ <h1>The change you wanted was rejected.</h1>
23
+ <p>Maybe you tried to change something you didn't have access to.</p>
24
+ </div>
25
+ </body>
26
+ </html>
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>We're sorry, but something went wrong (500)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/500.html -->
21
+ <div class="dialog">
22
+ <h1>We're sorry, but something went wrong.</h1>
23
+ <p>We've been notified about this issue and we'll take a look at it shortly.</p>
24
+ </div>
25
+ </body>
26
+ </html>
File without changes
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
3
+
4
+ APP_PATH = File.expand_path('../../config/application', __FILE__)
5
+ require File.expand_path('../../config/boot', __FILE__)
6
+ require 'rails/commands'
@@ -0,0 +1,13 @@
1
+ # Read about fixtures at http://api.rubyonrails.org/classes/Fixtures.html
2
+
3
+ one:
4
+ answerer:
5
+ question:
6
+ choice:
7
+ answer: MyText
8
+
9
+ two:
10
+ answerer:
11
+ question:
12
+ choice:
13
+ answer: MyText
@@ -0,0 +1,9 @@
1
+ # Read about fixtures at http://api.rubyonrails.org/classes/Fixtures.html
2
+
3
+ one:
4
+ question:
5
+ name: MyString
6
+
7
+ two:
8
+ question:
9
+ name: MyString
@@ -0,0 +1,17 @@
1
+ # Read about fixtures at http://api.rubyonrails.org/classes/Fixtures.html
2
+
3
+ one:
4
+ asker:
5
+ type:
6
+ name: MyString
7
+ instructions: MyText
8
+ required: false
9
+ position: 1
10
+
11
+ two:
12
+ asker:
13
+ type:
14
+ name: MyString
15
+ instructions: MyText
16
+ required: false
17
+ position: 1
@@ -0,0 +1,9 @@
1
+ # Read about fixtures at http://api.rubyonrails.org/classes/Fixtures.html
2
+
3
+ one:
4
+ submitter:
5
+ asker:
6
+
7
+ two:
8
+ submitter:
9
+ asker:
@@ -0,0 +1,49 @@
1
+ require 'test_helper'
2
+
3
+ class AnswersControllerTest < ActionController::TestCase
4
+ setup do
5
+ @answer = answers(:one)
6
+ end
7
+
8
+ test "should get index" do
9
+ get :index
10
+ assert_response :success
11
+ assert_not_nil assigns(:answers)
12
+ end
13
+
14
+ test "should get new" do
15
+ get :new
16
+ assert_response :success
17
+ end
18
+
19
+ test "should create answer" do
20
+ assert_difference('Answer.count') do
21
+ post :create, answer: @answer.attributes
22
+ end
23
+
24
+ assert_redirected_to answer_path(assigns(:answer))
25
+ end
26
+
27
+ test "should show answer" do
28
+ get :show, id: @answer.to_param
29
+ assert_response :success
30
+ end
31
+
32
+ test "should get edit" do
33
+ get :edit, id: @answer.to_param
34
+ assert_response :success
35
+ end
36
+
37
+ test "should update answer" do
38
+ put :update, id: @answer.to_param, answer: @answer.attributes
39
+ assert_redirected_to answer_path(assigns(:answer))
40
+ end
41
+
42
+ test "should destroy answer" do
43
+ assert_difference('Answer.count', -1) do
44
+ delete :destroy, id: @answer.to_param
45
+ end
46
+
47
+ assert_redirected_to answers_path
48
+ end
49
+ end
@@ -0,0 +1,49 @@
1
+ require 'test_helper'
2
+
3
+ class ChoicesControllerTest < ActionController::TestCase
4
+ setup do
5
+ @choice = choices(:one)
6
+ end
7
+
8
+ test "should get index" do
9
+ get :index
10
+ assert_response :success
11
+ assert_not_nil assigns(:choices)
12
+ end
13
+
14
+ test "should get new" do
15
+ get :new
16
+ assert_response :success
17
+ end
18
+
19
+ test "should create choice" do
20
+ assert_difference('Choice.count') do
21
+ post :create, choice: @choice.attributes
22
+ end
23
+
24
+ assert_redirected_to choice_path(assigns(:choice))
25
+ end
26
+
27
+ test "should show choice" do
28
+ get :show, id: @choice.to_param
29
+ assert_response :success
30
+ end
31
+
32
+ test "should get edit" do
33
+ get :edit, id: @choice.to_param
34
+ assert_response :success
35
+ end
36
+
37
+ test "should update choice" do
38
+ put :update, id: @choice.to_param, choice: @choice.attributes
39
+ assert_redirected_to choice_path(assigns(:choice))
40
+ end
41
+
42
+ test "should destroy choice" do
43
+ assert_difference('Choice.count', -1) do
44
+ delete :destroy, id: @choice.to_param
45
+ end
46
+
47
+ assert_redirected_to choices_path
48
+ end
49
+ end
@@ -0,0 +1,49 @@
1
+ require 'test_helper'
2
+
3
+ class QuestionsControllerTest < ActionController::TestCase
4
+ setup do
5
+ @question = questions(:one)
6
+ end
7
+
8
+ test "should get index" do
9
+ get :index
10
+ assert_response :success
11
+ assert_not_nil assigns(:questions)
12
+ end
13
+
14
+ test "should get new" do
15
+ get :new
16
+ assert_response :success
17
+ end
18
+
19
+ test "should create question" do
20
+ assert_difference('Question.count') do
21
+ post :create, question: @question.attributes
22
+ end
23
+
24
+ assert_redirected_to question_path(assigns(:question))
25
+ end
26
+
27
+ test "should show question" do
28
+ get :show, id: @question.to_param
29
+ assert_response :success
30
+ end
31
+
32
+ test "should get edit" do
33
+ get :edit, id: @question.to_param
34
+ assert_response :success
35
+ end
36
+
37
+ test "should update question" do
38
+ put :update, id: @question.to_param, question: @question.attributes
39
+ assert_redirected_to question_path(assigns(:question))
40
+ end
41
+
42
+ test "should destroy question" do
43
+ assert_difference('Question.count', -1) do
44
+ delete :destroy, id: @question.to_param
45
+ end
46
+
47
+ assert_redirected_to questions_path
48
+ end
49
+ end
@@ -0,0 +1,10 @@
1
+ require 'test_helper'
2
+
3
+ class NavigationTest < ActionDispatch::IntegrationTest
4
+ fixtures :all
5
+
6
+ # test "the truth" do
7
+ # assert true
8
+ # end
9
+ end
10
+
@@ -0,0 +1,10 @@
1
+ # Configure Rails Environment
2
+ ENV["RAILS_ENV"] = "test"
3
+
4
+ require File.expand_path("../dummy/config/environment.rb", __FILE__)
5
+ require "rails/test_help"
6
+
7
+ Rails.backtrace_cleaner.remove_silencers!
8
+
9
+ # Load support files
10
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
@@ -0,0 +1,7 @@
1
+ require 'test_helper'
2
+
3
+ class AnswerTest < ActiveSupport::TestCase
4
+ # test "the truth" do
5
+ # assert true
6
+ # end
7
+ end
@@ -0,0 +1,7 @@
1
+ require 'test_helper'
2
+
3
+ class ChoiceTest < ActiveSupport::TestCase
4
+ # test "the truth" do
5
+ # assert true
6
+ # end
7
+ end
@@ -0,0 +1,4 @@
1
+ require 'test_helper'
2
+
3
+ class AnswersHelperTest < ActionView::TestCase
4
+ end
@@ -0,0 +1,4 @@
1
+ require 'test_helper'
2
+
3
+ class ChoicesHelperTest < ActionView::TestCase
4
+ end
@@ -0,0 +1,4 @@
1
+ require 'test_helper'
2
+
3
+ class QuestionsHelperTest < ActionView::TestCase
4
+ end
@@ -0,0 +1,7 @@
1
+ require 'test_helper'
2
+
3
+ class QuestionTest < ActiveSupport::TestCase
4
+ # test "the truth" do
5
+ # assert true
6
+ # end
7
+ end
metadata ADDED
@@ -0,0 +1,231 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ask
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Adam Crownoble
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2011-10-07 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rails
16
+ requirement: &81488530 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: 3.1.0
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *81488530
25
+ - !ruby/object:Gem::Dependency
26
+ name: haml
27
+ requirement: &81838450 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: 3.0.0
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: *81838450
36
+ - !ruby/object:Gem::Dependency
37
+ name: acts_as_list
38
+ requirement: &81838020 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: 0.1.2
44
+ type: :runtime
45
+ prerelease: false
46
+ version_requirements: *81838020
47
+ - !ruby/object:Gem::Dependency
48
+ name: rails_autolink
49
+ requirement: &81836800 !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: 1.0.2
55
+ type: :runtime
56
+ prerelease: false
57
+ version_requirements: *81836800
58
+ - !ruby/object:Gem::Dependency
59
+ name: jquery-rails
60
+ requirement: &81835740 !ruby/object:Gem::Requirement
61
+ none: false
62
+ requirements:
63
+ - - ! '>='
64
+ - !ruby/object:Gem::Version
65
+ version: '0'
66
+ type: :runtime
67
+ prerelease: false
68
+ version_requirements: *81835740
69
+ - !ruby/object:Gem::Dependency
70
+ name: sqlite3
71
+ requirement: &81834720 !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - ! '>='
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: *81834720
80
+ description: Allow your site's maintainers to easily create forms.
81
+ email:
82
+ - adam@obledesign.com
83
+ executables: []
84
+ extensions: []
85
+ extra_rdoc_files: []
86
+ files:
87
+ - app/assets/javascripts/ask/forms.js
88
+ - app/assets/javascripts/ask.js
89
+ - app/assets/images/add.png
90
+ - app/assets/images/delete.png
91
+ - app/assets/stylesheets/ask/submissions.css.sass
92
+ - app/assets/stylesheets/ask/forms.css.sass
93
+ - app/assets/stylesheets/ask.css
94
+ - app/models/choose_one_question.rb
95
+ - app/models/question.rb
96
+ - app/models/choice.rb
97
+ - app/models/answer.rb
98
+ - app/models/form_section.rb
99
+ - app/models/text_question.rb
100
+ - app/models/checklist_question.rb
101
+ - app/models/essay_question.rb
102
+ - app/views/answerer/_form.html.haml
103
+ - app/views/answerer/_answers.html.haml
104
+ - app/views/asker/_form.html.haml
105
+ - app/views/asker/_form_preview.html.haml
106
+ - app/helpers/ask_helper.rb
107
+ - db/migrate/20110913214050_create_answers.rb
108
+ - db/migrate/20110913214255_create_choices.rb
109
+ - db/migrate/20110913214410_create_questions.rb
110
+ - lib/ask/acts_as_answerer.rb
111
+ - lib/ask/version.rb
112
+ - lib/ask/engine.rb
113
+ - lib/ask/acts_as_asker.rb
114
+ - lib/assets/javascripts/jquery.handle-nesting.js
115
+ - lib/ask.rb
116
+ - MIT-LICENSE
117
+ - Rakefile
118
+ - README.markdown
119
+ - test/unit/question_test.rb
120
+ - test/unit/choice_test.rb
121
+ - test/unit/answer_test.rb
122
+ - test/unit/helpers/choices_helper_test.rb
123
+ - test/unit/helpers/answers_helper_test.rb
124
+ - test/unit/helpers/questions_helper_test.rb
125
+ - test/test_helper.rb
126
+ - test/fixtures/submissions.yml
127
+ - test/fixtures/choices.yml
128
+ - test/fixtures/answers.yml
129
+ - test/fixtures/questions.yml
130
+ - test/ask_test.rb
131
+ - test/integration/navigation_test.rb
132
+ - test/dummy/script/rails
133
+ - test/dummy/public/favicon.ico
134
+ - test/dummy/public/404.html
135
+ - test/dummy/public/422.html
136
+ - test/dummy/public/500.html
137
+ - test/dummy/Rakefile
138
+ - test/dummy/config.ru
139
+ - test/dummy/log/development.log
140
+ - test/dummy/app/assets/javascripts/application.js
141
+ - test/dummy/app/assets/stylesheets/application.css
142
+ - test/dummy/app/views/layouts/application.html.erb
143
+ - test/dummy/app/controllers/application_controller.rb
144
+ - test/dummy/app/helpers/application_helper.rb
145
+ - test/dummy/config/locales/en.yml
146
+ - test/dummy/config/environments/test.rb
147
+ - test/dummy/config/environments/development.rb
148
+ - test/dummy/config/environments/production.rb
149
+ - test/dummy/config/application.rb
150
+ - test/dummy/config/database.yml
151
+ - test/dummy/config/routes.rb
152
+ - test/dummy/config/boot.rb
153
+ - test/dummy/config/environment.rb
154
+ - test/dummy/config/initializers/secret_token.rb
155
+ - test/dummy/config/initializers/inflections.rb
156
+ - test/dummy/config/initializers/backtrace_silencers.rb
157
+ - test/dummy/config/initializers/mime_types.rb
158
+ - test/dummy/config/initializers/wrap_parameters.rb
159
+ - test/dummy/config/initializers/session_store.rb
160
+ - test/functional/questions_controller_test.rb
161
+ - test/functional/answers_controller_test.rb
162
+ - test/functional/choices_controller_test.rb
163
+ homepage: https://github.com/biola/ask
164
+ licenses: []
165
+ post_install_message:
166
+ rdoc_options: []
167
+ require_paths:
168
+ - lib
169
+ required_ruby_version: !ruby/object:Gem::Requirement
170
+ none: false
171
+ requirements:
172
+ - - ! '>='
173
+ - !ruby/object:Gem::Version
174
+ version: '0'
175
+ required_rubygems_version: !ruby/object:Gem::Requirement
176
+ none: false
177
+ requirements:
178
+ - - ! '>='
179
+ - !ruby/object:Gem::Version
180
+ version: '0'
181
+ requirements: []
182
+ rubyforge_project:
183
+ rubygems_version: 1.8.10
184
+ signing_key:
185
+ specification_version: 3
186
+ summary: End-user form creation engine for Rails
187
+ test_files:
188
+ - test/unit/question_test.rb
189
+ - test/unit/choice_test.rb
190
+ - test/unit/answer_test.rb
191
+ - test/unit/helpers/choices_helper_test.rb
192
+ - test/unit/helpers/answers_helper_test.rb
193
+ - test/unit/helpers/questions_helper_test.rb
194
+ - test/test_helper.rb
195
+ - test/fixtures/submissions.yml
196
+ - test/fixtures/choices.yml
197
+ - test/fixtures/answers.yml
198
+ - test/fixtures/questions.yml
199
+ - test/ask_test.rb
200
+ - test/integration/navigation_test.rb
201
+ - test/dummy/script/rails
202
+ - test/dummy/public/favicon.ico
203
+ - test/dummy/public/404.html
204
+ - test/dummy/public/422.html
205
+ - test/dummy/public/500.html
206
+ - test/dummy/Rakefile
207
+ - test/dummy/config.ru
208
+ - test/dummy/log/development.log
209
+ - test/dummy/app/assets/javascripts/application.js
210
+ - test/dummy/app/assets/stylesheets/application.css
211
+ - test/dummy/app/views/layouts/application.html.erb
212
+ - test/dummy/app/controllers/application_controller.rb
213
+ - test/dummy/app/helpers/application_helper.rb
214
+ - test/dummy/config/locales/en.yml
215
+ - test/dummy/config/environments/test.rb
216
+ - test/dummy/config/environments/development.rb
217
+ - test/dummy/config/environments/production.rb
218
+ - test/dummy/config/application.rb
219
+ - test/dummy/config/database.yml
220
+ - test/dummy/config/routes.rb
221
+ - test/dummy/config/boot.rb
222
+ - test/dummy/config/environment.rb
223
+ - test/dummy/config/initializers/secret_token.rb
224
+ - test/dummy/config/initializers/inflections.rb
225
+ - test/dummy/config/initializers/backtrace_silencers.rb
226
+ - test/dummy/config/initializers/mime_types.rb
227
+ - test/dummy/config/initializers/wrap_parameters.rb
228
+ - test/dummy/config/initializers/session_store.rb
229
+ - test/functional/questions_controller_test.rb
230
+ - test/functional/answers_controller_test.rb
231
+ - test/functional/choices_controller_test.rb