decidim 0.4.3 → 0.4.4
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/.codeclimate.yml +11 -0
- data/CHANGELOG.md +16 -2
- data/Gemfile.lock +41 -42
- data/README.md +1 -1
- data/Rakefile +1 -1
- data/decidim-admin/app/commands/decidim/admin/publish_participatory_process.rb +1 -5
- data/decidim-admin/app/commands/decidim/admin/unpublish_participatory_process.rb +1 -5
- data/decidim-admin/app/controllers/decidim/admin/application_controller.rb +1 -1
- data/decidim-admin/app/controllers/decidim/admin/exports_controller.rb +2 -9
- data/decidim-admin/app/controllers/decidim/admin/feature_permissions_controller.rb +1 -1
- data/decidim-admin/app/controllers/decidim/admin/features/base_controller.rb +3 -2
- data/decidim-admin/app/controllers/decidim/admin/features_controller.rb +2 -2
- data/decidim-admin/app/controllers/decidim/admin/participatory_process_groups_controller.rb +2 -1
- data/decidim-admin/app/controllers/decidim/admin/participatory_processes_controller.rb +6 -2
- data/decidim-admin/app/forms/decidim/admin/participatory_process_copy_form.rb +1 -1
- data/decidim-admin/app/forms/decidim/admin/participatory_process_form.rb +1 -1
- data/decidim-admin/app/helpers/decidim/admin/process_groups_for_select_helper.rb +1 -1
- data/decidim-admin/app/helpers/decidim/admin/processes_for_select_helper.rb +1 -1
- data/decidim-admin/app/helpers/decidim/admin/{feature_settings_helper.rb → settings_helper.rb} +2 -2
- data/decidim-admin/app/models/decidim/admin/abilities/participatory_process_admin_ability.rb +2 -2
- data/decidim-admin/app/views/decidim/admin/attachments/index.html.erb +1 -1
- data/decidim-admin/app/views/decidim/admin/categories/index.html.erb +1 -1
- data/decidim-admin/app/views/decidim/admin/exports/_dropdown.html.erb +1 -1
- data/decidim-admin/app/views/decidim/admin/features/_feature.html.erb +2 -2
- data/decidim-admin/app/views/decidim/admin/features/edit.html.erb +1 -1
- data/decidim-admin/app/views/decidim/admin/features/index.html.erb +1 -1
- data/decidim-admin/app/views/decidim/admin/features/new.html.erb +1 -1
- data/decidim-admin/app/views/decidim/admin/participatory_process_groups/show.html.erb +1 -1
- data/decidim-admin/app/views/decidim/admin/participatory_process_steps/index.html.erb +2 -2
- data/decidim-admin/app/views/decidim/admin/participatory_process_steps/new.html.erb +0 -1
- data/decidim-admin/app/views/decidim/admin/participatory_process_user_roles/index.html.erb +1 -1
- data/decidim-admin/app/views/decidim/admin/participatory_process_user_roles/new.html.erb +6 -6
- data/decidim-admin/app/views/decidim/admin/participatory_processes/new.html.erb +0 -1
- data/decidim-admin/app/views/layouts/decidim/admin/participatory_process.html.erb +2 -2
- data/decidim-admin/config/locales/ca.yml +7 -14
- data/decidim-admin/config/locales/en.yml +7 -14
- data/decidim-admin/config/locales/es.yml +7 -14
- data/decidim-admin/config/locales/eu.yml +9 -15
- data/decidim-admin/config/locales/fi.yml +7 -12
- data/decidim-admin/config/locales/fr.yml +9 -15
- data/decidim-admin/config/locales/it.yml +9 -15
- data/decidim-admin/config/routes.rb +9 -7
- data/decidim-admin/spec/commands/copy_participatory_process_spec.rb +4 -4
- data/decidim-admin/spec/controllers/exports_controller_spec.rb +2 -0
- data/decidim-admin/spec/controllers/participatory_processes_controller_spec.rb +2 -0
- data/decidim-admin/spec/controllers/static_pages_controller_spec.rb +2 -0
- data/decidim-admin/spec/features/admin_copy_participatory_process_spec.rb +3 -2
- data/decidim-admin/spec/features/admin_manages_feature_permissions_spec.rb +1 -1
- data/decidim-admin/spec/features/admin_manages_features_spec.rb +4 -4
- data/decidim-admin/spec/features/admin_manages_participatory_process_admins_spec.rb +2 -1
- data/decidim-admin/spec/features/admin_manages_participatory_process_attachments_spec.rb +2 -1
- data/decidim-admin/spec/features/admin_manages_participatory_process_categories_spec.rb +1 -1
- data/decidim-admin/spec/features/admin_manages_participatory_process_groups_spec.rb +2 -2
- data/decidim-admin/spec/features/admin_manages_participatory_process_steps_spec.rb +2 -1
- data/decidim-admin/spec/features/admin_manages_participatory_processes_spec.rb +3 -3
- data/decidim-admin/spec/features/admin_manages_user_groups_spec.rb +3 -2
- data/decidim-admin/spec/features/participatory_process_admin_manages_participatory_process_admins_spec.rb +1 -2
- data/decidim-admin/spec/features/participatory_process_admin_manages_participatory_process_attachments_spec.rb +1 -3
- data/decidim-admin/spec/features/{process_admin_manages_participatory_process_categories_spec.rb → participatory_process_admin_manages_participatory_process_categories_spec.rb} +2 -4
- data/decidim-admin/spec/features/participatory_process_admin_manages_participatory_process_steps_spec.rb +1 -2
- data/decidim-admin/spec/features/participatory_process_admin_manages_participatory_processes_spec.rb +2 -2
- data/decidim-admin/spec/helpers/{feature_settings_helper_spec.rb → settings_helper_spec.rb} +1 -1
- data/decidim-admin/spec/shared/manage_process_admins_examples.rb +9 -1
- data/decidim-admin/spec/shared/participatory_process_administration_by_admin_shared_context.rb +9 -0
- data/decidim-admin/spec/shared/participatory_process_administration_by_process_admin_shared_context.rb +13 -0
- data/decidim-admin/spec/shared/{participatory_admin_shared_context.rb → participatory_process_administration_shared_context.rb} +2 -4
- data/decidim-api/decidim-api.gemspec +2 -0
- data/decidim-api/lib/decidim/api/schema.rb +1 -1
- data/decidim-api/lib/decidim/api/test/type_context.rb +1 -1
- data/decidim-api/spec/controllers/queries_controller_spec.rb +2 -0
- data/decidim-budgets/app/forms/decidim/budgets/admin/project_form.rb +4 -0
- data/decidim-budgets/app/views/decidim/budgets/admin/projects/index.html.erb +1 -1
- data/decidim-budgets/app/views/decidim/budgets/projects/_tags.html.erb +2 -2
- data/decidim-budgets/decidim-budgets.gemspec +1 -1
- data/decidim-budgets/lib/decidim/budgets/feature.rb +30 -34
- data/decidim-budgets/spec/commands/remove_line_item_spec.rb +2 -0
- data/decidim-budgets/spec/features/comments_spec.rb +1 -1
- data/decidim-budgets/spec/features/orders_spec.rb +1 -5
- data/decidim-budgets/spec/forms/project_form_spec.rb +6 -0
- data/decidim-budgets/spec/shared/manage_projects_examples.rb +1 -1
- data/decidim-comments/app/assets/javascripts/decidim/comments/bundle.js +0 -0
- data/decidim-comments/app/frontend/comments/add_comment_form.component.tsx +3 -3
- data/decidim-comments/app/frontend/support/schema.ts +1379 -94
- data/decidim-comments/app/types/decidim/comments/commentable_interface.rb +1 -1
- data/decidim-comments/decidim-comments.gemspec +1 -0
- data/decidim-comments/lib/decidim/comments/api/comment_mutation_type.rb +2 -2
- data/decidim-comments/spec/features/comments_spec.rb +1 -1
- data/decidim-comments/spec/features/notifications_spec.rb +1 -1
- data/decidim-comments/spec/features/report_comment_spec.rb +1 -1
- data/decidim-comments/spec/models/comment_spec.rb +1 -1
- data/decidim-dev/lib/decidim/dev/test/base_spec_helper.rb +2 -1
- data/decidim-dev/lib/decidim/dev/test/rspec_support/feature_context.rb +1 -3
- data/decidim-dev/lib/decidim/dev/test/rspec_support/i18n.rb +0 -7
- data/decidim-dev/lib/decidim/dev/test/rspec_support/phantomjs_polyfills/promise.js +2 -2
- data/decidim-dev/lib/decidim/dev/test/rspec_support/route_helpers.rb +6 -0
- data/decidim-dev/lib/generators/decidim/dummy_generator.rb +0 -2
- data/decidim-meetings/app/forms/decidim/meetings/admin/meeting_form.rb +6 -0
- data/decidim-meetings/app/helpers/decidim/meetings/meetings_helper.rb +2 -1
- data/decidim-meetings/app/services/decidim/meetings/meeting_search.rb +2 -2
- data/decidim-meetings/app/views/decidim/meetings/admin/meeting_closes/_form.html.erb +2 -2
- data/decidim-meetings/app/views/decidim/meetings/admin/meetings/index.html.erb +1 -1
- data/decidim-meetings/app/views/decidim/meetings/meetings/_tags.html.erb +2 -2
- data/decidim-meetings/decidim-meetings.gemspec +1 -1
- data/decidim-meetings/lib/decidim/meetings/feature.rb +35 -39
- data/decidim-meetings/spec/features/explore_meetings_spec.rb +1 -1
- data/decidim-meetings/spec/forms/meeting_form_spec.rb +6 -0
- data/decidim-meetings/spec/shared/manage_meetings_examples.rb +1 -1
- data/decidim-pages/lib/decidim/pages/feature.rb +14 -18
- data/decidim-pages/spec/features/comments_spec.rb +1 -1
- data/decidim-proposals/app/forms/decidim/proposals/admin/proposal_form.rb +6 -0
- data/decidim-proposals/app/forms/decidim/proposals/proposal_form.rb +6 -0
- data/decidim-proposals/app/models/decidim/proposals/proposal.rb +9 -1
- data/decidim-proposals/app/views/decidim/proposals/admin/proposals/index.html.erb +1 -1
- data/decidim-proposals/app/views/decidim/proposals/proposals/_tags.html.erb +2 -2
- data/decidim-proposals/decidim-proposals.gemspec +1 -0
- data/decidim-proposals/lib/decidim/proposals/feature.rb +59 -65
- data/decidim-proposals/lib/decidim/proposals/proposal_serializer.rb +1 -15
- data/decidim-proposals/spec/controllers/decidim/admin/proposal_answers_controller_spec.rb +2 -4
- data/decidim-proposals/spec/controllers/decidim/proposal_votes_controller_spec.rb +2 -4
- data/decidim-proposals/spec/controllers/decidim/proposals_controller_spec.rb +2 -4
- data/decidim-proposals/spec/features/comments_spec.rb +1 -1
- data/decidim-proposals/spec/features/report_proposal_spec.rb +1 -1
- data/decidim-proposals/spec/models/decidim/proposals/proposal_spec.rb +18 -0
- data/decidim-proposals/spec/shared/manage_proposals_examples.rb +1 -1
- data/decidim-proposals/spec/shared/proposal_form_examples.rb +6 -0
- data/decidim-results/app/controllers/decidim/results/result_widgets_controller.rb +0 -2
- data/decidim-results/app/forms/decidim/results/admin/result_form.rb +4 -0
- data/decidim-results/app/views/decidim/results/admin/results/index.html.erb +1 -1
- data/decidim-results/app/views/decidim/results/results/_tags.html.erb +2 -2
- data/decidim-results/decidim-results.gemspec +2 -1
- data/decidim-results/lib/decidim/results/feature.rb +18 -22
- data/decidim-results/spec/controllers/results_controller_spec.rb +2 -0
- data/decidim-results/spec/features/comments_spec.rb +1 -1
- data/decidim-results/spec/features/explore_results_spec.rb +1 -1
- data/decidim-results/spec/forms/result_form_spec.rb +6 -0
- data/decidim-results/spec/shared/manage_results_examples.rb +1 -1
- data/decidim-surveys/decidim-surveys.gemspec +1 -0
- data/decidim-surveys/lib/decidim/surveys/feature.rb +23 -27
- data/decidim-system/db/seeds.rb +1 -2
- data/decidim-system/spec/commands/decidim/system/create_default_pages_spec.rb +1 -1
- data/docs/features_and_components.md +6 -6
- data/docs/getting_started.md +1 -1
- data/docs/how_to_create_a_plugin.md +2 -2
- data/docs/social_providers.md +2 -2
- data/lib/generators/decidim/app_generator.rb +0 -6
- data/lib/generators/decidim/docker_generator.rb +1 -1
- data/lib/generators/decidim/install_generator.rb +5 -5
- data/lib/generators/decidim/templates/README.md.erb +1 -1
- data/lib/generators/decidim/templates/database.yml.erb +1 -1
- data/lib/generators/decidim/templates/initializer.rb +4 -1
- data/package-lock.json +46 -134
- data/package.json +9 -9
- metadata +31 -30
- data/decidim-dev/lib/decidim/dev/test/rspec_support/engine_routes.rb +0 -35
- data/decidim-dev/lib/generators/decidim/templates/decidim_dev.rb +0 -3
@@ -8,11 +8,11 @@ module Decidim
|
|
8
8
|
|
9
9
|
field :id, !types.ID, "The Comment's unique ID"
|
10
10
|
|
11
|
-
field :upVote, Decidim::Comments::CommentType do
|
11
|
+
field :upVote, !Decidim::Comments::CommentType do
|
12
12
|
resolve VoteCommentResolver.new(weight: 1)
|
13
13
|
end
|
14
14
|
|
15
|
-
field :downVote, Decidim::Comments::CommentType do
|
15
|
+
field :downVote, !Decidim::Comments::CommentType do
|
16
16
|
resolve VoteCommentResolver.new(weight: -1)
|
17
17
|
end
|
18
18
|
end
|
@@ -7,6 +7,6 @@ describe "Comments", type: :feature, perform_enqueued: true do
|
|
7
7
|
let!(:author) { create(:user, :confirmed, organization: organization) }
|
8
8
|
let!(:commentable) { create(:dummy_resource, feature: feature, author: author) }
|
9
9
|
|
10
|
-
let(:resource_path) {
|
10
|
+
let(:resource_path) { resource_locator(commentable).path }
|
11
11
|
include_examples "comments"
|
12
12
|
end
|
@@ -15,7 +15,7 @@ describe "Comment notifications", type: :feature do
|
|
15
15
|
end
|
16
16
|
|
17
17
|
it "commentable author receives an email with a link to the comment", perform_enqueued: true do
|
18
|
-
visit
|
18
|
+
visit resource_locator(commentable).path
|
19
19
|
expect(page).to have_selector(".add-comment form")
|
20
20
|
|
21
21
|
within ".add-comment form" do
|
@@ -9,7 +9,7 @@ describe "Report Comment", type: :feature do
|
|
9
9
|
let(:manifest_name) { "dummy" }
|
10
10
|
let!(:commentable) { create(:dummy_resource, feature: feature) }
|
11
11
|
let!(:reportable) { create(:comment, commentable: commentable) }
|
12
|
-
let(:reportable_path) {
|
12
|
+
let(:reportable_path) { resource_locator(commentable).path }
|
13
13
|
|
14
14
|
let!(:user) { create :user, :confirmed, organization: organization }
|
15
15
|
|
@@ -33,7 +33,8 @@ require "rails"
|
|
33
33
|
require "active_support/core_ext/string"
|
34
34
|
require "decidim/core"
|
35
35
|
require "decidim/core/test"
|
36
|
-
|
36
|
+
|
37
|
+
require_relative "rspec_support/feature.rb"
|
37
38
|
|
38
39
|
begin
|
39
40
|
require "#{Decidim::Dev.dummy_app_path}/config/environment"
|
@@ -1,8 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
RSpec.shared_context "feature" do
|
4
|
-
include Decidim::FeaturePathHelper
|
5
|
-
|
6
4
|
let(:manifest) { Decidim.find_feature_manifest(manifest_name) }
|
7
5
|
|
8
6
|
let(:user) { create :user, :confirmed, organization: organization }
|
@@ -28,7 +26,7 @@ RSpec.shared_context "feature" do
|
|
28
26
|
end
|
29
27
|
|
30
28
|
def visit_feature
|
31
|
-
page.visit
|
29
|
+
page.visit main_feature_path(feature)
|
32
30
|
end
|
33
31
|
end
|
34
32
|
|
@@ -3,14 +3,7 @@
|
|
3
3
|
RSpec.configure do |config|
|
4
4
|
config.before(:suite) do
|
5
5
|
I18n.config.enforce_available_locales = false
|
6
|
-
end
|
7
|
-
|
8
|
-
config.around(:each) do |example|
|
9
6
|
I18n.available_locales = %w(en ca es)
|
10
7
|
Decidim.available_locales = %w(en ca es)
|
11
|
-
|
12
|
-
previous_locale = I18n.locale
|
13
|
-
example.run
|
14
|
-
I18n.locale = previous_locale
|
15
8
|
end
|
16
9
|
end
|
@@ -5,7 +5,7 @@
|
|
5
5
|
var setTimeoutFunc = setTimeout;
|
6
6
|
|
7
7
|
function noop() {}
|
8
|
-
|
8
|
+
|
9
9
|
// Polyfill for Function.prototype.bind
|
10
10
|
function bind(fn, thisArg) {
|
11
11
|
return function () {
|
@@ -223,7 +223,7 @@
|
|
223
223
|
Promise._setUnhandledRejectionFn = function _setUnhandledRejectionFn(fn) {
|
224
224
|
Promise._unhandledRejectionFn = fn;
|
225
225
|
};
|
226
|
-
|
226
|
+
|
227
227
|
if (typeof module !== 'undefined' && module.exports) {
|
228
228
|
module.exports = Promise;
|
229
229
|
} else if (!root.Promise) {
|
@@ -48,8 +48,6 @@ module Decidim
|
|
48
48
|
end
|
49
49
|
|
50
50
|
def decidim_dev
|
51
|
-
template "decidim_dev.rb", "#{dummy_app_path}/config/initializers/decidim_dev.rb"
|
52
|
-
|
53
51
|
# TODO: Remove these after PhantomJS updates WebKit version (see YML and
|
54
52
|
# initializer comments)
|
55
53
|
template "autoprefixer.yml", "#{dummy_app_path}/config/autoprefixer.yml"
|
@@ -31,6 +31,12 @@ module Decidim
|
|
31
31
|
validates :scope, presence: true, if: ->(form) { form.decidim_scope_id.present? }
|
32
32
|
validates :category, presence: true, if: ->(form) { form.decidim_category_id.present? }
|
33
33
|
|
34
|
+
def map_model(model)
|
35
|
+
return unless model.categorization
|
36
|
+
|
37
|
+
self.decidim_category_id = model.categorization.decidim_category_id
|
38
|
+
end
|
39
|
+
|
34
40
|
def process_scope
|
35
41
|
current_feature.participatory_process.scope
|
36
42
|
end
|
@@ -6,6 +6,7 @@ module Decidim
|
|
6
6
|
module MeetingsHelper
|
7
7
|
include Decidim::ApplicationHelper
|
8
8
|
include Decidim::TranslationsHelper
|
9
|
+
include Decidim::ResourceHelper
|
9
10
|
|
10
11
|
# Public: truncates the meeting description
|
11
12
|
#
|
@@ -14,7 +15,7 @@ module Decidim
|
|
14
15
|
#
|
15
16
|
# Returns the meeting's description truncated.
|
16
17
|
def meeting_description(meeting, max_length = 120)
|
17
|
-
link =
|
18
|
+
link = resource_locator(meeting).path
|
18
19
|
description = translated_attribute(meeting.description)
|
19
20
|
tail = "... #{link_to(t("read_more", scope: "decidim.meetings"), link)}".html_safe
|
20
21
|
CGI.unescapeHTML html_truncate(description, max_length: max_length, tail: tail)
|
@@ -24,9 +24,9 @@ module Decidim
|
|
24
24
|
# Handle the date filter
|
25
25
|
def search_date
|
26
26
|
if options[:date] == "upcoming"
|
27
|
-
query.where("start_time >= ? ", Time.current).order(
|
27
|
+
query.where("start_time >= ? ", Time.current).order(start_time: :asc)
|
28
28
|
elsif options[:date] == "past"
|
29
|
-
query.where("start_time <= ? ", Time.current).order(
|
29
|
+
query.where("start_time <= ? ", Time.current).order(start_time: :desc)
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
@@ -24,11 +24,11 @@
|
|
24
24
|
<div class="row column">
|
25
25
|
<% if @form.proposals %>
|
26
26
|
<%= form.select :proposal_ids,
|
27
|
-
@form.proposals.order(
|
27
|
+
@form.proposals.order(title: :asc).pluck(:title, :id),
|
28
28
|
{ include_blank: true },
|
29
29
|
{ multiple: true, class: "chosen-select" }
|
30
30
|
%>
|
31
31
|
<% end %>
|
32
32
|
</div>
|
33
33
|
</div>
|
34
|
-
</div>
|
34
|
+
</div>
|
@@ -46,7 +46,7 @@
|
|
46
46
|
</td>
|
47
47
|
<% end %>
|
48
48
|
<td class="table-list__actions">
|
49
|
-
<%= icon_link_to "eye",
|
49
|
+
<%= icon_link_to "eye", resource_locator(meeting).path, t("actions.preview", scope: "decidim.meetings"), class: "action-icon--preview", target: :blank %>
|
50
50
|
|
51
51
|
<% if can? :update, current_feature %>
|
52
52
|
<%= icon_link_to "pencil", edit_meeting_path(meeting), t("actions.edit", scope: "decidim.meetings"), class: "action-icon--edit" %>
|
@@ -1,10 +1,10 @@
|
|
1
1
|
<% if meeting.category.present? || meeting.scope.present? %>
|
2
2
|
<ul class="tags tags--meeting" >
|
3
3
|
<% if meeting.category.present? %>
|
4
|
-
<li><%= link_to translated_attribute(meeting.category.name),
|
4
|
+
<li><%= link_to translated_attribute(meeting.category.name), resource_locator(meeting).index(filter: { category_id: meeting.category.id }) %></li>
|
5
5
|
<% end %>
|
6
6
|
<% if !current_participatory_process.scope && meeting.scope.present? %>
|
7
|
-
<li><%= link_to meeting.scope.name,
|
7
|
+
<li><%= link_to meeting.scope.name, resource_locator(meeting).index(filter: { scope_id: [meeting.scope.id] }) %></li>
|
8
8
|
<% end %>
|
9
9
|
</ul>
|
10
10
|
<% end %>
|
@@ -24,7 +24,7 @@ Gem::Specification.new do |s|
|
|
24
24
|
s.add_dependency "jquery-tmpl-rails", "~> 1.1.0"
|
25
25
|
|
26
26
|
s.add_development_dependency "decidim-dev", Decidim.version
|
27
|
-
s.add_development_dependency "decidim-proposals", Decidim.version
|
28
27
|
s.add_development_dependency "decidim-admin", Decidim.version
|
28
|
+
s.add_development_dependency "decidim-proposals", Decidim.version
|
29
29
|
s.add_development_dependency "decidim-results", Decidim.version
|
30
30
|
end
|
@@ -23,47 +23,43 @@ Decidim.register_feature(:meetings) do |feature|
|
|
23
23
|
meetings.count
|
24
24
|
end
|
25
25
|
|
26
|
-
feature.seeds do
|
27
|
-
Decidim::
|
28
|
-
|
26
|
+
feature.seeds do |process|
|
27
|
+
feature = Decidim::Feature.create!(
|
28
|
+
name: Decidim::Features::Namer.new(process.organization.available_locales, :meetings).i18n_name,
|
29
|
+
published_at: Time.current,
|
30
|
+
manifest_name: :meetings,
|
31
|
+
participatory_process: process
|
32
|
+
)
|
29
33
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
34
|
+
3.times do
|
35
|
+
meeting = Decidim::Meetings::Meeting.create!(
|
36
|
+
feature: feature,
|
37
|
+
scope: process.organization.scopes.sample,
|
38
|
+
category: process.categories.sample,
|
39
|
+
title: Decidim::Faker::Localized.sentence(2),
|
40
|
+
description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
|
41
|
+
Decidim::Faker::Localized.paragraph(3)
|
42
|
+
end,
|
43
|
+
location: Decidim::Faker::Localized.sentence,
|
44
|
+
location_hints: Decidim::Faker::Localized.sentence,
|
45
|
+
start_time: 3.weeks.from_now,
|
46
|
+
end_time: 3.weeks.from_now + 4.hours,
|
47
|
+
address: "#{Faker::Address.street_address} #{Faker::Address.zip} #{Faker::Address.city}",
|
48
|
+
latitude: Faker::Address.latitude,
|
49
|
+
longitude: Faker::Address.longitude
|
50
|
+
)
|
51
|
+
Decidim::Attachment.create!(
|
52
|
+
title: Decidim::Faker::Localized.sentence(2),
|
53
|
+
description: Decidim::Faker::Localized.sentence(5),
|
54
|
+
file: File.new(File.join(__dir__, "seeds", "city.jpeg")),
|
55
|
+
attached_to: meeting
|
56
|
+
)
|
57
|
+
Decidim::Attachment.create!(
|
58
|
+
title: Decidim::Faker::Localized.sentence(2),
|
59
|
+
description: Decidim::Faker::Localized.sentence(5),
|
60
|
+
file: File.new(File.join(__dir__, "seeds", "Exampledocument.pdf")),
|
61
|
+
attached_to: meeting
|
35
62
|
)
|
36
|
-
|
37
|
-
3.times do
|
38
|
-
meeting = Decidim::Meetings::Meeting.create!(
|
39
|
-
feature: feature,
|
40
|
-
scope: process.organization.scopes.sample,
|
41
|
-
category: process.categories.sample,
|
42
|
-
title: Decidim::Faker::Localized.sentence(2),
|
43
|
-
description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
|
44
|
-
Decidim::Faker::Localized.paragraph(3)
|
45
|
-
end,
|
46
|
-
location: Decidim::Faker::Localized.sentence,
|
47
|
-
location_hints: Decidim::Faker::Localized.sentence,
|
48
|
-
start_time: 3.weeks.from_now,
|
49
|
-
end_time: 3.weeks.from_now + 4.hours,
|
50
|
-
address: "#{Faker::Address.street_address} #{Faker::Address.zip} #{Faker::Address.city}",
|
51
|
-
latitude: Faker::Address.latitude,
|
52
|
-
longitude: Faker::Address.longitude
|
53
|
-
)
|
54
|
-
Decidim::Attachment.create!(
|
55
|
-
title: Decidim::Faker::Localized.sentence(2),
|
56
|
-
description: Decidim::Faker::Localized.sentence(5),
|
57
|
-
file: File.new(File.join(__dir__, "seeds", "city.jpeg")),
|
58
|
-
attached_to: meeting
|
59
|
-
)
|
60
|
-
Decidim::Attachment.create!(
|
61
|
-
title: Decidim::Faker::Localized.sentence(2),
|
62
|
-
description: Decidim::Faker::Localized.sentence(5),
|
63
|
-
file: File.new(File.join(__dir__, "seeds", "Exampledocument.pdf")),
|
64
|
-
attached_to: meeting
|
65
|
-
)
|
66
|
-
end
|
67
63
|
end
|
68
64
|
end
|
69
65
|
end
|
@@ -123,7 +123,7 @@ describe "Explore meetings", type: :feature do
|
|
123
123
|
end_time: date.end_of_day
|
124
124
|
)
|
125
125
|
|
126
|
-
visit
|
126
|
+
visit resource_locator(meeting).path
|
127
127
|
end
|
128
128
|
|
129
129
|
it "shows all meeting info" do
|
@@ -141,4 +141,10 @@ describe Decidim::Meetings::Admin::MeetingForm do
|
|
141
141
|
expect(subject.latitude).to eq(latitude)
|
142
142
|
expect(subject.longitude).to eq(longitude)
|
143
143
|
end
|
144
|
+
|
145
|
+
it "properly maps category id from model" do
|
146
|
+
meeting = create(:meeting, feature: current_feature, category: category)
|
147
|
+
|
148
|
+
expect(described_class.from_model(meeting).decidim_category_id).to eq(category_id)
|
149
|
+
end
|
144
150
|
end
|
@@ -47,7 +47,7 @@ RSpec.shared_examples "manage meetings" do
|
|
47
47
|
end
|
48
48
|
|
49
49
|
within_window @new_window do
|
50
|
-
expect(current_path).to eq
|
50
|
+
expect(current_path).to eq resource_locator(meeting).path
|
51
51
|
expect(page).to have_content(translated(meeting.title))
|
52
52
|
end
|
53
53
|
end
|
@@ -51,25 +51,21 @@ Decidim.register_feature(:pages) do |feature|
|
|
51
51
|
resource.model_class_name = "Decidim::Pages::Page"
|
52
52
|
end
|
53
53
|
|
54
|
-
feature.seeds do
|
55
|
-
Decidim::
|
56
|
-
|
54
|
+
feature.seeds do |process|
|
55
|
+
feature = Decidim::Feature.create!(
|
56
|
+
name: Decidim::Features::Namer.new(process.organization.available_locales, :pages).i18n_name,
|
57
|
+
manifest_name: :pages,
|
58
|
+
published_at: Time.current,
|
59
|
+
participatory_process: process
|
60
|
+
)
|
57
61
|
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
62
|
+
page = Decidim::Pages::Page.create!(
|
63
|
+
feature: feature,
|
64
|
+
body: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
|
65
|
+
Decidim::Faker::Localized.paragraph(3)
|
66
|
+
end
|
67
|
+
)
|
64
68
|
|
65
|
-
|
66
|
-
feature: feature,
|
67
|
-
body: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
|
68
|
-
Decidim::Faker::Localized.paragraph(3)
|
69
|
-
end
|
70
|
-
)
|
71
|
-
|
72
|
-
Decidim::Comments::Seed.comments_for(page)
|
73
|
-
end
|
69
|
+
Decidim::Comments::Seed.comments_for(page)
|
74
70
|
end
|
75
71
|
end
|
@@ -6,6 +6,6 @@ describe "Comments", type: :feature, perform_enqueued: true do
|
|
6
6
|
let!(:feature) { create(:page_feature, organization: organization) }
|
7
7
|
let!(:commentable) { create(:page, feature: feature) }
|
8
8
|
|
9
|
-
let(:resource_path) {
|
9
|
+
let(:resource_path) { resource_locator(commentable).path }
|
10
10
|
include_examples "comments"
|
11
11
|
end
|
@@ -22,6 +22,12 @@ module Decidim
|
|
22
22
|
|
23
23
|
delegate :categories, to: :current_feature, prefix: false
|
24
24
|
|
25
|
+
def map_model(model)
|
26
|
+
return unless model.categorization
|
27
|
+
|
28
|
+
self.category_id = model.categorization.decidim_category_id
|
29
|
+
end
|
30
|
+
|
25
31
|
def organization_scopes
|
26
32
|
current_organization.scopes
|
27
33
|
end
|
@@ -26,6 +26,12 @@ module Decidim
|
|
26
26
|
|
27
27
|
delegate :categories, to: :current_feature
|
28
28
|
|
29
|
+
def map_model(model)
|
30
|
+
return unless model.categorization
|
31
|
+
|
32
|
+
self.category_id = model.categorization.decidim_category_id
|
33
|
+
end
|
34
|
+
|
29
35
|
def organization_scopes
|
30
36
|
current_organization.scopes
|
31
37
|
end
|
@@ -33,7 +33,8 @@ module Decidim
|
|
33
33
|
end
|
34
34
|
|
35
35
|
def author_name
|
36
|
-
|
36
|
+
return I18n.t("decidim.proposals.models.proposal.fields.official_proposal") if official?
|
37
|
+
user_group&.name || author.name
|
37
38
|
end
|
38
39
|
|
39
40
|
def author_avatar_url
|
@@ -100,15 +101,22 @@ module Decidim
|
|
100
101
|
ResourceLocatorPresenter.new(self).url
|
101
102
|
end
|
102
103
|
|
104
|
+
# Public: Whether the proposal is official or not.
|
105
|
+
def official?
|
106
|
+
author.nil?
|
107
|
+
end
|
108
|
+
|
103
109
|
# Public: Overrides the `notifiable?` Notifiable concern method.
|
104
110
|
# When a proposal is commented the proposal's author is notified if it is not the same
|
105
111
|
# who has commented the proposal and if the proposal's author has comment notifications enabled.
|
106
112
|
def notifiable?(context)
|
113
|
+
return true if official?
|
107
114
|
context[:author] != author && author.comments_notifications?
|
108
115
|
end
|
109
116
|
|
110
117
|
# Public: Overrides the `users_to_notify` Notifiable concern method.
|
111
118
|
def users_to_notify
|
119
|
+
return Decidim::Admin::ProcessAdmins.for(feature.participatory_process) if official?
|
112
120
|
[author]
|
113
121
|
end
|
114
122
|
end
|