decidim-initiatives 0.20.1 → 0.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/concerns/decidim/initiatives/admin/filterable.rb +37 -0
  3. data/app/controllers/decidim/initiatives/admin/initiatives_controller.rb +6 -12
  4. data/app/models/decidim/initiative.rb +18 -1
  5. data/app/permissions/decidim/initiatives/admin/permissions.rb +10 -6
  6. data/app/queries/decidim/initiatives/admin/manageable_initiatives.rb +7 -39
  7. data/app/types/decidim/initiatives/initiative_api_type.rb +26 -0
  8. data/app/types/decidim/initiatives/initiative_committee_member_type.rb +18 -0
  9. data/app/types/decidim/initiatives/initiative_type.rb +42 -0
  10. data/app/views/decidim/initiatives/admin/initiatives/index.html.erb +3 -43
  11. data/config/locales/ar.yml +12 -10
  12. data/config/locales/ca.yml +12 -10
  13. data/config/locales/cs.yml +14 -12
  14. data/config/locales/de.yml +10 -10
  15. data/config/locales/el.yml +1 -0
  16. data/config/locales/en.yml +12 -10
  17. data/config/locales/es-MX.yml +12 -10
  18. data/config/locales/es-PY.yml +12 -10
  19. data/config/locales/es.yml +12 -10
  20. data/config/locales/eu.yml +10 -10
  21. data/config/locales/fi-plain.yml +12 -10
  22. data/config/locales/fi.yml +12 -10
  23. data/config/locales/fr.yml +10 -10
  24. data/config/locales/gl.yml +10 -10
  25. data/config/locales/hu.yml +12 -10
  26. data/config/locales/id-ID.yml +10 -10
  27. data/config/locales/is-IS.yml +10 -10
  28. data/config/locales/it.yml +12 -10
  29. data/config/locales/nl.yml +10 -10
  30. data/config/locales/no.yml +12 -10
  31. data/config/locales/pl.yml +10 -10
  32. data/config/locales/pt-BR.yml +10 -10
  33. data/config/locales/pt.yml +10 -10
  34. data/config/locales/ru.yml +10 -10
  35. data/config/locales/sv.yml +10 -10
  36. data/config/locales/tr-TR.yml +10 -10
  37. data/config/locales/uk.yml +10 -10
  38. data/lib/decidim/api/initiative_type_interface.rb +13 -0
  39. data/lib/decidim/initiatives/api.rb +7 -0
  40. data/lib/decidim/initiatives/engine.rb +8 -0
  41. data/lib/decidim/initiatives/participatory_space.rb +2 -0
  42. data/lib/decidim/initiatives/query_extensions.rb +40 -0
  43. data/lib/decidim/initiatives/version.rb +1 -1
  44. metadata +20 -13
  45. data/app/views/decidim/initiatives/initiative_widgets/show.html.erb +0 -4
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Initiatives
5
+ autoload :InitiativeTypeInterface, "decidim/api/initiative_type_interface"
6
+ end
7
+ end
@@ -6,6 +6,8 @@ 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
+ require "decidim/initiatives/query_extensions"
9
11
 
10
12
  module Decidim
11
13
  module Initiatives
@@ -110,6 +112,12 @@ module Decidim
110
112
  }
111
113
  end
112
114
  end
115
+
116
+ initializer "decidim_initiatives.query_extensions" do
117
+ Decidim::Api::QueryType.define do
118
+ QueryExtensions.define(self)
119
+ end
120
+ end
113
121
  end
114
122
  end
115
123
  end
@@ -18,6 +18,8 @@ Decidim.register_participatory_space(:initiatives) do |participatory_space|
18
18
  Decidim::Initiative.where(organization: organization)
19
19
  end
20
20
 
21
+ participatory_space.query_type = "Decidim::Initiatives::InitiativeType"
22
+
21
23
  participatory_space.register_resource(:initiative) do |resource|
22
24
  resource.model_class_name = "Decidim::Initiative"
23
25
  resource.card = "decidim/initiatives/initiative"
@@ -0,0 +1,40 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Initiatives
5
+ # This module's job is to extend the API with custom fields related to
6
+ # decidim-initiatives.
7
+ module QueryExtensions
8
+ # Public: Extends a type with `decidim-initiatives`'s fields.
9
+ #
10
+ # type - A GraphQL::BaseType to extend.
11
+ #
12
+ # Returns nothing.
13
+ def self.define(type)
14
+ type.field :initiativesTypes do
15
+ type !types[InitiativeApiType]
16
+ description "Lists all initiative types"
17
+
18
+ resolve lambda { |_obj, _args, ctx|
19
+ Decidim::InitiativesType.where(
20
+ organization: ctx[:current_organization]
21
+ )
22
+ }
23
+ end
24
+
25
+ type.field :initiativesType do
26
+ type InitiativeApiType
27
+ description "Finds a initiative type"
28
+ argument :id, !types.ID, "The ID of the initiative type"
29
+
30
+ resolve lambda { |_obj, args, ctx|
31
+ Decidim::InitiativesType.find_by(
32
+ organization: ctx[:current_organization],
33
+ id: args[:id]
34
+ )
35
+ }
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
@@ -4,7 +4,7 @@ module Decidim
4
4
  # This holds the decidim-initiatives version.
