decidim-proposals 0.23.6 → 0.24.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (116) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/decidim/proposals/add_proposal.js.es6 +4 -1
  3. data/app/assets/stylesheets/decidim/proposals/_proposals.css.scss +1 -0
  4. data/app/assets/stylesheets/decidim/proposals/proposals/_preview.css.scss +3 -0
  5. data/app/cells/decidim/proposals/collaborative_draft_link_to_proposal_cell.rb +3 -3
  6. data/app/cells/decidim/proposals/collaborative_drafts/reported_content/show.erb +3 -0
  7. data/app/cells/decidim/proposals/collaborative_drafts/reported_content_cell.rb +15 -0
  8. data/app/cells/decidim/proposals/content_blocks/highlighted_proposals/elements.erb +5 -0
  9. data/app/cells/decidim/proposals/content_blocks/highlighted_proposals/heading.erb +1 -0
  10. data/app/cells/decidim/proposals/content_blocks/highlighted_proposals_cell.rb +19 -0
  11. data/app/cells/decidim/proposals/irreversible_action_modal_cell.rb +1 -1
  12. data/app/cells/decidim/proposals/proposal_activity_cell.rb +5 -13
  13. data/app/cells/decidim/proposals/proposal_m_cell.rb +23 -2
  14. data/app/cells/decidim/proposals/proposals_picker_cell.rb +1 -1
  15. data/app/cells/decidim/proposals/reported_content/show.erb +4 -0
  16. data/app/cells/decidim/proposals/reported_content_cell.rb +13 -0
  17. data/app/commands/decidim/proposals/hashtags_methods.rb +1 -1
  18. data/app/controllers/decidim/proposals/admin/proposals_controller.rb +6 -4
  19. data/app/controllers/decidim/proposals/collaborative_drafts_controller.rb +1 -30
  20. data/app/controllers/decidim/proposals/proposals_controller.rb +9 -12
  21. data/app/events/decidim/proposals/publish_proposal_event.rb +1 -1
  22. data/app/forms/decidim/proposals/access_to_collaborative_draft_form.rb +1 -3
  23. data/app/forms/decidim/proposals/admin/proposal_base_form.rb +3 -2
  24. data/app/forms/decidim/proposals/proposal_form.rb +15 -5
  25. data/app/forms/decidim/proposals/proposal_wizard_create_step_form.rb +1 -1
  26. data/app/helpers/decidim/proposals/admin/filterable_helper.rb +1 -1
  27. data/app/helpers/decidim/proposals/admin/proposal_rankings_helper.rb +1 -1
  28. data/app/helpers/decidim/proposals/admin/proposals_helper.rb +8 -8
  29. data/app/helpers/decidim/proposals/application_helper.rb +5 -2
  30. data/app/helpers/decidim/proposals/map_helper.rb +25 -8
  31. data/app/helpers/decidim/proposals/proposal_wizard_helper.rb +14 -44
  32. data/app/helpers/decidim/proposals/proposals_helper.rb +3 -6
  33. data/app/models/decidim/proposals/collaborative_draft.rb +10 -0
  34. data/app/models/decidim/proposals/proposal.rb +18 -10
  35. data/app/permissions/decidim/proposals/admin/permissions.rb +2 -2
  36. data/app/permissions/decidim/proposals/permissions.rb +3 -2
  37. data/app/presenters/decidim/proposals/proposal_presenter.rb +4 -4
  38. data/app/queries/decidim/proposals/metrics/proposal_followers_metric_measure.rb +4 -4
  39. data/app/queries/decidim/proposals/metrics/proposal_participants_metric_measure.rb +6 -6
  40. data/app/services/decidim/proposals/collaborative_draft_search.rb +1 -1
  41. data/app/services/decidim/proposals/diff_renderer.rb +7 -11
  42. data/app/services/decidim/proposals/proposal_builder.rb +2 -3
  43. data/app/views/decidim/proposals/admin/proposals/_bulk-actions.html.erb +8 -1
  44. data/app/views/decidim/proposals/admin/proposals/_proposal-tr.html.erb +5 -1
  45. data/app/views/decidim/proposals/admin/proposals_imports/new.html.erb +1 -1
  46. data/app/views/decidim/proposals/collaborative_drafts/_wizard_aside.html.erb +2 -7
  47. data/app/views/decidim/proposals/collaborative_drafts/_wizard_header.html.erb +14 -0
  48. data/app/views/decidim/proposals/collaborative_drafts/edit.html.erb +1 -3
  49. data/app/views/decidim/proposals/collaborative_drafts/new.html.erb +5 -13
  50. data/app/views/decidim/proposals/collaborative_drafts/show.html.erb +1 -7
  51. data/app/views/decidim/proposals/proposals/_dynamic_map_instructions.html.erb +3 -0
  52. data/app/views/decidim/proposals/proposals/_edit_form_fields.html.erb +2 -2
  53. data/app/views/decidim/proposals/proposals/_filters.html.erb +34 -32
  54. data/app/views/decidim/proposals/proposals/_wizard_header.html.erb +21 -11
  55. data/app/views/decidim/proposals/proposals/edit.html.erb +1 -3
  56. data/app/views/decidim/proposals/proposals/index.html.erb +1 -1
  57. data/app/views/decidim/proposals/proposals/preview.html.erb +50 -2
  58. data/app/views/decidim/proposals/proposals/show.html.erb +2 -8
  59. data/config/locales/ar.yml +2 -23
  60. data/config/locales/bg.yml +0 -4
  61. data/config/locales/ca.yml +9 -32
  62. data/config/locales/cs.yml +49 -56
  63. data/config/locales/de.yml +23 -30
  64. data/config/locales/el.yml +2 -29
  65. data/config/locales/en.yml +23 -30
  66. data/config/locales/es-MX.yml +3 -31
  67. data/config/locales/es-PY.yml +3 -31
  68. data/config/locales/es.yml +3 -31
  69. data/config/locales/eu.yml +2 -23
  70. data/config/locales/fi-plain.yml +18 -29
  71. data/config/locales/fi.yml +18 -29
  72. data/config/locales/fr-CA.yml +19 -30
  73. data/config/locales/fr.yml +19 -30
  74. data/config/locales/gl.yml +4 -97
  75. data/config/locales/hu.yml +2 -23
  76. data/config/locales/id-ID.yml +2 -23
  77. data/config/locales/is-IS.yml +0 -8
  78. data/config/locales/it.yml +4 -29
  79. data/config/locales/ja.yml +2 -29
  80. data/config/locales/lv.yml +2 -22
  81. data/config/locales/nl.yml +13 -30
  82. data/config/locales/no.yml +2 -23
  83. data/config/locales/pl.yml +13 -33
  84. data/config/locales/pt-BR.yml +2 -22
  85. data/config/locales/pt.yml +2 -29
  86. data/config/locales/ro-RO.yml +2 -84
  87. data/config/locales/ru.yml +0 -8
  88. data/config/locales/sk.yml +5 -23
  89. data/config/locales/sv.yml +7 -38
  90. data/config/locales/tr-TR.yml +17 -29
  91. data/config/locales/uk.yml +0 -8
  92. data/config/locales/zh-CN.yml +2 -29
  93. data/db/migrate/20200915151348_fix_proposals_data_to_ensure_title_and_body_are_hashes.rb +37 -0
  94. data/{app/types/decidim/proposals → lib/decidim/api}/proposal_input_filter.rb +0 -0
  95. data/{app/types/decidim/proposals → lib/decidim/api}/proposal_input_sort.rb +3 -5
  96. data/lib/decidim/api/proposal_type.rb +56 -0
  97. data/lib/decidim/api/proposals_type.rb +43 -0
  98. data/lib/decidim/content_renderers/proposal_renderer.rb +1 -1
  99. data/lib/decidim/proposals/api.rb +10 -0
  100. data/lib/decidim/proposals/component.rb +30 -19
  101. data/lib/decidim/proposals/engine.rb +6 -27
  102. data/lib/decidim/proposals/proposal_creator.rb +98 -0
  103. data/lib/decidim/proposals/test/factories.rb +22 -8
  104. data/lib/decidim/proposals/version.rb +1 -1
  105. data/lib/decidim/proposals.rb +2 -0
  106. metadata +50 -38
  107. data/app/commands/decidim/proposals/create_proposal_export.rb +0 -37
  108. data/app/helpers/decidim/proposals/proposal_endorsements_helper.rb +0 -0
  109. data/app/queries/decidim/proposals/similar_collaborative_drafts.rb +0 -52
  110. data/app/types/decidim/proposals/proposal_type.rb +0 -70
  111. data/app/types/decidim/proposals/proposals_type.rb +0 -41
  112. data/app/views/decidim/participatory_processes/participatory_process_groups/_highlighted_proposals.html.erb +0 -13
  113. data/app/views/decidim/proposals/collaborative_drafts/compare.html.erb +0 -21
  114. data/app/views/decidim/proposals/collaborative_drafts/complete.html.erb +0 -24
  115. data/app/views/decidim/proposals/proposals/_proposal_preview.html.erb +0 -1
  116. data/db/migrate/20210318082934_fix_counters_for_copied_proposals.rb +0 -16
