decidim 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of decidim might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/.eslintrc.json +2 -5
- data/.mention-bot +2 -1
- data/.yardopts +8 -0
- data/Gemfile.lock +64 -62
- data/README.md +11 -9
- data/decidim-admin/app/assets/javascripts/decidim/admin/sort_steps.js.es6 +3 -3
- data/decidim-admin/app/assets/stylesheets/decidim/admin/_email_preview.scss +5 -0
- data/decidim-admin/app/assets/stylesheets/decidim/admin/application.scss +1 -0
- data/decidim-admin/app/commands/decidim/admin/create_newsletter.rb +30 -0
- data/decidim-admin/app/commands/decidim/admin/deliver_newsletter.rb +29 -0
- data/decidim-admin/app/commands/decidim/admin/destroy_participatory_process_step.rb +9 -0
- data/decidim-admin/app/commands/decidim/admin/update_newsletter.rb +33 -0
- data/decidim-admin/app/constraints/decidim/admin/organization_dashboard_constraint.rb +1 -1
- data/decidim-admin/app/controllers/decidim/admin/features_controller.rb +2 -2
- data/decidim-admin/app/controllers/decidim/admin/newsletters_controller.rb +115 -0
- data/decidim-admin/app/controllers/decidim/admin/participatory_processes_controller.rb +4 -4
- data/decidim-admin/app/forms/decidim/admin/newsletter_form.rb +15 -0
- data/decidim-admin/app/jobs/decidim/admin/newsletter_delivery_job.rb +18 -0
- data/decidim-admin/app/jobs/decidim/admin/newsletter_job.rb +32 -0
- data/decidim-admin/app/models/decidim/admin/abilities/admin_user.rb +4 -0
- data/decidim-admin/app/models/decidim/admin/abilities/base.rb +4 -0
- data/decidim-admin/app/models/decidim/admin/abilities/collaborator_user.rb +19 -0
- data/decidim-admin/app/models/decidim/admin/abilities/participatory_process_admin.rb +1 -1
- data/decidim-admin/app/queries/decidim/admin/manageable_participatory_processes_for_user.rb +1 -1
- data/decidim-admin/app/views/decidim/admin/newsletters/_form.html.erb +5 -0
- data/decidim-admin/app/views/decidim/admin/newsletters/edit.html.erb +11 -0
- data/decidim-admin/app/views/decidim/admin/newsletters/index.html.erb +47 -0
- data/decidim-admin/app/views/decidim/admin/newsletters/new.html.erb +11 -0
- data/decidim-admin/app/views/decidim/admin/newsletters/show.html.erb +14 -0
- data/decidim-admin/app/views/decidim/admin/participatory_process_steps/_form.html.erb +1 -1
- data/decidim-admin/app/views/decidim/admin/participatory_processes/_form.html.erb +1 -1
- data/decidim-admin/app/views/decidim/admin/static_pages/_form.html.erb +1 -1
- data/decidim-admin/app/views/layouts/decidim/admin/_sidebar.html.erb +1 -0
- data/decidim-admin/config/locales/ca.yml +40 -0
- data/decidim-admin/config/locales/en.yml +40 -0
- data/decidim-admin/config/locales/es.yml +40 -0
- data/decidim-admin/config/routes.rb +7 -0
- data/decidim-admin/decidim-admin.gemspec +0 -1
- data/decidim-admin/lib/decidim/admin/engine.rb +1 -0
- data/decidim-admin/lib/decidim/admin/features/base_controller.rb +5 -1
- data/decidim-admin/spec/commands/create_newsletter_spec.rb +62 -0
- data/decidim-admin/spec/commands/deliver_newsletter_spec.rb +45 -0
- data/decidim-admin/spec/commands/destroy_participatory_process_step_spec.rb +12 -0
- data/decidim-admin/spec/commands/update_newsletter_spec.rb +64 -0
- data/decidim-admin/spec/features/admin_manages_newsletters_spec.rb +147 -0
- data/decidim-admin/spec/features/admin_manages_participatory_processes_spec.rb +1 -5
- data/decidim-admin/spec/features/static_pages_spec.rb +16 -0
- data/decidim-admin/spec/forms/newsletter_form_spec.rb +47 -0
- data/decidim-admin/spec/jobs/newsletter_delivery_job_spec.rb +25 -0
- data/decidim-admin/spec/jobs/newsletter_job_spec.rb +29 -0
- data/decidim-admin/spec/models/abilities/collaborator_user_spec.rb +66 -0
- data/decidim-admin/spec/organization_dashboard_constraint_spec.rb +55 -0
- data/decidim-admin/spec/queries/manageable_participatory_processes_for_user_spec.rb +8 -0
- data/decidim-admin/spec/shared/manage_processes_examples.rb +1 -5
- data/decidim-api/lib/decidim/api.rb +2 -7
- data/decidim-api/lib/decidim/api/{types/mutation.rb → mutation_type.rb} +0 -0
- data/decidim-api/lib/decidim/api/{types/query.rb → query_type.rb} +0 -0
- data/decidim-budgets/app/assets/javascripts/decidim/budgets/projects.js.es6 +4 -4
- data/decidim-budgets/app/commands/decidim/budgets/add_line_item.rb +4 -2
- data/decidim-budgets/app/commands/decidim/budgets/checkout.rb +7 -3
- data/decidim-budgets/app/models/decidim/budgets/order.rb +16 -1
- data/decidim-budgets/app/models/decidim/budgets/project.rb +16 -0
- data/decidim-budgets/app/views/decidim/budgets/line_items/update_budget.js.erb +7 -7
- data/decidim-budgets/app/views/decidim/budgets/projects/_budget_confirm.html.erb +27 -25
- data/decidim-budgets/app/views/decidim/budgets/projects/_budget_summary.html.erb +4 -13
- data/decidim-budgets/app/views/decidim/budgets/projects/_order_progress.html.erb +23 -21
- data/decidim-budgets/app/views/decidim/budgets/projects/_order_selected_projects.html.erb +25 -23
- data/decidim-budgets/app/views/decidim/budgets/projects/_order_total_budget.html.erb +3 -1
- data/decidim-budgets/app/views/decidim/budgets/projects/_project.html.erb +32 -30
- data/decidim-budgets/app/views/decidim/budgets/projects/_projects.html.erb +1 -3
- data/decidim-budgets/app/views/decidim/budgets/projects/index.html.erb +0 -4
- data/decidim-budgets/app/views/decidim/budgets/projects/show.html.erb +5 -6
- data/decidim-budgets/config/i18n-tasks.yml +1 -0
- data/decidim-budgets/config/locales/ca.yml +7 -2
- data/decidim-budgets/config/locales/en.yml +17 -6
- data/decidim-budgets/config/locales/es.yml +7 -2
- data/decidim-budgets/lib/decidim/budgets/feature.rb +2 -2
- data/decidim-budgets/spec/commands/add_line_item_spec.rb +16 -3
- data/decidim-budgets/spec/commands/cancel_order_spec.rb +7 -1
- data/decidim-budgets/spec/commands/checkout_spec.rb +9 -2
- data/decidim-budgets/spec/commands/remove_line_item_spec.rb +16 -5
- data/decidim-budgets/spec/features/orders_spec.rb +8 -2
- data/decidim-budgets/spec/models/order_spec.rb +31 -2
- data/decidim-budgets/spec/shared/admin_shared_context.rb +1 -1
- data/decidim-comments/README.md +1 -1
- data/decidim-comments/app/assets/javascripts/decidim/comments/bundle.js +0 -0
- data/decidim-comments/app/frontend/comments/add_comment_form.component.jsx +156 -93
- data/decidim-comments/app/frontend/comments/add_comment_form.component.test.jsx +36 -23
- data/decidim-comments/app/frontend/comments/add_comment_form.mutation.graphql +5 -3
- data/decidim-comments/app/frontend/comments/add_comment_form_commentable.fragment.graphql +4 -0
- data/decidim-comments/app/frontend/comments/add_comment_form_session.fragment.graphql +6 -0
- data/decidim-comments/app/frontend/comments/comment.component.jsx +11 -13
- data/decidim-comments/app/frontend/comments/comment.component.test.jsx +22 -21
- data/decidim-comments/app/frontend/comments/comment.fragment.graphql +4 -4
- data/decidim-comments/app/frontend/comments/comment_data.fragment.graphql +4 -3
- data/decidim-comments/app/frontend/comments/comment_order_selector.component.jsx +1 -1
- data/decidim-comments/app/frontend/comments/comment_thread.component.jsx +3 -3
- data/decidim-comments/app/frontend/comments/comment_thread.component.test.jsx +3 -3
- data/decidim-comments/app/frontend/comments/comment_thread.fragment.graphql +1 -1
- data/decidim-comments/app/frontend/comments/comments.component.jsx +47 -39
- data/decidim-comments/app/frontend/comments/comments.component.test.jsx +51 -38
- data/decidim-comments/app/frontend/comments/comments.query.graphql +10 -4
- data/decidim-comments/app/frontend/comments/down_vote_button.component.jsx +6 -3
- data/decidim-comments/app/frontend/comments/up_vote_button.component.jsx +7 -4
- data/decidim-comments/app/frontend/support/generate_comments_data.js +4 -4
- data/decidim-comments/app/models/decidim/comments/comment.rb +7 -9
- data/decidim-comments/app/queries/decidim/comments/{comments_with_replies.rb → sorted_comments.rb} +3 -8
- data/decidim-comments/app/types/decidim/comments/commentable_interface.rb +44 -0
- data/decidim-comments/app/types/decidim/comments/commentable_mutation_type.rb +29 -0
- data/decidim-comments/app/types/decidim/comments/commentable_type.rb +14 -0
- data/decidim-comments/config/locales/ca.yml +3 -1
- data/decidim-comments/config/locales/en.yml +5 -2
- data/decidim-comments/config/locales/es.yml +3 -1
- data/decidim-comments/lib/decidim/comments.rb +4 -0
- data/decidim-comments/{app/types/decidim/comments → lib/decidim/comments/api}/add_comment_type.rb +0 -0
- data/decidim-comments/{app/types/decidim/comments → lib/decidim/comments/api}/comment_mutation_type.rb +0 -0
- data/decidim-comments/{app/types/decidim/comments → lib/decidim/comments/api}/comment_type.rb +11 -17
- data/decidim-comments/lib/decidim/comments/commentable.rb +45 -0
- data/decidim-comments/lib/decidim/comments/comments_helper.rb +15 -10
- data/decidim-comments/lib/decidim/comments/mutation_extensions.rb +8 -16
- data/decidim-comments/lib/decidim/comments/query_extensions.rb +5 -8
- data/decidim-comments/lib/decidim/comments/test/factories.rb +3 -3
- data/decidim-comments/spec/commands/vote_comment_spec.rb +3 -1
- data/decidim-comments/spec/features/comments_spec.rb +28 -14
- data/decidim-comments/spec/features/notifications_spec.rb +1 -1
- data/decidim-comments/spec/helpers/comments_helper_spec.rb +4 -27
- data/decidim-comments/spec/models/comment_spec.rb +7 -11
- data/decidim-comments/spec/models/comment_vote_spec.rb +3 -1
- data/decidim-comments/spec/models/seed_spec.rb +3 -4
- data/decidim-comments/spec/queries/{comments_with_replies_spec.rb → sorted_comments_spec.rb} +12 -29
- data/decidim-comments/spec/types/comment_type_spec.rb +23 -17
- data/decidim-comments/spec/types/commentable_mutation_type_spec.rb +34 -0
- data/decidim-comments/spec/types/commentable_type_spec.rb +48 -0
- data/decidim-comments/spec/types/mutation_type_spec.rb +5 -22
- data/decidim-comments/spec/types/query_type_spec.rb +0 -24
- data/decidim-dev/config/i18n-tasks.yml +4 -0
- data/decidim-dev/decidim-dev.gemspec +1 -1
- data/decidim-dev/lib/decidim/dev/test/rspec_support/action_mailer.rb +10 -4
- data/decidim-dev/lib/decidim/dev/test/rspec_support/feature.rb +6 -5
- data/decidim-dev/lib/decidim/dev/test/rspec_support/i18n.rb +0 -1
- data/decidim-meetings/app/assets/javascripts/decidim/meetings/map.js.es6.erb +8 -3
- data/decidim-meetings/app/assets/stylesheets/decidim/meetings/map.css +3 -1
- data/decidim-meetings/app/controllers/decidim/meetings/meetings_controller.rb +2 -2
- data/decidim-meetings/app/forms/decidim/meetings/admin/close_meeting_form.rb +2 -1
- data/decidim-meetings/app/helpers/decidim/meetings/map_helper.rb +1 -0
- data/decidim-meetings/app/services/decidim/meetings/meeting_search.rb +7 -3
- data/decidim-meetings/app/views/decidim/meetings/meetings/_datetime.html.erb +1 -1
- data/decidim-meetings/app/views/decidim/meetings/meetings/_filters.html.erb +5 -5
- data/decidim-meetings/app/views/decidim/meetings/meetings/_linked_meetings.html.erb +1 -1
- data/decidim-meetings/app/views/decidim/meetings/meetings/index.html.erb +1 -5
- data/decidim-meetings/app/views/decidim/meetings/meetings/show.html.erb +16 -9
- data/decidim-meetings/config/locales/ca.yml +2 -3
- data/decidim-meetings/config/locales/en.yml +2 -3
- data/decidim-meetings/config/locales/es.yml +2 -3
- data/decidim-meetings/spec/features/explore_meetings_spec.rb +75 -24
- data/decidim-meetings/spec/forms/close_meeting_form_spec.rb +1 -1
- data/decidim-meetings/spec/services/meeting_search_spec.rb +15 -12
- data/decidim-meetings/vendor/assets/javascripts/leaflet.markercluster.js +7 -0
- data/decidim-meetings/vendor/assets/stylesheets/MarkerCluster.Default.css +60 -0
- data/decidim-meetings/vendor/assets/stylesheets/MarkerCluster.css +14 -0
- data/decidim-pages/app/models/decidim/pages/page.rb +22 -0
- data/decidim-pages/app/views/decidim/pages/application/show.html.erb +2 -6
- data/decidim-pages/config/locales/ca.yml +2 -2
- data/decidim-pages/config/locales/en.yml +2 -2
- data/decidim-pages/config/locales/es.yml +2 -2
- data/decidim-pages/lib/decidim/pages/feature.rb +2 -2
- data/decidim-pages/spec/features/page_show_spec.rb +0 -33
- data/decidim-proposals/app/controllers/decidim/proposals/admin/proposal_answers_controller.rb +2 -0
- data/decidim-proposals/app/controllers/decidim/proposals/admin/proposals_controller.rb +2 -0
- data/decidim-proposals/app/models/decidim/proposals/abilities/admin_user.rb +45 -0
- data/decidim-proposals/app/models/decidim/proposals/abilities/process_admin_user.rb +57 -0
- data/decidim-proposals/app/models/decidim/proposals/proposal.rb +21 -0
- data/decidim-proposals/app/views/decidim/proposals/admin/proposals/_form.html.erb +1 -1
- data/decidim-proposals/app/views/decidim/proposals/admin/proposals/index.html.erb +16 -10
- data/decidim-proposals/app/views/decidim/proposals/proposal_votes/update_buttons_and_counters.js.erb +4 -4
- data/decidim-proposals/app/views/decidim/proposals/proposals/_filters.html.erb +7 -3
- data/decidim-proposals/app/views/decidim/proposals/proposals/_proposal.html.erb +2 -6
- data/decidim-proposals/app/views/decidim/proposals/proposals/_remaining_votes_count.html.erb +3 -1
- data/decidim-proposals/app/views/decidim/proposals/proposals/_tags.html.erb +1 -1
- data/decidim-proposals/app/views/decidim/proposals/proposals/_vote_button.html.erb +23 -21
- data/decidim-proposals/app/views/decidim/proposals/proposals/_votes_count.html.erb +9 -6
- data/decidim-proposals/app/views/decidim/proposals/proposals/_votes_limit.html.erb +1 -3
- data/decidim-proposals/app/views/decidim/proposals/proposals/index.html.erb +0 -4
- data/decidim-proposals/app/views/decidim/proposals/proposals/new.html.erb +1 -1
- data/decidim-proposals/app/views/decidim/proposals/proposals/show.html.erb +2 -6
- data/decidim-proposals/config/locales/ca.yml +8 -1
- data/decidim-proposals/config/locales/en.yml +8 -1
- data/decidim-proposals/config/locales/es.yml +8 -1
- data/decidim-proposals/lib/decidim/proposals/admin_engine.rb +7 -0
- data/decidim-proposals/lib/decidim/proposals/feature.rb +6 -2
- data/decidim-proposals/spec/features/proposals_spec.rb +226 -40
- data/decidim-proposals/spec/models/decidim/proposals/abilities/admin_user_spec.rb +62 -0
- data/decidim-proposals/spec/models/decidim/proposals/abilities/process_admin_user_spec.rb +63 -0
- data/decidim-proposals/spec/shared/manage_proposals_examples.rb +161 -50
- data/decidim-results/app/models/decidim/results/result.rb +21 -0
- data/decidim-results/app/views/decidim/results/results/index.html.erb +0 -4
- data/decidim-results/app/views/decidim/results/results/show.html.erb +2 -8
- data/decidim-results/config/i18n-tasks.yml +1 -0
- data/decidim-results/config/locales/ca.yml +5 -2
- data/decidim-results/config/locales/en.yml +5 -2
- data/decidim-results/config/locales/es.yml +5 -2
- data/decidim-results/lib/decidim/results/feature.rb +2 -2
- data/decidim-results/spec/services/result_stats_calculator_spec.rb +2 -2
- data/decidim-results/spec/shared/admin_shared_context.rb +1 -1
- data/decidim-system/config/i18n-tasks.yml +1 -1
- data/package.json +50 -51
- data/yarn.lock +198 -151
- metadata +69 -36
- data/decidim-admin/spec/features/admin_access_control.rb +0 -52
- data/decidim-api/lib/decidim/api/types/author_interface.rb +0 -13
- data/decidim-api/lib/decidim/api/types/localized_string.rb +0 -13
- data/decidim-api/lib/decidim/api/types/translated_field.rb +0 -44
- data/decidim-api/spec/types/localized_string_type_spec.rb +0 -31
- data/decidim-api/spec/types/translated_field_type_spec.rb +0 -69
- data/decidim-comments/app/frontend/comments/add_comment_form.fragment.graphql +0 -6
@@ -0,0 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require "spec_helper"
|
3
|
+
require "decidim/api/test/type_context"
|
4
|
+
|
5
|
+
module Decidim
|
6
|
+
module Comments
|
7
|
+
describe CommentableMutationType do
|
8
|
+
include_context "graphql type"
|
9
|
+
|
10
|
+
let(:participatory_process) { create(:participatory_process, organization: current_organization) }
|
11
|
+
let(:feature) { create(:feature, participatory_process: participatory_process) }
|
12
|
+
let(:model) { create(:dummy_resource, feature: feature) }
|
13
|
+
let(:body) { "test" }
|
14
|
+
let(:alignment) { 1 }
|
15
|
+
|
16
|
+
describe "addComment" do
|
17
|
+
let(:query) {
|
18
|
+
"{ addComment(body: \"#{body}\", alignment: #{alignment}) { body } }"
|
19
|
+
}
|
20
|
+
|
21
|
+
it "calls CreateComment command" do
|
22
|
+
params = { "comment" => { "body" => body, "alignment" => alignment, "user_group_id" => nil } }
|
23
|
+
expect(Decidim::Comments::CommentForm).to receive(:from_params).with(params).and_call_original
|
24
|
+
expect(Decidim::Comments::CreateComment).to receive(:call).with(
|
25
|
+
an_instance_of(Decidim::Comments::CommentForm),
|
26
|
+
current_user,
|
27
|
+
model
|
28
|
+
).and_call_original
|
29
|
+
expect(response["addComment"]).to include("body" => body)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require "spec_helper"
|
3
|
+
require "decidim/api/test/type_context"
|
4
|
+
|
5
|
+
module Decidim
|
6
|
+
module Comments
|
7
|
+
describe CommentableType do
|
8
|
+
include_context "graphql type"
|
9
|
+
|
10
|
+
let(:model) { create(:dummy_resource) }
|
11
|
+
let!(:comments) { create_list(:comment, 3, commentable: model) }
|
12
|
+
|
13
|
+
describe "acceptsNewComments" do
|
14
|
+
let(:query) { "{ acceptsNewComments }" }
|
15
|
+
|
16
|
+
it "returns the 'accepts_new_comments?' method value" do
|
17
|
+
expect(response).to include("acceptsNewComments" => model.accepts_new_comments?)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
describe "commentsHaveAlignment" do
|
22
|
+
let(:query) { "{ commentsHaveAlignment }" }
|
23
|
+
|
24
|
+
it "returns the 'comments_have_alignment?' method value" do
|
25
|
+
expect(response).to include("commentsHaveAlignment" => model.comments_have_alignment?)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
describe "commentsHaveVotes" do
|
30
|
+
let(:query) { "{ commentsHaveVotes }" }
|
31
|
+
|
32
|
+
it "returns the 'comments_have_votes?' method value" do
|
33
|
+
expect(response).to include("commentsHaveVotes" => model.comments_have_votes?)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
describe "comments" do
|
38
|
+
let(:query) { "{ comments { id } }" }
|
39
|
+
|
40
|
+
it "returns the commentable comments" do
|
41
|
+
model.comments.each do |comment|
|
42
|
+
expect(response["comments"]).to include("id" => comment.id.to_s)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -7,31 +7,14 @@ module Decidim
|
|
7
7
|
describe MutationType do
|
8
8
|
include_context "graphql type"
|
9
9
|
|
10
|
-
|
11
|
-
let!(:
|
12
|
-
let!(:dummy_resource) { create(:dummy_resource, feature: feature) }
|
13
|
-
|
10
|
+
describe "commentable" do
|
11
|
+
let!(:commentable) { create(:dummy_resource) }
|
14
12
|
let(:query) {
|
15
|
-
"{
|
13
|
+
"{ commentable(id: \"#{commentable.id}\", type: \"#{commentable.commentable_type}\") { id } }"
|
16
14
|
}
|
17
15
|
|
18
|
-
it "should
|
19
|
-
expect(response["
|
20
|
-
comment = Decidim::Comments::Comment.last
|
21
|
-
expect(comment.commentable).to eq(dummy_resource)
|
22
|
-
expect(response["addComment"]).to include("id" => comment.id.to_s)
|
23
|
-
end
|
24
|
-
|
25
|
-
context "if the query contains an argument alignment" do
|
26
|
-
let(:query) {
|
27
|
-
"{ addComment(commentableId: \"#{dummy_resource.id}\", commentableType: \"Decidim::DummyResource\", body: \"This is positive comment\", alignment: 1) { alignment } }"
|
28
|
-
}
|
29
|
-
|
30
|
-
it "should create a comment with that alignment" do
|
31
|
-
expect(response["addComment"]).to include("alignment" => 1)
|
32
|
-
comment = Decidim::Comments::Comment.last
|
33
|
-
expect(comment.alignment).to eq(1)
|
34
|
-
end
|
16
|
+
it "should fetch the commentable given its id and commentable_type" do
|
17
|
+
expect(response["commentable"]).to include("id" => commentable.id.to_s)
|
35
18
|
end
|
36
19
|
end
|
37
20
|
|
@@ -22,28 +22,4 @@ describe Decidim::Api::QueryType do
|
|
22
22
|
end
|
23
23
|
end
|
24
24
|
end
|
25
|
-
|
26
|
-
describe "comments" do
|
27
|
-
let!(:participatory_process_1) { create(:participatory_process, organization: current_organization) }
|
28
|
-
let!(:comment_1) { create(:comment, commentable: participatory_process_1) }
|
29
|
-
let!(:comment_2) { create(:comment, commentable: participatory_process_1) }
|
30
|
-
let!(:participatory_process_2) { create(:participatory_process, organization: current_organization) }
|
31
|
-
let!(:comment_3) { create(:comment, commentable: participatory_process_2) }
|
32
|
-
|
33
|
-
let(:query) { "{ comments(commentableId: \"#{participatory_process_1.id}\", commentableType: \"Decidim::ParticipatoryProcess\") { id } }" }
|
34
|
-
|
35
|
-
it "returns comments from a commentable resource" do
|
36
|
-
expect(response["comments"]).to include("id" => comment_1.id.to_s)
|
37
|
-
expect(response["comments"]).to include("id" => comment_2.id.to_s)
|
38
|
-
expect(response["comments"]).not_to include("id" => comment_3.id.to_s)
|
39
|
-
end
|
40
|
-
|
41
|
-
it "returns comments ordered by creation date" do
|
42
|
-
comment_2.update_attribute(:created_at, 2.days.ago)
|
43
|
-
comment_1.update_attribute(:created_at, 1.days.ago)
|
44
|
-
|
45
|
-
expect(response["comments"][0]["id"]).to eq comment_2.id.to_s
|
46
|
-
expect(response["comments"][1]["id"]).to eq comment_1.id.to_s
|
47
|
-
end
|
48
|
-
end
|
49
25
|
end
|
@@ -25,7 +25,7 @@ Gem::Specification.new do |s|
|
|
25
25
|
s.add_dependency "wisper-rspec"
|
26
26
|
s.add_dependency "listen", "~> 3.1.0"
|
27
27
|
s.add_dependency "launchy"
|
28
|
-
s.add_dependency "i18n-tasks", "0.9.
|
28
|
+
s.add_dependency "i18n-tasks", "0.9.12"
|
29
29
|
s.add_dependency "faker", "~> 1.7.3"
|
30
30
|
s.add_dependency "poltergeist", "~> 1.13.0"
|
31
31
|
s.add_dependency "rails-controller-testing", "~> 1.0.1"
|
@@ -2,9 +2,7 @@
|
|
2
2
|
require "nokogiri"
|
3
3
|
|
4
4
|
RSpec.configure do |config|
|
5
|
-
config.before(:each)
|
6
|
-
ActionMailer::Base.deliveries.clear
|
7
|
-
end
|
5
|
+
config.before(:each) { clear_emails }
|
8
6
|
end
|
9
7
|
|
10
8
|
# A set of helpers meant to make your life easier when testing
|
@@ -15,12 +13,20 @@ module MailerHelpers
|
|
15
13
|
ActionMailer::Base.deliveries
|
16
14
|
end
|
17
15
|
|
16
|
+
def clear_emails
|
17
|
+
ActionMailer::Base.deliveries.clear
|
18
|
+
end
|
19
|
+
|
18
20
|
def last_email
|
19
21
|
emails.last
|
20
22
|
end
|
21
23
|
|
22
24
|
def last_email_body
|
23
|
-
(last_email
|
25
|
+
email_body(last_email)
|
26
|
+
end
|
27
|
+
|
28
|
+
def email_body(email)
|
29
|
+
(email.try(:html_part).try(:body) || email.body).encoded
|
24
30
|
end
|
25
31
|
|
26
32
|
def last_email_link
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "decidim/feature_validator"
|
4
|
-
require "decidim/comments
|
4
|
+
require "decidim/comments"
|
5
5
|
|
6
6
|
module Decidim
|
7
7
|
# Dummy engine to be able to test components.
|
@@ -18,6 +18,7 @@ module Decidim
|
|
18
18
|
include HasFeature
|
19
19
|
include Resourceable
|
20
20
|
include Authorable
|
21
|
+
include Decidim::Comments::Commentable
|
21
22
|
|
22
23
|
feature_manifest_name "dummy"
|
23
24
|
end
|
@@ -28,12 +29,10 @@ module Decidim
|
|
28
29
|
|
29
30
|
def show
|
30
31
|
@commentable = DummyResource.find(params[:id])
|
31
|
-
@options = params.slice(:arguable, :votable)
|
32
|
-
@options.each { |key, val| @options[key] = val === "true" }
|
33
32
|
render inline: %{
|
34
33
|
<%= javascript_include_tag 'application' %>
|
35
|
-
<%=
|
36
|
-
}
|
34
|
+
<%= inline_comments_for(@commentable) %>
|
35
|
+
}
|
37
36
|
end
|
38
37
|
end
|
39
38
|
end
|
@@ -44,11 +43,13 @@ Decidim.register_feature(:dummy) do |feature|
|
|
44
43
|
feature.actions = %w(foo bar)
|
45
44
|
|
46
45
|
feature.settings(:global) do |settings|
|
46
|
+
settings.attribute :comments_enabled, type: :boolean, default: true
|
47
47
|
settings.attribute :dummy_global_attribute_1, type: :boolean
|
48
48
|
settings.attribute :dummy_global_attribute_2, type: :boolean
|
49
49
|
end
|
50
50
|
|
51
51
|
feature.settings(:step) do |settings|
|
52
|
+
settings.attribute :comments_blocked, type: :boolean, default: false
|
52
53
|
settings.attribute :dummy_step_attribute_1, type: :boolean
|
53
54
|
settings.attribute :dummy_step_attribute_2, type: :boolean
|
54
55
|
end
|
@@ -1,6 +1,7 @@
|
|
1
1
|
// = require leaflet
|
2
2
|
// = require leaflet-tilelayer-here
|
3
3
|
// = require leaflet-svg-icon
|
4
|
+
// = require leaflet.markercluster
|
4
5
|
// = require jquery-tmpl
|
5
6
|
// = require_self
|
6
7
|
|
@@ -22,13 +23,13 @@ L.DivIcon.SVGIcon.DecidimIcon = L.DivIcon.SVGIcon.extend({
|
|
22
23
|
const popupTemplateId = 'meeting-popup';
|
23
24
|
$.template('meeting-popup', $(`#${popupTemplateId}`).html());
|
24
25
|
|
25
|
-
const addMarkers = (meetingsData, map) => {
|
26
|
+
const addMarkers = (meetingsData, markerClusters, map) => {
|
26
27
|
const bounds = new L.LatLngBounds(meetingsData.map((meeting) => [meeting.latitude, meeting.longitude]));
|
27
28
|
|
28
29
|
meetingsData.forEach((meeting) => {
|
29
30
|
let marker = L.marker([meeting.latitude, meeting.longitude], {
|
30
31
|
icon: new L.DivIcon.SVGIcon.DecidimIcon()
|
31
|
-
})
|
32
|
+
});
|
32
33
|
let node = document.createElement('div');
|
33
34
|
|
34
35
|
$.tmpl('meeting-popup', meeting).appendTo(node);
|
@@ -39,12 +40,16 @@ const addMarkers = (meetingsData, map) => {
|
|
39
40
|
keepInView: true,
|
40
41
|
className: 'map-info'
|
41
42
|
}).openPopup();
|
43
|
+
|
44
|
+
markerClusters.addLayer(marker);
|
42
45
|
});
|
43
46
|
|
47
|
+
map.addLayer(markerClusters);
|
44
48
|
map.fitBounds(bounds, { padding: [100, 100] });
|
45
49
|
};
|
46
50
|
|
47
51
|
const loadMap = (mapId, meetingsData) => {
|
52
|
+
let markerClusters = L.markerClusterGroup();
|
48
53
|
const { hereAppId, hereAppCode } = window.DecidimMeetings.mapConfiguration;
|
49
54
|
|
50
55
|
if (window.DecidimMeetings.currentMap) {
|
@@ -60,7 +65,7 @@ const loadMap = (mapId, meetingsData) => {
|
|
60
65
|
}).addTo(map);
|
61
66
|
|
62
67
|
if (meetingsData.length > 0) {
|
63
|
-
addMarkers(meetingsData, map);
|
68
|
+
addMarkers(meetingsData, markerClusters, map);
|
64
69
|
} else {
|
65
70
|
map.fitWorld();
|
66
71
|
}
|
@@ -26,7 +26,7 @@ module Decidim
|
|
26
26
|
end
|
27
27
|
|
28
28
|
def meeting
|
29
|
-
@meeting ||=
|
29
|
+
@meeting ||= Meeting.where(feature: current_feature).find(params[:id])
|
30
30
|
end
|
31
31
|
|
32
32
|
def search_klass
|
@@ -35,7 +35,7 @@ module Decidim
|
|
35
35
|
|
36
36
|
def default_filter_params
|
37
37
|
{
|
38
|
-
|
38
|
+
date: "upcoming",
|
39
39
|
search_text: "",
|
40
40
|
scope_id: "",
|
41
41
|
category_id: ""
|
@@ -15,7 +15,8 @@ module Decidim
|
|
15
15
|
attribute :closed_at, DateTime, default: ->(_form, _attribute) { Time.current }
|
16
16
|
|
17
17
|
validates :closing_report, translatable_presence: true
|
18
|
-
validates :attendees_count,
|
18
|
+
validates :attendees_count, presence: true, numericality: { greater_than_or_equal_to: 0 }
|
19
|
+
validates :contributions_count, numericality: true, allow_blank: true
|
19
20
|
validates :attending_organizations, presence: true
|
20
21
|
|
21
22
|
# Private: Gets the proposals from the meeting and injects them to the form.
|
@@ -34,6 +34,7 @@ module Decidim
|
|
34
34
|
description: translated_attribute(meeting.description),
|
35
35
|
startTimeDay: l(meeting.start_time, format: "%d"),
|
36
36
|
startTimeMonth: l(meeting.start_time, format: "%B"),
|
37
|
+
startTimeYear: l(meeting.start_time, format: "%Y"),
|
37
38
|
startTime: "#{meeting.start_time.strftime("%H:%M")} - #{meeting.end_time.strftime("%H:%M")}",
|
38
39
|
icon: icon("meetings", width: 40, height: 70, remove_icon_class: true),
|
39
40
|
location: translated_attribute(meeting.location),
|
@@ -20,9 +20,13 @@ module Decidim
|
|
20
20
|
.or(query.where(localized_search_text_in(:description), text: "%#{search_text}%"))
|
21
21
|
end
|
22
22
|
|
23
|
-
# Handle the
|
24
|
-
def
|
25
|
-
|
23
|
+
# Handle the date filter
|
24
|
+
def search_date
|
25
|
+
if options[:date] == "upcoming"
|
26
|
+
query.where("start_time >= ? ", Time.current).order("start_time ASC")
|
27
|
+
elsif options[:date] == "past"
|
28
|
+
query.where("start_time <= ? ", Time.current).order("start_time DESC")
|
29
|
+
end
|
26
30
|
end
|
27
31
|
|
28
32
|
# Handle the scope_id filter
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<div class="card__datetime">
|
2
2
|
<div class="card__datetime__date">
|
3
|
-
<%= l meeting.start_time, format: "%d" %> <span class="card__datetime__month"><%= l meeting.start_time, format: "%B" %></span>
|
3
|
+
<%= l meeting.start_time, format: "%d" %> <span class="card__datetime__month"><%= l meeting.start_time, format: "%B %Y" %></span>
|
4
4
|
</div>
|
5
5
|
<div class="card__datetime__time">
|
6
6
|
<%= meeting.start_time.strftime("%H:%M") %> - <%= meeting.end_time.strftime("%H:%M") %>
|
@@ -2,23 +2,23 @@
|
|
2
2
|
<div class="filters__section">
|
3
3
|
<div class="filters__search">
|
4
4
|
<div class="input-group">
|
5
|
-
<%= form.search_field :search_text, label: false, class: "input-group-field", placeholder: t(
|
5
|
+
<%= form.search_field :search_text, label: false, class: "input-group-field", placeholder: t(".search") %>
|
6
6
|
<div class="input-group-button">
|
7
7
|
<button type="submit" class="button button--muted">
|
8
|
-
<%= icon "magnifying-glass", aria_label: t(
|
8
|
+
<%= icon "magnifying-glass", aria_label: t(".search") %>
|
9
9
|
</button>
|
10
10
|
</div>
|
11
11
|
</div>
|
12
12
|
</div>
|
13
13
|
</div>
|
14
14
|
|
15
|
-
<%= form.collection_radio_buttons :
|
15
|
+
<%= form.collection_radio_buttons :date, [["upcoming", t(".upcoming")], ["past", t(".past")]], :first, :last, legend_title: t(".date") %>
|
16
16
|
|
17
17
|
<% if current_organization.scopes.any? %>
|
18
|
-
<%= form.collection_check_boxes :scope_id, current_organization.scopes, lambda {|scope| scope.id.to_s}, :name, legend_title: t(
|
18
|
+
<%= form.collection_check_boxes :scope_id, current_organization.scopes, lambda {|scope| scope.id.to_s}, :name, legend_title: t(".scopes") %>
|
19
19
|
<% end %>
|
20
20
|
|
21
21
|
<% if current_feature.categories.any? %>
|
22
|
-
<%= form.categories_select :category_id, current_feature.categories, legend_title: t(
|
22
|
+
<%= form.categories_select :category_id, current_feature.categories, legend_title: t(".category"), disable_parents: false, label: false, include_blank: true %>
|
23
23
|
<% end %>
|
24
24
|
<% end %>
|
@@ -8,7 +8,7 @@
|
|
8
8
|
<% end %>
|
9
9
|
<div class="card__datetime">
|
10
10
|
<div class="card__datetime__date">
|
11
|
-
<%= l meeting.start_time, format: "%d" %> <span class="card__datetime__month"><%= l meeting.start_time, format: "%B" %></span>
|
11
|
+
<%= l meeting.start_time, format: "%d" %> <span class="card__datetime__month"><%= l meeting.start_time, format: "%B %Y" %></span>
|
12
12
|
</div>
|
13
13
|
<div class="card__datetime__time">
|
14
14
|
<%= meeting.start_time.strftime("%H:%M") %> - <%= meeting.end_time.strftime("%H:%M") %>
|
@@ -1,7 +1,3 @@
|
|
1
|
-
<% add_meta_tags({
|
2
|
-
title: t(".meta_title", feature_name: translated_attribute(current_feature.name))
|
3
|
-
}) %>
|
4
|
-
|
5
1
|
<% if Decidim.geocoder.present? %>
|
6
2
|
<div class="row column">
|
7
3
|
<div class="google-map" id="meetings-map" data-meetings="<%= meetings_data_for_map(geocoded_meetings).to_json %>" data-here-app-id="<%= Decidim.geocoder[:here_app_id] %>" data-here-app-code="<%= Decidim.geocoder[:here_app_code] %>">
|
@@ -15,7 +11,7 @@
|
|
15
11
|
<div class="map__date-adress">
|
16
12
|
<div class="card__datetime">
|
17
13
|
<div class="card__datetime__date">
|
18
|
-
${startTimeDay} <span class="card__datetime__month">${startTimeMonth}</span>
|
14
|
+
${startTimeDay} <span class="card__datetime__month">${startTimeMonth} ${startTimeYear}</span>
|
19
15
|
</div>
|
20
16
|
<div class="card__datetime__time">${starTime}</div>
|
21
17
|
</div>
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<% provide(:title, translated_attribute(meeting.title)) %>
|
2
2
|
|
3
|
-
<%
|
3
|
+
<% add_decidim_meta_tags({
|
4
4
|
title: translated_attribute(meeting.title),
|
5
5
|
description: translated_attribute(meeting.description),
|
6
6
|
url: meeting_url(meeting.id)
|
@@ -24,14 +24,21 @@
|
|
24
24
|
</div>
|
25
25
|
<% if meeting.closed? %>
|
26
26
|
<div class="card card--secondary extra definition-data">
|
27
|
-
|
28
|
-
<
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
<
|
33
|
-
|
34
|
-
|
27
|
+
<% if meeting.contributions_count && meeting.contributions_count.positive? %>
|
28
|
+
<div class="definition-data__item definition-data__item--double">
|
29
|
+
<span class="definition-data__title"><%= t(".attendees") %></span>
|
30
|
+
<span class="definition-data__number"><%= meeting.attendees_count %></span>
|
31
|
+
</div>
|
32
|
+
<div class="definition-data__item definition-data__item--double">
|
33
|
+
<span class="definition-data__title"><%= t(".contributions") %></span>
|
34
|
+
<span class="definition-data__number"><%= meeting.contributions_count %></span>
|
35
|
+
</div>
|
36
|
+
<% else %>
|
37
|
+
<div class="definition-data__item">
|
38
|
+
<span class="definition-data__title"><%= t(".attendees") %></span>
|
39
|
+
<span class="definition-data__number"><%= meeting.attendees_count %></span>
|
40
|
+
</div>
|
41
|
+
<% end %>
|
35
42
|
<div class="definition-data__item">
|
36
43
|
<span class="definition-data__title"><%= t(".organizations") %></span>
|
37
44
|
<span class="definition-data__text"><%= meeting.attending_organizations %></span>
|