decidim-proposals 0.30.2 → 0.31.0.rc1
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.
- checksums.yaml +4 -4
- data/app/cells/decidim/proposals/collaborative_draft_metadata_cell.rb +1 -1
- data/app/cells/decidim/proposals/proposal_g_cell.rb +4 -4
- data/app/cells/decidim/proposals/proposal_l_cell.rb +4 -4
- data/app/cells/decidim/proposals/proposal_metadata_cell.rb +2 -2
- data/app/commands/decidim/proposals/admin/{assign_proposals_to_valuator.rb → assign_proposals_to_evaluator.rb} +16 -16
- data/app/commands/decidim/proposals/admin/create_proposal.rb +1 -2
- data/app/commands/decidim/proposals/admin/create_proposal_note.rb +4 -4
- data/app/commands/decidim/proposals/admin/merge_proposals.rb +60 -13
- data/app/commands/decidim/proposals/admin/notify_proposal_answer.rb +2 -2
- data/app/commands/decidim/proposals/admin/proposal_notes_methods.rb +5 -5
- data/app/commands/decidim/proposals/admin/reply_proposal_note.rb +1 -1
- data/app/commands/decidim/proposals/admin/{unassign_proposals_from_valuator.rb → unassign_proposals_from_evaluator.rb} +7 -7
- data/app/commands/decidim/proposals/admin/update_proposal.rb +1 -2
- data/app/commands/decidim/proposals/create_collaborative_draft.rb +3 -8
- data/app/commands/decidim/proposals/create_proposal.rb +4 -17
- data/app/commands/decidim/proposals/publish_collaborative_draft.rb +2 -2
- data/app/commands/decidim/proposals/publish_proposal.rb +1 -5
- data/app/commands/decidim/proposals/update_collaborative_draft.rb +2 -4
- data/app/commands/decidim/proposals/update_proposal.rb +5 -18
- data/app/controllers/concerns/decidim/proposals/admin/filterable.rb +6 -6
- data/app/controllers/concerns/decidim/proposals/orderable.rb +3 -3
- data/app/controllers/decidim/proposals/admin/evaluation_assignments_controller.rb +55 -0
- data/app/controllers/decidim/proposals/admin/participatory_texts_controller.rb +6 -6
- data/app/controllers/decidim/proposals/admin/proposal_answers_controller.rb +1 -1
- data/app/controllers/decidim/proposals/admin/proposal_states_controller.rb +2 -2
- data/app/controllers/decidim/proposals/admin/proposals_controller.rb +2 -2
- data/app/controllers/decidim/proposals/admin/proposals_imports_controller.rb +1 -1
- data/app/controllers/decidim/proposals/admin/proposals_merges_controller.rb +12 -3
- data/app/controllers/decidim/proposals/collaborative_drafts_controller.rb +2 -3
- data/app/controllers/decidim/proposals/proposals_controller.rb +5 -6
- data/app/events/decidim/proposals/admin/{proposal_assigned_to_valuator_event.rb → proposal_assigned_to_evaluator_event.rb} +1 -1
- data/app/events/decidim/proposals/{endorsing_enabled_event.rb → liking_enabled_event.rb} +1 -1
- data/app/events/decidim/proposals/merged_proposal_event.rb +9 -0
- data/app/events/decidim/proposals/proposal_liked_event.rb +33 -0
- data/app/forms/decidim/proposals/admin/evaluation_assignment_form.rb +38 -0
- data/app/forms/decidim/proposals/admin/proposal_base_form.rb +1 -27
- data/app/forms/decidim/proposals/admin/proposals_fork_form.rb +1 -1
- data/app/forms/decidim/proposals/admin/proposals_merge_form.rb +58 -2
- data/app/forms/decidim/proposals/collaborative_draft_form.rb +1 -5
- data/app/forms/decidim/proposals/proposal_form.rb +0 -29
- data/app/helpers/decidim/proposals/admin/proposal_bulk_actions_helper.rb +8 -8
- data/app/helpers/decidim/proposals/admin/proposal_rankings_helper.rb +6 -6
- data/app/helpers/decidim/proposals/admin/proposals_helper.rb +2 -17
- data/app/helpers/decidim/proposals/application_helper.rb +3 -6
- data/app/jobs/decidim/proposals/settings_change_job.rb +6 -6
- data/app/models/decidim/proposals/collaborative_draft.rb +1 -1
- data/app/models/decidim/proposals/{valuation_assignment.rb → evaluation_assignment.rb} +7 -7
- data/app/models/decidim/proposals/proposal.rb +22 -32
- data/app/packs/entrypoints/decidim_proposals_admin.js +1 -0
- data/app/packs/src/decidim/proposals/add_proposal.js +1 -1
- data/app/packs/src/decidim/proposals/admin/proposals.js +22 -11
- data/app/packs/src/decidim/proposals/admin/proposals_form.js +1 -1
- data/app/packs/src/decidim/proposals/admin/proposals_merge.js +92 -0
- data/app/packs/src/decidim/proposals/choose_proposals.js +1 -1
- data/app/packs/src/decidim/proposals/exit_handler.js +1 -1
- data/app/packs/src/decidim/proposals/utils.js +1 -1
- data/app/packs/stylesheets/decidim/proposals/proposals.scss +29 -1
- data/app/permissions/decidim/proposals/admin/permissions.rb +20 -20
- data/app/presenters/decidim/proposals/admin_log/{valuation_assignment_presenter.rb → evaluation_assignment_presenter.rb} +7 -7
- data/app/presenters/decidim/proposals/admin_log/proposal_presenter.rb +15 -0
- data/app/presenters/decidim/proposals/admin_log/value_types/{valuator_role_user_presenter.rb → evaluator_role_user_presenter.rb} +2 -2
- data/app/presenters/decidim/proposals/admin_log/value_types/proposal_title_body_presenter.rb +1 -1
- data/app/presenters/decidim/proposals/collaborative_draft_presenter.rb +1 -6
- data/app/presenters/decidim/proposals/log/{valuation_assignment_presenter.rb → evaluation_assignment_presenter.rb} +1 -1
- data/app/presenters/decidim/proposals/proposal_presenter.rb +9 -13
- data/app/services/decidim/proposals/diff_renderer.rb +0 -1
- data/app/services/decidim/proposals/proposal_builder.rb +5 -10
- data/app/views/decidim/proposals/admin/participatory_texts/_article-preview.html.erb +1 -1
- data/app/views/decidim/proposals/admin/participatory_texts/index.html.erb +1 -2
- data/app/views/decidim/proposals/admin/proposal_notes/_form.html.erb +1 -1
- data/app/views/decidim/proposals/admin/proposal_notes/_proposal_notes.html.erb +1 -1
- data/app/views/decidim/proposals/admin/proposal_states/index.html.erb +42 -12
- data/app/views/decidim/proposals/admin/proposals/_actions.html.erb +87 -21
- data/app/views/decidim/proposals/admin/proposals/_bulk-actions.html.erb +9 -13
- data/app/views/decidim/proposals/admin/proposals/_form.html.erb +2 -24
- data/app/views/decidim/proposals/admin/proposals/_likes.html.erb +25 -0
- data/app/views/decidim/proposals/admin/proposals/_proposal-tr.html.erb +13 -12
- data/app/views/decidim/proposals/admin/proposals/_proposals-thead.html.erb +1 -1
- data/app/views/decidim/proposals/admin/proposals/bulk_actions/_assign_to_evaluator.html.erb +19 -0
- data/app/views/decidim/proposals/admin/proposals/bulk_actions/_dropdown.html.erb +45 -49
- data/app/views/decidim/proposals/admin/proposals/bulk_actions/{_valuators_picker.html.erb → _evaluators_picker.html.erb} +4 -4
- data/app/views/decidim/proposals/admin/proposals/bulk_actions/_merge.html.erb +7 -14
- data/app/views/decidim/proposals/admin/proposals/bulk_actions/_unassign_from_evaluator.html.erb +19 -0
- data/app/views/decidim/proposals/admin/proposals/index.html.erb +9 -5
- data/app/views/decidim/proposals/admin/proposals/manage_trash.html.erb +2 -1
- data/app/views/decidim/proposals/admin/proposals/show.html.erb +17 -17
- data/app/views/decidim/proposals/admin/proposals_merges/_form.html.erb +49 -0
- data/app/views/decidim/proposals/admin/proposals_merges/new.html.erb +14 -0
- data/app/views/decidim/proposals/collaborative_drafts/_collaborative_actions.html.erb +2 -2
- data/app/views/decidim/proposals/collaborative_drafts/_edit_form_fields.html.erb +1 -21
- data/app/views/decidim/proposals/collaborative_drafts/show.html.erb +1 -1
- data/app/views/decidim/proposals/proposals/_actions.html.erb +2 -2
- data/app/views/decidim/proposals/proposals/_edit_form_fields.html.erb +1 -21
- data/app/views/decidim/proposals/proposals/_proposal_actions.html.erb +4 -4
- data/app/views/decidim/proposals/proposals/_proposal_aside.html.erb +2 -2
- data/app/views/decidim/proposals/proposals/_proposal_voting_rules.html.erb +1 -1
- data/app/views/decidim/proposals/proposals/participatory_texts/_view_index.html.erb +1 -1
- data/app/views/decidim/proposals/proposals/preview.html.erb +1 -1
- data/app/views/decidim/proposals/proposals/show.html.erb +2 -2
- data/config/assets.rb +2 -2
- data/config/locales/ar.yml +0 -65
- data/config/locales/bg.yml +0 -71
- data/config/locales/bs-BA.yml +0 -25
- data/config/locales/ca-IT.yml +64 -72
- data/config/locales/ca.yml +64 -72
- data/config/locales/cs.yml +52 -81
- data/config/locales/de.yml +66 -73
- data/config/locales/el.yml +0 -66
- data/config/locales/en.yml +69 -77
- data/config/locales/es-MX.yml +68 -76
- data/config/locales/es-PY.yml +68 -76
- data/config/locales/es.yml +68 -76
- data/config/locales/eu.yml +66 -74
- data/config/locales/fi-plain.yml +67 -75
- data/config/locales/fi.yml +67 -75
- data/config/locales/fr-CA.yml +49 -74
- data/config/locales/fr.yml +49 -74
- data/config/locales/ga-IE.yml +0 -22
- data/config/locales/gl.yml +0 -47
- data/config/locales/hu.yml +0 -64
- data/config/locales/id-ID.yml +0 -34
- data/config/locales/is-IS.yml +0 -14
- data/config/locales/it.yml +0 -58
- data/config/locales/ja.yml +68 -76
- data/config/locales/lb.yml +0 -3
- data/config/locales/lt.yml +0 -68
- data/config/locales/lv.yml +0 -62
- data/config/locales/nl.yml +0 -63
- data/config/locales/no.yml +0 -42
- data/config/locales/pl.yml +0 -73
- data/config/locales/pt-BR.yml +0 -59
- data/config/locales/pt.yml +0 -60
- data/config/locales/ro-RO.yml +45 -64
- data/config/locales/ru.yml +0 -15
- data/config/locales/sk.yml +0 -60
- data/config/locales/sr-CS.yml +0 -25
- data/config/locales/sv.yml +58 -76
- data/config/locales/tr-TR.yml +0 -58
- data/config/locales/uk.yml +0 -15
- data/config/locales/zh-CN.yml +0 -57
- data/config/locales/zh-TW.yml +0 -65
- data/db/migrate/20240110203500_add_withdrawn_at_field_to_proposals.rb +1 -1
- data/db/migrate/20240110203504_create_default_proposal_states.rb +1 -1
- data/db/migrate/20250121110014_rename_proposal_valuation_assignments_to_evaluation_assignments.rb +15 -0
- data/db/migrate/20250121110904_rename_valuation_assignments_count_to_evaluation_assignments_count.rb +16 -0
- data/db/migrate/20250211141313_rename_valuator_columns.rb +8 -0
- data/db/migrate/20250515132351_rename_proposals_endorsements_count_to_likes.rb +7 -0
- data/decidim-proposals.gemspec +1 -1
- data/lib/decidim/api/mutations/answer_proposal_attributes.rb +17 -0
- data/lib/decidim/api/mutations/proposal_answer_type.rb +57 -0
- data/lib/decidim/api/mutations/proposal_mutation_type.rb +14 -0
- data/lib/decidim/api/mutations/proposals_mutation_type.rb +23 -0
- data/lib/decidim/api/proposal_input_sort.rb +1 -1
- data/lib/decidim/api/proposal_state_type.rb +16 -0
- data/lib/decidim/api/proposal_type.rb +59 -9
- data/lib/decidim/proposals/admin_engine.rb +3 -3
- data/lib/decidim/proposals/admin_filter.rb +3 -3
- data/lib/decidim/proposals/api.rb +5 -0
- data/lib/decidim/proposals/component.rb +44 -24
- data/lib/decidim/proposals/engine.rb +18 -83
- data/lib/decidim/proposals/evaluable.rb +22 -0
- data/lib/decidim/proposals/import/proposal_creator.rb +1 -1
- data/lib/decidim/proposals/proposal_serializer.rb +9 -11
- data/lib/decidim/proposals/seeds.rb +16 -27
- data/lib/decidim/proposals/test/factories.rb +21 -53
- data/lib/decidim/proposals/version.rb +1 -1
- data/lib/decidim/proposals.rb +3 -3
- data/lib/tasks/proposals/upgrade/decidim_proposals_upgrade_tasks.rake +11 -11
- metadata +57 -47
- data/app/commands/decidim/proposals/hashtags_methods.rb +0 -36
- data/app/controllers/decidim/proposals/admin/valuation_assignments_controller.rb +0 -55
- data/app/events/decidim/proposals/proposal_endorsed_event.rb +0 -33
- data/app/forms/decidim/proposals/admin/proposals_file_import_form.rb +0 -31
- data/app/forms/decidim/proposals/admin/valuation_assignment_form.rb +0 -38
- data/app/queries/decidim/proposals/metrics/accepted_proposals_metric_manage.rb +0 -32
- data/app/queries/decidim/proposals/metrics/endorsements_metric_manage.rb +0 -58
- data/app/queries/decidim/proposals/metrics/proposal_followers_metric_measure.rb +0 -58
- data/app/queries/decidim/proposals/metrics/proposal_participants_metric_measure.rb +0 -74
- data/app/queries/decidim/proposals/metrics/proposals_metric_manage.rb +0 -48
- data/app/queries/decidim/proposals/metrics/votes_metric_manage.rb +0 -52
- data/app/views/decidim/proposals/admin/imports/_proposals_fields.html.erb +0 -11
- data/app/views/decidim/proposals/admin/proposals/_endorsers.html.erb +0 -25
- data/app/views/decidim/proposals/admin/proposals/bulk_actions/_assign_to_valuator.html.erb +0 -19
- data/app/views/decidim/proposals/admin/proposals/bulk_actions/_unassign_from_valuator.html.erb +0 -19
- data/lib/decidim/proposals/valuatable.rb +0 -22
@@ -3,7 +3,7 @@
|
|
3
3
|
module Decidim
|
4
4
|
module Proposals
|
5
5
|
module AdminLog
|
6
|
-
# This class holds the logic to present a `Decidim::Proposals::
|
6
|
+
# This class holds the logic to present a `Decidim::Proposals::EvaluationAssignment`
|
7
7
|
# for the `AdminLog` log.
|
8
8
|
#
|
9
9
|
# Usage should be automatic and you should not need to call this class
|
@@ -11,31 +11,31 @@ module Decidim
|
|
11
11
|
#
|
12
12
|
# action_log = Decidim::ActionLog.last
|
13
13
|
# view_helpers # => this comes from the views
|
14
|
-
#
|
15
|
-
class
|
14
|
+
# EvaluationAssignmentPresenter.new(action_log, view_helpers).present
|
15
|
+
class EvaluationAssignmentPresenter < Decidim::Log::BasePresenter
|
16
16
|
private
|
17
17
|
|
18
18
|
def resource_presenter
|
19
|
-
@resource_presenter ||= Decidim::Proposals::Log::
|
19
|
+
@resource_presenter ||= Decidim::Proposals::Log::EvaluationAssignmentPresenter.new(action_log.resource, h, action_log.extra["resource"])
|
20
20
|
end
|
21
21
|
|
22
22
|
def diff_fields_mapping
|
23
23
|
{
|
24
|
-
|
24
|
+
evaluator_role_id: "Decidim::Proposals::AdminLog::ValueTypes::EvaluatorRoleUserPresenter"
|
25
25
|
}
|
26
26
|
end
|
27
27
|
|
28
28
|
def action_string
|
29
29
|
case action
|
30
30
|
when "create", "delete"
|
31
|
-
"decidim.proposals.admin_log.
|
31
|
+
"decidim.proposals.admin_log.evaluation_assignment.#{action}"
|
32
32
|
else
|
33
33
|
super
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
37
37
|
def i18n_labels_scope
|
38
|
-
"activemodel.attributes.
|
38
|
+
"activemodel.attributes.evaluation_assignment.admin_log"
|
39
39
|
end
|
40
40
|
|
41
41
|
def diff_actions
|
@@ -13,8 +13,15 @@ module Decidim
|
|
13
13
|
# view_helpers # => this comes from the views
|
14
14
|
# ProposalPresenter.new(action_log, view_helpers).present
|
15
15
|
class ProposalPresenter < Decidim::Log::BasePresenter
|
16
|
+
def initialize(action_log, view_helpers)
|
17
|
+
super
|
18
|
+
@proposal = action_log.resource if action_log.resource
|
19
|
+
end
|
20
|
+
|
16
21
|
private
|
17
22
|
|
23
|
+
attr_reader :proposal
|
24
|
+
|
18
25
|
def diff_fields_mapping
|
19
26
|
{
|
20
27
|
title: :i18n,
|
@@ -25,6 +32,10 @@ module Decidim
|
|
25
32
|
}
|
26
33
|
end
|
27
34
|
|
35
|
+
def i18n_params
|
36
|
+
super.merge(merged_count:)
|
37
|
+
end
|
38
|
+
|
28
39
|
def action_string
|
29
40
|
case action
|
30
41
|
when "answer", "create", "update", "publish_answer", "soft_delete", "restore"
|
@@ -41,6 +52,10 @@ module Decidim
|
|
41
52
|
def diff_actions
|
42
53
|
super + %w(answer)
|
43
54
|
end
|
55
|
+
|
56
|
+
def merged_count
|
57
|
+
proposal&.linked_resources(:proposals, "merged_from_component")&.count || 0
|
58
|
+
end
|
44
59
|
end
|
45
60
|
end
|
46
61
|
end
|
@@ -4,11 +4,11 @@ module Decidim
|
|
4
4
|
module Proposals
|
5
5
|
module AdminLog
|
6
6
|
module ValueTypes
|
7
|
-
class
|
7
|
+
class EvaluatorRoleUserPresenter < Decidim::Log::ValueTypes::DefaultPresenter
|
8
8
|
def present
|
9
9
|
return unless value
|
10
10
|
|
11
|
-
role = Decidim::Proposals::
|
11
|
+
role = Decidim::Proposals::EvaluationAssignment.find_by(evaluator_role_id: value).evaluator_role
|
12
12
|
user = role.user
|
13
13
|
user.try(:name)
|
14
14
|
end
|
data/app/presenters/decidim/proposals/admin_log/value_types/proposal_title_body_presenter.rb
CHANGED
@@ -11,7 +11,7 @@ module Decidim
|
|
11
11
|
translated_value = h.decidim_escape_translated(value)
|
12
12
|
return if translated_value.blank?
|
13
13
|
|
14
|
-
renderer = Decidim::ContentRenderers::
|
14
|
+
renderer = Decidim::ContentRenderers::BlobRenderer.new(translated_value)
|
15
15
|
renderer.render(links: false).html_safe
|
16
16
|
end
|
17
17
|
end
|
@@ -7,12 +7,7 @@ module Decidim
|
|
7
7
|
#
|
8
8
|
class CollaborativeDraftPresenter < ProposalPresenter
|
9
9
|
def author
|
10
|
-
|
11
|
-
@author ||= if coauthorship.user_group
|
12
|
-
Decidim::UserGroupPresenter.new(coauthorship.user_group)
|
13
|
-
else
|
14
|
-
Decidim::UserPresenter.new(coauthorship.author)
|
15
|
-
end
|
10
|
+
@author ||= Decidim::UserPresenter.new(__getobj__.coauthorships.first.author)
|
16
11
|
end
|
17
12
|
|
18
13
|
alias collaborative_draft proposal
|
@@ -14,8 +14,7 @@ module Decidim
|
|
14
14
|
@author ||= if official?
|
15
15
|
Decidim::Proposals::OfficialAuthorPresenter.new
|
16
16
|
else
|
17
|
-
|
18
|
-
coauthorship.user_group&.presenter || coauthorship.author.presenter
|
17
|
+
coauthorships.includes(:author).first.author.presenter
|
19
18
|
end
|
20
19
|
end
|
21
20
|
|
@@ -33,28 +32,25 @@ module Decidim
|
|
33
32
|
|
34
33
|
# Render the proposal title
|
35
34
|
#
|
36
|
-
# links - should render hashtags as links?
|
37
|
-
# extras - should include extra hashtags?
|
38
|
-
#
|
39
35
|
# Returns a String.
|
40
|
-
def title(
|
36
|
+
def title(html_escape: false, all_locales: false)
|
41
37
|
return unless proposal
|
42
38
|
|
43
|
-
super(proposal.title,
|
39
|
+
super(proposal.title, html_escape, all_locales)
|
44
40
|
end
|
45
41
|
|
46
|
-
def id_and_title(
|
47
|
-
"##{proposal.id} - #{title(
|
42
|
+
def id_and_title(html_escape: false)
|
43
|
+
"##{proposal.id} - #{title(html_escape:)}"
|
48
44
|
end
|
49
45
|
|
50
|
-
def body(links: false,
|
46
|
+
def body(links: false, strip_tags: false, all_locales: false)
|
51
47
|
return unless proposal
|
52
48
|
|
53
|
-
content_handle_locale(proposal.body, all_locales,
|
49
|
+
content_handle_locale(proposal.body, all_locales, links, strip_tags)
|
54
50
|
end
|
55
51
|
|
56
|
-
def editor_body(all_locales: false
|
57
|
-
editor_locales(proposal.body, all_locales
|
52
|
+
def editor_body(all_locales: false)
|
53
|
+
editor_locales(proposal.body, all_locales)
|
58
54
|
end
|
59
55
|
|
60
56
|
# Returns the proposal versions, hiding not published answers
|
@@ -24,7 +24,6 @@ module Decidim
|
|
24
24
|
return parse_i18n_changeset(attribute, values, type, diff) if [:i18n, :i18n_html].include?(type)
|
25
25
|
return parse_scope_changeset(attribute, values, type, diff) if type == :scope
|
26
26
|
return parse_state_changeset(attribute, values, type, diff) if type == :state
|
27
|
-
return parse_user_group_changeset(attribute, values, type, diff) if type == :user_group
|
28
27
|
|
29
28
|
values = parse_values(attribute, values)
|
30
29
|
old_value = values[0]
|
@@ -10,14 +10,13 @@ module Decidim
|
|
10
10
|
#
|
11
11
|
# attributes - The Hash of attributes to create the Proposal with.
|
12
12
|
# author - An Authorable the will be the first coauthor of the Proposal.
|
13
|
-
# user_group_author - A User Group to, optionally, set it as the author too.
|
14
13
|
# action_user - The User to be used as the user who is creating the proposal in the traceability logs.
|
15
14
|
#
|
16
15
|
# Returns a Proposal.
|
17
|
-
def create(attributes:, author:, action_user
|
16
|
+
def create(attributes:, author:, action_user:)
|
18
17
|
Decidim.traceability.perform_action!(:create, Proposal, action_user, visibility: "all") do
|
19
18
|
proposal = Proposal.new(attributes)
|
20
|
-
proposal.add_coauthor(author
|
19
|
+
proposal.add_coauthor(author)
|
21
20
|
proposal.save!
|
22
21
|
proposal
|
23
22
|
end
|
@@ -36,7 +35,7 @@ module Decidim
|
|
36
35
|
Decidim.traceability.perform_action!(:create, Proposal, action_user, visibility: "all") do
|
37
36
|
proposal = Proposal.new(attributes)
|
38
37
|
original_proposal.coauthorships.each do |coauthorship|
|
39
|
-
proposal.add_coauthor(coauthorship.author
|
38
|
+
proposal.add_coauthor(coauthorship.author)
|
40
39
|
end
|
41
40
|
proposal.save!
|
42
41
|
proposal
|
@@ -49,15 +48,13 @@ module Decidim
|
|
49
48
|
#
|
50
49
|
# original_proposal - The Proposal to be used as base to create the new one.
|
51
50
|
# author - An Authorable the will be the first coauthor of the Proposal.
|
52
|
-
# user_group_author - A User Group to, optionally, set it as the author too.
|
53
51
|
# action_user - The User to be used as the user who is creating the proposal in the traceability logs.
|
54
52
|
# extra_attributes - A Hash of attributes to create the new proposal, will overwrite the original ones.
|
55
53
|
# skip_link - Whether to skip linking the two proposals or not (default false).
|
56
54
|
#
|
57
55
|
# Returns a Proposal
|
58
56
|
#
|
59
|
-
|
60
|
-
def copy(original_proposal, author:, action_user:, user_group_author: nil, extra_attributes: {}, skip_link: false)
|
57
|
+
def copy(original_proposal, author:, action_user:, extra_attributes: {}, skip_link: false)
|
61
58
|
origin_attributes = original_proposal.attributes.except(
|
62
59
|
"id",
|
63
60
|
"created_at",
|
@@ -70,7 +67,7 @@ module Decidim
|
|
70
67
|
"decidim_component_id",
|
71
68
|
"reference",
|
72
69
|
"comments_count",
|
73
|
-
"
|
70
|
+
"likes_count",
|
74
71
|
"follows_count",
|
75
72
|
"proposal_notes_count",
|
76
73
|
"proposal_votes_count"
|
@@ -90,7 +87,6 @@ module Decidim
|
|
90
87
|
create(
|
91
88
|
attributes: origin_attributes,
|
92
89
|
author:,
|
93
|
-
user_group_author:,
|
94
90
|
action_user:
|
95
91
|
)
|
96
92
|
end
|
@@ -100,7 +96,6 @@ module Decidim
|
|
100
96
|
|
101
97
|
proposal
|
102
98
|
end
|
103
|
-
# rubocop:enable Metrics/ParameterLists
|
104
99
|
|
105
100
|
module_function :copy
|
106
101
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
<div class="grid-x">
|
2
2
|
<div class="cell">
|
3
3
|
<%= form.hidden_field :position, class: "position" %>
|
4
|
-
<%= form.text_field :title, required: true %>
|
4
|
+
<%= form.text_field :title, required: true, data: { controller: "character-counter" } %>
|
5
5
|
</div>
|
6
6
|
<% if proposal.article? %>
|
7
7
|
<div class="cell">
|
@@ -16,8 +16,7 @@
|
|
16
16
|
<div class="row column">
|
17
17
|
<p class="mt-3"><%= t(".info_1") %></p>
|
18
18
|
<ul id="participatory-text" class="draggable-list js-connect js-list-actives mt-2.5 ml-2.5 mr-2.5"
|
19
|
-
data-
|
20
|
-
data-accordion
|
19
|
+
data-controller="accordion"
|
21
20
|
data-sort-url="#"
|
22
21
|
data-multi-expand="true"
|
23
22
|
data-allow-all-closed="true">
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<%= decidim_form_for(@notes_form, url: form_path, html: { class: "form form-defaults new_proposal_note flex flex-col mt-4" }) do |f| %>
|
2
2
|
<div class="form__wrapper">
|
3
|
-
<%= f.text_area :body, rows: 4, label: t(".note"),
|
3
|
+
<%= f.text_area :body, rows: 4, label: t(".note"), data: { controller: "mention" } %>
|
4
4
|
</div>
|
5
5
|
|
6
6
|
<%= f.submit t(".submit"), class: "button button__sm button__secondary ml-auto" %>
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<div class="component__show_notes" data-
|
1
|
+
<div class="component__show_notes" data-controller="accordion" id="accordion-notes">
|
2
2
|
<button type="button" class="card-divider-button" data-controls="panel-notes">
|
3
3
|
<%= icon "arrow-right-s-line" %>
|
4
4
|
<h2 class="card-title">
|
@@ -6,7 +6,7 @@
|
|
6
6
|
<%= link_to t("actions.new_proposal_state", scope: "decidim.proposals"), new_proposal_state_path, class: "button button__sm button__secondary" if allowed_to? :create, :proposal_state %>
|
7
7
|
</h1>
|
8
8
|
</div>
|
9
|
-
<div class="table-
|
9
|
+
<div class="table-stacked mt-16">
|
10
10
|
<table class="table-list">
|
11
11
|
<thead>
|
12
12
|
<tr>
|
@@ -22,23 +22,53 @@
|
|
22
22
|
<tbody>
|
23
23
|
<% proposal_states.each do |state| %>
|
24
24
|
<tr>
|
25
|
-
<td>
|
25
|
+
<td data-label="<%= t("models.proposal_state.title", scope: "decidim.proposals") %>">
|
26
26
|
<%= translated_attribute(state.title) %>
|
27
27
|
</td>
|
28
|
-
<td>
|
28
|
+
<td data-label="<%= t("models.proposal_state.css_class", scope: "decidim.proposals") %>">
|
29
29
|
<strong class="label" style="<%= state.css_style %>">
|
30
30
|
<%= decidim_sanitize_translated(state.token) %>
|
31
31
|
</strong>
|
32
32
|
</td>
|
33
|
-
<td>
|
34
|
-
|
35
|
-
<%=
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
33
|
+
<td data-label="<%= t("actions.title", scope: "decidim.proposals") %>" class="table-list__actions">
|
34
|
+
<button type="button" data-controller="dropdown" data-target="actions-proposal-state-<%= state.id %>" aria-label="<%= t("decidim.admin.actions.actions_label", resource: translated_attribute(state.title)) %>">
|
35
|
+
<%= icon "more-fill", class: "text-secondary" %>
|
36
|
+
</button>
|
37
|
+
|
38
|
+
<div class="inline-block relative">
|
39
|
+
<ul id="actions-proposal-state-<%= state.id %>" class="dropdown dropdown__action" aria-hidden="true">
|
40
|
+
<% if allowed_to? :update, :proposal_state, proposal_state: state %>
|
41
|
+
<li class="dropdown__item">
|
42
|
+
<%= link_to edit_proposal_state_path(state), class: "dropdown__button" do %>
|
43
|
+
<%= icon "pencil-line" %>
|
44
|
+
<%= t("actions.edit_proposal_state", scope: "decidim.proposals") %>
|
45
|
+
<% end %>
|
46
|
+
</li>
|
47
|
+
<% end %>
|
48
|
+
|
49
|
+
<hr>
|
50
|
+
|
51
|
+
<% if allowed_to? :destroy, :proposal_state, proposal_state: state %>
|
52
|
+
<li class="dropdown__item">
|
53
|
+
<%= link_to proposal_state_path(state), method: :delete, data: { confirm: t("actions.delete_proposal_state_confirm", scope: "decidim.proposals") }, class: "dropdown__button" do %>
|
54
|
+
<%= icon "delete-bin-line" %>
|
55
|
+
<%= t("actions.destroy", scope: "decidim.proposals") %>
|
56
|
+
<% end %>
|
57
|
+
</li>
|
58
|
+
<% else %>
|
59
|
+
<li class="dropdown__item">
|
60
|
+
<div class="dropdown__button-disabled">
|
61
|
+
<%= with_tooltip t("tooltips.deleted_proposal_states_info", scope: "decidim.admin") do %>
|
62
|
+
<%= icon "pencil-line", class: "text-gray" %>
|
63
|
+
<span>
|
64
|
+
<%= t("actions.edit_proposal", scope: "decidim.proposals") %>
|
65
|
+
</span>
|
66
|
+
<% end %>
|
67
|
+
</div>
|
68
|
+
</li>
|
69
|
+
<% end %>
|
70
|
+
</ul>
|
71
|
+
</div>
|
42
72
|
</td>
|
43
73
|
</tr>
|
44
74
|
<% end %>
|
@@ -1,21 +1,87 @@
|
|
1
|
-
|
2
|
-
<%=
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
1
|
+
<button type="button" data-controller="dropdown" data-target="actions-proposal-<%= proposal.id %>" aria-label="<%= t("decidim.admin.actions.actions_label", resource: proposal.title) %>">
|
2
|
+
<%= icon "more-fill", class: "text-secondary" %>
|
3
|
+
</button>
|
4
|
+
|
5
|
+
<div class="inline-block relative">
|
6
|
+
<ul id="actions-proposal-<%= proposal.id %>" class="dropdown dropdown__action" aria-hidden="true">
|
7
|
+
<% if view == :deleted %>
|
8
|
+
<li class="dropdown__item">
|
9
|
+
<%= link_to restore_proposal_path(proposal), method: :patch, class: "dropdown__button" do %>
|
10
|
+
<%= icon "refresh-line" %>
|
11
|
+
<%= t("actions.restore", scope: "decidim.admin") %>
|
12
|
+
<% end %>
|
13
|
+
</li>
|
14
|
+
<% else %>
|
15
|
+
<% if allowed_to? :edit, :proposal, proposal: proposal %>
|
16
|
+
<li class="dropdown__item">
|
17
|
+
<%= link_to edit_proposal_path(proposal), class: "dropdown__button" do %>
|
18
|
+
<%= icon "pencil-line" %>
|
19
|
+
<%= t("actions.edit_proposal", scope: "decidim.proposals") %>
|
20
|
+
<% end %>
|
21
|
+
</li>
|
22
|
+
<% else %>
|
23
|
+
<li class="dropdown__item">
|
24
|
+
<div class="dropdown__button-disabled">
|
25
|
+
<%= with_tooltip t("tooltips.cannot_edit_proposal_info", scope: "decidim.admin") do %>
|
26
|
+
<%= icon "pencil-line", class: "text-gray" %>
|
27
|
+
<span>
|
28
|
+
<%= t("actions.edit_proposal", scope: "decidim.proposals") %>
|
29
|
+
</span>
|
30
|
+
<% end %>
|
31
|
+
</div>
|
32
|
+
</li>
|
33
|
+
<% end %>
|
34
|
+
|
35
|
+
<hr>
|
36
|
+
|
37
|
+
<li class="dropdown__item">
|
38
|
+
<%= link_to resource_locator(proposal).path, target: :blank, data: { "external-link": false }, class: "dropdown__button" do %>
|
39
|
+
<%= icon "eye-line" %>
|
40
|
+
<%= t("actions.preview", scope: "decidim.proposals.admin") %>
|
41
|
+
<% end %>
|
42
|
+
</li>
|
43
|
+
|
44
|
+
<hr>
|
45
|
+
|
46
|
+
<li class="dropdown__item">
|
47
|
+
<% if allowed_to?(:create, :proposal_answer, proposal:) && !proposal.emendation? %>
|
48
|
+
<%= link_to proposal_path(proposal), class: "dropdown__button" do %>
|
49
|
+
<%= icon "question-answer-line" %>
|
50
|
+
<%= t("actions.answer_proposal", scope: "decidim.proposals") %>
|
51
|
+
<% end %>
|
52
|
+
<% else %>
|
53
|
+
<%= link_to proposal_path(proposal), class: "dropdown__button" do %>
|
54
|
+
<%= icon "information-line" %>
|
55
|
+
<%= t("actions.show", scope: "decidim.proposals") %>
|
56
|
+
<% end %>
|
57
|
+
<% end %>
|
58
|
+
</li>
|
59
|
+
|
60
|
+
<hr>
|
61
|
+
|
62
|
+
<li class="dropdown__item">
|
63
|
+
<%= dropdown_resource_permissions_link(proposal) %>
|
64
|
+
</li>
|
65
|
+
|
66
|
+
<hr>
|
67
|
+
|
68
|
+
<li class="dropdown__item">
|
69
|
+
<% if allowed_to?(:soft_delete, :proposal, trashable_deleted_resource: proposal) %>
|
70
|
+
<%= link_to soft_delete_proposal_path(proposal), method: :patch, data: { confirm: t("actions.confirm_delete_proposal", scope: "decidim.proposals.admin") }, class: "dropdown__button" do %>
|
71
|
+
<%= icon "delete-bin-line" %>
|
72
|
+
<%= t("actions.soft_delete", scope: "decidim.admin") %>
|
73
|
+
<% end %>
|
74
|
+
<% else %>
|
75
|
+
<div class="dropdown__button-disabled">
|
76
|
+
<%= with_tooltip t("tooltips.deleted_proposals_info", scope: "decidim.admin") do %>
|
77
|
+
<%= icon "pencil-line", class: "text-gray" %>
|
78
|
+
<span>
|
79
|
+
<%= t("actions.edit_proposal", scope: "decidim.proposals") %>
|
80
|
+
</span>
|
81
|
+
<% end %>
|
82
|
+
</div>
|
83
|
+
<% end %>
|
84
|
+
</li>
|
85
|
+
<% end %>
|
86
|
+
</ul>
|
87
|
+
</div>
|
@@ -10,24 +10,20 @@
|
|
10
10
|
|
11
11
|
<% if allowed_to? :import, :proposals %>
|
12
12
|
<%= import_dropdown do %>
|
13
|
-
|
14
|
-
|
13
|
+
<li class="dropdown__item">
|
14
|
+
<%= link_to new_proposals_import_path, class: "dropdown__button" do %>
|
15
15
|
<%= t("actions.import", scope: "decidim.proposals", name: t("models.proposal.name", scope: "decidim.proposals.admin")) %>
|
16
|
-
</li>
|
17
|
-
<% current_component.manifest.import_manifests.each do |import_manifest| %>
|
18
|
-
<%= link_to admin_imports_path(current_component, name: import_manifest.name) do %>
|
19
|
-
<li class="imports--file imports--<%= import_manifest.name %>">
|
20
|
-
<%= import_manifest.message(:label, self) %>
|
21
|
-
</li>
|
22
|
-
<% end %>
|
23
16
|
<% end %>
|
17
|
+
</li>
|
18
|
+
<% current_component.manifest.import_manifests.each do |import_manifest| %>
|
19
|
+
<li class="dropdown__item">
|
20
|
+
<%= link_to admin_imports_path(current_component, name: import_manifest.name), class: "dropdown__button" do %>
|
21
|
+
<%= import_manifest.message(:label, self) %>
|
22
|
+
<% end %>
|
23
|
+
</li>
|
24
24
|
<% end %>
|
25
25
|
<% end %>
|
26
26
|
<% end %>
|
27
|
-
|
28
|
-
<% if allowed_to? :create, :proposal %>
|
29
|
-
<%= link_to t("actions.new", scope: "decidim.proposals"), new_proposal_path, class: "button button__sm button__secondary" %>
|
30
|
-
<% end %>
|
31
27
|
</div>
|
32
28
|
|
33
29
|
<%= render partial: "decidim/proposals/admin/proposals/bulk_actions/merge" %>
|
@@ -2,33 +2,11 @@
|
|
2
2
|
<div class="card pt-4">
|
3
3
|
<div class="card-section">
|
4
4
|
<div class="row column pb-4">
|
5
|
-
<%= form.translated :text_field, :title, autofocus: true,
|
5
|
+
<%= form.translated :text_field, :title, autofocus: true, aria: { label: :title }, data: { controller: "character-counter" } %>
|
6
6
|
</div>
|
7
7
|
<div class="row column">
|
8
|
-
<%= form.translated :editor, :body,
|
8
|
+
<%= form.translated :editor, :body, resource_mentionable: true, aria: { label: :body } %>
|
9
9
|
</div>
|
10
|
-
<% if @form.component_automatic_hashtags.any? %>
|
11
|
-
<div>
|
12
|
-
<%= form.label :automatic_hashtags %>
|
13
|
-
<div class="hashtags">
|
14
|
-
<% @form.component_automatic_hashtags.each do |hashtag| %>
|
15
|
-
<label>
|
16
|
-
<%= check_box_tag "", "", { checked: true }, { disabled: true } %>#<%= hashtag %>
|
17
|
-
</label>
|
18
|
-
<% end %>
|
19
|
-
</div>
|
20
|
-
</div>
|
21
|
-
<% end %>
|
22
|
-
<% if @form.component_suggested_hashtags.any? %>
|
23
|
-
<div class="row column">
|
24
|
-
<%= form.label :suggested_hashtags %>
|
25
|
-
<div class="hashtags">
|
26
|
-
<%= form.collection_check_boxes :suggested_hashtags, @form.component_suggested_hashtags.map { |hashtag| [hashtag.downcase, "##{hashtag}"] }, :first, :last do |option|
|
27
|
-
option.label { option.check_box(checked: @form.suggested_hashtag_checked?(option.value)) + option.text }
|
28
|
-
end %>
|
29
|
-
</div>
|
30
|
-
</div>
|
31
|
-
<% end %>
|
32
10
|
<% if @form.meetings %>
|
33
11
|
<div class="meeting-fields">
|
34
12
|
<div class="row column">
|
@@ -0,0 +1,25 @@
|
|
1
|
+
<div class="card-section">
|
2
|
+
<div class="row column">
|
3
|
+
<span class="component__show-title"><%= t "likes", scope: "decidim.proposals.admin.proposals.show" %></span>
|
4
|
+
<ul id="proposal-likes-list">
|
5
|
+
<% presented_likes.first(5).each do |presented_liker| %>
|
6
|
+
<li>
|
7
|
+
<%= link_to_if(
|
8
|
+
presented_liker.profile_path.present?,
|
9
|
+
presented_liker.name,
|
10
|
+
presented_liker.profile_path,
|
11
|
+
target: :blank
|
12
|
+
) %>
|
13
|
+
</li>
|
14
|
+
<% end %>
|
15
|
+
<% if presented_likes.count > 5 %>
|
16
|
+
<li>
|
17
|
+
<%= link_to(
|
18
|
+
t("n_more_likes", scope: "decidim.proposals.admin.proposals.show", count: presented_likes.count - 5),
|
19
|
+
resource_locator(proposal).path
|
20
|
+
) %>
|
21
|
+
</li>
|
22
|
+
<% end %>
|
23
|
+
</ul>
|
24
|
+
</div>
|
25
|
+
</div>
|