decidim-proposals 0.23.0 → 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/app/assets/javascripts/decidim/proposals/add_proposal.js.es6 +4 -1
- data/app/assets/stylesheets/decidim/proposals/_proposals.css.scss +1 -0
- data/app/assets/stylesheets/decidim/proposals/proposals/_preview.css.scss +3 -0
- data/app/cells/decidim/proposals/collaborative_draft_link_to_proposal_cell.rb +3 -3
- data/app/cells/decidim/proposals/collaborative_drafts/reported_content/show.erb +3 -0
- data/app/cells/decidim/proposals/collaborative_drafts/reported_content_cell.rb +15 -0
- data/app/cells/decidim/proposals/content_blocks/highlighted_proposals/elements.erb +5 -0
- data/app/cells/decidim/proposals/content_blocks/highlighted_proposals/heading.erb +1 -0
- data/app/cells/decidim/proposals/content_blocks/highlighted_proposals_cell.rb +19 -0
- data/app/cells/decidim/proposals/irreversible_action_modal_cell.rb +1 -1
- data/app/cells/decidim/proposals/proposal_m_cell.rb +23 -2
- data/app/cells/decidim/proposals/reported_content/show.erb +4 -0
- data/app/cells/decidim/proposals/reported_content_cell.rb +13 -0
- data/app/commands/decidim/proposals/admin/update_proposal.rb +2 -0
- data/app/commands/decidim/proposals/hashtags_methods.rb +1 -1
- data/app/controllers/decidim/proposals/admin/proposals_controller.rb +7 -5
- data/app/controllers/decidim/proposals/collaborative_drafts_controller.rb +1 -30
- data/app/controllers/decidim/proposals/proposals_controller.rb +5 -6
- data/app/events/decidim/proposals/publish_proposal_event.rb +1 -1
- data/app/forms/decidim/proposals/access_to_collaborative_draft_form.rb +1 -3
- data/app/forms/decidim/proposals/admin/proposal_base_form.rb +3 -2
- data/app/forms/decidim/proposals/admin/proposal_form.rb +13 -0
- data/app/forms/decidim/proposals/proposal_form.rb +15 -5
- data/app/forms/decidim/proposals/proposal_wizard_create_step_form.rb +1 -9
- data/app/helpers/decidim/proposals/admin/filterable_helper.rb +1 -1
- data/app/helpers/decidim/proposals/admin/proposal_rankings_helper.rb +1 -1
- data/app/helpers/decidim/proposals/admin/proposals_helper.rb +8 -8
- data/app/helpers/decidim/proposals/application_helper.rb +5 -2
- data/app/helpers/decidim/proposals/map_helper.rb +25 -4
- data/app/helpers/decidim/proposals/proposal_wizard_helper.rb +14 -44
- data/app/helpers/decidim/proposals/proposals_helper.rb +3 -6
- data/app/models/decidim/proposals/collaborative_draft.rb +10 -0
- data/app/models/decidim/proposals/proposal.rb +21 -11
- data/app/permissions/decidim/proposals/admin/permissions.rb +2 -2
- data/app/permissions/decidim/proposals/permissions.rb +3 -2
- data/app/presenters/decidim/proposals/admin_log/proposal_presenter.rb +2 -2
- data/app/presenters/decidim/proposals/admin_log/valuation_assignment_presenter.rb +2 -2
- data/app/presenters/decidim/proposals/proposal_presenter.rb +35 -16
- data/app/queries/decidim/proposals/metrics/proposal_followers_metric_measure.rb +4 -4
- data/app/queries/decidim/proposals/metrics/proposal_participants_metric_measure.rb +6 -6
- data/app/services/decidim/proposals/diff_renderer.rb +7 -11
- data/app/services/decidim/proposals/proposal_builder.rb +1 -0
- data/app/validators/proposal_length_validator.rb +4 -2
- data/app/views/decidim/proposals/admin/proposals/_bulk-actions.html.erb +8 -1
- data/app/views/decidim/proposals/admin/proposals/_form.html.erb +8 -2
- data/app/views/decidim/proposals/admin/proposals/_proposal-tr.html.erb +5 -1
- data/app/views/decidim/proposals/admin/proposals_imports/new.html.erb +1 -1
- data/app/views/decidim/proposals/collaborative_drafts/_wizard_aside.html.erb +2 -7
- data/app/views/decidim/proposals/collaborative_drafts/_wizard_header.html.erb +14 -0
- data/app/views/decidim/proposals/collaborative_drafts/edit.html.erb +7 -7
- data/app/views/decidim/proposals/collaborative_drafts/new.html.erb +5 -13
- data/app/views/decidim/proposals/collaborative_drafts/show.html.erb +7 -11
- data/app/views/decidim/proposals/proposals/_dynamic_map_instructions.html.erb +3 -0
- data/app/views/decidim/proposals/proposals/_edit_form_fields.html.erb +2 -2
- data/app/views/decidim/proposals/proposals/_filters.html.erb +34 -32
- data/app/views/decidim/proposals/proposals/_wizard_header.html.erb +21 -11
- data/app/views/decidim/proposals/proposals/edit.html.erb +7 -7
- data/app/views/decidim/proposals/proposals/preview.html.erb +50 -2
- data/app/views/decidim/proposals/proposals/show.html.erb +8 -12
- data/config/locales/ar.yml +2 -22
- data/config/locales/ca.yml +9 -30
- data/config/locales/cs.yml +47 -52
- data/config/locales/de.yml +126 -104
- data/config/locales/el.yml +2 -29
- data/config/locales/en.yml +24 -29
- data/config/locales/es-MX.yml +3 -29
- data/config/locales/es-PY.yml +3 -29
- data/config/locales/es.yml +3 -29
- data/config/locales/eu.yml +4 -22
- data/config/locales/fi-plain.yml +19 -28
- data/config/locales/fi.yml +26 -35
- data/config/locales/fr-CA.yml +20 -29
- data/config/locales/fr.yml +20 -29
- data/config/locales/gl.yml +4 -22
- data/config/locales/hu.yml +2 -22
- data/config/locales/id-ID.yml +2 -22
- data/config/locales/is-IS.yml +0 -5
- data/config/locales/it.yml +4 -29
- data/config/locales/ja.yml +2 -29
- data/config/locales/lv.yml +2 -21
- data/config/locales/nl.yml +28 -43
- data/config/locales/no.yml +4 -24
- data/config/locales/pl.yml +17 -30
- data/config/locales/pt-BR.yml +2 -21
- data/config/locales/pt.yml +2 -29
- data/config/locales/ro-RO.yml +5 -28
- data/config/locales/ru.yml +0 -5
- data/config/locales/si-LK.yml +1 -0
- data/config/locales/sk.yml +5 -22
- data/config/locales/sv.yml +12 -34
- data/config/locales/sw-KE.yml +1 -0
- data/config/locales/tr-TR.yml +383 -231
- data/config/locales/uk.yml +0 -5
- data/config/locales/zh-CN.yml +2 -29
- data/db/migrate/20200708091228_move_proposals_fields_to_i18n.rb +8 -2
- data/db/migrate/20210127115628_fix_answered_proposals_after_copy.rb +14 -0
- data/{app/types/decidim/proposals → lib/decidim/api}/proposal_input_filter.rb +0 -0
- data/{app/types/decidim/proposals → lib/decidim/api}/proposal_input_sort.rb +3 -5
- data/lib/decidim/api/proposal_type.rb +56 -0
- data/lib/decidim/api/proposals_type.rb +43 -0
- data/lib/decidim/content_renderers/proposal_renderer.rb +1 -1
- data/lib/decidim/proposals.rb +2 -0
- data/lib/decidim/proposals/api.rb +10 -0
- data/lib/decidim/proposals/component.rb +30 -19
- data/lib/decidim/proposals/engine.rb +6 -27
- data/lib/decidim/proposals/proposal_creator.rb +98 -0
- data/lib/decidim/proposals/test/factories.rb +22 -8
- data/lib/decidim/proposals/version.rb +1 -1
- metadata +55 -40
- data/app/commands/decidim/proposals/create_proposal_export.rb +0 -37
- data/app/helpers/decidim/proposals/proposal_endorsements_helper.rb +0 -0
- data/app/queries/decidim/proposals/similar_collaborative_drafts.rb +0 -52
- data/app/types/decidim/proposals/proposal_type.rb +0 -70
- data/app/types/decidim/proposals/proposals_type.rb +0 -41
- data/app/views/decidim/participatory_processes/participatory_process_groups/_highlighted_proposals.html.erb +0 -13
- data/app/views/decidim/proposals/collaborative_drafts/compare.html.erb +0 -21
- data/app/views/decidim/proposals/collaborative_drafts/complete.html.erb +0 -24
- data/app/views/decidim/proposals/proposals/_proposal_preview.html.erb +0 -1
@@ -1,37 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Decidim
|
4
|
-
module Proposals
|
5
|
-
# A command with all the business logic when a user creates a new proposal.
|
6
|
-
class CreateProposalExport < Rectify::Command
|
7
|
-
# Public: Initializes the command.
|
8
|
-
#
|
9
|
-
# form - A form object with the params.
|
10
|
-
# current_user - The current user.
|
11
|
-
def initialize(participatory_process)
|
12
|
-
@participatory_process = participatory_process
|
13
|
-
end
|
14
|
-
|
15
|
-
# Executes the command. Broadcasts these events:
|
16
|
-
#
|
17
|
-
# - :ok when everything is valid, together with the proposal.
|
18
|
-
# - :invalid if the proposal wasn't valid and we couldn't proceed.
|
19
|
-
#
|
20
|
-
# Returns nothing.
|
21
|
-
def call
|
22
|
-
return broadcast(:invalid) if participatory_process.invalid?
|
23
|
-
|
24
|
-
create_proposal_export
|
25
|
-
broadcast(:ok, export)
|
26
|
-
end
|
27
|
-
|
28
|
-
private
|
29
|
-
|
30
|
-
attr_reader :participatory_process
|
31
|
-
|
32
|
-
def create_proposal_export
|
33
|
-
ProposalsExporterJob.perform_later(participatory_process)
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
File without changes
|
@@ -1,52 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Decidim
|
4
|
-
module Proposals
|
5
|
-
# Class used to retrieve similar collaborative_drafts.
|
6
|
-
class SimilarCollaborativeDrafts < Rectify::Query
|
7
|
-
include Decidim::TranslationsHelper
|
8
|
-
|
9
|
-
# Syntactic sugar to initialize the class and return the queried objects.
|
10
|
-
#
|
11
|
-
# component - Decidim::CurrentComponent
|
12
|
-
# collaborative_draft - Decidim::Proposals::CollaborativeDraft
|
13
|
-
def self.for(component, collaborative_draft)
|
14
|
-
new(component, collaborative_draft).query
|
15
|
-
end
|
16
|
-
|
17
|
-
# Initializes the class.
|
18
|
-
#
|
19
|
-
# component - Decidim::CurrentComponent
|
20
|
-
# collaborative_draft - Decidim::Proposals::CollaborativeDraft
|
21
|
-
def initialize(component, collaborative_draft)
|
22
|
-
@component = component
|
23
|
-
@collaborative_draft = collaborative_draft
|
24
|
-
end
|
25
|
-
|
26
|
-
# Retrieves similar collaborative_drafts
|
27
|
-
def query
|
28
|
-
Decidim::Proposals::CollaborativeDraft
|
29
|
-
.where(component: @component)
|
30
|
-
.where(
|
31
|
-
"GREATEST(#{title_similarity}, #{body_similarity}) >= ?",
|
32
|
-
@collaborative_draft[:title],
|
33
|
-
@collaborative_draft[:body],
|
34
|
-
Decidim::Proposals.similarity_threshold
|
35
|
-
)
|
36
|
-
.limit(Decidim::Proposals.similarity_limit)
|
37
|
-
end
|
38
|
-
|
39
|
-
private
|
40
|
-
|
41
|
-
attr_reader :collaborative_draft
|
42
|
-
|
43
|
-
def title_similarity
|
44
|
-
"similarity(title, ?)"
|
45
|
-
end
|
46
|
-
|
47
|
-
def body_similarity
|
48
|
-
"similarity(body, ?)"
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
@@ -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 %>
|