tasuku 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (211) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +82 -0
  3. data/Rakefile +28 -0
  4. data/app/assets/javascripts/tasks/application.js +13 -0
  5. data/app/assets/stylesheets/tasks/application.css +15 -0
  6. data/app/controllers/tasks/application_controller.rb +13 -0
  7. data/app/controllers/tasks/taskables/image/responses_controller.rb +32 -0
  8. data/app/controllers/tasks/taskables/questions/answers_controller.rb +37 -0
  9. data/app/controllers/tasks/taskables/text/responses_controller.rb +32 -0
  10. data/app/controllers/tasks/taskables/url/responses_controller.rb +32 -0
  11. data/app/controllers/tasks/taskables/verifications/confirmations_controller.rb +28 -0
  12. data/app/controllers/tasks/tasks_controller.rb +7 -0
  13. data/app/helpers/tasks/application_helper.rb +7 -0
  14. data/app/helpers/tasks/taskables/verifications_helper.rb +18 -0
  15. data/app/models/tasks/task.rb +5 -0
  16. data/app/models/tasks/taskables.rb +7 -0
  17. data/app/models/tasks/taskables/image.rb +7 -0
  18. data/app/models/tasks/taskables/image/request.rb +7 -0
  19. data/app/models/tasks/taskables/image/response.rb +17 -0
  20. data/app/models/tasks/taskables/question.rb +7 -0
  21. data/app/models/tasks/taskables/question/answer.rb +39 -0
  22. data/app/models/tasks/taskables/question/option.rb +7 -0
  23. data/app/models/tasks/taskables/question/vote.rb +6 -0
  24. data/app/models/tasks/taskables/taskable.rb +31 -0
  25. data/app/models/tasks/taskables/taskable/response.rb +9 -0
  26. data/app/models/tasks/taskables/taskable/submission.rb +39 -0
  27. data/app/models/tasks/taskables/text.rb +7 -0
  28. data/app/models/tasks/taskables/text/request.rb +7 -0
  29. data/app/models/tasks/taskables/text/response.rb +15 -0
  30. data/app/models/tasks/taskables/url.rb +7 -0
  31. data/app/models/tasks/taskables/url/request.rb +5 -0
  32. data/app/models/tasks/taskables/url/response.rb +18 -0
  33. data/app/models/tasks/taskables/verification.rb +7 -0
  34. data/app/models/tasks/taskables/verification/confirmation.rb +12 -0
  35. data/app/uploaders/tasks/image_uploader.rb +58 -0
  36. data/app/views/tasks/taskables/image/requests/_request.html.erb +19 -0
  37. data/app/views/tasks/taskables/image/responses/_form.html.erb +8 -0
  38. data/app/views/tasks/taskables/image/responses/create.html.erb +2 -0
  39. data/app/views/tasks/taskables/questions/_question.html.erb +27 -0
  40. data/app/views/tasks/taskables/questions/answers/_form.html.erb +16 -0
  41. data/app/views/tasks/taskables/questions/answers/_statistics.html.erb +26 -0
  42. data/app/views/tasks/taskables/text/requests/_request.html.erb +19 -0
  43. data/app/views/tasks/taskables/text/responses/_form.html.erb +5 -0
  44. data/app/views/tasks/taskables/text/responses/create.html.erb +2 -0
  45. data/app/views/tasks/taskables/url/requests/_request.html.erb +19 -0
  46. data/app/views/tasks/taskables/url/responses/_form.html.erb +5 -0
  47. data/app/views/tasks/taskables/url/responses/create.html.erb +2 -0
  48. data/app/views/tasks/taskables/verifications/_verification.html.erb +1 -0
  49. data/app/views/tasks/taskables/verifications/confirmations/_form.html.erb +3 -0
  50. data/app/views/tasks/tasks/_task.html.erb +3 -0
  51. data/app/views/tasks/tasks/show.html.erb +1 -0
  52. data/config/locales/en.yml +24 -0
  53. data/config/locales/nb.yml +122 -0
  54. data/config/routes.rb +35 -0
  55. data/db/migrate/20140315151838_create_tasks_tasks.rb +9 -0
  56. data/db/migrate/20140315152116_create_tasks_taskables_verifications.rb +11 -0
  57. data/db/migrate/20140315153512_create_tasks_taskables_verification_confirmations.rb +13 -0
  58. data/db/migrate/20140316203422_create_tasks_taskables_questions.rb +9 -0
  59. data/db/migrate/20140316203812_create_tasks_taskables_question_options.rb +10 -0
  60. data/db/migrate/20140316204119_create_tasks_taskables_question_answers.rb +12 -0
  61. data/db/migrate/20140316221703_remove_unique_constraint_on_task_taskable_question_answer_index.rb +6 -0
  62. data/db/migrate/20140320123047_remove_unique_constraint_on_confirmation_author.rb +6 -0
  63. data/db/migrate/20140402132837_create_tasks_taskables_image_requests.rb +9 -0
  64. data/db/migrate/20140402135306_create_tasks_taskables_image_responses.rb +13 -0
  65. data/db/migrate/20140403090537_remove_unique_constraint_on_image_response_author.rb +6 -0
  66. data/db/migrate/20140404113158_add_description_to_taskables_questions.rb +5 -0
  67. data/db/migrate/20140404130151_add_description_to_tasks_taskables_image_requests.rb +5 -0
  68. data/db/migrate/20140512072931_create_tasks_taskables_url_requests.rb +10 -0
  69. data/db/migrate/20140512074135_create_tasks_taskables_url_responses.rb +13 -0
  70. data/db/migrate/20140512120632_create_tasks_taskables_question_votes.rb +10 -0
  71. data/db/migrate/20140512121254_add_multiple_to_question.rb +5 -0
  72. data/db/migrate/20140512131526_remove_option_id_from_questions.rb +21 -0
  73. data/db/migrate/20140514082129_create_tasks_taskables_text_requests.rb +10 -0
  74. data/db/migrate/20140514082143_create_tasks_taskables_text_responses.rb +13 -0
  75. data/db/migrate/20140520122938_add_correct_to_tasks_taskables_question_option.rb +5 -0
  76. data/db/migrate/20140521134515_add_show_statistics_to_tasks_taskables_question.rb +5 -0
  77. data/db/migrate/20140523091152_add_images.rb +8 -0
  78. data/db/migrate/20140604075046_add_obligatory_to_tasks_task.rb +5 -0
  79. data/db/migrate/20140605095241_create_tasks_taskables_taskable_responses.rb +10 -0
  80. data/db/migrate/20140605124021_add_task_to_response.rb +6 -0
  81. data/db/migrate/20140606072225_migrate_existing_date.rb +15 -0
  82. data/lib/generators/tasks/install/USAGE +8 -0
  83. data/lib/generators/tasks/install/install_generator.rb +23 -0
  84. data/lib/generators/tasks/install/templates/tasks.rb +3 -0
  85. data/lib/generators/tasks/views/USAGE +5 -0
  86. data/lib/generators/tasks/views/views_generator.rb +9 -0
  87. data/lib/tasks.rb +20 -0
  88. data/lib/tasks/concerns.rb +7 -0
  89. data/lib/tasks/concerns/controllers.rb +5 -0
  90. data/lib/tasks/concerns/controllers/tasks_controller.rb +18 -0
  91. data/lib/tasks/concerns/illustratable.rb +9 -0
  92. data/lib/tasks/concerns/models.rb +4 -0
  93. data/lib/tasks/concerns/models/task.rb +25 -0
  94. data/lib/tasks/concerns/models/taskables.rb +7 -0
  95. data/lib/tasks/concerns/models/taskables/image.rb +3 -0
  96. data/lib/tasks/concerns/models/taskables/image/request.rb +18 -0
  97. data/lib/tasks/concerns/models/taskables/question.rb +31 -0
  98. data/lib/tasks/concerns/models/taskables/text.rb +3 -0
  99. data/lib/tasks/concerns/models/taskables/text/request.rb +18 -0
  100. data/lib/tasks/concerns/models/taskables/url.rb +3 -0
  101. data/lib/tasks/concerns/models/taskables/url/request.rb +18 -0
  102. data/lib/tasks/concerns/models/taskables/verification.rb +20 -0
  103. data/lib/tasks/concerns/redirectable.rb +11 -0
  104. data/lib/tasks/concerns/verifiable.rb +9 -0
  105. data/lib/tasks/engine.rb +22 -0
  106. data/lib/tasks/seeds.rb +13 -0
  107. data/lib/tasks/tasks_tasks.rake +4 -0
  108. data/lib/tasks/version.rb +3 -0
  109. data/lib/tasuku.rb +1 -0
  110. data/spec/controllers/tasks/taskables/image/responses_controller_spec.rb +37 -0
  111. data/spec/controllers/tasks/taskables/questions/answers_controller_spec.rb +39 -0
  112. data/spec/controllers/tasks/taskables/text/responses_controller_spec.rb +37 -0
  113. data/spec/controllers/tasks/taskables/verifications/confirmations_controller_spec.rb +38 -0
  114. data/spec/controllers/tasks/tasks_controller_spec.rb +17 -0
  115. data/spec/dummy/README.rdoc +28 -0
  116. data/spec/dummy/Rakefile +6 -0
  117. data/spec/dummy/app/assets/javascripts/application.js +13 -0
  118. data/spec/dummy/app/assets/stylesheets/application.css +15 -0
  119. data/spec/dummy/app/controllers/application_controller.rb +7 -0
  120. data/spec/dummy/app/helpers/application_helper.rb +5 -0
  121. data/spec/dummy/app/models/article.rb +3 -0
  122. data/spec/dummy/app/models/user.rb +2 -0
  123. data/spec/dummy/app/views/layouts/application.html.erb +17 -0
  124. data/spec/dummy/bin/bundle +3 -0
  125. data/spec/dummy/bin/rails +4 -0
  126. data/spec/dummy/bin/rake +4 -0
  127. data/spec/dummy/config.ru +4 -0
  128. data/spec/dummy/config/application.rb +29 -0
  129. data/spec/dummy/config/boot.rb +5 -0
  130. data/spec/dummy/config/database.yml +30 -0
  131. data/spec/dummy/config/environment.rb +5 -0
  132. data/spec/dummy/config/environments/development.rb +37 -0
  133. data/spec/dummy/config/environments/production.rb +83 -0
  134. data/spec/dummy/config/environments/test.rb +39 -0
  135. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  136. data/spec/dummy/config/initializers/cookies_serializer.rb +3 -0
  137. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  138. data/spec/dummy/config/initializers/inflections.rb +16 -0
  139. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  140. data/spec/dummy/config/initializers/session_store.rb +3 -0
  141. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  142. data/spec/dummy/config/locales/en.yml +23 -0
  143. data/spec/dummy/config/routes.rb +4 -0
  144. data/spec/dummy/config/secrets.yml +22 -0
  145. data/spec/dummy/db/migrate/20140315162017_create_users.rb +8 -0
  146. data/spec/dummy/db/migrate/20140315185502_create_articles.rb +8 -0
  147. data/spec/dummy/db/schema.rb +166 -0
  148. data/spec/dummy/db/seeds.rb +3 -0
  149. data/spec/dummy/db/test.sqlite3 +0 -0
  150. data/spec/dummy/log/development.log +90 -0
  151. data/spec/dummy/log/test.log +2568 -0
  152. data/spec/dummy/public/404.html +67 -0
  153. data/spec/dummy/public/422.html +67 -0
  154. data/spec/dummy/public/500.html +66 -0
  155. data/spec/dummy/public/favicon.ico +0 -0
  156. data/spec/dummy/public/uploads/tasks/taskables/image/request/image/1/doge.jpg +0 -0
  157. data/spec/dummy/public/uploads/tasks/taskables/image/response/image/1/doge.jpg +0 -0
  158. data/spec/dummy/public/uploads/tasks/taskables/question/image/1/doge.jpg +0 -0
  159. data/spec/dummy/public/uploads/tasks/taskables/text/request/image/1/doge.jpg +0 -0
  160. data/spec/dummy/public/uploads/tasks/taskables/url/request/image/1/doge.jpg +0 -0
  161. data/spec/dummy/spec/factories/articles.rb +6 -0
  162. data/spec/dummy/spec/factories/users.rb +6 -0
  163. data/spec/dummy/spec/models/article_spec.rb +4 -0
  164. data/spec/dummy/spec/models/user_spec.rb +4 -0
  165. data/spec/factories/tasks_taskables_image_requests.rb +7 -0
  166. data/spec/factories/tasks_taskables_image_responses.rb +8 -0
  167. data/spec/factories/tasks_taskables_question_answers.rb +17 -0
  168. data/spec/factories/tasks_taskables_question_options.rb +10 -0
  169. data/spec/factories/tasks_taskables_question_votes.rb +8 -0
  170. data/spec/factories/tasks_taskables_questions.rb +19 -0
  171. data/spec/factories/tasks_taskables_taskable_responses.rb +8 -0
  172. data/spec/factories/tasks_taskables_text_requests.rb +5 -0
  173. data/spec/factories/tasks_taskables_text_responses.rb +6 -0
  174. data/spec/factories/tasks_taskables_url_requests.rb +8 -0
  175. data/spec/factories/tasks_taskables_url_responses.rb +9 -0
  176. data/spec/factories/tasks_taskables_verification_confirmations.rb +8 -0
  177. data/spec/factories/tasks_taskables_verifications.rb +7 -0
  178. data/spec/factories/tasks_tasks.rb +14 -0
  179. data/spec/fixtures/doge.jpg +0 -0
  180. data/spec/helpers/tasks/taskables/verifications_helper_spec.rb +20 -0
  181. data/spec/lib/generators/views_generators_spec.rb +22 -0
  182. data/spec/lib/tasks/concerns/verifiable_spec.rb +23 -0
  183. data/spec/models/tasks/task_spec.rb +20 -0
  184. data/spec/models/tasks/taskables/image/request_spec.rb +6 -0
  185. data/spec/models/tasks/taskables/image/response_spec.rb +18 -0
  186. data/spec/models/tasks/taskables/question/answer_spec.rb +91 -0
  187. data/spec/models/tasks/taskables/question/option_spec.rb +6 -0
  188. data/spec/models/tasks/taskables/question/vote_spec.rb +6 -0
  189. data/spec/models/tasks/taskables/question_spec.rb +18 -0
  190. data/spec/models/tasks/taskables/taskable/response_spec.rb +7 -0
  191. data/spec/models/tasks/taskables/taskable/submission_spec.rb +30 -0
  192. data/spec/models/tasks/taskables/taskable_spec.rb +49 -0
  193. data/spec/models/tasks/taskables/text/request_spec.rb +6 -0
  194. data/spec/models/tasks/taskables/text/response_spec.rb +17 -0
  195. data/spec/models/tasks/taskables/url/request_spec.rb +6 -0
  196. data/spec/models/tasks/taskables/url/response_spec.rb +6 -0
  197. data/spec/models/tasks/taskables/verification/confirmation_spec.rb +6 -0
  198. data/spec/models/tasks/taskables/verification_spec.rb +18 -0
  199. data/spec/spec_helper.rb +31 -0
  200. data/spec/support/fixture.rb +3 -0
  201. data/spec/support/shared_examples_for_redirectable.rb +37 -0
  202. data/spec/support/trackable_submission_spec.rb +14 -0
  203. data/spec/views/tasks/taskables/image/requests/_request.html.erb_spec.rb +35 -0
  204. data/spec/views/tasks/taskables/image/responses/create.html.erb_spec.rb +4 -0
  205. data/spec/views/tasks/taskables/questions/_question.html.erb_spec.rb +35 -0
  206. data/spec/views/tasks/taskables/questions/answers/_form.html.erb_spec.rb +18 -0
  207. data/spec/views/tasks/taskables/text/requests/_request.html.erb_spec.rb +35 -0
  208. data/spec/views/tasks/taskables/url/requests/_request.html.erb_spec.rb +35 -0
  209. data/spec/views/tasks/taskables/verifications/confirmations/_form.html.erb_spec.rb +17 -0
  210. data/spec/views/tasks/tasks/show.html.erb_spec.rb +4 -0
  211. metadata +550 -0
