decidim-proposals 0.18.1 → 0.19.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (98) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/config/decidim_proposals_manifest.js +0 -1
  3. data/app/assets/javascripts/decidim/proposals/admin/proposals_form.js.es6 +5 -0
  4. data/app/cells/decidim/proposals/collaborative_draft_m_cell.rb +1 -0
  5. data/app/cells/decidim/proposals/endorsers_list_cell.rb +1 -0
  6. data/app/cells/decidim/proposals/irreversible_action_modal_cell.rb +1 -0
  7. data/app/cells/decidim/proposals/participatory_text_proposal/buttons.erb +8 -8
  8. data/app/cells/decidim/proposals/participatory_text_proposal_cell.rb +13 -0
  9. data/app/cells/decidim/proposals/proposal_link_to_collaborative_draft_cell.rb +4 -8
  10. data/app/cells/decidim/proposals/{proposal_link_to_collaborative_draft → proposal_link_to_rejected_emendation}/show.erb +0 -0
  11. data/app/cells/decidim/proposals/proposal_link_to_rejected_emendation_cell.rb +34 -0
  12. data/app/cells/decidim/proposals/proposal_linked_resources/show.erb +9 -0
  13. data/app/cells/decidim/proposals/proposal_linked_resources_cell.rb +14 -0
  14. data/app/cells/decidim/proposals/proposal_m_cell.rb +3 -0
  15. data/app/commands/decidim/proposals/admin/create_proposal.rb +10 -33
  16. data/app/commands/decidim/proposals/admin/import_participatory_text.rb +2 -0
  17. data/app/commands/decidim/proposals/admin/merge_proposals.rb +1 -0
  18. data/app/commands/decidim/proposals/admin/publish_participatory_text.rb +24 -1
  19. data/app/commands/decidim/proposals/admin/update_participatory_text.rb +11 -7
  20. data/app/commands/decidim/proposals/admin/update_proposal.rb +9 -1
  21. data/app/commands/decidim/proposals/gallery_methods.rb +67 -0
  22. data/app/commands/decidim/proposals/unvote_proposal.rb +1 -0
  23. data/app/commands/decidim/proposals/update_proposal.rb +6 -1
  24. data/app/commands/decidim/proposals/vote_proposal.rb +1 -0
  25. data/app/controllers/concerns/decidim/proposals/collaborative_orderable.rb +1 -15
  26. data/app/controllers/concerns/decidim/proposals/orderable.rb +1 -15
  27. data/app/controllers/decidim/proposals/admin/participatory_texts_controller.rb +5 -0
  28. data/app/controllers/decidim/proposals/application_controller.rb +1 -0
  29. data/app/controllers/decidim/proposals/collaborative_drafts_controller.rb +1 -0
  30. data/app/controllers/decidim/proposals/proposal_endorsements_controller.rb +1 -1
  31. data/app/controllers/decidim/proposals/proposal_votes_controller.rb +1 -1
  32. data/app/controllers/decidim/proposals/proposals_controller.rb +22 -23
  33. data/app/forms/decidim/proposals/admin/proposal_form.rb +3 -0
  34. data/app/forms/decidim/proposals/admin/proposals_fork_form.rb +1 -0
  35. data/app/forms/decidim/proposals/proposal_wizard_create_step_form.rb +1 -0
  36. data/app/helpers/decidim/proposals/admin/proposals_helper.rb +1 -0
  37. data/app/helpers/decidim/proposals/map_helper.rb +1 -1
  38. data/app/helpers/decidim/proposals/proposal_cells_helper.rb +2 -0
  39. data/app/helpers/decidim/proposals/proposal_endorsements_helper.rb +1 -0
  40. data/app/helpers/decidim/proposals/proposal_votes_helper.rb +5 -0
  41. data/app/helpers/decidim/proposals/proposal_wizard_helper.rb +1 -0
  42. data/app/models/decidim/proposals/collaborative_draft.rb +1 -0
  43. data/app/models/decidim/proposals/proposal.rb +4 -8
  44. data/app/models/decidim/proposals/proposal_endorsement.rb +2 -0
  45. data/app/models/decidim/proposals/proposal_vote.rb +2 -0
  46. data/app/permissions/decidim/proposals/admin/permissions.rb +1 -0
  47. data/app/permissions/decidim/proposals/permissions.rb +17 -0
  48. data/app/presenters/decidim/proposals/admin_log/value_types/proposal_state_presenter.rb +1 -0
  49. data/app/presenters/decidim/proposals/collaborative_draft_presenter.rb +1 -1
  50. data/app/presenters/decidim/proposals/proposal_presenter.rb +4 -2
  51. data/app/queries/decidim/proposals/metrics/endorsements_metric_manage.rb +1 -0
  52. data/app/queries/decidim/proposals/metrics/proposal_followers_metric_measure.rb +2 -0
  53. data/app/queries/decidim/proposals/metrics/proposal_participants_metric_measure.rb +3 -0
  54. data/app/queries/decidim/proposals/metrics/proposals_metric_manage.rb +1 -0
  55. data/app/queries/decidim/proposals/metrics/votes_metric_manage.rb +1 -0
  56. data/app/services/decidim/proposals/diff_renderer.rb +43 -0
  57. data/app/services/decidim/proposals/proposal_builder.rb +23 -0
  58. data/app/services/decidim/proposals/proposal_search.rb +5 -3
  59. data/app/views/decidim/proposals/admin/proposals/_form.html.erb +24 -0
  60. data/app/views/decidim/proposals/admin/proposals/_proposal-tr.html.erb +3 -3
  61. data/app/views/decidim/proposals/collaborative_drafts/_collaborative_drafts.html.erb +1 -1
  62. data/app/views/decidim/proposals/collaborative_drafts/show.html.erb +0 -3
  63. data/app/views/decidim/proposals/proposal_endorsements/_identity.html.erb +1 -1
  64. data/app/views/decidim/proposals/proposals/_filters.html.erb +2 -1
  65. data/app/views/decidim/proposals/proposals/_proposal_preview.html.erb +1 -1
  66. data/app/views/decidim/proposals/proposals/_proposals.html.erb +1 -1
  67. data/app/views/decidim/proposals/proposals/index.html.erb +1 -1
  68. data/app/views/decidim/proposals/proposals/participatory_texts/_index.html.erb +1 -1
  69. data/app/views/decidim/proposals/proposals/show.html.erb +13 -9
  70. data/config/locales/ar.yml +2 -0
  71. data/config/locales/ca.yml +20 -0
  72. data/config/locales/cs.yml +20 -0
  73. data/config/locales/de.yml +2 -0
  74. data/config/locales/en.yml +20 -0
  75. data/config/locales/es-MX.yml +18 -0
  76. data/config/locales/es-PY.yml +18 -0
  77. data/config/locales/es.yml +20 -0
  78. data/config/locales/fi-plain.yml +20 -0
  79. data/config/locales/fi.yml +20 -0
  80. data/config/locales/fr.yml +21 -1
  81. data/config/locales/hu.yml +20 -0
  82. data/config/locales/it.yml +16 -0
  83. data/config/locales/nl.yml +20 -0
  84. data/config/locales/sv.yml +15 -0
  85. data/config/locales/tr-TR.yml +7 -0
  86. data/lib/decidim/content_parsers/proposal_parser.rb +2 -2
  87. data/lib/decidim/content_renderers/proposal_renderer.rb +1 -1
  88. data/lib/decidim/proposals/commentable_proposal.rb +1 -0
  89. data/lib/decidim/proposals/component.rb +8 -3
  90. data/lib/decidim/proposals/engine.rb +0 -1
  91. data/lib/decidim/proposals/markdown_to_proposals.rb +11 -7
  92. data/lib/decidim/proposals/proposal_serializer.rb +20 -2
  93. data/lib/decidim/proposals/version.rb +1 -1
  94. metadata +24 -38
  95. data/app/assets/config/decidim_proposals_manifest.css +0 -3
  96. data/app/assets/javascripts/decidim/proposals/social_share.js +0 -2
  97. data/app/assets/stylesheets/decidim/proposals/social_share.css.scss +0 -22
  98. data/config/initializers/social_share_button.rb +0 -5
