tasuku 0.0.1 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +6 -6
- data/app/assets/javascripts/{tasks → tasuku}/application.js +0 -0
- data/app/assets/stylesheets/{tasks → tasuku}/application.css +0 -0
- data/app/controllers/{tasks → tasuku}/application_controller.rb +1 -1
- data/app/controllers/{tasks → tasuku}/taskables/image/responses_controller.rb +2 -2
- data/app/controllers/{tasks → tasuku}/taskables/questions/answers_controller.rb +2 -2
- data/app/controllers/{tasks → tasuku}/taskables/text/responses_controller.rb +2 -2
- data/app/controllers/{tasks → tasuku}/taskables/url/responses_controller.rb +2 -2
- data/app/controllers/{tasks → tasuku}/taskables/verifications/confirmations_controller.rb +2 -2
- data/app/controllers/{tasks → tasuku}/tasks_controller.rb +2 -2
- data/app/helpers/{tasks → tasuku}/application_helper.rb +1 -1
- data/app/helpers/{tasks → tasuku}/taskables/verifications_helper.rb +2 -2
- data/app/models/{tasks → tasuku}/task.rb +1 -1
- data/app/models/{tasks → tasuku}/taskables.rb +2 -2
- data/app/models/{tasks → tasuku}/taskables/image.rb +2 -2
- data/app/models/{tasks → tasuku}/taskables/image/request.rb +1 -1
- data/app/models/{tasks → tasuku}/taskables/image/response.rb +1 -1
- data/app/models/{tasks → tasuku}/taskables/question.rb +1 -1
- data/app/models/{tasks → tasuku}/taskables/question/answer.rb +4 -8
- data/app/models/{tasks → tasuku}/taskables/question/option.rb +1 -1
- data/app/models/tasuku/taskables/question/vote.rb +6 -0
- data/app/models/{tasks → tasuku}/taskables/taskable.rb +2 -2
- data/app/models/{tasks → tasuku}/taskables/taskable/response.rb +2 -2
- data/app/models/{tasks → tasuku}/taskables/taskable/submission.rb +1 -1
- data/app/models/{tasks → tasuku}/taskables/text.rb +2 -2
- data/app/models/{tasks → tasuku}/taskables/text/request.rb +1 -1
- data/app/models/{tasks → tasuku}/taskables/text/response.rb +1 -1
- data/app/models/{tasks → tasuku}/taskables/url.rb +2 -2
- data/app/models/{tasks → tasuku}/taskables/url/request.rb +1 -1
- data/app/models/{tasks → tasuku}/taskables/url/response.rb +1 -1
- data/app/models/{tasks → tasuku}/taskables/verification.rb +2 -2
- data/app/models/{tasks → tasuku}/taskables/verification/confirmation.rb +1 -1
- data/app/uploaders/{tasks → tasuku}/image_uploader.rb +1 -1
- data/app/views/{tasks → tasuku}/taskables/image/requests/_request.html.erb +1 -1
- data/app/views/tasuku/taskables/image/responses/_form.html.erb +8 -0
- data/app/views/tasuku/taskables/image/responses/create.html.erb +2 -0
- data/app/views/{tasks → tasuku}/taskables/questions/_question.html.erb +3 -3
- data/app/views/{tasks → tasuku}/taskables/questions/answers/_form.html.erb +2 -2
- data/app/views/{tasks → tasuku}/taskables/questions/answers/_statistics.html.erb +0 -0
- data/app/views/{tasks → tasuku}/taskables/text/requests/_request.html.erb +2 -2
- data/app/views/tasuku/taskables/text/responses/_form.html.erb +5 -0
- data/app/views/tasuku/taskables/text/responses/create.html.erb +2 -0
- data/app/views/{tasks → tasuku}/taskables/url/requests/_request.html.erb +3 -3
- data/app/views/tasuku/taskables/url/responses/_form.html.erb +5 -0
- data/app/views/tasuku/taskables/url/responses/create.html.erb +2 -0
- data/app/views/{tasks → tasuku}/taskables/verifications/_verification.html.erb +0 -0
- data/app/views/tasuku/taskables/verifications/confirmations/_form.html.erb +3 -0
- data/app/views/{tasks → tasuku}/tasks/_task.html.erb +0 -0
- data/app/views/{tasks → tasuku}/tasks/show.html.erb +0 -0
- data/config/locales/en.yml +1 -1
- data/config/locales/nb.yml +24 -25
- data/config/routes.rb +1 -1
- data/db/migrate/20140512131526_remove_option_id_from_questions.rb +12 -4
- data/db/migrate/20140606112652_migrate_polymorphic_relations.rb +19 -0
- data/db/migrate/20140610121130_change_tasks_tables_to_tasuku_tables.rb +48 -0
- data/lib/generators/tasuku/install/USAGE +5 -0
- data/lib/generators/tasuku/install/install_generator.rb +23 -0
- data/lib/generators/{tasks/install/templates/tasks.rb → tasuku/install/templates/tasuku.rb} +1 -1
- data/lib/generators/{tasks → tasuku}/views/USAGE +1 -1
- data/lib/generators/{tasks → tasuku}/views/views_generator.rb +2 -2
- data/lib/tasuku.rb +21 -1
- data/lib/tasuku/concerns.rb +7 -0
- data/lib/tasuku/concerns/controllers.rb +5 -0
- data/lib/{tasks → tasuku}/concerns/controllers/tasks_controller.rb +1 -1
- data/lib/{tasks → tasuku}/concerns/illustratable.rb +1 -1
- data/lib/tasuku/concerns/models.rb +4 -0
- data/lib/{tasks → tasuku}/concerns/models/task.rb +4 -4
- data/lib/tasuku/concerns/models/taskables.rb +7 -0
- data/lib/tasuku/concerns/models/taskables/image.rb +3 -0
- data/lib/{tasks → tasuku}/concerns/models/taskables/image/request.rb +1 -1
- data/lib/{tasks → tasuku}/concerns/models/taskables/question.rb +1 -1
- data/lib/tasuku/concerns/models/taskables/text.rb +3 -0
- data/lib/{tasks → tasuku}/concerns/models/taskables/text/request.rb +1 -1
- data/lib/tasuku/concerns/models/taskables/url.rb +3 -0
- data/lib/{tasks → tasuku}/concerns/models/taskables/url/request.rb +1 -1
- data/lib/{tasks → tasuku}/concerns/models/taskables/verification.rb +1 -1
- data/lib/{tasks → tasuku}/concerns/redirectable.rb +1 -1
- data/lib/{tasks → tasuku}/concerns/verifiable.rb +2 -1
- data/lib/{tasks → tasuku}/engine.rb +5 -5
- data/lib/tasuku/seeds.rb +13 -0
- data/lib/{tasks/tasks_tasks.rake → tasuku/tasuku_tasks.rake} +0 -0
- data/lib/tasuku/version.rb +3 -0
- data/spec/controllers/{tasks → tasuku}/taskables/image/responses_controller_spec.rb +3 -3
- data/spec/controllers/{tasks → tasuku}/taskables/questions/answers_controller_spec.rb +3 -3
- data/spec/controllers/{tasks → tasuku}/taskables/text/responses_controller_spec.rb +3 -3
- data/spec/controllers/{tasks → tasuku}/taskables/verifications/confirmations_controller_spec.rb +3 -3
- data/spec/controllers/{tasks → tasuku}/tasks_controller_spec.rb +2 -2
- data/spec/dummy/config/application.rb +1 -1
- data/spec/dummy/db/schema.rb +29 -29
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/log/test.log +14611 -0
- data/spec/dummy/public/uploads/tasuku/taskables/image/request/image/1/doge.jpg +0 -0
- data/spec/dummy/public/uploads/tasuku/taskables/image/response/image/1/doge.jpg +0 -0
- data/spec/dummy/public/uploads/tasuku/taskables/question/image/1/doge.jpg +0 -0
- data/spec/dummy/public/uploads/tasuku/taskables/text/request/image/1/doge.jpg +0 -0
- data/spec/dummy/public/uploads/tasuku/taskables/url/request/image/1/doge.jpg +0 -0
- data/spec/dummy/public/uploads/tmp/1402401935-55786-0961/doge.jpg +0 -0
- data/spec/dummy/public/uploads/tmp/1402401935-55786-2854/doge.jpg +0 -0
- data/spec/dummy/public/uploads/tmp/1402402180-56033-5455/doge.jpg +0 -0
- data/spec/dummy/public/uploads/tmp/1402402180-56033-5512/doge.jpg +0 -0
- data/spec/factories/{tasks_taskables_image_requests.rb → tasuku_taskables_image_requests.rb} +1 -1
- data/spec/factories/{tasks_taskables_image_responses.rb → tasuku_taskables_image_responses.rb} +1 -1
- data/spec/factories/{tasks_taskables_question_answers.rb → tasuku_taskables_question_answers.rb} +1 -1
- data/spec/factories/{tasks_taskables_question_options.rb → tasuku_taskables_question_options.rb} +1 -1
- data/spec/factories/{tasks_taskables_question_votes.rb → tasuku_taskables_question_votes.rb} +1 -1
- data/spec/factories/{tasks_taskables_questions.rb → tasuku_taskables_questions.rb} +2 -2
- data/spec/factories/tasuku_taskables_text_requests.rb +5 -0
- data/spec/factories/tasuku_taskables_text_responses.rb +6 -0
- data/spec/factories/{tasks_taskables_url_requests.rb → tasuku_taskables_url_requests.rb} +1 -1
- data/spec/factories/{tasks_taskables_url_responses.rb → tasuku_taskables_url_responses.rb} +1 -1
- data/spec/factories/tasuku_taskables_verification_confirmations.rb +8 -0
- data/spec/factories/tasuku_taskables_verifications.rb +7 -0
- data/spec/factories/{tasks_tasks.rb → tasuku_tasks.rb} +4 -4
- data/spec/helpers/{tasks → tasuku}/taskables/verifications_helper_spec.rb +2 -2
- data/spec/lib/generators/views_generators_spec.rb +8 -8
- data/spec/lib/{tasks → tasuku}/concerns/verifiable_spec.rb +1 -1
- data/spec/models/tasuku/task_spec.rb +17 -0
- data/spec/models/{tasks → tasuku}/taskables/image/request_spec.rb +1 -1
- data/spec/models/{tasks → tasuku}/taskables/image/response_spec.rb +2 -5
- data/spec/models/{tasks → tasuku}/taskables/question/answer_spec.rb +3 -3
- data/spec/models/{tasks → tasuku}/taskables/question/option_spec.rb +1 -1
- data/spec/models/{tasks → tasuku}/taskables/question/vote_spec.rb +1 -1
- data/spec/models/{tasks → tasuku}/taskables/question_spec.rb +1 -1
- data/spec/models/{tasks → tasuku}/taskables/taskable/submission_spec.rb +1 -1
- data/spec/models/{tasks → tasuku}/taskables/taskable_spec.rb +1 -1
- data/spec/models/{tasks → tasuku}/taskables/text/request_spec.rb +1 -1
- data/spec/models/{tasks → tasuku}/taskables/text/response_spec.rb +3 -6
- data/spec/models/{tasks → tasuku}/taskables/url/request_spec.rb +1 -1
- data/spec/models/{tasks → tasuku}/taskables/url/response_spec.rb +1 -1
- data/spec/models/{tasks → tasuku}/taskables/verification/confirmation_spec.rb +1 -1
- data/spec/models/{tasks → tasuku}/taskables/verification_spec.rb +1 -1
- data/spec/support/trackable_submission_spec.rb +2 -2
- data/spec/views/{tasks → tasuku}/taskables/image/requests/_request.html.erb_spec.rb +3 -3
- data/spec/views/{tasks → tasuku}/taskables/image/responses/create.html.erb_spec.rb +0 -0
- data/spec/views/{tasks → tasuku}/taskables/questions/_question.html.erb_spec.rb +3 -3
- data/spec/views/{tasks → tasuku}/taskables/questions/answers/_form.html.erb_spec.rb +2 -2
- data/spec/views/{tasks → tasuku}/taskables/text/requests/_request.html.erb_spec.rb +3 -3
- data/spec/views/{tasks → tasuku}/taskables/url/requests/_request.html.erb_spec.rb +3 -3
- data/spec/views/{tasks → tasuku}/taskables/verifications/confirmations/_form.html.erb_spec.rb +2 -2
- data/spec/views/tasuku/tasks/show.html.erb_spec.rb +4 -0
- metadata +184 -190
- data/app/models/tasks/taskables/question/vote.rb +0 -6
- data/app/views/tasks/taskables/image/responses/_form.html.erb +0 -8
- data/app/views/tasks/taskables/image/responses/create.html.erb +0 -2
- data/app/views/tasks/taskables/text/responses/_form.html.erb +0 -5
- data/app/views/tasks/taskables/text/responses/create.html.erb +0 -2
- data/app/views/tasks/taskables/url/responses/_form.html.erb +0 -5
- data/app/views/tasks/taskables/url/responses/create.html.erb +0 -2
- data/app/views/tasks/taskables/verifications/confirmations/_form.html.erb +0 -3
- data/lib/generators/tasks/install/USAGE +0 -8
- data/lib/generators/tasks/install/install_generator.rb +0 -23
- data/lib/tasks.rb +0 -20
- data/lib/tasks/concerns.rb +0 -7
- data/lib/tasks/concerns/controllers.rb +0 -5
- data/lib/tasks/seeds.rb +0 -13
- data/lib/tasks/version.rb +0 -3
- data/spec/factories/tasks_taskables_text_requests.rb +0 -5
- data/spec/factories/tasks_taskables_text_responses.rb +0 -6
- data/spec/factories/tasks_taskables_verification_confirmations.rb +0 -8
- data/spec/factories/tasks_taskables_verifications.rb +0 -7
- data/spec/models/tasks/task_spec.rb +0 -20
- data/spec/models/tasks/taskables/taskable/response_spec.rb +0 -7
- data/spec/views/tasks/tasks/show.html.erb_spec.rb +0 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0b0e37a9ae098ec1c1933a0d5d69d517a1ee9397
|
4
|
+
data.tar.gz: fab33f963e6b44883daa2d15b41ea90e9d4958d7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d91280373ec8d16e6635a5bb647a4e931eb8ece9c5838cd0831dbb70ea5400d1ad53cb77f5095c291feec0151e7c479e7e61358ac53030f7364bf6f7af72b50e
|
7
|
+
data.tar.gz: 9b68f94763ad774632bf700b1b8c701e21929145fa2f6835584c3771621130bb224a4790c140efda6895339fd80db33a569f1b49b66611e078770271a1b93130
|
data/README.md
CHANGED
@@ -22,7 +22,7 @@ Or install it yourself as:
|
|
22
22
|
|
23
23
|
Install the gem:
|
24
24
|
|
25
|
-
$ rails generate
|
25
|
+
$ rails generate tasuku:install
|
26
26
|
|
27
27
|
Run the migrations:
|
28
28
|
|
@@ -33,15 +33,15 @@ Then you can change the default configurations:
|
|
33
33
|
```ruby
|
34
34
|
# config/routes.rb
|
35
35
|
Rails.application.routes.draw do
|
36
|
-
mount
|
36
|
+
mount Tasuku::Engine, at: '/tasks'
|
37
37
|
end
|
38
38
|
```
|
39
39
|
|
40
40
|
And the method to use in deriving the current user:
|
41
41
|
|
42
42
|
```ruby
|
43
|
-
# config/initializers/
|
44
|
-
|
43
|
+
# config/initializers/tasuku.rb
|
44
|
+
Tasuku.configure do |config|
|
45
45
|
config.author = :current_user
|
46
46
|
end
|
47
47
|
```
|
@@ -51,7 +51,7 @@ end
|
|
51
51
|
Tasuku ships with views, but you can copy them to customize things to your liking:
|
52
52
|
|
53
53
|
```
|
54
|
-
$ rails generate
|
54
|
+
$ rails generate tasuku:views
|
55
55
|
```
|
56
56
|
|
57
57
|
Tasuku defaults to using your application's layout, so you'll need to prefix your own route helpers with `main_app` so Ruby on Rails knows where to look.
|
@@ -79,4 +79,4 @@ and if you're using this library we probably want to hire you.
|
|
79
79
|
|
80
80
|
## License
|
81
81
|
|
82
|
-
|
82
|
+
Tasuku is available under the MIT license. See the LICENSE file for more info.
|
File without changes
|
File without changes
|
@@ -1,4 +1,4 @@
|
|
1
|
-
module
|
1
|
+
module Tasuku
|
2
2
|
module Taskables::VerificationsHelper
|
3
3
|
|
4
4
|
# Render a button to confirm the given verification.
|
@@ -10,7 +10,7 @@ module Tasks
|
|
10
10
|
# confirm terms_of_service.verification
|
11
11
|
#
|
12
12
|
def confirm verification
|
13
|
-
render partial: '
|
13
|
+
render partial: 'tasuku/taskables/verifications/confirmations/form.html.erb', locals: {
|
14
14
|
confirmation: verification.confirmations.build
|
15
15
|
}
|
16
16
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
module
|
1
|
+
module Tasuku
|
2
2
|
module Taskables
|
3
3
|
class Question::Answer < ActiveRecord::Base
|
4
4
|
include Taskable::Submission
|
@@ -12,11 +12,7 @@ module Tasks
|
|
12
12
|
validate :can_only_vote_once_for_single_choice_questions
|
13
13
|
|
14
14
|
def question
|
15
|
-
if votes.any?
|
16
|
-
votes.first.option.question
|
17
|
-
else
|
18
|
-
raise StandardError, "Cannot derive question for #{self}, as it has no votes"
|
19
|
-
end
|
15
|
+
votes.first.option.question if votes.any?
|
20
16
|
end
|
21
17
|
|
22
18
|
request is: :question
|
@@ -28,11 +24,11 @@ module Tasks
|
|
28
24
|
private
|
29
25
|
|
30
26
|
def can_only_answer_each_question_once
|
31
|
-
errors.add :base, I18n.t('
|
27
|
+
errors.add :base, I18n.t('tasuku.taskables.questions.answers.already_answered') if question && question.answers.find_by(author: author)
|
32
28
|
end
|
33
29
|
|
34
30
|
def can_only_vote_once_for_single_choice_questions
|
35
|
-
errors.add :base, I18n.t('
|
31
|
+
errors.add :base, I18n.t('tasuku.taskables.questions.answers.can_only_vote_once') if question && question.single? && votes.many?
|
36
32
|
end
|
37
33
|
end
|
38
34
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
module
|
1
|
+
module Tasuku
|
2
2
|
module Taskables::Taskable
|
3
3
|
extend ActiveSupport::Concern
|
4
4
|
|
@@ -12,7 +12,7 @@ module Tasks
|
|
12
12
|
end
|
13
13
|
|
14
14
|
included do
|
15
|
-
has_one :task, as: :taskable, class_name: '::
|
15
|
+
has_one :task, as: :taskable, class_name: '::Tasuku::Task', dependent: :destroy
|
16
16
|
end
|
17
17
|
|
18
18
|
module ClassMethods
|
@@ -1,6 +1,6 @@
|
|
1
|
-
module
|
1
|
+
module Tasuku
|
2
2
|
class Taskables::Taskable::Response < ActiveRecord::Base
|
3
|
-
self.table_name = '
|
3
|
+
self.table_name = 'tasuku_taskables_taskable_responses'
|
4
4
|
|
5
5
|
belongs_to :author, polymorphic: true
|
6
6
|
belongs_to :submittable, polymorphic: true
|
@@ -0,0 +1,8 @@
|
|
1
|
+
<%= form_for request.responses.build, url: tasuku.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('tasuku.taskables.images.responses.upload'), data: {
|
6
|
+
disable_with: t('tasuku.taskables.images.responses.uploading')
|
7
|
+
} %>
|
8
|
+
<% end %>
|
@@ -6,7 +6,7 @@
|
|
6
6
|
<div class="description"><%= question.description %></div>
|
7
7
|
|
8
8
|
<% if question.completed_by? current_author %>
|
9
|
-
<%= t '
|
9
|
+
<%= t 'tasuku.taskables.questions.answers.already_answered' %>
|
10
10
|
<div class="answer">
|
11
11
|
<% question.answers.by(current_author).each do |answer| %>
|
12
12
|
<ul>
|
@@ -17,11 +17,11 @@
|
|
17
17
|
<% end %>
|
18
18
|
|
19
19
|
<% if question.show_statistics? %>
|
20
|
-
<%= render '
|
20
|
+
<%= render 'tasuku/taskables/questions/answers/statistics', question: question %>
|
21
21
|
<% end %>
|
22
22
|
</div>
|
23
23
|
<% else %>
|
24
24
|
<div class="options">
|
25
|
-
<%= render '
|
25
|
+
<%= render 'tasuku/taskables/questions/answers/form', question: question %>
|
26
26
|
</div>
|
27
27
|
<% end %>
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<%= form_for
|
1
|
+
<%= form_for Tasuku::Taskables::Question::Answer.new, url: tasuku.question_answers_path(question_id: question.id), method: :post do |form| %>
|
2
2
|
<% question.options.each do |option| %>
|
3
3
|
<div class="question option">
|
4
4
|
<% if question.multiple? %>
|
@@ -12,5 +12,5 @@
|
|
12
12
|
</div>
|
13
13
|
<% end %>
|
14
14
|
|
15
|
-
<%= form.submit t('
|
15
|
+
<%= form.submit t('tasuku.taskables.questions.answers.submit') %>
|
16
16
|
<% end %>
|
File without changes
|
@@ -6,7 +6,7 @@
|
|
6
6
|
<div class="description"><%= request.description %></div>
|
7
7
|
|
8
8
|
<% if request.completed_by? current_author %>
|
9
|
-
<%= t '
|
9
|
+
<%= t 'tasuku.taskables.texts.responses.already_responded' %>
|
10
10
|
<div class="response">
|
11
11
|
<% request.responses.by(current_user).each do |response| %>
|
12
12
|
<%= response.text %>
|
@@ -14,6 +14,6 @@
|
|
14
14
|
</div>
|
15
15
|
<% else %>
|
16
16
|
<div class="form">
|
17
|
-
<%= render partial: '
|
17
|
+
<%= render partial: 'tasuku/taskables/text/responses/form', locals: { request: request } %>
|
18
18
|
</div>
|
19
19
|
<% end %>
|