@@ -0,0 +1,7 @@
1
+ module Tasks
2
+ class Taskables::Question::Option < ActiveRecord::Base
3
+ belongs_to :question
4
+ has_many :votes
5
+ has_many :answers, through: :votes
6
+ end
7
+ end
@@ -0,0 +1,6 @@
1
+ module Tasks
2
+ class Taskables::Question::Vote < ActiveRecord::Base
3
+ belongs_to :answer, class_name: 'Tasks::Taskables::Question::Answer'
4
+ belongs_to :option, class_name: 'Tasks::Taskables::Question::Option'
5
+ end
6
+ end
@@ -0,0 +1,31 @@
1
+ module Tasks
2
+ module Taskables::Taskable
3
+ extend ActiveSupport::Concern
4
+
5
+ # Determine whether the task has been completed by the given author.
6
+ #
7
+ # author - Any model that can complete tasks.
8
+ #
9
+ # Returns a Boolean.
10
+ def completed_by? author
11
+ !!responses.find_by(author: author)
12
+ end
13
+
14
+ included do
15
+ has_one :task, as: :taskable, class_name: '::Tasks::Task', dependent: :destroy
16
+ end
17
+
18
+ module ClassMethods
19
+ # Declare the relation for responses.
20
+ #
21
+ # are - A model that represents submissions.
22
+ #
23
+ # This method really only aliases the name of the taskable's join model
24
+ # between authors and tasks to 'responses' so as to promote a common interface
25
+ # for any taskable.
26
+ def responses are: nil
27
+ alias_method :responses, are
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,9 @@
1
+ module Tasks
2
+ class Taskables::Taskable::Response < ActiveRecord::Base
3
+ self.table_name = 'tasks_taskables_taskable_responses'
4
+
5
+ belongs_to :author, polymorphic: true
6
+ belongs_to :submittable, polymorphic: true
7
+ belongs_to :task
8
+ end
9
+ end
@@ -0,0 +1,39 @@
1
+ module Tasks
2
+ module Taskables::Taskable::Submission
3
+ extend ActiveSupport::Concern
4
+
5
+ included do
6
+ scope :by, ->(author) { where author: author }
7
+
8
+ after_create do |model|
9
+ if model.request.task.present?
10
+ Tasks::Taskables::Taskable::Response.create do |response|
11
+ response.author = model.author
12
+ response.submittable = model
13
+ response.task = model.request.task
14
+ end
15
+ end
16
+ end
17
+
18
+ before_destroy do |model|
19
+ Tasks::Taskables::Taskable::Response.where(
20
+ "submittable_id = ? and submittable_type = ? and author_id = ? and author_type = ?",
21
+ model.id, model.class.name, model.author.id, model.author.class.name
22
+ ).delete_all
23
+ end
24
+ end
25
+
26
+ module ClassMethods
27
+ # Declare the relation the response belongs to.
28
+ #
29
+ # is - A String or Symbol describing the relation that instances of this model
30
+ # are responses for.
31
+ #
32
+ # This method really only aliases the relation to 'request' so as to promote a
33
+ # common interface for any submission.
34
+ def request is: nil
35
+ alias_method :request, is
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,7 @@
1
+ module Tasks
2
+ module Taskables::Text
3
+ def self.table_name_prefix
4
+ 'tasks_taskables_text_'
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ module Tasks
2
+ module Taskables
3
+ class Text::Request < ActiveRecord::Base
4
+ include Concerns::Models::Taskables::Text::Request
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,15 @@
1
+ module Tasks
2
+ module Taskables
3
+ class Text::Response < ActiveRecord::Base
4
+ include Taskable::Submission
5
+
6
+ belongs_to :request
7
+ belongs_to :author, polymorphic: true
8
+
9
+ validates :author_id, :author_type, presence: true
10
+ validates :text, presence: true
11
+
12
+ request is: :request
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,7 @@
1
+ module Tasks
2
+ module Taskables::URL
3
+ def self.table_name_prefix
4
+ 'tasks_taskables_url_'
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,5 @@
1
+ module Tasks
2
+ class Taskables::URL::Request < ActiveRecord::Base
3
+ include Concerns::Models::Taskables::URL::Request
4
+ end
5
+ end
@@ -0,0 +1,18 @@
1
+ module Tasks
2
+ module Taskables
3
+ class URL::Response < ActiveRecord::Base
4
+ include Taskable::Submission
5
+ include Embeddable
6
+
7
+ embeddable :video, from: :url
8
+
9
+ belongs_to :request
10
+ belongs_to :author, polymorphic: true
11
+
12
+ validates :author_id, :author_type, presence: true
13
+ validates :url, presence: true
14
+
15
+ request is: :request
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,7 @@
1
+ module Tasks
2
+ module Taskables
3
+ class Verification < ActiveRecord::Base
4
+ include Tasks::Concerns::Models::Taskables::Verification
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,12 @@
1
+ module Tasks
2
+ module Taskables
3
+ class Verification::Confirmation < ActiveRecord::Base
4
+ include Taskable::Submission
5
+
6
+ belongs_to :verification
7
+ belongs_to :author, polymorphic: true
8
+
9
+ request is: :verification
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,58 @@
1
+ # encoding: utf-8
2
+
3
+ class Tasks::ImageUploader < CarrierWave::Uploader::Base
4
+
5
+ # Include RMagick or MiniMagick support:
6
+ # include CarrierWave::RMagick
7
+ include CarrierWave::MiniMagick
8
+
9
+ # Choose what kind of storage to use for this uploader:
10
+ #storage :file
11
+ #storage :fog
12
+
13
+ # Override the directory where uploaded files will be stored.
14
+ # This is a sensible default for uploaders that are meant to be mounted:
15
+ def store_dir
16
+ "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
17
+ end
18
+
19
+ # Provide a default URL as a default if there hasn't been a file uploaded:
20
+ # def default_url
21
+ # # For Rails 3.1+ asset pipeline compatibility:
22
+ # # ActionController::Base.helpers.asset_path("fallback/" + [version_name, "default.png"].compact.join('_'))
23
+ #
24
+ # "/images/fallback/" + [version_name, "default.png"].compact.join('_')
25
+ # end
26
+
27
+ # Process files as they are uploaded:
28
+ process :resize_to_limit => [1000, nil]
29
+ process :auto_orient
30
+
31
+ def auto_orient
32
+ manipulate! do |img|
33
+ img.tap(&:auto_orient)
34
+ end
35
+ end
36
+
37
+ # def scale(width, height)
38
+ # # do something
39
+ # end
40
+
41
+ # Create different versions of your uploaded files:
42
+ # version :thumb do
43
+ # process :resize_to_fit => [50, 50]
44
+ # end
45
+
46
+ # Add a white list of extensions which are allowed to be uploaded.
47
+ # For images you might use something like this:
48
+ # def extension_white_list
49
+ # %w(jpg jpeg gif png)
50
+ # end
51
+
52
+ # Override the filename of the uploaded files:
53
+ # Avoid using model.id or version_name here, see uploader/store.rb for details.
54
+ # def filename
55
+ # "something.jpg" if original_filename
56
+ # end
57
+
58
+ end
@@ -0,0 +1,19 @@
1
+ <% if request.image? %>
2
+ <div class="image"><%= image_tag request.image %></div>
3
+ <% end %>
4
+
5
+ <div class="text"><%= request.text %></div>
6
+ <div class="description"><%= request.description %></div>
7
+
8
+ <% if request.completed_by? current_author %>
9
+ <%= t 'tasks.taskables.images.responses.already_uploaded' %>
10
+ <div class="response">
11
+ <% request.responses.by(current_user).each do |response| %>
12
+ <%= image_tag response.image %>
13
+ <% end %>
14
+ </div>
15
+ <% else %>
16
+ <div class="form">
17
+ <%= render partial: 'tasks/taskables/image/responses/form', locals: { request: request } %>
18
+ </div>
19
+ <% end %>
@@ -0,0 +1,8 @@
1
+ <%= form_for request.responses.build, url: tasks.image_request_responses_path(request_id: request.id), method: :post, html: { multipart: true } do |form| %>
2
+ <%= form.hidden_field :image, value: 0 %>
3
+ <%= form.file_field :image %>
4
+
5
+ <%= form.submit t('tasks.taskables.images.responses.upload'), data: {
6
+ disable_with: t('tasks.taskables.images.responses.uploading')
7
+ } %>
8
+ <% end %>
@@ -0,0 +1,2 @@
1
+ <h1>Taskables::Image::Responses#create</h1>
2
+ <p>Find me in app/views/tasks/taskables/image/responses/create.html.erb</p>
@@ -0,0 +1,27 @@
1
+ <% if question.image? %>
2
+ <div class="image"><%= image_tag question.image %></div>
3
+ <% end %>
4
+
5
+ <div class="text"><%= question.text %></div>
6
+ <div class="description"><%= question.description %></div>
7
+
8
+ <% if question.completed_by? current_author %>
9
+ <%= t 'tasks.taskables.questions.answers.already_answered' %>
10
+ <div class="answer">
11
+ <% question.answers.by(current_author).each do |answer| %>
12
+ <ul>
13
+ <% answer.votes.each do |vote| %>
14
+ <%= vote.option.text %>
15
+ <% end %>
16
+ </ul>
17
+ <% end %>
18
+
19
+ <% if question.show_statistics? %>
20
+ <%= render 'tasks/taskables/questions/answers/statistics', question: question %>
21
+ <% end %>
22
+ </div>
23
+ <% else %>
24
+ <div class="options">
25
+ <%= render 'tasks/taskables/questions/answers/form', question: question %>
26
+ </div>
27
+ <% end %>
@@ -0,0 +1,16 @@
1
+ <%= form_for Tasks::Taskables::Question::Answer.new, url: tasks.question_answers_path(question_id: question.id), method: :post do |form| %>
2
+ <% question.options.each do |option| %>
3
+ <div class="question option">
4
+ <% if question.multiple? %>
5
+ <%= check_box_tag 'taskables_question_answer[option_ids][]', option.id,
6
+ false, id: "taskables_question_answer_option_id_#{option.id}" %>
7
+ <% else %>
8
+ <%= radio_button_tag 'taskables_question_answer[option_ids][]', option.id,
9
+ false, id: "taskables_question_answer_option_id_#{option.id}" %>
10
+ <% end %>
11
+ <%= form.label :option_id, option.text, value: option.id %>
12
+ </div>
13
+ <% end %>
14
+
15
+ <%= form.submit t('tasks.taskables.questions.answers.submit') %>
16
+ <% end %>
@@ -0,0 +1,26 @@
1
+ <table class="answers-statistics">
2
+ <% question.options.each do |option| %>
3
+ <tr>
4
+ <td>
5
+ <%= option.text %>
6
+ <% question.answers.by(current_user).each do |answer| %>
7
+ <% answer.votes.each do |vote| %>
8
+ <%= '*' if vote.option == option %>
9
+ <% end %>
10
+ <% end %>
11
+ </td>
12
+ <% percentage = ( 100 / question.votes.count ) * option.votes.count %>
13
+ <td class="percentage-bar-container">
14
+ <span style="width: <%= percentage %>%;">
15
+ <%= percentage %>%
16
+ (<%= option.votes.count %>)
17
+ </span>
18
+ </td>
19
+ <td>
20
+ <% if option.correct? %>
21
+
22
+ <% end %>
23
+ </td>
24
+ </tr>
25
+ <% end %>
26
+ </table>
@@ -0,0 +1,19 @@
1
+ <% if request.image? %>
2
+ <div class="image"><%= image_tag request.image %></div>
3
+ <% end %>
4
+
5
+ <div class="text"><%= request.text %></div>
6
+ <div class="description"><%= request.description %></div>
7
+
8
+ <% if request.completed_by? current_author %>
9
+ <%= t 'tasks.taskables.texts.responses.already_responded' %>
10
+ <div class="response">
11
+ <% request.responses.by(current_user).each do |response| %>
12
+ <%= response.text %>
13
+ <% end %>
14
+ </div>
15
+ <% else %>
16
+ <div class="form">
17
+ <%= render partial: 'tasks/taskables/text/responses/form', locals: { request: request } %>
18
+ </div>
19
+ <% end %>
@@ -0,0 +1,5 @@
1
+ <%= form_for request.responses.build, url: tasks.text_request_responses_path(request_id: request.id), method: :post, html: { multipart: true } do |form| %>
2
+ <%= form.text_area :text %>
3
+
4
+ <%= form.submit t('tasks.taskables.texts.responses.respond') %>
5
+ <% end %>
@@ -0,0 +1,2 @@
1
+ <h1>Taskables::Text::Responses#create</h1>
2
+ <p>Find me in app/views/tasks/taskables/text/responses/create.html.erb</p>
@@ -0,0 +1,19 @@
1
+ <% if request.image? %>
2
+ <div class="image"><%= image_tag request.image %></div>
3
+ <% end %>
4
+
5
+ <div class="text"><%= request.text %></div>
6
+ <div class="description"><%= request.description %></div>
7
+
8
+ <% if request.completed_by? current_author %>
9
+ <%= t 'tasks.taskables.urls.responses.already_answered' %>
10
+ <div class="response url">
11
+ <% request.responses.by(current_user).each do |response| %>
12
+ <%= embed_video(response, Tasks.config.video_width, Tasks.config.video_height) %>
13
+ <% end %>
14
+ </div>
15
+ <% else %>
16
+ <div class="form">
17
+ <%= render partial: 'tasks/taskables/url/responses/form', locals: { request: request } %>
18
+ </div>
19
+ <% end %>
@@ -0,0 +1,5 @@
1
+ <%= form_for request.responses.build, url: tasks.url_request_responses_path(request_id: request.id), method: :post, html: { multipart: true } do |form| %>
2
+ <%= form.text_field :url %>
3
+
4
+ <%= form.submit t('tasks.taskables.urls.responses.answer') %>
5
+ <% end %>
@@ -0,0 +1,2 @@
1
+ <h1>Taskables::Image::Responses#create</h1>
2
+ <p>Find me in app/views/tasks/taskables/image/responses/create.html.erb</p>
@@ -0,0 +1 @@
1
+ <%= render verification.verifiable %>
@@ -0,0 +1,3 @@
1
+ <%= form_for confirmation, url: tasks.verification_confirmations_path(verification_id: confirmation.verification.id), method: :post do |form| %>
2
+ <%= form.submit t('tasks.taskables.verifications.confirmations.confirm') %>
3
+ <% end %>
@@ -0,0 +1,3 @@
1
+ <div class="<%= task.taskable.class.name.demodulize.underscore %> task">
2
+ <%= render task.taskable %>
3
+ </div>