@@ -35,6 +35,8 @@ module Decidim
35
35
  can_endorse_proposal?
36
36
  when :unendorse
37
37
  can_unendorse_proposal?
38
+ when :amend
39
+ can_create_amendment?
38
40
  when :vote
39
41
  can_vote_proposal?
40
42
  when :unvote
@@ -50,11 +52,13 @@ module Decidim
50
52
 
51
53
  def voting_enabled?
52
54
  return unless current_settings
55
+
53
56
  current_settings.votes_enabled? && !current_settings.votes_blocked?
54
57
  end
55
58
 
56
59
  def vote_limit_enabled?
57
60
  return unless component_settings
61
+
58
62
  component_settings.vote_limit.present? && component_settings.vote_limit.positive?
59
63
  end
60
64
 
@@ -95,6 +99,14 @@ module Decidim
95
99
  toggle_allow(is_allowed)
96
100
  end
97
101
 
102
+ def can_create_amendment?
103
+ is_allowed = proposal &&
104
+ authorized?(:amend, resource: proposal) &&
105
+ current_settings&.amendments_enabled?
106
+
107
+ toggle_allow(is_allowed)
108
+ end
109
+
98
110
  def can_vote_proposal?
99
111
  is_allowed = proposal &&
100
112
  authorized?(:vote, resource: proposal) &&
