ask_it 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +11 -0
  3. data/LICENSE.md +21 -0
  4. data/README.md +287 -0
  5. data/Rakefile +29 -0
  6. data/app/controllers/ask_it/attempts_controller.rb +36 -0
  7. data/app/controllers/ask_it/surveys_controller.rb +58 -0
  8. data/app/models/ask_it/answer.rb +99 -0
  9. data/app/models/ask_it/attempt.rb +108 -0
  10. data/app/models/ask_it/option.rb +65 -0
  11. data/app/models/ask_it/options_type.rb +39 -0
  12. data/app/models/ask_it/predefined_value.rb +24 -0
  13. data/app/models/ask_it/question.rb +73 -0
  14. data/app/models/ask_it/question_type.rb +32 -0
  15. data/app/models/ask_it/section.rb +66 -0
  16. data/app/models/ask_it/survey.rb +77 -0
  17. data/config/locales/en.yml +54 -0
  18. data/config/locales/pt-PT.yml +48 -0
  19. data/config/locales/pt.yml +48 -0
  20. data/lib/ask_it/active_record.rb +25 -0
  21. data/lib/ask_it/engine.rb +8 -0
  22. data/lib/ask_it/railtie.rb +13 -0
  23. data/lib/ask_it/version.rb +5 -0
  24. data/lib/ask_it.rb +20 -0
  25. data/lib/generators/ask_it/install_generator.rb +57 -0
  26. data/lib/generators/ask_it/survey_generator.rb +117 -0
  27. data/lib/generators/templates/active_admin.rb +87 -0
  28. data/lib/generators/templates/controllers/attempts_controller.rb +11 -0
  29. data/lib/generators/templates/controllers/surveys_controller.rb +31 -0
  30. data/lib/generators/templates/helpers/ask_it/surveys_helper.rb +56 -0
  31. data/lib/generators/templates/migration.rb.tt +59 -0
  32. data/lib/generators/templates/migration_add_head_number_to_options_table.rb.tt +8 -0
  33. data/lib/generators/templates/migration_add_mandatory_to_questions_table.rb.tt +8 -0
  34. data/lib/generators/templates/migration_add_types_to_questions_and_options.rb.tt +15 -0
  35. data/lib/generators/templates/migration_create_predefined_values_table.rb.tt +16 -0
  36. data/lib/generators/templates/migration_section.rb.tt +24 -0
  37. data/lib/generators/templates/migration_update_survey_tables.rb.tt +24 -0
  38. data/lib/generators/templates/rails_admin.rb +10 -0
  39. data/lib/generators/templates/views/attempts/_form.html.erb +61 -0
  40. data/lib/generators/templates/views/attempts/new.html.erb +10 -0
  41. data/lib/generators/templates/views/surveys/_form.html.erb +78 -0
  42. data/lib/generators/templates/views/surveys/_option_fields.html.erb +26 -0
  43. data/lib/generators/templates/views/surveys/_question_fields.html.erb +42 -0
  44. data/lib/generators/templates/views/surveys/_section_fields.html.erb +29 -0
  45. data/lib/generators/templates/views/surveys/edit.html.erb +2 -0
  46. data/lib/generators/templates/views/surveys/index.html.erb +14 -0
  47. data/lib/generators/templates/views/surveys/new.html.erb +2 -0
  48. data/lib/survey.rb +7 -0
  49. data/lib/tasks/changelog.rake +10 -0
  50. metadata +372 -0
