decidim-plans 0.16.5 → 0.16.6
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/commands/decidim/plans/admin/export_plans_to_budgets.rb +6 -5
- data/app/controllers/decidim/plans/plans_controller.rb +2 -2
- data/app/helpers/decidim/plans/links_helper.rb +2 -2
- data/app/presenters/concerns/decidim/plans/rich_presenter.rb +11 -1
- data/app/presenters/decidim/plans/content_presenter.rb +1 -1
- data/app/presenters/decidim/plans/plan_presenter.rb +3 -3
- data/lib/decidim/plans/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 870133d81fb0fd7608a2087fbf2fdb7a434a37ebe3437334c9cdb604c2afd3f8
|
|
4
|
+
data.tar.gz: 4e28e6926fbdfe8339eb19ef66c1c455cef50ad9cf42a1940f2c2ec9df0a041f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1cd3865a386f58d321ff9e077e7c8728b011dfe85cffcc52b0c6854759ee91592398eab98506fdb31d162f52022a532a0bc5e18d21191e88798d9fa29fc84858
|
|
7
|
+
data.tar.gz: 55e53122d62b560a70532c9ce0d3b2b8466b4ca2187cc54664df4f3710a8697b8f5112c200d597d39e19006271ae4402d6421d5a8dac83e8b5dd254201bfb56f
|
|
@@ -6,7 +6,7 @@ module Decidim
|
|
|
6
6
|
# A command with all the business logic when an admin exports plans to a
|
|
7
7
|
# single budget component.
|
|
8
8
|
class ExportPlansToBudgets < Rectify::Command
|
|
9
|
-
include
|
|
9
|
+
include Decidim::Plans::RichPresenter
|
|
10
10
|
|
|
11
11
|
# Public: Initializes the command.
|
|
12
12
|
#
|
|
@@ -85,13 +85,14 @@ module Decidim
|
|
|
85
85
|
original_plan.sections.each do |section|
|
|
86
86
|
content = original_plan.contents.find_by(section: section)
|
|
87
87
|
content.body.each do |locale, body_text|
|
|
88
|
-
title =
|
|
88
|
+
title = plain_content(section.body[locale])
|
|
89
89
|
pr_desc[locale] ||= ""
|
|
90
90
|
pr_desc[locale] += "<h3>#{title}</h3>\n"
|
|
91
91
|
|
|
92
92
|
# Wrap non-HTML strings within a <p> tag and replace newlines with
|
|
93
|
-
# <br>. This also takes care of sanitization
|
|
94
|
-
|
|
93
|
+
# <br>. This also takes care of sanitization and specific styling
|
|
94
|
+
# of the text, such as bold, italics, etc.
|
|
95
|
+
pr_desc[locale] += rich_content(body_text)
|
|
95
96
|
end
|
|
96
97
|
end
|
|
97
98
|
|
|
@@ -103,7 +104,7 @@ module Decidim
|
|
|
103
104
|
|
|
104
105
|
def sanitize_localized(hash)
|
|
105
106
|
hash.each do |locale, value|
|
|
106
|
-
hash[locale] =
|
|
107
|
+
hash[locale] = plain_content(value)
|
|
107
108
|
end
|
|
108
109
|
end
|
|
109
110
|
end
|
|
@@ -17,9 +17,9 @@ module Decidim
|
|
|
17
17
|
|
|
18
18
|
helper_method :attached_proposals_picker_field
|
|
19
19
|
|
|
20
|
-
before_action :authenticate_user!, only: [:new, :create, :edit, :update, :withdraw, :preview, :publish, :close, :
|
|
20
|
+
before_action :authenticate_user!, only: [:new, :create, :edit, :update, :withdraw, :preview, :publish, :close, :destroy]
|
|
21
21
|
before_action :check_draft, only: [:new]
|
|
22
|
-
before_action :retrieve_plan, only: [:show, :edit, :update, :withdraw, :preview, :publish, :close, :
|
|
22
|
+
before_action :retrieve_plan, only: [:show, :edit, :update, :withdraw, :preview, :publish, :close, :destroy]
|
|
23
23
|
before_action :ensure_published!, only: [:show, :withdraw]
|
|
24
24
|
|
|
25
25
|
def index
|
|
@@ -4,7 +4,7 @@ module Decidim
|
|
|
4
4
|
module Plans
|
|
5
5
|
module LinksHelper
|
|
6
6
|
# This is for generating the links so that they maintain the search status
|
|
7
|
-
def request_params(extra_params={}, exclude_params=[])
|
|
7
|
+
def request_params(extra_params = {}, exclude_params = [])
|
|
8
8
|
@request_params ||= request.params.except(
|
|
9
9
|
*(exclude_params + [
|
|
10
10
|
:action,
|
|
@@ -17,7 +17,7 @@ module Decidim
|
|
|
17
17
|
).merge(prepare_extra_params(extra_params))
|
|
18
18
|
end
|
|
19
19
|
|
|
20
|
-
def request_params_query(extra_params={}, exclude_params=[])
|
|
20
|
+
def request_params_query(extra_params = {}, exclude_params = [])
|
|
21
21
|
return "" unless request_params(extra_params, exclude_params).any?
|
|
22
22
|
|
|
23
23
|
"?#{request_params.to_query}"
|
|
@@ -6,8 +6,18 @@ module Decidim
|
|
|
6
6
|
extend ActiveSupport::Concern
|
|
7
7
|
include ActionView::Helpers::TextHelper
|
|
8
8
|
|
|
9
|
+
def plain_content(content)
|
|
10
|
+
sanitize(content, tags: [])
|
|
11
|
+
end
|
|
12
|
+
|
|
9
13
|
def rich_content(content)
|
|
10
|
-
simple_format(content, wrapper_tag: nil)
|
|
14
|
+
simple_format(sanitize(content, tags: allowed_rich_tags), wrapper_tag: nil)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
protected
|
|
18
|
+
|
|
19
|
+
def allowed_rich_tags
|
|
20
|
+
%w(strong em b i)
|
|
11
21
|
end
|
|
12
22
|
end
|
|
13
23
|
end
|
|
@@ -29,7 +29,7 @@ module Decidim
|
|
|
29
29
|
end
|
|
30
30
|
|
|
31
31
|
def title
|
|
32
|
-
|
|
32
|
+
plain_content(translated_attribute(plan.title))
|
|
33
33
|
end
|
|
34
34
|
|
|
35
35
|
def body
|
|
@@ -37,8 +37,8 @@ module Decidim
|
|
|
37
37
|
content = plan.contents.find_by(section: section)
|
|
38
38
|
next if content.nil?
|
|
39
39
|
|
|
40
|
-
section_title =
|
|
41
|
-
section_body =
|
|
40
|
+
section_title = plain_content(translated_attribute(content.title))
|
|
41
|
+
section_body = plain_content(translated_attribute(content.body))
|
|
42
42
|
"<dt>#{section_title}</dt> <dd>#{section_body}</dd>"
|
|
43
43
|
end
|
|
44
44
|
|