5
5
  module Initiatives
6
6
  def self.version
7
- "0.20.1"
7
+ "0.21.0"
8
8
  end
9
9
  end
10
10
  end
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.20.1
4
+ version: 0.21.0
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: 2020-03-27 00:00:00.000000000 Z
11
+ date: 2020-04-08 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.20.1
19
+ version: 0.21.0
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.20.1
26
+ version: 0.21.0
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.20.1
33
+ version: 0.21.0
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.20.1
40
+ version: 0.21.0
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.20.1
47
+ version: 0.21.0
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.20.1
54
+ version: 0.21.0
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.20.1
61
+ version: 0.21.0
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.20.1
68
+ version: 0.21.0
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: kaminari
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -156,14 +156,14 @@ dependencies:
156
156
  requirements:
157
157
  - - '='
158
158
  - !ruby/object:Gem::Version
159
- version: 0.20.1
159
+ version: 0.21.0
160
160
  type: :development
161
161
  prerelease: false
162
162
  version_requirements: !ruby/object:Gem::Requirement
163
163
  requirements:
164
164
  - - '='
165
165
  - !ruby/object:Gem::Version
166
- version: 0.20.1
166
+ version: 0.21.0
167
167
  description: Citizen initiatives plugin for decidim.
168
168
  email:
169
169
  - jsperezg@gmail.com
@@ -218,6 +218,7 @@ files:
218
218
  - app/commands/decidim/initiatives/vote_initiative.rb
219
219
  - app/constraints/decidim/initiatives/current_component.rb
220
220
  - app/constraints/decidim/initiatives/current_initiative.rb
221
+ - app/controllers/concerns/decidim/initiatives/admin/filterable.rb
221
222
  - app/controllers/concerns/decidim/initiatives/admin/initiative_admin.rb
222
223
  - app/controllers/concerns/decidim/initiatives/needs_initiative.rb
223
224
  - app/controllers/concerns/decidim/initiatives/orderable.rb
@@ -288,6 +289,9 @@ files:
288
289
  - app/services/decidim/initiatives/pdf_signature_example.rb
289
290
  - app/services/decidim/initiatives/progress_notifier.rb
290
291
  - app/services/decidim/initiatives/status_change_notifier.rb
292
+ - app/types/decidim/initiatives/initiative_api_type.rb
293
+ - app/types/decidim/initiatives/initiative_committee_member_type.rb
294
+ - app/types/decidim/initiatives/initiative_type.rb
291
295
  - app/views/decidim/initiatives/_initiative.html.erb
292
296
  - app/views/decidim/initiatives/admin/answers/_info_initiative.html.erb
293
297
  - app/views/decidim/initiatives/admin/answers/edit.html.erb
@@ -321,7 +325,6 @@ files:
321
325
  - app/views/decidim/initiatives/initiative_signatures/sms_phone_number.html.erb
322
326
  - app/views/decidim/initiatives/initiative_signatures/update_buttons_and_counters.js.erb
323
327
  - app/views/decidim/initiatives/initiative_votes/update_buttons_and_counters.js.erb
324
- - app/views/decidim/initiatives/initiative_widgets/show.html.erb
325
328
  - app/views/decidim/initiatives/initiatives/_author.html.erb
326
329
  - app/views/decidim/initiatives/initiatives/_count.html.erb
327
330
  - app/views/decidim/initiatives/initiatives/_filters.html.erb
@@ -368,6 +371,7 @@ files:
368
371
  - config/locales/cs.yml
369
372
  - config/locales/de.yml
370
373
  - config/locales/el-GR.yml
374
+ - config/locales/el.yml
371
375
  - config/locales/en.yml
372
376
  - config/locales/eo-UY.yml
373
377
  - config/locales/es-MX.yml
@@ -437,14 +441,17 @@ files:
437
441
  - db/migrate/20190925145648_add_promoting_committee_option.rb
438
442
  - db/migrate/20191002082220_move_signature_type_to_initative_type.rb
439
443
  - db/seeds/city2.jpeg
444
+ - lib/decidim/api/initiative_type_interface.rb
440
445
  - lib/decidim/initiatives.rb
441
446
  - lib/decidim/initiatives/admin.rb
442
447
  - lib/decidim/initiatives/admin_engine.rb
448
+ - lib/decidim/initiatives/api.rb
443
449
  - lib/decidim/initiatives/current_locale.rb
444
450
  - lib/decidim/initiatives/engine.rb
445
451
  - lib/decidim/initiatives/initiative_slug.rb
446
452
  - lib/decidim/initiatives/initiatives_filter_form_builder.rb
447
453
  - lib/decidim/initiatives/participatory_space.rb
454
+ - lib/decidim/initiatives/query_extensions.rb
448
455
  - lib/decidim/initiatives/test/factories.rb
449
456
  - lib/decidim/initiatives/version.rb
450
457
  - lib/tasks/decidim_initiatives.rake
@@ -1,4 +0,0 @@
1
- <% content_for(:title, translated_attribute(model.title)) %>
2
-
3
- <%= render partial: "decidim/initiatives/initiatives/initiative_badge", locals: { initiative: model } %>
4
- <p><%= truncate(translated_attribute(model.description), length: 100) %></p>