@@ -0,0 +1,42 @@
1
+ <li>
2
+ <h2>Question</h2>
3
+ <div class="field">
4
+ <%= f.label :head_number %> <br />
5
+ <%= f.text_field :head_number %>
6
+ </div>
7
+ <div class="field">
8
+ <%= f.label :locale_head_number %> <br />
9
+ <%= f.text_field :locale_head_number %>
10
+ </div>
11
+ <div class="field">
12
+ <%= f.label :text %> <br />
13
+ <%= f.text_field :text %>
14
+ </div>
15
+ <div class="field">
16
+ <%= f.label :locale_text %> <br />
17
+ <%= f.text_field :locale_text %>
18
+ </div>
19
+ <div class="field">
20
+ <%= f.label :description %> <br />
21
+ <%= f.text_area :description %>
22
+ </div>
23
+ <div class="field">
24
+ <%= f.label :locale_description %> <br />
25
+ <%= f.text_area :locale_description %>
26
+ </div>
27
+ <div class="field">
28
+ <%= f.label :questions_type_id %> <br />
29
+ <%= f.select :questions_type_id, AskIt::QuestionsType.questions_types_title %>
30
+ </div>
31
+
32
+ <div class="field">
33
+ <ul class="options">
34
+ <%= f.fields_for :options do |builder| %>
35
+ <%= render "option_fields", :f => builder %>
36
+ <% end -%>
37
+ </ul>
38
+ <%= link_to_add_field "Add a new Option", f, :options %>
39
+ <br/ >
40
+ <%= link_to_remove_field "Remove Question", f %>
41
+ </div>
42
+ </li>
@@ -0,0 +1,29 @@
1
+ <li>
2
+ <h2>Section</h2>
3
+ <%= f.hidden_field :id %>
4
+ <div class="field">
5
+ <%= f.label :head_number %> <br />
6
+ <%= f.text_field :locale_head_number %>
7
+ </div>
8
+ <div class="field">
9
+ <%= f.label :name %> <br />
10
+ <%= f.text_field :name %>
11
+ </div>
12
+ <div class="field">
13
+ <%= f.label :locale_name %> <br />
14
+ <%= f.text_field :locale_name %>
15
+ </div>
16
+ <div class="field">
17
+ <%= f.label :description %> <br />
18
+ <%= f.text_field :locale_description %>
19
+ </div>
20
+ <div class="field">
21
+ <ul>
22
+ <%= f.fields_for :questions do |builder| %>
23
+ <%= render "question_fields", :f => builder %>
24
+ <% end %>
25
+ </ul>
26
+ <br/ >
27
+ <%= link_to_add_field "Add a new Question", f, :questions %>
28
+ </div>
29
+ </li>
@@ -0,0 +1,2 @@
1
+ <h2>Edit Survey</h2>
2
+ <%= render 'form' %>
@@ -0,0 +1,14 @@
1
+ <div class="questionnaires_<%= action_name %>">
2
+ <h1>
3
+ Surveys Index
4
+ </h1>
5
+ <hr>
6
+ <%= link_to "New Survey", new_survey_path %>
7
+ <ul>
8
+ <% @surveys.each do |survey| %>
9
+ <li>
10
+ <%= link_to survey.name, edit_survey_path(survey) %>
11
+ </li>
12
+ <% end -%>
13
+ </ul>
14
+ </div>
@@ -0,0 +1,2 @@
1
+ <h2>New Survey</h2>
2
+ <%= render 'form' %>
data/lib/survey.rb ADDED
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'ask_it/engine'
4
+ require 'ask_it/version'
5
+ require 'ask_it/active_record'
6
+
7
+ ActiveRecord::Base.include AskIt::ActiveRecord
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ # lib/tasks/changelog.rake
4
+ require 'github_changelog_generator/task'
5
+
6
+ GitHubChangelogGenerator::RakeTask.new :changelog do |config|
7
+ config.user = 'growth-constant'
8
+ config.project = 'ask_it'
9
+ config.future_release = AskIt::VERSION
10
+ end
metadata ADDED
@@ -0,0 +1,372 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ask_it
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.1
5
+ platform: ruby
6
+ authors:
7
+ - Victor
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2024-09-14 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rails
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '6.1'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '6.1'
27
+ - !ruby/object:Gem::Dependency
28
+ name: appraisal
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 2.5.0
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 2.5.0
41
+ - !ruby/object:Gem::Dependency
42
+ name: factory_bot
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: faker
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: faraday-retry
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: generator_spec
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: github_changelog_generator
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: mocha
113
+ requirement: !ruby/object:Gem::Requirement
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
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: pry
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: puma
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
153
+ - !ruby/object:Gem::Dependency
154
+ name: rake
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - ">="
158
+ - !ruby/object:Gem::Version
159
+ version: '0'
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - ">="
165
+ - !ruby/object:Gem::Version
166
+ version: '0'
167
+ - !ruby/object:Gem::Dependency
168
+ name: rspec
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - "~>"
172
+ - !ruby/object:Gem::Version
173
+ version: '3.13'
174
+ type: :development
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - "~>"
179
+ - !ruby/object:Gem::Version
180
+ version: '3.13'
181
+ - !ruby/object:Gem::Dependency
182
+ name: rspec-rails
183
+ requirement: !ruby/object:Gem::Requirement
184
+ requirements:
185
+ - - ">="
186
+ - !ruby/object:Gem::Version
187
+ version: '6.0'
188
+ type: :development
189
+ prerelease: false
190
+ version_requirements: !ruby/object:Gem::Requirement
191
+ requirements:
192
+ - - ">="
193
+ - !ruby/object:Gem::Version
194
+ version: '6.0'
195
+ - !ruby/object:Gem::Dependency
196
+ name: rubocop
197
+ requirement: !ruby/object:Gem::Requirement
198
+ requirements:
199
+ - - ">="
200
+ - !ruby/object:Gem::Version
201
+ version: '0'
202
+ type: :development
203
+ prerelease: false
204
+ version_requirements: !ruby/object:Gem::Requirement
205
+ requirements:
206
+ - - ">="
207
+ - !ruby/object:Gem::Version
208
+ version: '0'
209
+ - !ruby/object:Gem::Dependency
210
+ name: rubocop-factory_bot
211
+ requirement: !ruby/object:Gem::Requirement
212
+ requirements:
213
+ - - ">="
214
+ - !ruby/object:Gem::Version
215
+ version: '0'
216
+ type: :development
217
+ prerelease: false
218
+ version_requirements: !ruby/object:Gem::Requirement
219
+ requirements:
220
+ - - ">="
221
+ - !ruby/object:Gem::Version
222
+ version: '0'
223
+ - !ruby/object:Gem::Dependency
224
+ name: rubocop-rails
225
+ requirement: !ruby/object:Gem::Requirement
226
+ requirements:
227
+ - - ">="
228
+ - !ruby/object:Gem::Version
229
+ version: '0'
230
+ type: :development
231
+ prerelease: false
232
+ version_requirements: !ruby/object:Gem::Requirement
233
+ requirements:
234
+ - - ">="
235
+ - !ruby/object:Gem::Version
236
+ version: '0'
237
+ - !ruby/object:Gem::Dependency
238
+ name: rubocop-rake
239
+ requirement: !ruby/object:Gem::Requirement
240
+ requirements:
241
+ - - ">="
242
+ - !ruby/object:Gem::Version
243
+ version: '0'
244
+ type: :development
245
+ prerelease: false
246
+ version_requirements: !ruby/object:Gem::Requirement
247
+ requirements:
248
+ - - ">="
249
+ - !ruby/object:Gem::Version
250
+ version: '0'
251
+ - !ruby/object:Gem::Dependency
252
+ name: rubocop-rspec
253
+ requirement: !ruby/object:Gem::Requirement
254
+ requirements:
255
+ - - ">="
256
+ - !ruby/object:Gem::Version
257
+ version: '0'
258
+ type: :development
259
+ prerelease: false
260
+ version_requirements: !ruby/object:Gem::Requirement
261
+ requirements:
262
+ - - ">="
263
+ - !ruby/object:Gem::Version
264
+ version: '0'
265
+ - !ruby/object:Gem::Dependency
266
+ name: rubocop-rspec_rails
267
+ requirement: !ruby/object:Gem::Requirement
268
+ requirements:
269
+ - - ">="
270
+ - !ruby/object:Gem::Version
271
+ version: '0'
272
+ type: :development
273
+ prerelease: false
274
+ version_requirements: !ruby/object:Gem::Requirement
275
+ requirements:
276
+ - - ">="
277
+ - !ruby/object:Gem::Version
278
+ version: '0'
279
+ - !ruby/object:Gem::Dependency
280
+ name: simplecov
281
+ requirement: !ruby/object:Gem::Requirement
282
+ requirements:
283
+ - - ">="
284
+ - !ruby/object:Gem::Version
285
+ version: '0'
286
+ type: :development
287
+ prerelease: false
288
+ version_requirements: !ruby/object:Gem::Requirement
289
+ requirements:
290
+ - - ">="
291
+ - !ruby/object:Gem::Version
292
+ version: '0'
293
+ description: A rails gem to enable surveys in your application as easy as possible
294
+ email: victor@joinbuildit.com
295
+ executables: []
296
+ extensions: []
297
+ extra_rdoc_files: []
298
+ files:
299
+ - Gemfile
300
+ - LICENSE.md
301
+ - README.md
302
+ - Rakefile
303
+ - app/controllers/ask_it/attempts_controller.rb
304
+ - app/controllers/ask_it/surveys_controller.rb
305
+ - app/models/ask_it/answer.rb
306
+ - app/models/ask_it/attempt.rb
307
+ - app/models/ask_it/option.rb
308
+ - app/models/ask_it/options_type.rb
309
+ - app/models/ask_it/predefined_value.rb
310
+ - app/models/ask_it/question.rb
311
+ - app/models/ask_it/question_type.rb
312
+ - app/models/ask_it/section.rb
313
+ - app/models/ask_it/survey.rb
314
+ - config/locales/en.yml
315
+ - config/locales/pt-PT.yml
316
+ - config/locales/pt.yml
317
+ - lib/ask_it.rb
318
+ - lib/ask_it/active_record.rb
319
+ - lib/ask_it/engine.rb
320
+ - lib/ask_it/railtie.rb
321
+ - lib/ask_it/version.rb
322
+ - lib/generators/ask_it/install_generator.rb
323
+ - lib/generators/ask_it/survey_generator.rb
324
+ - lib/generators/templates/active_admin.rb
325
+ - lib/generators/templates/controllers/attempts_controller.rb
326
+ - lib/generators/templates/controllers/surveys_controller.rb
327
+ - lib/generators/templates/helpers/ask_it/surveys_helper.rb
328
+ - lib/generators/templates/migration.rb.tt
329
+ - lib/generators/templates/migration_add_head_number_to_options_table.rb.tt
330
+ - lib/generators/templates/migration_add_mandatory_to_questions_table.rb.tt
331
+ - lib/generators/templates/migration_add_types_to_questions_and_options.rb.tt
332
+ - lib/generators/templates/migration_create_predefined_values_table.rb.tt
333
+ - lib/generators/templates/migration_section.rb.tt
334
+ - lib/generators/templates/migration_update_survey_tables.rb.tt
335
+ - lib/generators/templates/rails_admin.rb
336
+ - lib/generators/templates/views/attempts/_form.html.erb
337
+ - lib/generators/templates/views/attempts/new.html.erb
338
+ - lib/generators/templates/views/surveys/_form.html.erb
339
+ - lib/generators/templates/views/surveys/_option_fields.html.erb
340
+ - lib/generators/templates/views/surveys/_question_fields.html.erb
341
+ - lib/generators/templates/views/surveys/_section_fields.html.erb
342
+ - lib/generators/templates/views/surveys/edit.html.erb
343
+ - lib/generators/templates/views/surveys/index.html.erb
344
+ - lib/generators/templates/views/surveys/new.html.erb
345
+ - lib/survey.rb
346
+ - lib/tasks/changelog.rake
347
+ homepage: https://github.com/
348
+ licenses:
349
+ - LICENSE.md
350
+ metadata: {}
351
+ post_install_message:
352
+ rdoc_options: []
353
+ require_paths:
354
+ - lib
355
+ - app
356
+ required_ruby_version: !ruby/object:Gem::Requirement
357
+ requirements:
358
+ - - ">="
359
+ - !ruby/object:Gem::Version
360
+ version: 2.7.8
361
+ required_rubygems_version: !ruby/object:Gem::Requirement
362
+ requirements:
363
+ - - ">="
364
+ - !ruby/object:Gem::Version
365
+ version: '0'
366
+ requirements: []
367
+ rubygems_version: 3.4.19
368
+ signing_key:
369
+ specification_version: 4
370
+ summary: Ask it is a user oriented tool that brings surveys into Rails applications.
371
+ It is based on and inherits from Questionnaire, and Survey gems
372
+ test_files: []