@@ -137,28 +149,33 @@ module Decidim
137
149
 
138
150
  def can_create_collaborative_draft?
139
151
  return toggle_allow(false) unless collaborative_drafts_enabled?
152
+
140
153
  toggle_allow(current_settings&.creation_enabled? && authorized?(:create))
141
154
  end
142
155
 
143
156
  def can_edit_collaborative_draft?
144
157
  return toggle_allow(false) unless collaborative_drafts_enabled? && collaborative_draft.open?
158
+
145
159
  toggle_allow(collaborative_draft.editable_by?(user))
146
160
  end
147
161
 
148
162
  def can_publish_collaborative_draft?
149
163
  return toggle_allow(false) unless collaborative_drafts_enabled? && collaborative_draft.open?
164
+
150
165
  toggle_allow(collaborative_draft.created_by?(user))
151
166
  end
152
167
 
153
168
  def can_request_access_collaborative_draft?
154
169
  return toggle_allow(false) unless collaborative_drafts_enabled? && collaborative_draft.open?
155
170
  return toggle_allow(false) if collaborative_draft.requesters.include?(user)
171
+
156
172
  toggle_allow(!collaborative_draft.editable_by?(user))
157
173
  end
158
174
 
159
175
  def can_react_to_request_access_collaborative_draft?
160
176
  return toggle_allow(false) unless collaborative_drafts_enabled? && collaborative_draft.open?
161
177
  return toggle_allow(false) if collaborative_draft.requesters.include? user
178
+
162
179
  toggle_allow(collaborative_draft.created_by?(user))
163
180
  end
164
181
  end
@@ -7,6 +7,7 @@ module Decidim
7
7
  class ProposalStatePresenter < Decidim::Log::ValueTypes::DefaultPresenter
8
8
  def present
9
9
  return unless value
10
+
10
11
  h.t(value, scope: "decidim.proposals.admin.proposal_answers.edit", default: value)
11
12
  end
12
13
  end
@@ -43,7 +43,7 @@ module Decidim
43
43
  renderer = Decidim::ContentRenderers::HashtagRenderer.new(text)
44
44
  text = renderer.render(links: links, extras: extras).html_safe
45
45
 
46
- text = Anchored::Linker.auto_link(text, target: "_blank", rel: "noopener") if links
46
+ text = Decidim::ContentRenderers::LinkRenderer.new(text).render if links
47
47
  text
48
48
  end
49
49
  end
@@ -18,8 +18,10 @@ module Decidim
18
18
  coauthorship = coauthorships.first
19
19
  if coauthorship.user_group
20
20
  Decidim::UserGroupPresenter.new(coauthorship.user_group)
21
- else
21
+ elsif coauthorship.author.is_a?(Decidim::User)
22
22
  Decidim::UserPresenter.new(coauthorship.author)
23
+ elsif coauthorship.author.is_a?(Decidim::Meeting)
24
+ Decidim::MeetingPresenter.new(coauthorship.author)
23
25
  end
24
26
  end
25
27
  end
