tasuku 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +82 -0
- data/Rakefile +28 -0
- data/app/assets/javascripts/tasks/application.js +13 -0
- data/app/assets/stylesheets/tasks/application.css +15 -0
- data/app/controllers/tasks/application_controller.rb +13 -0
- data/app/controllers/tasks/taskables/image/responses_controller.rb +32 -0
- data/app/controllers/tasks/taskables/questions/answers_controller.rb +37 -0
- data/app/controllers/tasks/taskables/text/responses_controller.rb +32 -0
- data/app/controllers/tasks/taskables/url/responses_controller.rb +32 -0
- data/app/controllers/tasks/taskables/verifications/confirmations_controller.rb +28 -0
- data/app/controllers/tasks/tasks_controller.rb +7 -0
- data/app/helpers/tasks/application_helper.rb +7 -0
- data/app/helpers/tasks/taskables/verifications_helper.rb +18 -0
- data/app/models/tasks/task.rb +5 -0
- data/app/models/tasks/taskables.rb +7 -0
- data/app/models/tasks/taskables/image.rb +7 -0
- data/app/models/tasks/taskables/image/request.rb +7 -0
- data/app/models/tasks/taskables/image/response.rb +17 -0
- data/app/models/tasks/taskables/question.rb +7 -0
- data/app/models/tasks/taskables/question/answer.rb +39 -0
- data/app/models/tasks/taskables/question/option.rb +7 -0
- data/app/models/tasks/taskables/question/vote.rb +6 -0
- data/app/models/tasks/taskables/taskable.rb +31 -0
- data/app/models/tasks/taskables/taskable/response.rb +9 -0
- data/app/models/tasks/taskables/taskable/submission.rb +39 -0
- data/app/models/tasks/taskables/text.rb +7 -0
- data/app/models/tasks/taskables/text/request.rb +7 -0
- data/app/models/tasks/taskables/text/response.rb +15 -0
- data/app/models/tasks/taskables/url.rb +7 -0
- data/app/models/tasks/taskables/url/request.rb +5 -0
- data/app/models/tasks/taskables/url/response.rb +18 -0
- data/app/models/tasks/taskables/verification.rb +7 -0
- data/app/models/tasks/taskables/verification/confirmation.rb +12 -0
- data/app/uploaders/tasks/image_uploader.rb +58 -0
- data/app/views/tasks/taskables/image/requests/_request.html.erb +19 -0
- data/app/views/tasks/taskables/image/responses/_form.html.erb +8 -0
- data/app/views/tasks/taskables/image/responses/create.html.erb +2 -0
- data/app/views/tasks/taskables/questions/_question.html.erb +27 -0
- data/app/views/tasks/taskables/questions/answers/_form.html.erb +16 -0
- data/app/views/tasks/taskables/questions/answers/_statistics.html.erb +26 -0
- data/app/views/tasks/taskables/text/requests/_request.html.erb +19 -0
- data/app/views/tasks/taskables/text/responses/_form.html.erb +5 -0
- data/app/views/tasks/taskables/text/responses/create.html.erb +2 -0
- data/app/views/tasks/taskables/url/requests/_request.html.erb +19 -0
- data/app/views/tasks/taskables/url/responses/_form.html.erb +5 -0
- data/app/views/tasks/taskables/url/responses/create.html.erb +2 -0
- data/app/views/tasks/taskables/verifications/_verification.html.erb +1 -0
- data/app/views/tasks/taskables/verifications/confirmations/_form.html.erb +3 -0
- data/app/views/tasks/tasks/_task.html.erb +3 -0
- data/app/views/tasks/tasks/show.html.erb +1 -0
- data/config/locales/en.yml +24 -0
- data/config/locales/nb.yml +122 -0
- data/config/routes.rb +35 -0
- data/db/migrate/20140315151838_create_tasks_tasks.rb +9 -0
- data/db/migrate/20140315152116_create_tasks_taskables_verifications.rb +11 -0
- data/db/migrate/20140315153512_create_tasks_taskables_verification_confirmations.rb +13 -0
- data/db/migrate/20140316203422_create_tasks_taskables_questions.rb +9 -0
- data/db/migrate/20140316203812_create_tasks_taskables_question_options.rb +10 -0
- data/db/migrate/20140316204119_create_tasks_taskables_question_answers.rb +12 -0
- data/db/migrate/20140316221703_remove_unique_constraint_on_task_taskable_question_answer_index.rb +6 -0
- data/db/migrate/20140320123047_remove_unique_constraint_on_confirmation_author.rb +6 -0
- data/db/migrate/20140402132837_create_tasks_taskables_image_requests.rb +9 -0
- data/db/migrate/20140402135306_create_tasks_taskables_image_responses.rb +13 -0
- data/db/migrate/20140403090537_remove_unique_constraint_on_image_response_author.rb +6 -0
- data/db/migrate/20140404113158_add_description_to_taskables_questions.rb +5 -0
- data/db/migrate/20140404130151_add_description_to_tasks_taskables_image_requests.rb +5 -0
- data/db/migrate/20140512072931_create_tasks_taskables_url_requests.rb +10 -0
- data/db/migrate/20140512074135_create_tasks_taskables_url_responses.rb +13 -0
- data/db/migrate/20140512120632_create_tasks_taskables_question_votes.rb +10 -0
- data/db/migrate/20140512121254_add_multiple_to_question.rb +5 -0
- data/db/migrate/20140512131526_remove_option_id_from_questions.rb +21 -0
- data/db/migrate/20140514082129_create_tasks_taskables_text_requests.rb +10 -0
- data/db/migrate/20140514082143_create_tasks_taskables_text_responses.rb +13 -0
- data/db/migrate/20140520122938_add_correct_to_tasks_taskables_question_option.rb +5 -0
- data/db/migrate/20140521134515_add_show_statistics_to_tasks_taskables_question.rb +5 -0
- data/db/migrate/20140523091152_add_images.rb +8 -0
- data/db/migrate/20140604075046_add_obligatory_to_tasks_task.rb +5 -0
- data/db/migrate/20140605095241_create_tasks_taskables_taskable_responses.rb +10 -0
- data/db/migrate/20140605124021_add_task_to_response.rb +6 -0
- data/db/migrate/20140606072225_migrate_existing_date.rb +15 -0
- data/lib/generators/tasks/install/USAGE +8 -0
- data/lib/generators/tasks/install/install_generator.rb +23 -0
- data/lib/generators/tasks/install/templates/tasks.rb +3 -0
- data/lib/generators/tasks/views/USAGE +5 -0
- data/lib/generators/tasks/views/views_generator.rb +9 -0
- data/lib/tasks.rb +20 -0
- data/lib/tasks/concerns.rb +7 -0
- data/lib/tasks/concerns/controllers.rb +5 -0
- data/lib/tasks/concerns/controllers/tasks_controller.rb +18 -0
- data/lib/tasks/concerns/illustratable.rb +9 -0
- data/lib/tasks/concerns/models.rb +4 -0
- data/lib/tasks/concerns/models/task.rb +25 -0
- data/lib/tasks/concerns/models/taskables.rb +7 -0
- data/lib/tasks/concerns/models/taskables/image.rb +3 -0
- data/lib/tasks/concerns/models/taskables/image/request.rb +18 -0
- data/lib/tasks/concerns/models/taskables/question.rb +31 -0
- data/lib/tasks/concerns/models/taskables/text.rb +3 -0
- data/lib/tasks/concerns/models/taskables/text/request.rb +18 -0
- data/lib/tasks/concerns/models/taskables/url.rb +3 -0
- data/lib/tasks/concerns/models/taskables/url/request.rb +18 -0
- data/lib/tasks/concerns/models/taskables/verification.rb +20 -0
- data/lib/tasks/concerns/redirectable.rb +11 -0
- data/lib/tasks/concerns/verifiable.rb +9 -0
- data/lib/tasks/engine.rb +22 -0
- data/lib/tasks/seeds.rb +13 -0
- data/lib/tasks/tasks_tasks.rake +4 -0
- data/lib/tasks/version.rb +3 -0
- data/lib/tasuku.rb +1 -0
- data/spec/controllers/tasks/taskables/image/responses_controller_spec.rb +37 -0
- data/spec/controllers/tasks/taskables/questions/answers_controller_spec.rb +39 -0
- data/spec/controllers/tasks/taskables/text/responses_controller_spec.rb +37 -0
- data/spec/controllers/tasks/taskables/verifications/confirmations_controller_spec.rb +38 -0
- data/spec/controllers/tasks/tasks_controller_spec.rb +17 -0
- data/spec/dummy/README.rdoc +28 -0
- data/spec/dummy/Rakefile +6 -0
- data/spec/dummy/app/assets/javascripts/application.js +13 -0
- data/spec/dummy/app/assets/stylesheets/application.css +15 -0
- data/spec/dummy/app/controllers/application_controller.rb +7 -0
- data/spec/dummy/app/helpers/application_helper.rb +5 -0
- data/spec/dummy/app/models/article.rb +3 -0
- data/spec/dummy/app/models/user.rb +2 -0
- data/spec/dummy/app/views/layouts/application.html.erb +17 -0
- data/spec/dummy/bin/bundle +3 -0
- data/spec/dummy/bin/rails +4 -0
- data/spec/dummy/bin/rake +4 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/config/application.rb +29 -0
- data/spec/dummy/config/boot.rb +5 -0
- data/spec/dummy/config/database.yml +30 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +37 -0
- data/spec/dummy/config/environments/production.rb +83 -0
- data/spec/dummy/config/environments/test.rb +39 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/cookies_serializer.rb +3 -0
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/dummy/config/initializers/inflections.rb +16 -0
- data/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/dummy/config/initializers/session_store.rb +3 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +23 -0
- data/spec/dummy/config/routes.rb +4 -0
- data/spec/dummy/config/secrets.yml +22 -0
- data/spec/dummy/db/migrate/20140315162017_create_users.rb +8 -0
- data/spec/dummy/db/migrate/20140315185502_create_articles.rb +8 -0
- data/spec/dummy/db/schema.rb +166 -0
- data/spec/dummy/db/seeds.rb +3 -0
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/log/development.log +90 -0
- data/spec/dummy/log/test.log +2568 -0
- data/spec/dummy/public/404.html +67 -0
- data/spec/dummy/public/422.html +67 -0
- data/spec/dummy/public/500.html +66 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/public/uploads/tasks/taskables/image/request/image/1/doge.jpg +0 -0
- data/spec/dummy/public/uploads/tasks/taskables/image/response/image/1/doge.jpg +0 -0
- data/spec/dummy/public/uploads/tasks/taskables/question/image/1/doge.jpg +0 -0
- data/spec/dummy/public/uploads/tasks/taskables/text/request/image/1/doge.jpg +0 -0
- data/spec/dummy/public/uploads/tasks/taskables/url/request/image/1/doge.jpg +0 -0
- data/spec/dummy/spec/factories/articles.rb +6 -0
- data/spec/dummy/spec/factories/users.rb +6 -0
- data/spec/dummy/spec/models/article_spec.rb +4 -0
- data/spec/dummy/spec/models/user_spec.rb +4 -0
- data/spec/factories/tasks_taskables_image_requests.rb +7 -0
- data/spec/factories/tasks_taskables_image_responses.rb +8 -0
- data/spec/factories/tasks_taskables_question_answers.rb +17 -0
- data/spec/factories/tasks_taskables_question_options.rb +10 -0
- data/spec/factories/tasks_taskables_question_votes.rb +8 -0
- data/spec/factories/tasks_taskables_questions.rb +19 -0
- data/spec/factories/tasks_taskables_taskable_responses.rb +8 -0
- data/spec/factories/tasks_taskables_text_requests.rb +5 -0
- data/spec/factories/tasks_taskables_text_responses.rb +6 -0
- data/spec/factories/tasks_taskables_url_requests.rb +8 -0
- data/spec/factories/tasks_taskables_url_responses.rb +9 -0
- data/spec/factories/tasks_taskables_verification_confirmations.rb +8 -0
- data/spec/factories/tasks_taskables_verifications.rb +7 -0
- data/spec/factories/tasks_tasks.rb +14 -0
- data/spec/fixtures/doge.jpg +0 -0
- data/spec/helpers/tasks/taskables/verifications_helper_spec.rb +20 -0
- data/spec/lib/generators/views_generators_spec.rb +22 -0
- data/spec/lib/tasks/concerns/verifiable_spec.rb +23 -0
- data/spec/models/tasks/task_spec.rb +20 -0
- data/spec/models/tasks/taskables/image/request_spec.rb +6 -0
- data/spec/models/tasks/taskables/image/response_spec.rb +18 -0
- data/spec/models/tasks/taskables/question/answer_spec.rb +91 -0
- data/spec/models/tasks/taskables/question/option_spec.rb +6 -0
- data/spec/models/tasks/taskables/question/vote_spec.rb +6 -0
- data/spec/models/tasks/taskables/question_spec.rb +18 -0
- data/spec/models/tasks/taskables/taskable/response_spec.rb +7 -0
- data/spec/models/tasks/taskables/taskable/submission_spec.rb +30 -0
- data/spec/models/tasks/taskables/taskable_spec.rb +49 -0
- data/spec/models/tasks/taskables/text/request_spec.rb +6 -0
- data/spec/models/tasks/taskables/text/response_spec.rb +17 -0
- data/spec/models/tasks/taskables/url/request_spec.rb +6 -0
- data/spec/models/tasks/taskables/url/response_spec.rb +6 -0
- data/spec/models/tasks/taskables/verification/confirmation_spec.rb +6 -0
- data/spec/models/tasks/taskables/verification_spec.rb +18 -0
- data/spec/spec_helper.rb +31 -0
- data/spec/support/fixture.rb +3 -0
- data/spec/support/shared_examples_for_redirectable.rb +37 -0
- data/spec/support/trackable_submission_spec.rb +14 -0
- data/spec/views/tasks/taskables/image/requests/_request.html.erb_spec.rb +35 -0
- data/spec/views/tasks/taskables/image/responses/create.html.erb_spec.rb +4 -0
- data/spec/views/tasks/taskables/questions/_question.html.erb_spec.rb +35 -0
- data/spec/views/tasks/taskables/questions/answers/_form.html.erb_spec.rb +18 -0
- data/spec/views/tasks/taskables/text/requests/_request.html.erb_spec.rb +35 -0
- data/spec/views/tasks/taskables/url/requests/_request.html.erb_spec.rb +35 -0
- data/spec/views/tasks/taskables/verifications/confirmations/_form.html.erb_spec.rb +17 -0
- data/spec/views/tasks/tasks/show.html.erb_spec.rb +4 -0
- metadata +550 -0
@@ -0,0 +1 @@
|
|
1
|
+
<%= render @task %>
|
@@ -0,0 +1,24 @@
|
|
1
|
+
en:
|
2
|
+
tasks:
|
3
|
+
taskables:
|
4
|
+
verifications:
|
5
|
+
confirmations:
|
6
|
+
confirm: 'Confirm'
|
7
|
+
questions:
|
8
|
+
answers:
|
9
|
+
submit: 'Submit'
|
10
|
+
already_answered: 'You have already answered this question'
|
11
|
+
can_only_vote_once: 'You may only select one alternative'
|
12
|
+
images:
|
13
|
+
responses:
|
14
|
+
already_uploaded: 'You have already uploaded an image'
|
15
|
+
upload: 'Upload'
|
16
|
+
uploading: 'Uploading...'
|
17
|
+
texts:
|
18
|
+
responses:
|
19
|
+
already_responded: 'You have already submitted a text'
|
20
|
+
respond: 'Submit'
|
21
|
+
urls:
|
22
|
+
responses:
|
23
|
+
already_answered: 'You have already answered'
|
24
|
+
answer: 'Answer'
|
@@ -0,0 +1,122 @@
|
|
1
|
+
nb:
|
2
|
+
activerecord:
|
3
|
+
models:
|
4
|
+
tasks/task:
|
5
|
+
one: Oppgave
|
6
|
+
other: Oppgaver
|
7
|
+
tasks/taskables/question:
|
8
|
+
one: Spørsmål
|
9
|
+
other: Spørsmål
|
10
|
+
tasks/taskables/question/option:
|
11
|
+
one: Alternativ
|
12
|
+
other: Alternativer
|
13
|
+
tasks/taskables/question/vote:
|
14
|
+
one: Stemme
|
15
|
+
other: Stemmer
|
16
|
+
tasks/taskables/question/answer:
|
17
|
+
one: Svar
|
18
|
+
other: Svar
|
19
|
+
tasks/taskables/verification:
|
20
|
+
one: Verifisering
|
21
|
+
other: Verifiseringer
|
22
|
+
tasks/taskables/image/request:
|
23
|
+
one: Bildeforespørsel
|
24
|
+
other: Bildeforespørsler
|
25
|
+
tasks/taskables/image/response:
|
26
|
+
one: Svar på bildeforespørsel
|
27
|
+
other: Svar på bildeforespørsler
|
28
|
+
tasks/taskables/text/request:
|
29
|
+
one: Tekstforespørsel
|
30
|
+
other: Tekstforespørsler
|
31
|
+
tasks/taskables/text/response:
|
32
|
+
one: Svar på tekstforespørsler
|
33
|
+
other: Svar på tekstforespørsler
|
34
|
+
tasks/taskables/verification/confirmation:
|
35
|
+
one: Bekreftelse
|
36
|
+
other: Bekreftelser
|
37
|
+
tasks/taskables/url/request:
|
38
|
+
one: URL-forespørsel
|
39
|
+
other: URL-forespørsler
|
40
|
+
tasks/taskables/url/response:
|
41
|
+
one: Svar på URL-forespørsel
|
42
|
+
other: Svar på URL-forespørsler
|
43
|
+
attributes:
|
44
|
+
defaults: &DEFAULT_ATTRS
|
45
|
+
created_at: Opprettet
|
46
|
+
updated_at: Oppdatert
|
47
|
+
text: Tekst
|
48
|
+
verification: Verifisering
|
49
|
+
task: Oppgave
|
50
|
+
request: Forespørsel
|
51
|
+
responses: Svar
|
52
|
+
votes: Stemmer
|
53
|
+
description: Beskrivelse
|
54
|
+
tasks/task:
|
55
|
+
<<: *DEFAULT_ATTRS
|
56
|
+
taskable_type: Oppgavetype
|
57
|
+
taskable: Oppgave
|
58
|
+
tasks/taskables/question:
|
59
|
+
<<: *DEFAULT_ATTRS
|
60
|
+
description: Beskrivelse
|
61
|
+
multiple: Flere svar mulig?
|
62
|
+
show_statistics: Vis statistikk
|
63
|
+
options: Alternativer
|
64
|
+
tasks/taskables/question/option:
|
65
|
+
<<: *DEFAULT_ATTRS
|
66
|
+
question: Spørsmål
|
67
|
+
correct: Korrekt?
|
68
|
+
answers: Svar
|
69
|
+
tasks/taskables/question/vote:
|
70
|
+
<<: *DEFAULT_ATTRS
|
71
|
+
option: Alternativ
|
72
|
+
answer: Svar
|
73
|
+
tasks/taskables/question/answer:
|
74
|
+
<<: *DEFAULT_ATTRS
|
75
|
+
option: Alternativ
|
76
|
+
author: Forfatter
|
77
|
+
option_id: Alternativ
|
78
|
+
tasks/taskables/verification:
|
79
|
+
<<: *DEFAULT_ATTRS
|
80
|
+
verifiable: Verifisering
|
81
|
+
confirmations: Bekreftelser
|
82
|
+
tasks/taskables/verification/confirmation:
|
83
|
+
<<: *DEFAULT_ATTRS
|
84
|
+
tasks/taskables/image/request:
|
85
|
+
<<: *DEFAULT_ATTRS
|
86
|
+
tasks/taskables/image/response:
|
87
|
+
<<: *DEFAULT_ATTRS
|
88
|
+
image: Bilde
|
89
|
+
tasks/taskables/text/request:
|
90
|
+
<<: *DEFAULT_ATTRS
|
91
|
+
tasks/taskables/text/response:
|
92
|
+
<<: *DEFAULT_ATTRS
|
93
|
+
text: Svartekst
|
94
|
+
tasks/taskables/url/request:
|
95
|
+
<<: *DEFAULT_ATTRS
|
96
|
+
tasks/taskables/url/response:
|
97
|
+
<<: *DEFAULT_ATTRS
|
98
|
+
|
99
|
+
tasks:
|
100
|
+
taskables:
|
101
|
+
verifications:
|
102
|
+
confirmations:
|
103
|
+
confirm: 'Bekreft'
|
104
|
+
questions:
|
105
|
+
answers:
|
106
|
+
submit: 'Svar'
|
107
|
+
already_answered: 'Du har allerede svart på spørsmålet'
|
108
|
+
can_only_vote_once: 'Du kan kun avgi ett svar'
|
109
|
+
images:
|
110
|
+
responses:
|
111
|
+
already_uploaded: 'Du har allerede lastet opp et bilde'
|
112
|
+
upload: 'Last opp'
|
113
|
+
uploading: 'Laster opp...'
|
114
|
+
texts:
|
115
|
+
responses:
|
116
|
+
already_responded: 'Du har allerede sendt inn svartekst'
|
117
|
+
response: 'Svar'
|
118
|
+
respond: 'Svar'
|
119
|
+
urls:
|
120
|
+
responses:
|
121
|
+
already_answered: 'Du har allerede oppgitt en addresse'
|
122
|
+
answer: 'Svar'
|
data/config/routes.rb
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
Tasks::Engine.routes.draw do
|
2
|
+
resources :tasks, only: [:show]
|
3
|
+
|
4
|
+
scope module: :taskables do
|
5
|
+
resources :verifications, only: [] do
|
6
|
+
scope module: :verifications do
|
7
|
+
resources :confirmations, only: [:create]
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
resources :questions, only: [] do
|
12
|
+
scope module: :questions do
|
13
|
+
resources :answers, only: [:create]
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
namespace :image do
|
18
|
+
resources :requests, only: [] do
|
19
|
+
resources :responses, only: [:create]
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
namespace :text do
|
24
|
+
resources :requests, only: [] do
|
25
|
+
resources :responses, only: [:create]
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
namespace :url do
|
30
|
+
resources :requests, only: [] do
|
31
|
+
resources :responses, only: [:create]
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
class CreateTasksTaskablesVerifications < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :tasks_taskables_verifications do |t|
|
4
|
+
t.references :verifiable, polymorphic: true
|
5
|
+
|
6
|
+
t.timestamps
|
7
|
+
end
|
8
|
+
|
9
|
+
add_index :tasks_taskables_verifications, [:verifiable_id, :verifiable_type], unique: true, name: 'index_tasks_taskable_verifications_verifiable'
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
class CreateTasksTaskablesVerificationConfirmations < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :tasks_taskables_verification_confirmations do |t|
|
4
|
+
t.references :verification
|
5
|
+
t.references :author, polymorphic: true
|
6
|
+
|
7
|
+
t.timestamps
|
8
|
+
end
|
9
|
+
|
10
|
+
add_index :tasks_taskables_verification_confirmations, [:verification_id], name: 'tasks_taskable_verification_confirmation_verification'
|
11
|
+
add_index :tasks_taskables_verification_confirmations, [:author_id, :author_type], unique: true, name: 'tasks_taskable_verification_confirmation_author'
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
class CreateTasksTaskablesQuestionAnswers < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :tasks_taskables_question_answers do |t|
|
4
|
+
t.references :option, index: true
|
5
|
+
t.references :author, polymorphic: true
|
6
|
+
|
7
|
+
t.timestamps
|
8
|
+
end
|
9
|
+
|
10
|
+
add_index :tasks_taskables_question_answers, [:author_id, :author_type], unique: true, name: 'tasks_taskable_question_answers_author'
|
11
|
+
end
|
12
|
+
end
|
data/db/migrate/20140316221703_remove_unique_constraint_on_task_taskable_question_answer_index.rb
ADDED
@@ -0,0 +1,6 @@
|
|
1
|
+
class RemoveUniqueConstraintOnTaskTaskableQuestionAnswerIndex < ActiveRecord::Migration
|
2
|
+
def up
|
3
|
+
remove_index :tasks_taskables_question_answers, name: 'tasks_taskable_question_answers_author'
|
4
|
+
add_index :tasks_taskables_question_answers, [:author_id, :author_type], name: 'tasks_taskable_question_answers_author'
|
5
|
+
end
|
6
|
+
end
|
@@ -0,0 +1,6 @@
|
|
1
|
+
class RemoveUniqueConstraintOnConfirmationAuthor < ActiveRecord::Migration
|
2
|
+
def up
|
3
|
+
remove_index :tasks_taskables_verification_confirmations, name: 'tasks_taskable_verification_confirmation_author'
|
4
|
+
add_index :tasks_taskables_verification_confirmations, ['author_id', 'author_type'], name: 'tasks_taskable_verification_confirmation_author'
|
5
|
+
end
|
6
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
class CreateTasksTaskablesImageResponses < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :tasks_taskables_image_responses do |t|
|
4
|
+
t.string :image
|
5
|
+
t.references :request, index: true
|
6
|
+
t.references :author, polymorphic: true
|
7
|
+
|
8
|
+
t.timestamps
|
9
|
+
end
|
10
|
+
|
11
|
+
add_index :tasks_taskables_image_responses, [:author_id, :author_type], unique: true, name: 'tasks_taskable_image_responses_author'
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,6 @@
|
|
1
|
+
class RemoveUniqueConstraintOnImageResponseAuthor < ActiveRecord::Migration
|
2
|
+
def up
|
3
|
+
remove_index :tasks_taskables_image_responses, name: 'tasks_taskable_image_responses_author'
|
4
|
+
add_index :tasks_taskables_image_responses, [:author_id, :author_type], name: 'tasks_taskable_image_responses_author'
|
5
|
+
end
|
6
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
class CreateTasksTaskablesURLResponses < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :tasks_taskables_url_responses do |t|
|
4
|
+
t.text :url
|
5
|
+
t.references :request, index: true
|
6
|
+
t.references :author, polymorphic: true
|
7
|
+
|
8
|
+
t.timestamps
|
9
|
+
end
|
10
|
+
|
11
|
+
add_index :tasks_taskables_url_responses, [:author_id, :author_type], unique: true, name: 'tasks_taskable_url_responses_author'
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
class RemoveOptionIdFromQuestions < ActiveRecord::Migration
|
2
|
+
class Tasks::Taskables::Question < ActiveRecord::Base; end
|
3
|
+
|
4
|
+
class Tasks::Taskables::Question::Answer < ActiveRecord::Base
|
5
|
+
has_many :votes
|
6
|
+
belongs_to :option
|
7
|
+
end
|
8
|
+
|
9
|
+
class Tasks::Taskables::Question::Vote < ActiveRecord::Base
|
10
|
+
belongs_to :option
|
11
|
+
belongs_to :answer
|
12
|
+
end
|
13
|
+
|
14
|
+
def up
|
15
|
+
Tasks::Taskables::Question::Answer.all.each do |answer|
|
16
|
+
answer.votes.create option: answer.option
|
17
|
+
end
|
18
|
+
|
19
|
+
remove_column :tasks_taskables_question_answers, :option_id, :integer
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
class CreateTasksTaskablesTextResponses < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :tasks_taskables_text_responses do |t|
|
4
|
+
t.text :text
|
5
|
+
t.references :request
|
6
|
+
t.references :author, polymorphic: true
|
7
|
+
|
8
|
+
t.timestamps
|
9
|
+
end
|
10
|
+
|
11
|
+
add_index :tasks_taskables_text_responses, [:author_id, :author_type], unique: true, name: 'tasks_taskable_text_responses_author'
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
class AddImages < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
add_column :tasks_taskables_questions, :image, :string
|
4
|
+
add_column :tasks_taskables_image_requests, :image, :string
|
5
|
+
add_column :tasks_taskables_url_requests, :image, :string
|
6
|
+
add_column :tasks_taskables_text_requests, :image, :string
|
7
|
+
end
|
8
|
+
end
|