decidim-initiatives 0.23.5 → 0.24.0.rc1
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/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 +47 -20
- 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/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/_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 +3 -28
- data/config/locales/ca.yml +62 -32
- data/config/locales/cs.yml +108 -48
- data/config/locales/de.yml +91 -31
- data/config/locales/el.yml +3 -34
- data/config/locales/en.yml +94 -34
- data/config/locales/es-MX.yml +9 -36
- data/config/locales/es-PY.yml +9 -36
- data/config/locales/es.yml +10 -37
- data/config/locales/eu.yml +3 -28
- data/config/locales/fi-plain.yml +94 -34
- data/config/locales/fi.yml +94 -34
- data/config/locales/fr-CA.yml +96 -36
- data/config/locales/fr.yml +96 -36
- data/config/locales/gl.yml +3 -36
- data/config/locales/hu.yml +3 -32
- data/config/locales/id-ID.yml +3 -28
- data/config/locales/is-IS.yml +3 -13
- data/config/locales/it.yml +3 -34
- data/config/locales/ja.yml +2 -35
- data/config/locales/lv.yml +3 -32
- data/config/locales/nl.yml +31 -34
- data/config/locales/no.yml +2 -32
- data/config/locales/pl.yml +78 -33
- data/config/locales/pt-BR.yml +3 -28
- data/config/locales/pt.yml +4 -35
- data/config/locales/ro-RO.yml +3 -35
- data/config/locales/ru.yml +3 -21
- data/config/locales/sk.yml +3 -30
- data/config/locales/sr-CS.yml +0 -7
- data/config/locales/sv.yml +2 -37
- data/config/locales/tr-TR.yml +68 -34
- data/config/locales/uk.yml +3 -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/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 +34 -19
- 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
data/config/locales/uk.yml
CHANGED
@@ -14,14 +14,6 @@ uk:
|
|
14
14
|
offline: На особистих зустрічах
|
15
15
|
online: Онлайн
|
16
16
|
title: Назва
|
17
|
-
initiative_author:
|
18
|
-
address: Адреса
|
19
|
-
city: Місто
|
20
|
-
id_document: ІПН / РНОКПП
|
21
|
-
name: Ім'я та прізвище
|
22
|
-
phone_number: Номер телефону
|
23
|
-
post_code: Поштовий індекс
|
24
|
-
province: Область
|
25
17
|
initiatives_committee_member:
|
26
18
|
user: Член робочого гурту
|
27
19
|
initiatives_type:
|
@@ -191,23 +183,14 @@ uk:
|
|
191
183
|
fill_data:
|
192
184
|
back: Повернутись
|
193
185
|
continue: Продовжити
|
194
|
-
fill_data_help: "<ul> <li>Перегляньте зміст вашого почину. Чи легко розуміти його заголовок? Ясна мета вашого почину?</li> <li>Ви маєте обрати різновид збору підписів. На особистій зустрічі, в Інтернеті або і там, і там</li> <li>Який географічний обсяг почину? Місто, район?</li> </ul>"
|
195
186
|
initiative_type: Різновид почину
|
196
187
|
more_information: "(Додаткові відомості)"
|
197
188
|
select_scope: Оберіть обсяг
|
198
189
|
finish:
|
199
190
|
back: Повернутись
|
200
191
|
back_to_initiatives: Повернутися до починів
|
201
|
-
callout_text: Вітаємо! Ваш громадський почин було успішно додано.
|
202
192
|
go_to_my_initiatives: Перейти до моїх починів
|
203
193
|
more_information: "(Додаткові відомості)"
|
204
|
-
finish_help:
|
205
|
-
access_reminder: Пам'ятайте, що ви завжди зможете отримати доступ до ваших починів через меню учасника.
|
206
|
-
help_for_organizations: Якщо ви є асоціацією організацій, ви маєте завантажити протоколи засідань правління усіх організацій, які входять до робочого гурту з просування
|
207
|
-
help_in_person_signatures: Якщо ви вирішили збирати підписи на особистих зустрічах або в поєднанні зі збором онлайн, вам потрібно завантажити необхідні для цього відомості.
|
208
|
-
help_text: Пам'ятайте, що для властивої обробки почину ви повинні зайти до панелі адміністрування. Знайдіть там меню учасника, завантажте необхідні відомості та відправте їх на обробку.
|
209
|
-
initiatives_page_link: Ви можете знайти всі ці відомості на %{link}, де розповідається все про почини.
|
210
|
-
page: сторінці
|
211
194
|
previous_form:
|
212
195
|
back: Повернутись
|
213
196
|
continue: Продовжити
|
@@ -219,7 +202,6 @@ uk:
|
|
219
202
|
select_initiative_type:
|
220
203
|
back: Повернутись
|
221
204
|
more_information: "(Додаткові відомості)"
|
222
|
-
select_initiative_type_help: Громадські почини - це засіб, за допомогою якого громадяни можуть втрутитися в те, щоб міська рада вжила заходів для забезпечення спільних потреб, які відносяться до сфери міських повноважень. Який почин ви бажаєте зробити?
|
223
205
|
share_committee_link:
|
224
206
|
continue: Продовжити
|
225
207
|
invite_to_committee_help: Посилання для запрошення людей, які увійдуть в робочий гурт з просування
|
@@ -279,11 +261,10 @@ uk:
|
|
279
261
|
most_voted: З найбільшою кількістю підписів
|
280
262
|
random: Довільно
|
281
263
|
recent: Найновіші
|
264
|
+
print:
|
265
|
+
city: Місто
|
282
266
|
result:
|
283
267
|
initiative_rejected_reason: Цей почин був відхилений через недостатню підтримку.
|
284
|
-
show:
|
285
|
-
any_vote_method: Цей громадський почин збирає онлайн-підтримку, а також підтримку на особистих зустрічах.
|
286
|
-
offline_method: Цей громадський почин збирає прояви підтримки лише на особистих зустрічах.
|
287
268
|
signatures_count:
|
288
269
|
one: " підпис"
|
289
270
|
few: " підписи"
|
@@ -325,6 +306,7 @@ uk:
|
|
325
306
|
decidim:
|
326
307
|
admin:
|
327
308
|
initiative:
|
309
|
+
attachments: Вкладені файли
|
328
310
|
committee_members: Члени робочого гурту
|
329
311
|
components: Складові
|
330
312
|
information: Відомості
|
data/config/locales/zh-CN.yml
CHANGED
@@ -16,14 +16,6 @@ zh-CN:
|
|
16
16
|
online: 在线
|
17
17
|
state: 状态
|
18
18
|
title: 标题
|
19
|
-
initiative_author:
|
20
|
-
address: 地址
|
21
|
-
city: 城市
|
22
|
-
id_document: DNI/NIE
|
23
|
-
name: 姓名:
|
24
|
-
phone_number: 电话号码
|
25
|
-
post_code: 邮编
|
26
|
-
province: 省
|
27
19
|
initiatives_committee_member:
|
28
20
|
user: 委员会成员
|
29
21
|
initiatives_type:
|
@@ -154,10 +146,7 @@ zh-CN:
|
|
154
146
|
email_subject: 新里程碑已完成!
|
155
147
|
notification_title: <a href="%{resource_path}">%{resource_title}</a> 倡议已经实现了 %{percentage}%的签名。
|
156
148
|
support_threshold_reached:
|
157
|
-
email_intro: '%{resource_title} 倡议已达到支持阈值'
|
158
149
|
email_outro: 您收到此通知是因为您是平台的管理员。
|
159
|
-
email_subject: 已达到支持阈值
|
160
|
-
notification_title: <a href="%{resource_path}">%{resource_title}</a> 倡议已达到支持阈值
|
161
150
|
gamification:
|
162
151
|
badges:
|
163
152
|
initiatives:
|
@@ -264,7 +253,6 @@ zh-CN:
|
|
264
253
|
update: 更新
|
265
254
|
form:
|
266
255
|
authorizations: 授权设置
|
267
|
-
child_scope_threshold_enabled_help: '这个配置标志不支持离线投票,它允许子jauges,并且与一个授权处理程序与用户相关联。 请确保您在授权设置中选择该授权和下拉。 要使其工作范围需要分级配置: 1 家长-N 孩子。 关于此配置如何工作的更多信息,请查看 <a href="https://docs.decidim.org/admin-manual/en/initiatives/" target="_blank">链接</a>。'
|
268
256
|
only_global_scope_enabled_help: 如果您启用了“子范围签名”并将全局范围设置为您的上级范围,请勾选此标记。 通过启用此功能,倡议类型选择将会在创建向导中跳过。 关于此配置如何工作的更多信息,请查看 <a href="https://docs.decidim.org/admin-manual/en/initiatives/" target="_blank">链接</a>。
|
269
257
|
options: 备选方案
|
270
258
|
title: 通告周知
|
@@ -316,7 +304,6 @@ zh-CN:
|
|
316
304
|
fill_data:
|
317
305
|
back: 后退
|
318
306
|
continue: 继续
|
319
|
-
fill_data_help: "<ul> <li>查看您倡议的内容。 您的标题易于理解吗?您的主动行动的目标是否明确?</li> <li>您必须选择签名类型。 在本人、在线或两者兼而有</li> <li>倡议的地理范围是什么? 城市,区?</li> </ul>"
|
320
307
|
initiative_type: 倡议类型
|
321
308
|
more_information: "(更多信息)"
|
322
309
|
select_area: 选择区域
|
@@ -324,19 +311,8 @@ zh-CN:
|
|
324
311
|
finish:
|
325
312
|
back: 后退
|
326
313
|
back_to_initiatives: 回到倡议
|
327
|
-
callout_text: 恭喜!您的公民倡议已成功创建。
|
328
|
-
confirm: 确认
|
329
|
-
edit_my_initiative: 编辑我的倡议
|
330
314
|
go_to_my_initiatives: 转到我的倡议
|
331
315
|
more_information: "(更多信息)"
|
332
|
-
send_my_initiative: 发送我的倡议
|
333
|
-
finish_help:
|
334
|
-
access_reminder: 请记住,您将始终能够通过参与者菜单访问您的倡议。
|
335
|
-
help_for_organizations: 如果您是一个协会,您必须上传所有组成促进委员会的组织的管理委员会的记录
|
336
|
-
help_in_person_signatures: 如果您选择亲自收集签名或与在线合并,您将必须上传所需信息。
|
337
|
-
help_text: 请记住,为了正确处理主动行动,您必须访问管理面板,您可以在那里找到用户菜单, 上传所需信息并发送以供处理。
|
338
|
-
initiatives_page_link: 您可以查询所有关于 %{link} 的信息来通报倡议。
|
339
|
-
page: 页面
|
340
316
|
previous_form:
|
341
317
|
back: 后退
|
342
318
|
continue: 继续
|
@@ -344,14 +320,12 @@ zh-CN:
|
|
344
320
|
more_information: "(更多信息)"
|
345
321
|
promotal_committee:
|
346
322
|
back: 后退
|
347
|
-
individual_help_text: 这种公民倡议需要一个至少由 %{committee_size} 人组成的促进委员会(证明人)。 您必须与属于此倡议一部分的其他人分享以下链接。 当您的联系人收到此链接时,他们必须遵循指定的步骤。
|
348
323
|
more_information: "(更多信息)"
|
349
324
|
select_initiative_type:
|
350
325
|
back: 后退
|
351
326
|
choose_html: 我想要创建 <strong>%{title}</strong>
|
352
327
|
more_information: "(更多信息)"
|
353
328
|
select: 我想促进这项倡议
|
354
|
-
select_initiative_type_help: 公民倡议是公民可以进行干预的一种手段,使市议会能够采取行动,维护市政管辖范围内的普遍利益。 你想要发起哪个倡议?
|
355
329
|
share_committee_link:
|
356
330
|
continue: 继续
|
357
331
|
invite_to_committee_help: 邀请将成为促进委员会成员的人的链接
|
@@ -444,19 +418,12 @@ zh-CN:
|
|
444
418
|
random: 随机播放
|
445
419
|
recent: 最新的
|
446
420
|
recently_published: 最近发布的
|
421
|
+
print:
|
422
|
+
city: 城市
|
447
423
|
result:
|
448
|
-
answer_title:
|
449
|
-
accepted: 这项建议已被接受,原因是:
|
450
|
-
created: 此建议已创建
|
451
|
-
discarded: 这项建议已经被放弃,原因是:
|
452
|
-
published: 此建议发布原因:
|
453
|
-
rejected: 这项建议已被拒绝,原因是:
|
454
|
-
validating: 这项建议正在评估
|
455
424
|
initiative_rejected_reason: 这项倡议由于没有签字而被拒绝。
|
456
425
|
show:
|
457
|
-
any_vote_method: 这项公民倡议收集在线签名和亲身签名。
|
458
426
|
follow_description: 当该倡议有消息时收到通知
|
459
|
-
offline_method: 这项公民倡议只收集亲身签名。
|
460
427
|
signatures_count:
|
461
428
|
other: " 签名"
|
462
429
|
vote_cabin:
|
@@ -8,7 +8,7 @@ class AddScopesToInitiativesVotes < ActiveRecord::Migration[5.2]
|
|
8
8
|
|
9
9
|
class Initiative < ApplicationRecord
|
10
10
|
self.table_name = :decidim_initiatives
|
11
|
-
belongs_to :scoped_type,
|
11
|
+
belongs_to :scoped_type, class_name: "InitiativesTypeScope"
|
12
12
|
end
|
13
13
|
|
14
14
|
class InitiativesTypeScope < ApplicationRecord
|
@@ -7,7 +7,7 @@ class AllowMultipleOfflineVotes < ActiveRecord::Migration[5.2]
|
|
7
7
|
|
8
8
|
class Initiative < ApplicationRecord
|
9
9
|
self.table_name = :decidim_initiatives
|
10
|
-
belongs_to :scoped_type,
|
10
|
+
belongs_to :scoped_type, class_name: "InitiativesTypeScope"
|
11
11
|
end
|
12
12
|
|
13
13
|
def change
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Initiatives
|
5
|
+
class InitiativeApiType < Decidim::Api::Types::BaseObject
|
6
|
+
graphql_name "InitiativeType"
|
7
|
+
description "An initiative type"
|
8
|
+
|
9
|
+
field :id, GraphQL::Types::ID, "The internal ID for this initiative type", null: false
|
10
|
+
field :title, Decidim::Core::TranslatedFieldType, "Initiative type name", null: true
|
11
|
+
field :description, Decidim::Core::TranslatedFieldType, "This is the initiative type description", null: true
|
12
|
+
field :created_at, Decidim::Core::DateTimeType, "The date this initiative type was created", null: true
|
13
|
+
field :updated_at, Decidim::Core::DateTimeType, "The date this initiative type was updated", null: true
|
14
|
+
field :banner_image, GraphQL::Types::String, "Banner image", null: true
|
15
|
+
field :collect_user_extra_fields, GraphQL::Types::Boolean, "Collect participant personal data on signature", null: true
|
16
|
+
field :extra_fields_legal_information, GraphQL::Types::String, "Legal information about the collection of personal data", null: true
|
17
|
+
field :minimum_committee_members, GraphQL::Types::Int, "Minimum of committee members", null: true
|
18
|
+
field :validate_sms_code_on_votes, GraphQL::Types::Boolean, "Add SMS code validation step to signature process", null: true
|
19
|
+
field :undo_online_signatures_enabled, GraphQL::Types::Boolean, "Enable participants to undo their online signatures", null: true
|
20
|
+
field :promoting_comittee_enabled, GraphQL::Types::Boolean, "If promoting committee is enabled", method: :promoting_committee_enabled, null: true
|
21
|
+
field :signature_type, GraphQL::Types::String, "Signature type of the initiative", null: true
|
22
|
+
|
23
|
+
field :initiatives, [Decidim::Initiatives::InitiativeType, { null: true }], "The initiatives that have this type", null: false
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Initiatives
|
5
|
+
# This type represents a initiative committee member.
|
6
|
+
class InitiativeCommitteeMemberType < Decidim::Api::Types::BaseObject
|
7
|
+
graphql_name "InitiativeCommitteeMemberType"
|
8
|
+
description "A initiative committee member"
|
9
|
+
|
10
|
+
field :id, GraphQL::Types::ID, "Internal ID for this member of the committee", null: false
|
11
|
+
field :user, Decidim::Core::UserType, "The decidim user for this initiative committee member", null: true
|
12
|
+
|
13
|
+
field :state, GraphQL::Types::String, "Type of the committee member", null: true
|
14
|
+
field :created_at, Decidim::Core::DateTimeType, "The date this initiative committee member was created", null: true
|
15
|
+
field :updated_at, Decidim::Core::DateTimeType, "The date this initiative committee member was updated", null: true
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -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
|