@@ -1,70 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Decidim
4
- module Proposals
5
- ProposalType = GraphQL::ObjectType.define do
6
- name "Proposal"
7
- description "A proposal"
8
-
9
- interfaces [
10
- -> { Decidim::Comments::CommentableInterface },
11
- -> { Decidim::Core::CoauthorableInterface },
12
- -> { Decidim::Core::CategorizableInterface },
13
- -> { Decidim::Core::ScopableInterface },
14
- -> { Decidim::Core::AttachableInterface },
15
- -> { Decidim::Core::FingerprintInterface },
16
- -> { Decidim::Core::AmendableInterface },
17
- -> { Decidim::Core::AmendableEntityInterface },
18
- -> { Decidim::Core::TraceableInterface },
19
- -> { Decidim::Core::EndorsableInterface },
20
- -> { Decidim::Core::TimestampsInterface }
21
- ]
22
-
23
- field :id, !types.ID
24
- field :title, Decidim::Core::TranslatedFieldType, "The title for this title"
25
- field :body, Decidim::Core::TranslatedFieldType, "The description for this body"
26
- field :address, types.String, "The physical address (location) of this proposal"
27
- field :coordinates, Decidim::Core::CoordinatesType, "Physical coordinates for this proposal" do
28
- resolve ->(proposal, _args, _ctx) {
29
- [proposal.latitude, proposal.longitude]
30
- }
31
- end
32
- field :reference, types.String, "This proposal's unique reference"
33
- field :state, types.String, "The answer status in which proposal is in"
34
- field :answer, Decidim::Core::TranslatedFieldType, "The answer feedback for the status for this proposal"
35
-
36
- field :answeredAt, Decidim::Core::DateTimeType do
37
- description "The date and time this proposal was answered"
38
- property :answered_at
39
- end
40
-
41
- field :publishedAt, Decidim::Core::DateTimeType do
42
- description "The date and time this proposal was published"
43
- property :published_at
44
- end
45
-
46
- field :participatoryTextLevel, types.String do
47
- description "If it is a participatory text, the level indicates the type of paragraph"
48
- property :participatory_text_level
49
- end
50
- field :position, types.Int, "Position of this proposal in the participatory text"
51
-
52
- field :official, types.Boolean, "Whether this proposal is official or not", property: :official?
53
- field :createdInMeeting, types.Boolean, "Whether this proposal comes from a meeting or not", property: :official_meeting?
54
- field :meeting, Decidim::Meetings::MeetingType do
55
- description "If the proposal comes from a meeting, the related meeting"
56
- resolve ->(proposal, _, _) {
57
- proposal.authors.first if proposal.official_meeting?
58
- }
59
- end
60
-
61
- field :voteCount, types.Int do
62
- description "The total amount of votes the proposal has received"
63
- resolve ->(proposal, _args, _ctx) {
64
- current_component = proposal.component
65
- proposal.proposal_votes_count unless current_component.current_settings.votes_hidden?
66
- }
67
- end
68
- end
69
- end
70
- end
@@ -1,41 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Decidim
4
- module Proposals
5
- ProposalsType = GraphQL::ObjectType.define do
6
- interfaces [-> { Decidim::Core::ComponentInterface }]
7
-
8
- name "Proposals"
9
- description "A proposals component of a participatory space."
10
-
11
- connection :proposals,
12
- type: ProposalType.connection_type,
13
- description: "List all proposals",
14
- function: ProposalListHelper.new(model_class: Proposal)
15
-
16
- field :proposal,
17
- type: ProposalType,
18
- description: "Finds one proposal",
19
- function: ProposalFinderHelper.new(model_class: Proposal)
20
- end
21
-
22
- class ProposalListHelper < Decidim::Core::ComponentListBase
23
- argument :order, ProposalInputSort, "Provides several methods to order the results"
24
- argument :filter, ProposalInputFilter, "Provides several methods to filter the results"
25
-
26
- # only querying published posts
27
- def query_scope
28
- super.published
29
- end
30
- end
31
-
32
- class ProposalFinderHelper < Decidim::Core::ComponentFinderBase
33
- argument :id, !types.ID, "The ID of the proposal"
34
-
35
- # only querying published posts
36
- def query_scope
37
- super.published
38
- end
39
- end
40
- end
41
- end
@@ -1,13 +0,0 @@
1
- <% if proposals.any? %>
2
- <section class="section row collapse highlighted_proposals">
3
- <h2 class="section-heading"><%= t(".proposals") %></h2>
4
-
5
- <%= cell(
6
- "decidim/collapsible_list",
7
- proposals,
8
- cell_options: {},
9
- list_class: "row small-up-1 medium-up-2 large-up-3 card-grid",
10
- size: proposals.count
11
- ) %>
12
- </section>
13
- <% end %>
@@ -1,21 +0,0 @@
1
- <% add_decidim_page_title(proposal_wizard_step_title(action_name)) %>
2
-
3
- <div class="row">
4
- <%= render partial: "wizard_aside" %>
5
-
6
- <div class="columns large-6">
7
- <%= render partial: "decidim/proposals/proposals/wizard_header", locals: { callout_step_help_text_class: "warning" } %>
8
-
9
- <% if @similar_collaborative_drafts.presence %>
10
- <div class="row small-up-1 card-grid">
11
- <% @similar_collaborative_drafts.each do |collaborative_draft| %>
12
- <%= card_for collaborative_draft %>
13
- <% end %>
14
- </div>
15
- <% end %>
16
- <div class="row column text-center">
17
- <%= link_to t(".mine_is_different"), complete_collaborative_drafts_path(collaborative_draft: { title: @form.title, body: @form.body }), class: "button small" %>
18
- </div>
19
- </div>
20
- <div class="columns large-3"></div>
21
- </div>
@@ -1,24 +0,0 @@
1
- <% add_decidim_page_title(proposal_wizard_step_title(action_name)) %>
2
-
3
- <div class="row">
4
- <%= render partial: "wizard_aside" %>
5
-
6
- <div class="columns large-6">
7
- <%= render partial: "decidim/proposals/proposals/wizard_header" %>
8
-
9
- <div class="card">
10
- <div class="card__content">
11
- <%= decidim_form_for(@form) do |form| %>
12
- <%= render partial: "edit_form_fields", locals: { form: form } %>
13
-
14
- <div class="actions">
15
- <%= form.submit t(".send"), class: "button expanded mt-s mb-none", data: { disable: true } %>
16
- </div>
17
- <% end %>
18
- </div>
19
- </div>
20
- </div>
21
- <div class="columns large-3"></div>
22
- </div>
23
-
24
- <%= javascript_include_tag "decidim/proposals/add_proposal" %>
@@ -1 +0,0 @@
1
- <%= card_for @proposal, from: @proposal, preview: true %>
@@ -1,16 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- class FixCountersForCopiedProposals < ActiveRecord::Migration[5.2]
4
- def up
5
- copies_ids = Decidim::ResourceLink
6
- .where(
7
- name: "copied_from_component",
8
- from_type: "Decidim::Proposals::Proposal",
9
- to_type: "Decidim::Proposals::Proposal"
10
- ).pluck(:to_id)
11
-
12
- Decidim::Proposals::Proposal.where(id: copies_ids).find_each(&:update_comments_count)
13
- end
14
-
15
- def down; end
16
- end