@@ -57,7 +59,7 @@ module Decidim
57
59
  renderer = Decidim::ContentRenderers::HashtagRenderer.new(text)
58
60
  text = renderer.render(links: links, extras: extras).html_safe
59
61
 
60
- text = Anchored::Linker.auto_link(text, target: "_blank", rel: "noopener") if links
62
+ text = Decidim::ContentRenderers::LinkRenderer.new(text).render if links
61
63
  text
62
64
  end
63
65
  end
@@ -14,6 +14,7 @@ module Decidim
14
14
  @registry = []
15
15
  cumulative.each do |key, cumulative_value|
16
16
  next if cumulative_value.zero?
17
+
17
18
  quantity_value = quantity[key] || 0
18
19
  category_id, space_type, space_id, proposal_id = key
19
20
  record = Decidim::Metric.find_or_initialize_by(day: @day.to_s, metric_type: @metric_name,
@@ -33,6 +33,7 @@ module Decidim
33
33
  .where("decidim_follows.created_at <= ?", end_time)
34
34
 
35
35
  return @proposals_followers.where("decidim_follows.created_at >= ?", start_time) if from_start
36
+
36
37
  @proposals_followers
37
38
  end
38
39
 
@@ -40,6 +41,7 @@ module Decidim
40
41
  @drafts_followers ||= Decidim::Follow.where(followable: retrieve_collaborative_drafts).joins(:user)
41
42
  .where("decidim_follows.created_at <= ?", end_time)
42
43
  return @drafts_followers.where("decidim_follows.created_at >= ?", start_time) if from_start
44
+
43
45
  @drafts_followers
44
46
  end
45
47
 
@@ -45,6 +45,7 @@ module Decidim
45
45
  .except_withdrawn
46
46
 
47
47
  return @proposals.where("decidim_proposals_proposals.published_at >= ?", start_time) if from_start
48
+
48
49
  @proposals
49
50
  end
50
51
 
@@ -53,6 +54,7 @@ module Decidim
53
54
  .where("decidim_proposals_proposal_votes.created_at <= ?", end_time)
54
55
 
55
56
  return @votes.where("decidim_proposals_proposal_votes.created_at >= ?", start_time) if from_start
57
+
56
58
  @votes
57
59
  end
58
60
 
@@ -62,6 +64,7 @@ module Decidim
62
64
  .where(decidim_author_type: "Decidim::UserBaseEntity")
63
65
 
64
66
  return @endorsements.where("decidim_proposals_proposal_endorsements.created_at >= ?", start_time) if from_start
67
+
65
68
  @endorsements
66
69
  end
67
70
  end
@@ -14,6 +14,7 @@ module Decidim
14
14
  @registry = []
15
15
  cumulative.each do |key, cumulative_value|
16
16
  next if cumulative_value.zero?
17
+
17
18
  quantity_value = quantity[key] || 0
18
19
  category_id, space_type, space_id = key
19
20
  record = Decidim::Metric.find_or_initialize_by(day: @day.to_s, metric_type: @metric_name,
@@ -14,6 +14,7 @@ module Decidim
14
14
  @registry = []
15
15
  cumulative.each do |key, cumulative_value|
16
16
  next if cumulative_value.zero?
17
+
17
18
  quantity_value = quantity[key] || 0
18
19
  category_id, space_type, space_id, proposal_id = key
19
20
  record = Decidim::Metric.find_or_initialize_by(day: @day.to_s, metric_type: @metric_name,
@@ -18,6 +18,49 @@ module Decidim
18
18
  state: :string
19
19
  }
20
20
  end
21
+
22
+ # Parses the values before parsing the changeset.
23
+ def parse_changeset(attribute, values, type, diff)
24
+ values = parse_values(attribute, values)
25
+
26
+ diff.update(
27
+ attribute => {
28
+ type: type,
29
+ label: I18n.t(attribute, scope: i18n_scope),
30
+ old_value: values[0],
31
+ new_value: values[1]
32
+ }
33
+ )
34
+ end
35
+
36
+ # Handles which values to use when diffing emendations and
37
+ # normalizes line endings of the :body attribute values.
38
+ # Returns and Array of two Strings.
39
+ def parse_values(attribute, values)
40
+ values = [amended_previous_value(attribute), values[1]] if proposal&.emendation?
41
+ values = values.map { |value| normalize_line_endings(value) } if attribute == :body
42
+ values
43
+ end
44
+
45
+ # Sets the previous value so the emendation can be compared with the amended proposal.
46
+ # If the amendment is being evaluated, returns the CURRENT attribute value of the amended proposal;
47
+ # else, returns the attribute value of amended proposal at the moment of making the amendment.
48
+ def amended_previous_value(attribute)
49
+ if proposal.amendment.evaluating?
50
+ proposal.amendable.attributes[attribute.to_s]
51
+ else # See Decidim::Amendable::PublishDraft#set_first_emendation_version
52
+ proposal.versions.first.changeset[attribute.to_s].last
53
+ end
54
+ end
55
+
56
+ # Returns a String with the newline escape sequences normalized.
57
+ def normalize_line_endings(string)
58
+ Decidim::ContentParsers::NewlineParser.new(string, context: {}).rewrite
59
+ end
60
+
61
+ def proposal
62
+ @proposal ||= Proposal.find_by(id: version.item_id)
63
+ end
21
64
  end
22
65
  end
23
66
  end
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "open-uri"
4
+
3
5
  module Decidim
4
6
  module Proposals
5
7
  # A factory class to ensure we always create Proposals the same way since it involves some logic.
@@ -90,11 +92,32 @@ module Decidim
90
92
  end
91
93
 
92
94
  proposal.link_resources(original_proposal, "copied_from_component") unless skip_link
95
+ copy_attachments(original_proposal, proposal)
96
+
93
97
  proposal
94
98
  end
95
99
  # rubocop:enable Metrics/ParameterLists
96
100
 
97
101
  module_function :copy
102
+
103
+ def copy_attachments(original_proposal, proposal)
104
+ original_proposal.attachments.each do |attachment|
105
+ new_attachment = Decidim::Attachment.new(attachment.attributes.slice("content_type", "description", "file", "file_size", "title", "weight"))
106
+ new_attachment.attached_to = proposal
107
+
108
+ if File.exist?(attachment.file.file.path)
109
+ new_attachment.file = File.open(attachment.file.file.path)
110
+ else
111
+ new_attachment.remote_file_url = attachment.url
112
+ end
113
+
114
+ new_attachment.save!
115
+ rescue Errno::ENOENT, OpenURI::HTTPError => e
116
+ Rails.logger.warn("[ERROR] Couldn't copy attachment from proposal #{original_proposal.id} when copying to component due to #{e.message}")
117
+ end
118
+ end
119
+
120
+ module_function :copy_attachments
98
121
  end
99
122
  end
100
123
  end
@@ -10,6 +10,8 @@ module Decidim
10
10
  # page - The page number to paginate the results.
11
11
  # per_page - The number of proposals to return per page.
12
12
  def initialize(options = {})
13
+ @component = options[:component]
14
+ @current_user = options[:current_user]
13
15
  super(Proposal.all, options)
14
16
  end
15
17
 
@@ -86,9 +88,9 @@ module Decidim
86
88
  when "proposals"
87
89
  query.only_amendables
88
90
  when "amendments"
89
- query.only_emendations
90
- else
91
- query
91
+ query.only_visible_emendations_for(@current_user, @component)
92
+ else # Assume 'all'
93
+ query.amendables_and_visible_emendations_for(@current_user, @component)
92
94
  end
93
95
  end
94
96
 
@@ -69,6 +69,30 @@
69
69
  </div>
70
70
  <% end %>
71
71
 
72
+ <% if component_settings.attachments_allowed? %>
73
+ <div class="row column gallery__container">
74
+ <fieldset>
75
+ <legend><%= t(".gallery_legend") %></legend>
76
+
77
+ <% if @form.photos.any? %>
78
+ <% @form.photos.each do |photo| %>
79
+ <div class="callout gallery__item" data-closable>
80
+ <%= image_tag photo.thumbnail_url, class: "thumbnail", alt: photo.file.file.filename %>
81
+ <%= form.hidden_field :photos, multiple: true, value: photo.id, id: "photo-#{photo.id}" %>
82
+ <button class="close-button" aria-label="Close" type="button" data-close>
83
+ <span aria-hidden="true">&times;</span>
84
+ </button>
85
+ </div>
86
+ <% end %>
87
+ <% end %>
88
+
89
+ <div class="row column">
90
+ <%= form.file_field :add_photos, multiple: true, label: t(".add_images") %>
91
+ </div>
92
+ </fieldset>
93
+ </div>
94
+ <% end %>
95
+
72
96
  <% if component_settings.attachments_allowed? %>
73
97
  <div class="row column">
74
98
  <fieldset>
@@ -1,12 +1,12 @@
1
1
  <tr data-id="<%= proposal.id %>">
2
2
  <td>
3
- <%= check_box_tag "proposal_ids_s[]", proposal.id, false, class: "js-check-all-proposal js-proposal-list-check js-proposal-id-#{proposal.id}" %><br />
3
+ <%= check_box_tag "proposal_ids_s[]", proposal.id, false, class: "js-check-all-proposal js-proposal-list-check js-proposal-id-#{proposal.id}" %><br>
4
4
  </td>
5
5
  <td>
6
- <%= proposal.id %><br />
6
+ <%= proposal.id %><br>
7
7
  </td>
8
8
  <td>
9
- <%= decidim_html_escape(present(proposal).title).html_safe %><br />
9
+ <%= decidim_html_escape(present(proposal).title).html_safe %><br>
10
10
  </td>
11
11
  <td>
12
12
  <% if proposal.category %>
@@ -13,4 +13,4 @@
13
13
  <%= card_for draft, context: { label: true } %>
14
14
  <% end %>
15
15
  </div>
16
- <%= decidim_paginate @collaborative_drafts, random_seed: random_seed %>
16
+ <%= decidim_paginate @collaborative_drafts %>
@@ -124,9 +124,6 @@
124
124
  <%= attachments_for @collaborative_draft %>
125
125
  <%= comments_for @collaborative_draft %>
126
126
 
127
- <%= javascript_include_tag "decidim/proposals/social_share" %>
128
- <%= stylesheet_link_tag "decidim/proposals/social_share" %>
129
-
130
127
  <%=
131
128
  render partial: "decidim/shared/flag_modal", locals: {
132
129
  reportable: @collaborative_draft,
@@ -1,7 +1,7 @@
1
1
  <li class="<%= selected ? "selected" : "" %>" data-method="<%= http_method.to_s.upcase %>" data-url="<%= current_endorsement_url %>">
2
2
  <div class="author-data author-data--small">
3
3
  <div class="author-data__main">
4
- <%== cell("decidim/author", identity).profile %>
4
+ <%== cell("decidim/author", identity, skip_profile_link: true).profile %>
5
5
  </div>
6
6
  </div>
7
7
 
@@ -12,9 +12,10 @@
12
12
  </div>
13
13
  </div>
14
14
 
15
- <% if Decidim::Proposals::Proposal.only_emendations.any? %>
15
+ <% if @proposals.only_emendations.any? %>
16
16
  <%= form.collection_radio_buttons :type, filter_type_values, :first, :last, legend_title: t(".amendment_type") %>
17
17
  <% end %>
18
+
18
19
  <% if component_settings.official_proposals_enabled %>
19
20
  <%= form.collection_radio_buttons :origin, filter_origin_values, :first, :last, legend_title: t(".origin") %>
20
21
  <% end %>
@@ -7,5 +7,5 @@
7
7
  <div class="row column">
8
8
  <%= simple_format(present(@proposal).body(links: true, strip_tags: true), nil, sanitize: false) %>
9
9
  </div>
10
- <br />
10
+ <br>
11
11
  <%= attachments_for(@proposal) %>
@@ -11,4 +11,4 @@
11
11
  <div class="row small-up-1 medium-up-2 card-grid">
12
12
  <%= render @proposals %>
13
13
  </div>
14
- <%= decidim_paginate @proposals, random_seed: random_seed %>
14
+ <%= decidim_paginate @proposals %>
@@ -11,7 +11,7 @@
11
11
  <div class="address card__extra">
12
12
  <div class="address__icon">{{html icon}}</div>
13
13
  <div class="address__details">
14
- <span>${address}</span><br />
14
+ <span>${address}</span><br>
15
15
  </div>
16
16
  </div>
17
17
  </div>
@@ -10,7 +10,7 @@
10
10
  <% else %>
11
11
  <u class="text-uppercase"><%= decidim_html_escape(present(proposal).title).html_safe %></u>
12
12
  <% end %>
13
- <br />
13
+ <br>
14
14
  <% end %>
15
15
  </p>
16
16
  </div>
@@ -23,7 +23,11 @@ edit_link(
23
23
  <% end %>
24
24
  <%= emendation_announcement_for @proposal %>
25
25
  <div class="row column view-header">
26
- <h2 class="heading2"><%= present(@proposal).title(links: true, html_escape: true) %></h2>
26
+ <% if @proposal.emendation? %>
27
+ <h2 class="heading2"><%= t(".changes_at_title", title: present(@proposal.amendable).title(links: true, html_escape: true)) %></h2>
28
+ <% else %>
29
+ <h2 class="heading2"><%= present(@proposal).title(links: true, html_escape: true) %></h2>
30
+ <% end %>
27
31
  <% unless component_settings.participatory_texts_enabled? %>
28
32
  <%= cell("decidim/coauthorships", @proposal, has_actions: true, size: 3, context: { current_user: current_user }) %>
29
33
  <% end %>
@@ -50,7 +54,7 @@ edit_link(
50
54
  </div>
51
55
  </div>
52
56
  <% end %>
53
- <% if allowed_to?(:edit, :proposal, proposal: @proposal) %>
57
+ <% if @proposal.amendable? && allowed_to?(:edit, :proposal, proposal: @proposal) %>
54
58
  <%= link_to t(".edit_proposal"), edit_proposal_path(@proposal), class: "button secondary hollow expanded button-sc button--icon follow-button" %>
55
59
  <% else %>
56
60
  <%= amend_button_for @proposal %>
@@ -75,7 +79,7 @@ edit_link(
75
79
  <%= render partial: "vote_button", locals: { proposal: @proposal, from_proposals_list: false } %>
76
80
  <% end %>
77
81
  <%= render partial: "endorsements_card_row", locals: { proposal: @proposal } %>
78
- <br />
82
+ <br>
79
83
  <%= follow_button_for(@proposal) %>
80
84
  </div>
81
85
  </div>
@@ -89,12 +93,15 @@ edit_link(
89
93
  <%= render partial: "decidim/shared/share_modal" %>
90
94
  <%= embed_modal_for proposal_proposal_widget_url(@proposal, format: :js) %>
91
95
  <%= cell "decidim/proposals/proposal_link_to_collaborative_draft", @proposal %>
96
+ <%= cell "decidim/proposals/proposal_link_to_rejected_emendation", @proposal %>
92
97
  </div>
93
98
  <div class="columns mediumlarge-8 mediumlarge-pull-4">
94
99
  <div class="section">
95
- <%== cell("decidim/proposals/proposal_m", @proposal, full_badge: true).badge %>
96
- <% unless @proposal.participatory_text_level == "section" || @proposal.participatory_text_level == "subsection" %>
97
- <%= simple_format(present(@proposal).body(links: true, strip_tags: true), nil, sanitize: false) %>
100
+ <% if @proposal.emendation? %>
101
+ <%= cell("decidim/diff", @proposal.versions.last) %>
102
+ <% elsif not ["section","subsection"].include? @proposal.participatory_text_level %>
103
+ <%== cell("decidim/proposals/proposal_m", @proposal, full_badge: true).badge %>
104
+ <%= simple_format present(@proposal).body(links: true, strip_tags: true), nil, sanitize: false %>
98
105
  <% end %>
99
106
  <% if component_settings.geocoding_enabled? %>
100
107
  <%= render partial: "decidim/shared/static_map", locals: { icon_name: "proposals", geolocalizable: @proposal } %>
@@ -138,9 +145,6 @@ edit_link(
138
145
 
139
146
  <%= comments_for @proposal %>
140
147
 
141
- <%= javascript_include_tag "decidim/proposals/social_share" %>
142
- <%= stylesheet_link_tag "decidim/proposals/social_share" %>
143
-
144
148
  <%=
145
149
  render partial: "decidim/shared/flag_modal", locals: {
146
150
  reportable: @proposal,