decidim-proposals 0.15.2 → 0.16.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +12 -0
- data/app/assets/config/decidim_proposals_manifest.js +1 -0
- data/app/assets/javascripts/decidim/proposals/add_proposal.js.es6 +1 -1
- data/app/assets/javascripts/decidim/proposals/admin/proposals_form.js.es6 +23 -0
- data/app/cells/decidim/proposals/collaborative_draft_cell.rb +0 -2
- data/app/cells/decidim/proposals/collaborative_draft_m_cell.rb +5 -1
- data/app/cells/decidim/proposals/highlighted_proposals/show.erb +3 -0
- data/app/cells/decidim/proposals/highlighted_proposals_cell.rb +25 -0
- data/app/cells/decidim/proposals/highlighted_proposals_for_component/show.erb +19 -0
- data/app/cells/decidim/proposals/highlighted_proposals_for_component_cell.rb +34 -0
- data/app/cells/decidim/proposals/participatory_text_proposal/buttons.erb +33 -0
- data/app/cells/decidim/proposals/participatory_text_proposal/show.erb +9 -0
- data/app/cells/decidim/proposals/participatory_text_proposal_cell.rb +77 -0
- data/app/cells/decidim/proposals/proposal_cell.rb +0 -2
- data/app/cells/decidim/proposals/proposal_m/footer.erb +1 -1
- data/app/cells/decidim/proposals/proposal_m_cell.rb +6 -1
- data/app/commands/decidim/proposals/accept_access_to_collaborative_draft.rb +3 -3
- data/app/commands/decidim/proposals/admin/answer_proposal.rb +2 -1
- data/app/commands/decidim/proposals/admin/create_proposal.rb +7 -7
- data/app/commands/decidim/proposals/admin/import_participatory_text.rb +8 -8
- data/app/commands/decidim/proposals/admin/update_proposal.rb +13 -6
- data/app/commands/decidim/proposals/admin/update_proposal_category.rb +1 -1
- data/app/commands/decidim/proposals/create_collaborative_draft.rb +6 -3
- data/app/commands/decidim/proposals/create_proposal.rb +25 -11
- data/app/commands/decidim/proposals/endorse_proposal.rb +1 -2
- data/app/commands/decidim/proposals/hashtags_methods.rb +36 -0
- data/app/commands/decidim/proposals/publish_collaborative_draft.rb +39 -34
- data/app/commands/decidim/proposals/publish_proposal.rb +13 -17
- data/app/commands/decidim/proposals/reject_access_to_collaborative_draft.rb +2 -3
- data/app/commands/decidim/proposals/request_access_to_collaborative_draft.rb +1 -2
- data/app/commands/decidim/proposals/update_collaborative_draft.rb +11 -8
- data/app/commands/decidim/proposals/update_proposal.rb +37 -13
- data/app/commands/decidim/proposals/withdraw_collaborative_draft.rb +3 -3
- data/app/commands/decidim/proposals/withdraw_proposal.rb +14 -1
- data/app/controllers/decidim/proposals/admin/participatory_texts_controller.rb +2 -1
- data/app/controllers/decidim/proposals/admin/proposals_controller.rb +9 -1
- data/app/controllers/decidim/proposals/collaborative_drafts_controller.rb +8 -0
- data/app/controllers/decidim/proposals/proposals_controller.rb +64 -27
- data/app/controllers/decidim/proposals/versions_controller.rb +5 -1
- data/app/events/decidim/proposals/accepted_proposal_event.rb +8 -0
- data/app/events/decidim/proposals/evaluating_proposal_event.rb +3 -0
- data/app/events/decidim/proposals/proposal_endorsed_event.rb +4 -0
- data/app/events/decidim/proposals/publish_proposal_event.rb +4 -0
- data/app/events/decidim/proposals/rejected_proposal_event.rb +8 -0
- data/app/forms/decidim/proposals/admin/import_participatory_text_form.rb +4 -0
- data/app/forms/decidim/proposals/admin/proposal_form.rb +49 -0
- data/app/forms/decidim/proposals/collaborative_draft_form.rb +2 -0
- data/app/forms/decidim/proposals/proposal_form.rb +32 -0
- data/app/helpers/decidim/proposals/admin/proposals_helper.rb +19 -0
- data/app/helpers/decidim/proposals/application_helper.rb +48 -12
- data/app/helpers/decidim/proposals/control_version_helper.rb +61 -0
- data/app/helpers/decidim/proposals/participatory_texts_helper.rb +8 -0
- data/app/helpers/decidim/proposals/proposal_cells_helper.rb +7 -1
- data/app/helpers/decidim/proposals/proposal_endorsements_helper.rb +8 -6
- data/app/jobs/decidim/proposals/notify_proposals_mentioned_job.rb +2 -2
- data/app/jobs/decidim/proposals/settings_change_job.rb +8 -6
- data/app/models/decidim/proposals/collaborative_draft.rb +3 -0
- data/app/models/decidim/proposals/proposal.rb +20 -8
- data/app/permissions/decidim/proposals/admin/permissions.rb +1 -1
- data/app/presenters/decidim/proposals/admin_log/value_types/proposal_title_body_presenter.rb +2 -1
- data/app/presenters/decidim/proposals/collaborative_draft_presenter.rb +15 -2
- data/app/presenters/decidim/proposals/official_author_presenter.rb +4 -0
- data/app/presenters/decidim/proposals/proposal_presenter.rb +10 -14
- data/app/queries/decidim/proposals/metrics/endorsements_metric_manage.rb +54 -0
- data/app/queries/decidim/proposals/metrics/proposal_followers_metric_measure.rb +56 -0
- data/app/queries/decidim/proposals/metrics/proposal_participants_metric_measure.rb +64 -0
- data/app/services/decidim/proposals/proposal_search.rb +46 -5
- data/app/views/decidim/participatory_processes/participatory_process_groups/_highlighted_proposals.html.erb +1 -1
- data/app/views/decidim/proposals/admin/proposals/_form.html.erb +43 -2
- data/app/views/decidim/proposals/admin/proposals/_proposal-tr.html.erb +6 -2
- data/app/views/decidim/proposals/admin/proposals/edit.html.erb +1 -1
- data/app/views/decidim/proposals/admin/proposals/new.html.erb +1 -1
- data/app/views/decidim/proposals/collaborative_drafts/_edit_form_fields.html.erb +81 -0
- data/app/views/decidim/proposals/collaborative_drafts/complete.html.erb +1 -49
- data/app/views/decidim/proposals/collaborative_drafts/edit.html.erb +1 -29
- data/app/views/decidim/proposals/collaborative_drafts/show.html.erb +5 -5
- data/app/views/decidim/proposals/proposals/_edit_form_fields.html.erb +27 -3
- data/app/views/decidim/proposals/proposals/_filters.html.erb +5 -2
- data/app/views/decidim/proposals/proposals/_proposal.html.erb +5 -1
- data/app/views/decidim/proposals/proposals/_proposal_similar.html.erb +2 -2
- data/app/views/decidim/proposals/proposals/_vote_button.html.erb +39 -35
- data/app/views/decidim/proposals/proposals/_votes_count.html.erb +16 -12
- data/app/views/decidim/proposals/proposals/new.html.erb +1 -1
- data/app/views/decidim/proposals/proposals/participatory_texts/_index.html.erb +19 -0
- data/app/views/decidim/proposals/proposals/participatory_texts/_proposal_vote_button.html.erb +46 -0
- data/app/views/decidim/proposals/proposals/participatory_texts/_proposal_votes_count.html.erb +41 -0
- data/app/views/decidim/proposals/proposals/participatory_texts/_view_index.html.erb +10 -0
- data/app/views/decidim/proposals/proposals/participatory_texts/participatory_text.html.erb +15 -0
- data/app/views/decidim/proposals/proposals/show.html.erb +45 -4
- data/app/views/decidim/proposals/versions/_version.html.erb +2 -2
- data/app/views/decidim/proposals/versions/index.html.erb +1 -1
- data/app/views/decidim/proposals/versions/show.html.erb +2 -2
- data/config/locales/ca.yml +87 -33
- data/config/locales/de.yml +87 -36
- data/config/locales/en.yml +87 -33
- data/config/locales/es-PY.yml +87 -33
- data/config/locales/es.yml +88 -34
- data/config/locales/eu.yml +87 -33
- data/config/locales/fi-pl.yml +87 -33
- data/config/locales/fi.yml +87 -33
- data/config/locales/fr.yml +87 -33
- data/config/locales/gl.yml +87 -33
- data/config/locales/hu.yml +87 -33
- data/config/locales/id-ID.yml +84 -30
- data/config/locales/it.yml +87 -33
- data/config/locales/nl.yml +87 -33
- data/config/locales/pl.yml +87 -33
- data/config/locales/pt-BR.yml +87 -33
- data/config/locales/pt.yml +87 -33
- data/config/locales/ru.yml +21 -38
- data/config/locales/sv.yml +87 -33
- data/config/locales/tr-TR.yml +86 -32
- data/config/locales/uk.yml +21 -38
- data/db/migrate/20181026073215_add_created_in_meeting.rb +7 -0
- data/lib/decidim/proposals.rb +2 -0
- data/lib/decidim/proposals/component.rb +74 -0
- data/lib/decidim/proposals/doc_to_markdown.rb +40 -0
- data/lib/decidim/proposals/engine.rb +52 -35
- data/lib/decidim/proposals/odt_to_markdown.rb +46 -0
- data/lib/decidim/proposals/proposal_serializer.rb +29 -13
- data/lib/decidim/proposals/test/factories.rb +76 -0
- data/lib/decidim/proposals/version.rb +1 -1
- metadata +56 -20
- data/app/views/decidim/participatory_spaces/_highlighted_proposals.html.erb +0 -15
@@ -18,9 +18,22 @@ module Decidim
|
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
21
|
+
def collaborative_draft
|
22
|
+
__getobj__
|
23
|
+
end
|
24
|
+
|
21
25
|
def collaborative_draft_path
|
22
|
-
|
23
|
-
|
26
|
+
Decidim::ResourceLocatorPresenter.new(collaborative_draft).path
|
27
|
+
end
|
28
|
+
|
29
|
+
def title(links: false, extras: true)
|
30
|
+
renderer = Decidim::ContentRenderers::HashtagRenderer.new(collaborative_draft.title)
|
31
|
+
renderer.render(links: links, extras: extras).html_safe
|
32
|
+
end
|
33
|
+
|
34
|
+
def body(links: false, extras: true)
|
35
|
+
renderer = Decidim::ContentRenderers::HashtagRenderer.new(collaborative_draft.body)
|
36
|
+
renderer.render(links: links, extras: extras).html_safe
|
24
37
|
end
|
25
38
|
end
|
26
39
|
end
|
@@ -34,24 +34,20 @@ module Decidim
|
|
34
34
|
link_to title, proposal_path
|
35
35
|
end
|
36
36
|
|
37
|
-
|
37
|
+
# Render the proposal title
|
38
|
+
#
|
39
|
+
# links - should render hashtags as links?
|
40
|
+
# extras - should include extra hashtags?
|
41
|
+
#
|
42
|
+
# Returns a String.
|
43
|
+
def title(links: false, extras: true)
|
38
44
|
renderer = Decidim::ContentRenderers::HashtagRenderer.new(proposal.title)
|
39
|
-
renderer.
|
45
|
+
renderer.render(links: links, extras: extras).html_safe
|
40
46
|
end
|
41
47
|
|
42
|
-
def
|
43
|
-
renderer = Decidim::ContentRenderers::HashtagRenderer.new(proposal.title)
|
44
|
-
renderer.render.html_safe
|
45
|
-
end
|
46
|
-
|
47
|
-
def body
|
48
|
-
renderer = Decidim::ContentRenderers::HashtagRenderer.new(proposal.body)
|
49
|
-
renderer.render_without_link.html_safe
|
50
|
-
end
|
51
|
-
|
52
|
-
def html_body
|
48
|
+
def body(links: false, extras: true)
|
53
49
|
renderer = Decidim::ContentRenderers::HashtagRenderer.new(proposal.body)
|
54
|
-
renderer.render.html_safe
|
50
|
+
renderer.render(links: links, extras: extras).html_safe
|
55
51
|
end
|
56
52
|
end
|
57
53
|
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Proposals
|
5
|
+
module Metrics
|
6
|
+
class EndorsementsMetricManage < Decidim::MetricManage
|
7
|
+
def metric_name
|
8
|
+
"endorsements"
|
9
|
+
end
|
10
|
+
|
11
|
+
def save
|
12
|
+
return @registry if @registry
|
13
|
+
|
14
|
+
@registry = []
|
15
|
+
cumulative.each do |key, cumulative_value|
|
16
|
+
next if cumulative_value.zero?
|
17
|
+
quantity_value = quantity[key] || 0
|
18
|
+
category_id, space_type, space_id, proposal_id = key
|
19
|
+
record = Decidim::Metric.find_or_initialize_by(day: @day.to_s, metric_type: @metric_name,
|
20
|
+
organization: @organization, decidim_category_id: category_id,
|
21
|
+
participatory_space_type: space_type, participatory_space_id: space_id,
|
22
|
+
related_object_type: "Decidim::Proposals::Proposal", related_object_id: proposal_id)
|
23
|
+
record.assign_attributes(cumulative: cumulative_value, quantity: quantity_value)
|
24
|
+
@registry << record
|
25
|
+
end
|
26
|
+
@registry.each(&:save!)
|
27
|
+
@registry
|
28
|
+
end
|
29
|
+
|
30
|
+
private
|
31
|
+
|
32
|
+
def query
|
33
|
+
return @query if @query
|
34
|
+
|
35
|
+
components = Decidim::Component.where(participatory_space: retrieve_participatory_spaces).published
|
36
|
+
proposals = Decidim::Proposals::Proposal.where(component: components).except_withdrawn
|
37
|
+
@query = Decidim::Proposals::ProposalEndorsement.joins(proposal: :component)
|
38
|
+
.left_outer_joins(proposal: :category)
|
39
|
+
.where(proposal: proposals)
|
40
|
+
@query = @query.where("decidim_proposals_proposal_endorsements.created_at <= ?", end_time)
|
41
|
+
@query = @query.group("decidim_categorizations.id",
|
42
|
+
:participatory_space_type,
|
43
|
+
:participatory_space_id,
|
44
|
+
:decidim_proposal_id)
|
45
|
+
@query
|
46
|
+
end
|
47
|
+
|
48
|
+
def quantity
|
49
|
+
@quantity ||= query.where("decidim_proposals_proposal_endorsements.created_at >= ?", start_time).count
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Proposals
|
5
|
+
module Metrics
|
6
|
+
# Searches for unique Users following the next objects
|
7
|
+
# - Proposals
|
8
|
+
# - CollaborativeDrafts
|
9
|
+
class ProposalFollowersMetricMeasure < Decidim::MetricMeasure
|
10
|
+
def valid?
|
11
|
+
super && @resource.is_a?(Decidim::Component)
|
12
|
+
end
|
13
|
+
|
14
|
+
def calculate
|
15
|
+
cumulative_users = []
|
16
|
+
cumulative_users |= retrieve_proposals_followers.pluck(:decidim_user_id)
|
17
|
+
cumulative_users |= retrieve_drafts_followers.pluck(:decidim_user_id)
|
18
|
+
|
19
|
+
quantity_users = []
|
20
|
+
quantity_users |= retrieve_proposals_followers(true).pluck(:decidim_user_id)
|
21
|
+
quantity_users |= retrieve_drafts_followers(true).pluck(:decidim_user_id)
|
22
|
+
|
23
|
+
{
|
24
|
+
cumulative_users: cumulative_users.uniq,
|
25
|
+
quantity_users: quantity_users.uniq
|
26
|
+
}
|
27
|
+
end
|
28
|
+
|
29
|
+
private
|
30
|
+
|
31
|
+
def retrieve_proposals_followers(from_start = false)
|
32
|
+
@proposals_followers ||= Decidim::Follow.where(followable: retrieve_proposals).joins(:user)
|
33
|
+
.where("decidim_follows.created_at <= ?", end_time)
|
34
|
+
|
35
|
+
return @proposals_followers.where("decidim_follows.created_at >= ?", start_time) if from_start
|
36
|
+
@proposals_followers
|
37
|
+
end
|
38
|
+
|
39
|
+
def retrieve_drafts_followers(from_start = false)
|
40
|
+
@drafts_followers ||= Decidim::Follow.where(followable: retrieve_collaborative_drafts).joins(:user)
|
41
|
+
.where("decidim_follows.created_at <= ?", end_time)
|
42
|
+
return @drafts_followers.where("decidim_follows.created_at >= ?", start_time) if from_start
|
43
|
+
@drafts_followers
|
44
|
+
end
|
45
|
+
|
46
|
+
def retrieve_proposals
|
47
|
+
Decidim::Proposals::Proposal.where(component: @resource).except_withdrawn
|
48
|
+
end
|
49
|
+
|
50
|
+
def retrieve_collaborative_drafts
|
51
|
+
Decidim::Proposals::CollaborativeDraft.where(component: @resource).except_withdrawn
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Proposals
|
5
|
+
module Metrics
|
6
|
+
# Searches for Participants in the following actions
|
7
|
+
# - Create a proposal (Proposals)
|
8
|
+
# - Give support to a proposal (Proposals)
|
9
|
+
# - Endorse (Proposals)
|
10
|
+
class ProposalParticipantsMetricMeasure < Decidim::MetricMeasure
|
11
|
+
def valid?
|
12
|
+
super && @resource.is_a?(Decidim::Component)
|
13
|
+
end
|
14
|
+
|
15
|
+
def calculate
|
16
|
+
cumulative_users = []
|
17
|
+
cumulative_users |= retrieve_votes.pluck(:decidim_author_id)
|
18
|
+
cumulative_users |= retrieve_endorsements.pluck(:decidim_author_id)
|
19
|
+
cumulative_users |= retrieve_proposals.pluck("decidim_coauthorships.decidim_author_id") # To avoid ambiguosity must be called this way
|
20
|
+
|
21
|
+
quantity_users = []
|
22
|
+
quantity_users |= retrieve_votes(true).pluck(:decidim_author_id)
|
23
|
+
quantity_users |= retrieve_endorsements(true).pluck(:decidim_author_id)
|
24
|
+
quantity_users |= retrieve_proposals(true).pluck("decidim_coauthorships.decidim_author_id") # To avoid ambiguosity must be called this way
|
25
|
+
|
26
|
+
{
|
27
|
+
cumulative_users: cumulative_users.uniq,
|
28
|
+
quantity_users: quantity_users.uniq
|
29
|
+
}
|
30
|
+
end
|
31
|
+
|
32
|
+
private
|
33
|
+
|
34
|
+
def retrieve_proposals(from_start = false)
|
35
|
+
@proposals ||= Decidim::Proposals::Proposal.where(component: @resource).joins(:coauthorships)
|
36
|
+
.includes(:votes, :endorsements)
|
37
|
+
.where(decidim_coauthorships: { decidim_author_type: "Decidim::UserBaseEntity" })
|
38
|
+
.where("decidim_proposals_proposals.published_at <= ?", end_time)
|
39
|
+
.except_withdrawn
|
40
|
+
|
41
|
+
return @proposals.where("decidim_proposals_proposals.published_at >= ?", start_time) if from_start
|
42
|
+
@proposals
|
43
|
+
end
|
44
|
+
|
45
|
+
def retrieve_votes(from_start = false)
|
46
|
+
@votes ||= Decidim::Proposals::ProposalVote.joins(:proposal).where(proposal: retrieve_proposals).joins(:author)
|
47
|
+
.where("decidim_proposals_proposal_votes.created_at <= ?", end_time)
|
48
|
+
|
49
|
+
return @votes.where("decidim_proposals_proposal_votes.created_at >= ?", start_time) if from_start
|
50
|
+
@votes
|
51
|
+
end
|
52
|
+
|
53
|
+
def retrieve_endorsements(from_start = false)
|
54
|
+
@endorsements ||= Decidim::Proposals::ProposalEndorsement.joins(:proposal).where(proposal: retrieve_proposals)
|
55
|
+
.where("decidim_proposals_proposal_endorsements.created_at <= ?", end_time)
|
56
|
+
.where(decidim_author_type: "Decidim::UserBaseEntity")
|
57
|
+
|
58
|
+
return @endorsements.where("decidim_proposals_proposal_endorsements.created_at >= ?", start_time) if from_start
|
59
|
+
@endorsements
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
@@ -21,12 +21,29 @@ module Decidim
|
|
21
21
|
end
|
22
22
|
|
23
23
|
# Handle the origin filter
|
24
|
-
# The 'official' proposals doesn't have an author id
|
25
24
|
def search_origin
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
25
|
+
case origin
|
26
|
+
when "official"
|
27
|
+
query
|
28
|
+
.where.not(coauthorships_count: 0)
|
29
|
+
.joins(:coauthorships)
|
30
|
+
.where(decidim_coauthorships: { decidim_author_type: "Decidim::Organization" })
|
31
|
+
when "citizens"
|
32
|
+
query
|
33
|
+
.where.not(coauthorships_count: 0)
|
34
|
+
.joins(:coauthorships)
|
35
|
+
.where.not(decidim_coauthorships: { decidim_author_type: "Decidim::Organization" })
|
36
|
+
when "user_group"
|
37
|
+
query
|
38
|
+
.where.not(coauthorships_count: 0)
|
39
|
+
.joins(:coauthorships)
|
40
|
+
.where(decidim_coauthorships: { decidim_author_type: "Decidim::UserBaseEntity" })
|
41
|
+
.where.not(decidim_coauthorships: { decidim_user_group_id: nil })
|
42
|
+
when "meeting"
|
43
|
+
query
|
44
|
+
.where.not(coauthorships_count: 0)
|
45
|
+
.joins(:coauthorships)
|
46
|
+
.where(decidim_coauthorships: { decidim_author_type: "Decidim::Meetings::Meeting" })
|
30
47
|
else # Assume 'all'
|
31
48
|
query
|
32
49
|
end
|
@@ -63,6 +80,18 @@ module Decidim
|
|
63
80
|
end
|
64
81
|
end
|
65
82
|
|
83
|
+
# Handle the amendment type filter
|
84
|
+
def search_type
|
85
|
+
case type
|
86
|
+
when "proposals"
|
87
|
+
query.where.not(id: query.joins(:amendable).pluck(:id))
|
88
|
+
when "amendments"
|
89
|
+
query.where(id: query.joins(:amendable).pluck(:id))
|
90
|
+
else
|
91
|
+
query
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
66
95
|
# Filters Proposals by the name of the classes they are linked to. By default,
|
67
96
|
# returns all Proposals. When a `related_to` param is given, then it camelcases item
|
68
97
|
# to find the real class name and checks the links for the Proposals.
|
@@ -85,6 +114,18 @@ module Decidim
|
|
85
114
|
|
86
115
|
query.where(id: from).or(query.where(id: to))
|
87
116
|
end
|
117
|
+
|
118
|
+
# We overwrite the `results` method to ensure we only return unique
|
119
|
+
# results. We can't use `#uniq` because it returns an Array and we're
|
120
|
+
# adding scopes in the controller, and `#distinct` doesn't work here
|
121
|
+
# because in the later scopes we're ordering by `RANDOM()` in a DB level,
|
122
|
+
# and `SELECT DISTINCT` doesn't work with `RANDOM()` sorting, so we need
|
123
|
+
# to perform two queries.
|
124
|
+
#
|
125
|
+
# The correct behaviour is backed by tests.
|
126
|
+
def results
|
127
|
+
Proposal.where(id: super.pluck(:id))
|
128
|
+
end
|
88
129
|
end
|
89
130
|
end
|
90
131
|
end
|
@@ -5,13 +5,52 @@
|
|
5
5
|
|
6
6
|
<div class="card-section">
|
7
7
|
<div class="row column hashtags__container">
|
8
|
-
<%= form.text_field :title, class: "js-hashtags", hashtaggable: true %>
|
8
|
+
<%= form.text_field :title, class: "js-hashtags", hashtaggable: true, value: form_presenter.title(extras: false).strip %>
|
9
9
|
</div>
|
10
10
|
|
11
11
|
<div class="row column hashtags__container">
|
12
|
-
<%= form.text_area :body, rows: 10, class: "js-hashtags", hashtaggable: true %>
|
12
|
+
<%= form.text_area :body, rows: 10, class: "js-hashtags", hashtaggable: true, value: form_presenter.body(extras: false).strip %>
|
13
13
|
</div>
|
14
14
|
|
15
|
+
<% if @form.component_automatic_hashtags.any? %>
|
16
|
+
<div class="field">
|
17
|
+
<%= form.label :automatic_hashtags %>
|
18
|
+
<div class="checkboxes hashtags">
|
19
|
+
<% @form.component_automatic_hashtags.each do |hashtag| %>
|
20
|
+
<label>
|
21
|
+
<%= check_box_tag "", "", { checked: true }, { disabled: true } %>#<%= hashtag %>
|
22
|
+
</label>
|
23
|
+
<% end %>
|
24
|
+
</div>
|
25
|
+
</div>
|
26
|
+
<% end %>
|
27
|
+
|
28
|
+
<% if @form.component_suggested_hashtags.any? %>
|
29
|
+
<div class="field">
|
30
|
+
<%= form.label :suggested_hashtags %>
|
31
|
+
<div class="checkboxes hashtags">
|
32
|
+
<%= form.collection_check_boxes :suggested_hashtags, @form.component_suggested_hashtags.map {|hashtag| [hashtag.downcase, "##{hashtag}"]}, :first, :last do |option|
|
33
|
+
option.label { option.check_box(checked: @form.suggested_hashtag_checked?(option.value)) + option.text }
|
34
|
+
end %>
|
35
|
+
</div>
|
36
|
+
</div>
|
37
|
+
<% end %>
|
38
|
+
|
39
|
+
<% if @form.meetings %>
|
40
|
+
<div class="meeting-fields">
|
41
|
+
<div class="row column">
|
42
|
+
<%= form.check_box :created_in_meeting, label: t(".created_in_meeting") %>
|
43
|
+
</div>
|
44
|
+
|
45
|
+
<div class="row column" id="proposal_meeting">
|
46
|
+
<%= form.select :meeting_id,
|
47
|
+
options_for_select(@form.meetings&.map { |meeting| [present(meeting).title, meeting.id] }, selected: meetings_as_authors_selected ),
|
48
|
+
{ include_blank: true, label: t(".select_a_meeting") },
|
49
|
+
{ multiple: false, class: "chosen-select" } %>
|
50
|
+
</div>
|
51
|
+
</div>
|
52
|
+
<% end %>
|
53
|
+
|
15
54
|
<% if component_settings.geocoding_enabled? %>
|
16
55
|
<div class="row column">
|
17
56
|
<%= form.text_field :address %>
|
@@ -48,3 +87,5 @@
|
|
48
87
|
<% end %>
|
49
88
|
</div>
|
50
89
|
</div>
|
90
|
+
|
91
|
+
<%= javascript_include_tag "decidim/proposals/admin/proposals_form" %>
|
@@ -23,7 +23,9 @@
|
|
23
23
|
</td>
|
24
24
|
<% end %>
|
25
25
|
<td>
|
26
|
+
<%= t("decidim/amendment", scope: "activerecord.models", count: 1) if proposal.emendation? %>
|
26
27
|
<strong class="<%= proposal_state_css_class proposal.state %>">
|
28
|
+
<%= t("decidim/amendment", scope: "activerecord.models", count: 1) if proposal.emendation? %>
|
27
29
|
<%= humanize_proposal_state proposal.state %>
|
28
30
|
</strong>
|
29
31
|
</td>
|
@@ -59,8 +61,10 @@
|
|
59
61
|
<%= icon_link_to "chat", proposal_proposal_notes_path(proposal_id: proposal.id), t("actions.private_notes", scope: "decidim.proposals"), class: "action-icon--index-notes" %>
|
60
62
|
<% end %>
|
61
63
|
|
62
|
-
<% if allowed_to? :create, :proposal_answer %>
|
63
|
-
|
64
|
+
<% if allowed_to? :create, :proposal_answer and !proposal.emendation? %>
|
65
|
+
<%= icon_link_to "comment-square", edit_proposal_proposal_answer_path(proposal_id: proposal.id, id: proposal.id), t("actions.answer", scope: "decidim.proposals"), class: " icon--small" %>
|
66
|
+
<% else %>
|
67
|
+
<%= icon "comment-square", scope: "decidim.proposals.admin", class: "action-icon action-icon--disabled" %>
|
64
68
|
<% end %>
|
65
69
|
|
66
70
|
<%= resource_permissions_link(proposal) %>
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<%= decidim_form_for(@form, html: { class: "form edit_proposal" }) do |f| %>
|
1
|
+
<%= decidim_form_for(@form, html: { class: "form edit_proposal proposal_form_admin" }) do |f| %>
|
2
2
|
<%= render partial: "form", object: f, locals: { title: t(".title") } %>
|
3
3
|
|
4
4
|
<div class="button--double form-general-submit">
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<%= decidim_form_for(@form, html: { class: "form new_proposal" }) do |f| %>
|
1
|
+
<%= decidim_form_for(@form, html: { class: "form new_proposal proposal_form_admin" }) do |f| %>
|
2
2
|
<%= render partial: "form", object: f, locals: { title: t(".title") } %>
|
3
3
|
|
4
4
|
<div class="button--double form-general-submit">
|
@@ -0,0 +1,81 @@
|
|
1
|
+
<div class="field hashtags__container">
|
2
|
+
<%= form.text_field :title, class: "js-hashtags", hashtaggable: true, value: form_presenter.title %>
|
3
|
+
</div>
|
4
|
+
|
5
|
+
<div class="field hashtags__container">
|
6
|
+
<%= form.text_area :body, rows: 10, class: "js-hashtags", hashtaggable: true, value: form_presenter.body(extras: false).strip %>
|
7
|
+
</div>
|
8
|
+
|
9
|
+
<% if @form.component_automatic_hashtags.any? %>
|
10
|
+
<div class="field">
|
11
|
+
<%= form.label :automatic_hashtags %>
|
12
|
+
<div class="checkboxes hashtags">
|
13
|
+
<% @form.component_automatic_hashtags.each do |hashtag| %>
|
14
|
+
<label>
|
15
|
+
<%= check_box_tag "", "", { checked: true }, { disabled: true } %>#<%= hashtag %>
|
16
|
+
</label>
|
17
|
+
<% end %>
|
18
|
+
</div>
|
19
|
+
</div>
|
20
|
+
<% end %>
|
21
|
+
|
22
|
+
<% if @form.component_suggested_hashtags.any? %>
|
23
|
+
<div class="field">
|
24
|
+
<%= form.label :suggested_hashtags %>
|
25
|
+
<div class="checkboxes 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
|
+
|
33
|
+
<% if component_settings.geocoding_enabled? %>
|
34
|
+
<div class="field">
|
35
|
+
<%= form.check_box :has_address, checked: form_has_address? %>
|
36
|
+
</div>
|
37
|
+
|
38
|
+
<div class="field" id="address_input">
|
39
|
+
<%= form.text_field :address %>
|
40
|
+
</div>
|
41
|
+
<% end %>
|
42
|
+
|
43
|
+
<% if @form.categories&.any? %>
|
44
|
+
<div class="field">
|
45
|
+
<%= form.categories_select :category_id, @form.categories, prompt: t("decidim.proposals.collaborative_drafts.edit.select_a_category") %>
|
46
|
+
</div>
|
47
|
+
<% end %>
|
48
|
+
|
49
|
+
<% if current_participatory_space.has_subscopes? %>
|
50
|
+
<div class="field">
|
51
|
+
<%= scopes_picker_field form, :scope_id %>
|
52
|
+
</div>
|
53
|
+
<% end %>
|
54
|
+
|
55
|
+
<% if current_organization.user_groups_enabled? && Decidim::UserGroups::ManageableUserGroups.for(current_user).verified.any? %>
|
56
|
+
<div class="field">
|
57
|
+
<%= user_group_select_field form, :user_group_id %>
|
58
|
+
</div>
|
59
|
+
<% end %>
|
60
|
+
|
61
|
+
<% if component_settings.attachments_allowed? %>
|
62
|
+
<fieldset>
|
63
|
+
<legend><%= t("attachment_legend", scope: "decidim.proposals.collaborative_drafts.edit") %></legend>
|
64
|
+
<%= form.fields_for :attachment, @form.attachment do |nested_form| %>
|
65
|
+
<div class="field">
|
66
|
+
<%= nested_form.text_field :title %>
|
67
|
+
</div>
|
68
|
+
|
69
|
+
<div class="field">
|
70
|
+
<%= nested_form.upload :file, optional: false %>
|
71
|
+
<% if @form.errors[:attachment].present? %>
|
72
|
+
<% @form.errors[:attachment].each do |message| %>
|
73
|
+
<small class="form-error is-visible">
|
74
|
+
<%= message %>
|
75
|
+
</small>
|
76
|
+
<% end %>
|
77
|
+
<% end %>
|
78
|
+
</div>
|
79
|
+
<% end %>
|
80
|
+
</fieldset>
|
81
|
+
<% end %>
|