decidim-initiatives 0.23.5 → 0.24.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/app/assets/stylesheet/decidim/initiatives/initiatives.scss +6 -0
- data/app/assets/stylesheet/decidim/initiatives/print-initiative.css.scss +22 -0
- data/app/cells/decidim/initiatives/content_blocks/highlighted_initiatives/show.erb +4 -8
- data/app/cells/decidim/initiatives/content_blocks/highlighted_initiatives_cell.rb +5 -1
- data/app/cells/decidim/initiatives/content_blocks/highlighted_initiatives_settings_form/show.erb +2 -1
- data/app/cells/decidim/initiatives/content_blocks/highlighted_initiatives_settings_form_cell.rb +12 -1
- data/app/cells/decidim/initiatives/initiative_m/tags.erb +1 -1
- data/app/commands/decidim/initiatives/admin/update_initiative.rb +3 -3
- data/app/commands/decidim/initiatives/admin/update_initiative_answer.rb +3 -3
- data/app/commands/decidim/initiatives/approve_membership_request.rb +40 -0
- data/app/commands/decidim/initiatives/create_initiative.rb +5 -4
- data/app/commands/decidim/initiatives/revoke_membership_request.rb +40 -0
- data/app/commands/decidim/initiatives/send_initiative_to_technical_validation.rb +57 -0
- data/app/commands/decidim/initiatives/spawn_committee_request.rb +18 -0
- data/app/commands/decidim/initiatives/update_initiative.rb +74 -0
- data/app/controllers/decidim/initiatives/admin/committee_requests_controller.rb +15 -4
- data/app/controllers/decidim/initiatives/admin/initiatives_controller.rb +1 -1
- data/app/controllers/decidim/initiatives/admin/moderations/reports_controller.rb +18 -0
- data/app/controllers/decidim/initiatives/committee_requests_controller.rb +32 -0
- data/app/controllers/decidim/initiatives/initiatives_controller.rb +58 -1
- data/app/events/decidim/initiatives/approve_membership_request_event.rb +61 -0
- data/app/events/decidim/initiatives/initiative_sent_to_technical_validation_event.rb +19 -0
- data/app/events/decidim/initiatives/revoke_membership_request_event.rb +61 -0
- data/app/events/decidim/initiatives/spawn_committee_request_event.rb +61 -0
- data/app/forms/decidim/initiatives/admin/initiative_form.rb +8 -4
- data/app/forms/decidim/initiatives/admin/initiative_type_form.rb +3 -0
- data/app/forms/decidim/initiatives/initiative_form.rb +25 -2
- data/app/forms/decidim/initiatives/vote_form.rb +1 -1
- data/app/helpers/decidim/initiatives/admin/initiative_admin_menu_helper.rb +15 -0
- data/app/helpers/decidim/initiatives/create_initiative_helper.rb +3 -2
- data/app/models/concerns/decidim/initiatives/has_area.rb +1 -1
- data/app/models/decidim/initiative.rb +0 -1
- data/app/permissions/decidim/initiatives/admin/permissions.rb +5 -4
- data/app/permissions/decidim/initiatives/permissions.rb +63 -30
- data/app/queries/decidim/initiatives/initiatives_promoted.rb +1 -1
- data/app/queries/decidim/initiatives/organization_prioritized_initiatives.rb +13 -2
- data/app/serializers/decidim/initiatives/initiative_serializer.rb +3 -0
- data/app/services/decidim/initiatives/dummy_timestamp.rb +1 -1
- data/app/services/decidim/initiatives/initiative_search.rb +15 -13
- data/app/services/decidim/initiatives/pdf_signature_example.rb +27 -27
- data/app/views/decidim/initiatives/admin/initiatives/edit.html.erb +1 -1
- data/app/views/decidim/initiatives/admin/initiatives/index.html.erb +6 -0
- data/app/views/decidim/initiatives/admin/initiatives_type_scopes/edit.html.erb +24 -17
- data/app/views/decidim/initiatives/admin/initiatives_type_scopes/new.html.erb +17 -11
- data/app/views/decidim/initiatives/admin/initiatives_types/index.html.erb +1 -1
- data/app/views/decidim/initiatives/create_initiative/_finish_help.html.erb +2 -7
- data/app/views/decidim/initiatives/create_initiative/fill_data.html.erb +4 -17
- data/app/views/decidim/initiatives/create_initiative/finish.html.erb +11 -11
- data/app/views/decidim/initiatives/initiatives/_committee_members.html.erb +73 -0
- data/app/views/decidim/initiatives/initiatives/_filters_small_view.html.erb +1 -1
- data/app/views/decidim/initiatives/initiatives/_form.html.erb +112 -0
- data/app/views/decidim/initiatives/initiatives/_result.html.erb +1 -1
- data/app/views/decidim/initiatives/initiatives/_send_to_technical_validation.html.erb +8 -0
- data/app/views/decidim/initiatives/initiatives/edit.html.erb +78 -0
- data/app/views/decidim/initiatives/initiatives/print.html.erb +156 -0
- data/app/views/decidim/initiatives/initiatives/show.html.erb +19 -7
- data/app/views/layouts/decidim/admin/initiative.html.erb +0 -1
- data/app/views/layouts/decidim/admin/initiatives.html.erb +2 -15
- data/config/locales/ar.yml +2 -28
- data/config/locales/ca.yml +90 -30
- data/config/locales/cs.yml +98 -38
- data/config/locales/de.yml +90 -30
- data/config/locales/el.yml +2 -34
- data/config/locales/en.yml +94 -34
- data/config/locales/es-MX.yml +93 -33
- data/config/locales/es-PY.yml +93 -33
- data/config/locales/es.yml +91 -31
- data/config/locales/eu.yml +2 -28
- data/config/locales/fi-plain.yml +94 -34
- data/config/locales/fi.yml +94 -34
- data/config/locales/fr-CA.yml +94 -34
- data/config/locales/fr.yml +94 -34
- data/config/locales/gl.yml +2 -36
- data/config/locales/hu.yml +2 -31
- data/config/locales/id-ID.yml +2 -28
- data/config/locales/is-IS.yml +2 -13
- data/config/locales/it.yml +2 -34
- data/config/locales/ja.yml +2 -35
- data/config/locales/lv.yml +2 -32
- data/config/locales/nl.yml +31 -34
- data/config/locales/no.yml +2 -32
- data/config/locales/pl.yml +93 -33
- data/config/locales/pt-BR.yml +2 -28
- data/config/locales/pt.yml +2 -34
- data/config/locales/ro-RO.yml +2 -35
- data/config/locales/ru.yml +2 -21
- data/config/locales/sk.yml +2 -30
- data/config/locales/sr-CS.yml +0 -7
- data/config/locales/sv.yml +52 -34
- data/config/locales/tr-TR.yml +68 -34
- data/config/locales/uk.yml +2 -21
- data/config/locales/zh-CN.yml +2 -35
- data/db/migrate/20171017095143_update_initiative_scoped_type.rb +0 -1
- data/db/migrate/20191107134847_add_scopes_to_initiatives_votes.rb +1 -1
- data/db/migrate/20191118105634_allow_multiple_offline_votes.rb +1 -1
- data/db/migrate/20210310120720_add_followable_counter_cache_to_initiatives.rb +16 -0
- data/lib/decidim/api/initiative_api_type.rb +26 -0
- data/lib/decidim/api/initiative_committee_member_type.rb +18 -0
- data/lib/decidim/api/initiative_type.rb +49 -0
- data/lib/decidim/api/initiative_type_interface.rb +8 -3
- data/lib/decidim/initiatives.rb +1 -0
- data/lib/decidim/initiatives/admin_engine.rb +23 -1
- data/lib/decidim/initiatives/api.rb +3 -0
- data/lib/decidim/initiatives/engine.rb +14 -9
- data/lib/decidim/initiatives/initiatives_filter_form_builder.rb +19 -12
- data/lib/decidim/initiatives/participatory_space.rb +6 -6
- data/lib/decidim/initiatives/query_extensions.rb +42 -19
- data/lib/decidim/initiatives/test/factories.rb +36 -0
- data/lib/decidim/initiatives/version.rb +1 -1
- metadata +33 -17
- data/app/types/decidim/initiatives/initiative_api_type.rb +0 -26
- data/app/types/decidim/initiatives/initiative_committee_member_type.rb +0 -18
- data/app/types/decidim/initiatives/initiative_type.rb +0 -42
@@ -0,0 +1,49 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Initiatives
|
5
|
+
# This type represents a Initiative.
|
6
|
+
class InitiativeType < Decidim::Api::Types::BaseObject
|
7
|
+
implements Decidim::Core::ParticipatorySpaceInterface
|
8
|
+
implements Decidim::Core::ScopableInterface
|
9
|
+
implements Decidim::Core::AttachableInterface
|
10
|
+
implements Decidim::Initiatives::InitiativeTypeInterface
|
11
|
+
implements Decidim::Core::TimestampsInterface
|
12
|
+
|
13
|
+
description "A initiative"
|
14
|
+
|
15
|
+
field :description, Decidim::Core::TranslatedFieldType, "The description of this initiative.", null: true
|
16
|
+
field :slug, GraphQL::Types::String, null: false
|
17
|
+
field :hashtag, GraphQL::Types::String, "The hashtag for this initiative", null: true
|
18
|
+
field :published_at, Decidim::Core::DateTimeType, "The time this initiative was published", null: false
|
19
|
+
field :reference, GraphQL::Types::String, "Reference prefix for this initiative", null: false
|
20
|
+
field :state, GraphQL::Types::String, "Current status of the initiative", null: true
|
21
|
+
field :signature_type, GraphQL::Types::String, "Signature type of the initiative", null: true
|
22
|
+
field :signature_start_date, Decidim::Core::DateType, "The signature start date", null: false
|
23
|
+
field :signature_end_date, Decidim::Core::DateType, "The signature end date", null: false
|
24
|
+
field :offline_votes, GraphQL::Types::Int, "The number of offline votes in this initiative", method: :offline_votes_count, null: true
|
25
|
+
field :online_votes, GraphQL::Types::Int, "The number of online votes in this initiative", method: :online_votes_count, null: true
|
26
|
+
field :initiative_votes_count, GraphQL::Types::Int,
|
27
|
+
description: "The number of votes in this initiative",
|
28
|
+
deprecation_reason: "initiativeVotesCount has been collapsed in onlineVotes parameter",
|
29
|
+
null: true
|
30
|
+
field :initiative_supports_count, GraphQL::Types::Int,
|
31
|
+
description: "The number of supports in this initiative",
|
32
|
+
method: :online_votes_count,
|
33
|
+
deprecation_reason: "initiativeSupportsCount has been collapsed in onlineVotes parameter",
|
34
|
+
null: true
|
35
|
+
|
36
|
+
field :author, Decidim::Core::AuthorInterface, "The initiative author", null: false
|
37
|
+
|
38
|
+
def initiative_votes_count
|
39
|
+
object.online_votes_count
|
40
|
+
end
|
41
|
+
|
42
|
+
def author
|
43
|
+
object.user_group || object.author
|
44
|
+
end
|
45
|
+
|
46
|
+
field :committee_members, [Decidim::Initiatives::InitiativeCommitteeMemberType, { null: true }], null: true
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -3,11 +3,16 @@
|
|
3
3
|
module Decidim
|
4
4
|
module Initiatives
|
5
5
|
# This interface represents a commentable object.
|
6
|
-
|
7
|
-
|
6
|
+
|
7
|
+
module InitiativeTypeInterface
|
8
|
+
include Decidim::Api::Types::BaseInterface
|
8
9
|
description "An interface that can be used in Initiative objects."
|
9
10
|
|
10
|
-
field :
|
11
|
+
field :initiative_type, Decidim::Initiatives::InitiativeApiType, "The object's initiative type", null: true
|
12
|
+
|
13
|
+
def initiative_type
|
14
|
+
object.type
|
15
|
+
end
|
11
16
|
end
|
12
17
|
end
|
13
18
|
end
|
data/lib/decidim/initiatives.rb
CHANGED
@@ -64,6 +64,7 @@ module Decidim
|
|
64
64
|
put :hide
|
65
65
|
put :unhide
|
66
66
|
end
|
67
|
+
resources :reports, controller: "moderations/reports", only: [:index, :show]
|
67
68
|
end
|
68
69
|
end
|
69
70
|
|
@@ -84,16 +85,37 @@ module Decidim
|
|
84
85
|
)
|
85
86
|
end
|
86
87
|
|
88
|
+
initializer "admin_decidim_initiatives.action_controller" do |_app|
|
89
|
+
ActiveSupport.on_load :action_controller do
|
90
|
+
helper Decidim::Initiatives::Admin::InitiativeAdminMenuHelper if respond_to?(:helper)
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
87
94
|
initializer "decidim_initiaves.admin_menu" do
|
88
95
|
Decidim.menu :admin_menu do |menu|
|
89
96
|
menu.item I18n.t("menu.initiatives", scope: "decidim.admin"),
|
90
97
|
decidim_admin_initiatives.initiatives_path,
|
91
98
|
icon_name: "chat",
|
92
|
-
position:
|
99
|
+
position: 2.4,
|
93
100
|
active: :inclusive,
|
94
101
|
if: allowed_to?(:enter, :space_area, space_name: :initiatives)
|
95
102
|
end
|
96
103
|
end
|
104
|
+
|
105
|
+
initializer "admin_decidim_initiatives.admin_menu" do
|
106
|
+
Decidim.menu :admin_initiatives_menu do |menu|
|
107
|
+
menu.item I18n.t("menu.initiatives", scope: "decidim.admin"),
|
108
|
+
decidim_admin_initiatives.initiatives_path,
|
109
|
+
position: 1.0,
|
110
|
+
active: is_active_link?(decidim_admin_initiatives.initiatives_path),
|
111
|
+
if: allowed_to?(:index, :initiative)
|
112
|
+
|
113
|
+
menu.item I18n.t("menu.initiatives_types", scope: "decidim.admin"),
|
114
|
+
decidim_admin_initiatives.initiatives_types_path,
|
115
|
+
active: is_active_link?(decidim_admin_initiatives.initiatives_types_path),
|
116
|
+
if: allowed_to?(:manage, :initiative_type)
|
117
|
+
end
|
118
|
+
end
|
97
119
|
end
|
98
120
|
end
|
99
121
|
end
|
@@ -3,5 +3,8 @@
|
|
3
3
|
module Decidim
|
4
4
|
module Initiatives
|
5
5
|
autoload :InitiativeTypeInterface, "decidim/api/initiative_type_interface"
|
6
|
+
autoload :InitiativeType, "decidim/api/initiative_type"
|
7
|
+
autoload :InitiativeApiType, "decidim/api/initiative_api_type"
|
8
|
+
autoload :InitiativeCommitteeMemberType, "decidim/api/initiative_committee_member_type"
|
6
9
|
end
|
7
10
|
end
|
@@ -6,7 +6,6 @@ require "decidim/core"
|
|
6
6
|
require "decidim/initiatives/current_locale"
|
7
7
|
require "decidim/initiatives/initiatives_filter_form_builder"
|
8
8
|
require "decidim/initiatives/initiative_slug"
|
9
|
-
require "decidim/initiatives/api"
|
10
9
|
require "decidim/initiatives/query_extensions"
|
11
10
|
|
12
11
|
module Decidim
|
@@ -32,19 +31,25 @@ module Decidim
|
|
32
31
|
initiative ? "/initiatives/#{initiative.slug}/f/#{params[:component_id]}" : "/404"
|
33
32
|
}, constraints: { initiative_id: /[0-9]+/ }
|
34
33
|
|
35
|
-
resources :initiatives, param: :slug, only: [:index, :show], path: "initiatives" do
|
34
|
+
resources :initiatives, param: :slug, only: [:index, :show, :edit, :update], path: "initiatives" do
|
36
35
|
resources :initiative_signatures
|
37
36
|
|
38
37
|
member do
|
39
38
|
get :authorization_sign_modal, to: "authorization_sign_modals#show"
|
39
|
+
get :print, to: "initiatives#print", as: "print"
|
40
|
+
get :send_to_technical_validation, to: "initiatives#send_to_technical_validation"
|
40
41
|
end
|
41
42
|
|
42
43
|
resource :initiative_vote, only: [:create, :destroy]
|
43
44
|
resource :widget, only: :show, path: "embed"
|
44
|
-
resources :committee_requests, only: [:new]
|
45
|
+
resources :committee_requests, only: [:new] do
|
45
46
|
collection do
|
46
47
|
get :spawn
|
47
48
|
end
|
49
|
+
member do
|
50
|
+
get :approve
|
51
|
+
delete :revoke
|
52
|
+
end
|
48
53
|
end
|
49
54
|
resources :versions, only: [:show, :index]
|
50
55
|
end
|
@@ -75,6 +80,7 @@ module Decidim
|
|
75
80
|
|
76
81
|
content_block.settings do |settings|
|
77
82
|
settings.attribute :max_results, type: :integer, default: 4
|
83
|
+
settings.attribute :order, type: :string, default: "default"
|
78
84
|
end
|
79
85
|
end
|
80
86
|
end
|
@@ -88,7 +94,7 @@ module Decidim
|
|
88
94
|
Decidim.menu :menu do |menu|
|
89
95
|
menu.item I18n.t("menu.initiatives", scope: "decidim"),
|
90
96
|
decidim_initiatives.initiatives_path,
|
91
|
-
position: 2.
|
97
|
+
position: 2.4,
|
92
98
|
active: :inclusive
|
93
99
|
end
|
94
100
|
end
|
@@ -100,12 +106,13 @@ module Decidim
|
|
100
106
|
badge.valid_for = [:user, :user_group]
|
101
107
|
|
102
108
|
badge.reset = lambda { |model|
|
103
|
-
|
109
|
+
case model
|
110
|
+
when User
|
104
111
|
Decidim::Initiative.where(
|
105
112
|
author: model,
|
106
113
|
user_group: nil
|
107
114
|
).published.count
|
108
|
-
|
115
|
+
when UserGroup
|
109
116
|
Decidim::Initiative.where(
|
110
117
|
user_group: model
|
111
118
|
).published.count
|
@@ -115,9 +122,7 @@ module Decidim
|
|
115
122
|
end
|
116
123
|
|
117
124
|
initializer "decidim_initiatives.query_extensions" do
|
118
|
-
Decidim::Api::QueryType.
|
119
|
-
QueryExtensions.define(self)
|
120
|
-
end
|
125
|
+
Decidim::Api::QueryType.include QueryExtensions
|
121
126
|
end
|
122
127
|
end
|
123
128
|
end
|
@@ -16,6 +16,24 @@ module Decidim
|
|
16
16
|
def initiative_types_select(name, collection, options = {})
|
17
17
|
selected = object.send(name)
|
18
18
|
|
19
|
+
types = types_for_options_for_select(selected, collection)
|
20
|
+
|
21
|
+
prompt = options.delete(:prompt)
|
22
|
+
remote_path = options.delete(:remote_path) || false
|
23
|
+
multiple = options.delete(:multiple) || false
|
24
|
+
html_options = {
|
25
|
+
multiple: multiple,
|
26
|
+
class: "select2",
|
27
|
+
"data-remote-path" => remote_path,
|
28
|
+
"data-placeholder" => prompt
|
29
|
+
}
|
30
|
+
|
31
|
+
select(name, @template.options_for_select(types, selected: selected), options, html_options)
|
32
|
+
end
|
33
|
+
|
34
|
+
private
|
35
|
+
|
36
|
+
def types_for_options_for_select(selected, collection)
|
19
37
|
if selected.present?
|
20
38
|
if selected == "all"
|
21
39
|
types = collection.all.map do |type|
|
@@ -31,18 +49,7 @@ module Decidim
|
|
31
49
|
else
|
32
50
|
types = []
|
33
51
|
end
|
34
|
-
|
35
|
-
prompt = options.delete(:prompt)
|
36
|
-
remote_path = options.delete(:remote_path) || false
|
37
|
-
multiple = options.delete(:multiple) || false
|
38
|
-
html_options = {
|
39
|
-
multiple: multiple,
|
40
|
-
class: "select2",
|
41
|
-
"data-remote-path" => remote_path,
|
42
|
-
"data-placeholder" => prompt
|
43
|
-
}
|
44
|
-
|
45
|
-
select(name, @template.options_for_select(types, selected: selected), options, html_options)
|
52
|
+
types
|
46
53
|
end
|
47
54
|
end
|
48
55
|
end
|
@@ -56,8 +56,8 @@ Decidim.register_participatory_space(:initiatives) do |participatory_space|
|
|
56
56
|
|
57
57
|
3.times do |n|
|
58
58
|
type = Decidim::InitiativesType.create!(
|
59
|
-
title: Decidim::Faker::Localized.sentence(5),
|
60
|
-
description: Decidim::Faker::Localized.sentence(25),
|
59
|
+
title: Decidim::Faker::Localized.sentence(word_count: 5),
|
60
|
+
description: Decidim::Faker::Localized.sentence(word_count: 25),
|
61
61
|
organization: organization,
|
62
62
|
banner_image: File.new(File.join(seeds_root, "city2.jpeg"))
|
63
63
|
)
|
@@ -76,8 +76,8 @@ Decidim.register_participatory_space(:initiatives) do |participatory_space|
|
|
76
76
|
Decidim::Initiative.skip_callback(:create, :after, :notify_creation, raise: false)
|
77
77
|
|
78
78
|
params = {
|
79
|
-
title: Decidim::Faker::Localized.sentence(3),
|
80
|
-
description: Decidim::Faker::Localized.sentence(25),
|
79
|
+
title: Decidim::Faker::Localized.sentence(word_count: 3),
|
80
|
+
description: Decidim::Faker::Localized.sentence(word_count: 25),
|
81
81
|
scoped_type: Decidim::InitiativesTypeScope.reorder(Arel.sql("RANDOM()")).first,
|
82
82
|
state: state,
|
83
83
|
signature_type: "online",
|
@@ -101,8 +101,8 @@ Decidim.register_participatory_space(:initiatives) do |participatory_space|
|
|
101
101
|
Decidim::Comments::Seed.comments_for(initiative)
|
102
102
|
|
103
103
|
Decidim::Attachment.create!(
|
104
|
-
title: Decidim::Faker::Localized.sentence(2),
|
105
|
-
description: Decidim::Faker::Localized.sentence(5),
|
104
|
+
title: Decidim::Faker::Localized.sentence(word_count: 2),
|
105
|
+
description: Decidim::Faker::Localized.sentence(word_count: 5),
|
106
106
|
attached_to: initiative,
|
107
107
|
file: File.new(File.join(seeds_root, "city.jpeg"))
|
108
108
|
)
|
@@ -10,31 +10,54 @@ module Decidim
|
|
10
10
|
# type - A GraphQL::BaseType to extend.
|
11
11
|
#
|
12
12
|
# Returns nothing.
|
13
|
-
def self.
|
14
|
-
type.field :
|
15
|
-
type !types[InitiativeApiType]
|
13
|
+
def self.included(type)
|
14
|
+
type.field :initiatives_types, [InitiativeApiType], null: false do
|
16
15
|
description "Lists all initiative types"
|
16
|
+
end
|
17
|
+
|
18
|
+
type.field :initiatives_type, InitiativeApiType, null: true, description: "Finds a initiative type" do
|
19
|
+
argument :id, GraphQL::Types::ID, "The ID of the initiative type", required: true
|
20
|
+
end
|
17
21
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
22
|
+
type.field :initiatives,
|
23
|
+
[Decidim::Initiatives::InitiativeType],
|
24
|
+
null: true,
|
25
|
+
description: "Lists all initiatives" do
|
26
|
+
argument :filter, Decidim::ParticipatoryProcesses::ParticipatoryProcessInputFilter, "This argument lets you filter the results", required: false
|
27
|
+
argument :order, Decidim::ParticipatoryProcesses::ParticipatoryProcessInputSort, "This argument lets you order the results", required: false
|
23
28
|
end
|
24
29
|
|
25
|
-
type.field :
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
resolve lambda { |_obj, args, ctx|
|
31
|
-
Decidim::InitiativesType.find_by(
|
32
|
-
organization: ctx[:current_organization],
|
33
|
-
id: args[:id]
|
34
|
-
)
|
35
|
-
}
|
30
|
+
type.field :initiative,
|
31
|
+
Decidim::Initiatives::InitiativeType,
|
32
|
+
null: true,
|
33
|
+
description: "Finds a initiative" do
|
34
|
+
argument :id, GraphQL::Types::ID, "The ID of the participatory space", required: false
|
36
35
|
end
|
37
36
|
end
|
37
|
+
|
38
|
+
def initiatives_types
|
39
|
+
Decidim::InitiativesType.where(
|
40
|
+
organization: context[:current_organization]
|
41
|
+
)
|
42
|
+
end
|
43
|
+
|
44
|
+
def initiatives_type(id:)
|
45
|
+
Decidim::InitiativesType.find_by(
|
46
|
+
organization: context[:current_organization],
|
47
|
+
id: id
|
48
|
+
)
|
49
|
+
end
|
50
|
+
|
51
|
+
def initiatives(filter: {}, order: {})
|
52
|
+
manifest = Decidim.participatory_space_manifests.select { |m| m.name == :initiatives }.first
|
53
|
+
Decidim::Core::ParticipatorySpaceListBase.new(manifest: manifest).call(object, { filter: filter, order: order }, context)
|
54
|
+
end
|
55
|
+
|
56
|
+
def initiative(id: nil)
|
57
|
+
manifest = Decidim.participatory_space_manifests.select { |m| m.name == :initiatives }.first
|
58
|
+
|
59
|
+
Decidim::Core::ParticipatorySpaceFinderBase.new(manifest: manifest).call(object, { id: id }, context)
|
60
|
+
end
|
38
61
|
end
|
39
62
|
end
|
40
63
|
end
|
@@ -190,6 +190,42 @@ FactoryBot.define do
|
|
190
190
|
type: create(:initiatives_type, :with_user_extra_fields_collection, organization: organization))
|
191
191
|
end
|
192
192
|
end
|
193
|
+
|
194
|
+
trait :with_area do
|
195
|
+
area { create(:area, organization: organization) }
|
196
|
+
end
|
197
|
+
|
198
|
+
trait :with_documents do
|
199
|
+
transient do
|
200
|
+
documents_number { 2 }
|
201
|
+
end
|
202
|
+
|
203
|
+
after :create do |initiative, evaluator|
|
204
|
+
evaluator.documents_number.times do
|
205
|
+
initiative.attachments << create(
|
206
|
+
:attachment,
|
207
|
+
:with_pdf,
|
208
|
+
attached_to: initiative
|
209
|
+
)
|
210
|
+
end
|
211
|
+
end
|
212
|
+
end
|
213
|
+
|
214
|
+
trait :with_photos do
|
215
|
+
transient do
|
216
|
+
photos_number { 2 }
|
217
|
+
end
|
218
|
+
|
219
|
+
after :create do |initiative, evaluator|
|
220
|
+
evaluator.photos_number.times do
|
221
|
+
initiative.attachments << create(
|
222
|
+
:attachment,
|
223
|
+
:with_image,
|
224
|
+
attached_to: initiative
|
225
|
+
)
|
226
|
+
end
|
227
|
+
end
|
228
|
+
end
|
193
229
|
end
|
194
230
|
|
195
231
|
factory :initiative_user_vote, class: "Decidim::InitiativesVote" do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: decidim-initiatives
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.24.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Juan Salvador Perez Garcia
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-05-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: decidim-admin
|
@@ -16,56 +16,56 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: 0.24.2
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.
|
26
|
+
version: 0.24.2
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: decidim-comments
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - '='
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.
|
33
|
+
version: 0.24.2
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - '='
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.
|
40
|
+
version: 0.24.2
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: decidim-core
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - '='
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 0.
|
47
|
+
version: 0.24.2
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - '='
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 0.
|
54
|
+
version: 0.24.2
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: decidim-verifications
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - '='
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 0.
|
61
|
+
version: 0.24.2
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - '='
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 0.
|
68
|
+
version: 0.24.2
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: kaminari
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -162,14 +162,14 @@ dependencies:
|
|
162
162
|
requirements:
|
163
163
|
- - '='
|
164
164
|
- !ruby/object:Gem::Version
|
165
|
-
version: 0.
|
165
|
+
version: 0.24.2
|
166
166
|
type: :development
|
167
167
|
prerelease: false
|
168
168
|
version_requirements: !ruby/object:Gem::Requirement
|
169
169
|
requirements:
|
170
170
|
- - '='
|
171
171
|
- !ruby/object:Gem::Version
|
172
|
-
version: 0.
|
172
|
+
version: 0.24.2
|
173
173
|
description: Citizen initiatives plugin for decidim.
|
174
174
|
email:
|
175
175
|
- jsperezg@gmail.com
|
@@ -216,10 +216,14 @@ files:
|
|
216
216
|
- app/commands/decidim/initiatives/admin/update_initiative_answer.rb
|
217
217
|
- app/commands/decidim/initiatives/admin/update_initiative_type.rb
|
218
218
|
- app/commands/decidim/initiatives/admin/update_initiative_type_scope.rb
|
219
|
+
- app/commands/decidim/initiatives/approve_membership_request.rb
|
219
220
|
- app/commands/decidim/initiatives/attachment_methods.rb
|
220
221
|
- app/commands/decidim/initiatives/create_initiative.rb
|
222
|
+
- app/commands/decidim/initiatives/revoke_membership_request.rb
|
223
|
+
- app/commands/decidim/initiatives/send_initiative_to_technical_validation.rb
|
221
224
|
- app/commands/decidim/initiatives/spawn_committee_request.rb
|
222
225
|
- app/commands/decidim/initiatives/unvote_initiative.rb
|
226
|
+
- app/commands/decidim/initiatives/update_initiative.rb
|
223
227
|
- app/commands/decidim/initiatives/validate_mobile_phone.rb
|
224
228
|
- app/commands/decidim/initiatives/validate_sms_code.rb
|
225
229
|
- app/commands/decidim/initiatives/vote_initiative.rb
|
@@ -241,6 +245,7 @@ files:
|
|
241
245
|
- app/controllers/decidim/initiatives/admin/initiatives_type_scopes_controller.rb
|
242
246
|
- app/controllers/decidim/initiatives/admin/initiatives_types_controller.rb
|
243
247
|
- app/controllers/decidim/initiatives/admin/initiatives_types_permissions_controller.rb
|
248
|
+
- app/controllers/decidim/initiatives/admin/moderations/reports_controller.rb
|
244
249
|
- app/controllers/decidim/initiatives/admin/moderations_controller.rb
|
245
250
|
- app/controllers/decidim/initiatives/application_controller.rb
|
246
251
|
- app/controllers/decidim/initiatives/authorization_sign_modals_controller.rb
|
@@ -256,10 +261,14 @@ files:
|
|
256
261
|
- app/controllers/decidim/initiatives/widgets_controller.rb
|
257
262
|
- app/events/decidim/initiatives/admin/initiative_sent_to_technical_validation_event.rb
|
258
263
|
- app/events/decidim/initiatives/admin/support_threshold_reached_event.rb
|
264
|
+
- app/events/decidim/initiatives/approve_membership_request_event.rb
|
259
265
|
- app/events/decidim/initiatives/create_initiative_event.rb
|
260
266
|
- app/events/decidim/initiatives/endorse_initiative_event.rb
|
261
267
|
- app/events/decidim/initiatives/extend_initiative_event.rb
|
268
|
+
- app/events/decidim/initiatives/initiative_sent_to_technical_validation_event.rb
|
262
269
|
- app/events/decidim/initiatives/milestone_completed_event.rb
|
270
|
+
- app/events/decidim/initiatives/revoke_membership_request_event.rb
|
271
|
+
- app/events/decidim/initiatives/spawn_committee_request_event.rb
|
263
272
|
- app/forms/decidim/initiatives/admin/initiative_answer_form.rb
|
264
273
|
- app/forms/decidim/initiatives/admin/initiative_form.rb
|
265
274
|
- app/forms/decidim/initiatives/admin/initiative_type_form.rb
|
@@ -269,6 +278,7 @@ files:
|
|
269
278
|
- app/forms/decidim/initiatives/previous_form.rb
|
270
279
|
- app/forms/decidim/initiatives/select_initiative_type_form.rb
|
271
280
|
- app/forms/decidim/initiatives/vote_form.rb
|
281
|
+
- app/helpers/decidim/initiatives/admin/initiative_admin_menu_helper.rb
|
272
282
|
- app/helpers/decidim/initiatives/application_helper.rb
|
273
283
|
- app/helpers/decidim/initiatives/create_initiative_helper.rb
|
274
284
|
- app/helpers/decidim/initiatives/initiative_helper.rb
|
@@ -305,9 +315,6 @@ files:
|
|
305
315
|
- app/services/decidim/initiatives/pdf_signature_example.rb
|
306
316
|
- app/services/decidim/initiatives/progress_notifier.rb
|
307
317
|
- app/services/decidim/initiatives/status_change_notifier.rb
|
308
|
-
- app/types/decidim/initiatives/initiative_api_type.rb
|
309
|
-
- app/types/decidim/initiatives/initiative_committee_member_type.rb
|
310
|
-
- app/types/decidim/initiatives/initiative_type.rb
|
311
318
|
- app/views/decidim/initiatives/_initiative.html.erb
|
312
319
|
- app/views/decidim/initiatives/admin/answers/_info_initiative.html.erb
|
313
320
|
- app/views/decidim/initiatives/admin/answers/edit.html.erb
|
@@ -345,9 +352,11 @@ files:
|
|
345
352
|
- app/views/decidim/initiatives/initiative_signatures/update_buttons_and_counters.js.erb
|
346
353
|
- app/views/decidim/initiatives/initiative_votes/update_buttons_and_counters.js.erb
|
347
354
|
- app/views/decidim/initiatives/initiatives/_author.html.erb
|
355
|
+
- app/views/decidim/initiatives/initiatives/_committee_members.html.erb
|
348
356
|
- app/views/decidim/initiatives/initiatives/_count.html.erb
|
349
357
|
- app/views/decidim/initiatives/initiatives/_filters.html.erb
|
350
358
|
- app/views/decidim/initiatives/initiatives/_filters_small_view.html.erb
|
359
|
+
- app/views/decidim/initiatives/initiatives/_form.html.erb
|
351
360
|
- app/views/decidim/initiatives/initiatives/_index_header.html.erb
|
352
361
|
- app/views/decidim/initiatives/initiatives/_initiative_badge.html.erb
|
353
362
|
- app/views/decidim/initiatives/initiatives/_initiatives.html.erb
|
@@ -356,11 +365,14 @@ files:
|
|
356
365
|
- app/views/decidim/initiatives/initiatives/_no_initiatives_yet.html.erb
|
357
366
|
- app/views/decidim/initiatives/initiatives/_progress_bar.html.erb
|
358
367
|
- app/views/decidim/initiatives/initiatives/_result.html.erb
|
368
|
+
- app/views/decidim/initiatives/initiatives/_send_to_technical_validation.html.erb
|
359
369
|
- app/views/decidim/initiatives/initiatives/_tags.html.erb
|
360
370
|
- app/views/decidim/initiatives/initiatives/_vote_button.html.erb
|
361
371
|
- app/views/decidim/initiatives/initiatives/_vote_cabin.html.erb
|
372
|
+
- app/views/decidim/initiatives/initiatives/edit.html.erb
|
362
373
|
- app/views/decidim/initiatives/initiatives/index.html.erb
|
363
374
|
- app/views/decidim/initiatives/initiatives/index.js.erb
|
375
|
+
- app/views/decidim/initiatives/initiatives/print.html.erb
|
364
376
|
- app/views/decidim/initiatives/initiatives/show.html.erb
|
365
377
|
- app/views/decidim/initiatives/initiatives_mailer/_initiative_link.html.erb
|
366
378
|
- app/views/decidim/initiatives/initiatives_mailer/notify_creation.html.erb
|
@@ -506,8 +518,12 @@ files:
|
|
506
518
|
- db/migrate/20200514102631_add_area_enabled_option_to_initiatives.rb
|
507
519
|
- db/migrate/20200528151456_remove_user_groups_from_initiative_votes.rb
|
508
520
|
- db/migrate/20200827154214_add_commentable_counter_cache_to_initiatives.rb
|
521
|
+
- db/migrate/20210310120720_add_followable_counter_cache_to_initiatives.rb
|
509
522
|
- db/seeds/city.jpeg
|
510
523
|
- db/seeds/city2.jpeg
|
524
|
+
- lib/decidim/api/initiative_api_type.rb
|
525
|
+
- lib/decidim/api/initiative_committee_member_type.rb
|
526
|
+
- lib/decidim/api/initiative_type.rb
|
511
527
|
- lib/decidim/api/initiative_type_interface.rb
|
512
528
|
- lib/decidim/initiatives.rb
|
513
529
|
- lib/decidim/initiatives/admin.rb
|
@@ -534,14 +550,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
534
550
|
requirements:
|
535
551
|
- - ">="
|
536
552
|
- !ruby/object:Gem::Version
|
537
|
-
version: '2.
|
553
|
+
version: '2.7'
|
538
554
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
539
555
|
requirements:
|
540
556
|
- - ">="
|
541
557
|
- !ruby/object:Gem::Version
|
542
558
|
version: '0'
|
543
559
|
requirements: []
|
544
|
-
rubygems_version: 3.
|
560
|
+
rubygems_version: 3.1.2
|
545
561
|
signing_key:
|
546
562
|
specification_version: 4
|
547
563
|
summary: Decidim initiatives module
|