decidim-challenges 0.7.4 → 0.9.0

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.
Files changed (77) hide show
  1. checksums.yaml +4 -4
  2. data/app/cells/decidim/challenges/challenge_g/show.erb +1 -1
  3. data/app/cells/decidim/challenges/challenge_g_cell.rb +0 -20
  4. data/app/cells/decidim/problems/problem_g/show.erb +1 -1
  5. data/app/cells/decidim/problems/problem_g_cell.rb +1 -25
  6. data/app/cells/decidim/solutions/solution_g/show.erb +1 -1
  7. data/app/cells/decidim/solutions/solution_g_cell.rb +0 -40
  8. data/app/commands/decidim/challenges/admin/create_challenge.rb +3 -4
  9. data/app/commands/decidim/challenges/admin/update_challenge.rb +3 -4
  10. data/app/commands/decidim/challenges/survey_challenge.rb +1 -1
  11. data/app/commands/decidim/command_utils.rb +1 -1
  12. data/app/commands/decidim/problems/admin/create_problem.rb +2 -4
  13. data/app/commands/decidim/problems/admin/update_problem.rb +2 -4
  14. data/app/controllers/decidim/challenges/admin/challenges_controller.rb +3 -3
  15. data/app/controllers/decidim/challenges/admin/survey_form_controller.rb +7 -3
  16. data/app/controllers/decidim/challenges/admin/surveys_controller.rb +12 -8
  17. data/app/controllers/decidim/challenges/challenges_controller.rb +1 -8
  18. data/app/controllers/decidim/challenges/surveys_controller.rb +4 -4
  19. data/app/controllers/decidim/problems/admin/problems_controller.rb +3 -3
  20. data/app/controllers/decidim/problems/problems_controller.rb +1 -10
  21. data/app/controllers/decidim/solutions/admin/solutions_controller.rb +4 -4
  22. data/app/controllers/decidim/solutions/solutions_controller.rb +1 -24
  23. data/app/forms/decidim/challenges/admin/challenges_form.rb +2 -9
  24. data/app/forms/decidim/problems/admin/problems_form.rb +3 -19
  25. data/app/forms/decidim/solutions/solutions_form.rb +2 -3
  26. data/app/helpers/decidim/challenges/challenge_cells_helper.rb +1 -1
  27. data/app/helpers/decidim/challenges/challenges_helper.rb +3 -7
  28. data/app/helpers/decidim/problems/problems_helper.rb +3 -8
  29. data/app/helpers/decidim/solutions/application_helper.rb +1 -3
  30. data/app/helpers/decidim/solutions/solution_cells_helper.rb +1 -1
  31. data/app/helpers/decidim/solutions/solutions_helper.rb +2 -5
  32. data/app/models/decidim/challenges/challenge.rb +5 -8
  33. data/app/models/decidim/problems/problem.rb +5 -54
  34. data/app/models/decidim/solutions/solution.rb +10 -16
  35. data/app/permissions/decidim/challenges/admin/permissions.rb +3 -9
  36. data/app/presenters/decidim/challenges/challenge_presenter.rb +16 -19
  37. data/app/presenters/decidim/problems/problem_presenter.rb +11 -12
  38. data/app/presenters/decidim/solutions/solution_presenter.rb +36 -37
  39. data/app/serializers/decidim/challenges/download_your_data_survey_serializer.rb +5 -5
  40. data/app/serializers/decidim/challenges/survey_serializer.rb +8 -8
  41. data/app/serializers/decidim/solutions/solution_serializer.rb +2 -1
  42. data/app/types/decidim/challenges/challenge_type.rb +1 -3
  43. data/app/types/decidim/challenges/challenges_type.rb +1 -3
  44. data/app/types/decidim/problems/problem_type.rb +1 -3
  45. data/app/types/decidim/problems/problems_type.rb +1 -3
  46. data/app/types/decidim/solutions/solution_type.rb +1 -1
  47. data/app/types/decidim/solutions/solutions_type.rb +1 -3
  48. data/app/views/decidim/challenges/admin/challenges/_form.html.erb +8 -13
  49. data/app/views/decidim/challenges/admin/survey_form/edit_questions.html.erb +46 -0
  50. data/app/views/decidim/challenges/admin/surveys/edit.html.erb +6 -5
  51. data/app/views/decidim/challenges/admin/surveys/index.html.erb +12 -12
  52. data/app/views/decidim/challenges/admin/surveys/show.html.erb +14 -14
  53. data/app/views/decidim/challenges/challenges/_sidebar_data.html.erb +3 -10
  54. data/app/views/decidim/challenges/challenges/show.html.erb +1 -3
  55. data/app/views/decidim/problems/admin/problems/_form.html.erb +8 -17
  56. data/app/views/decidim/problems/problems/_sidebar_data.html.erb +2 -22
  57. data/app/views/decidim/problems/problems/show.html.erb +1 -3
  58. data/app/views/decidim/solutions/admin/solutions/_form.html.erb +9 -9
  59. data/app/views/decidim/solutions/admin/solutions/index.html.erb +3 -3
  60. data/app/views/decidim/solutions/solutions/_form.html.erb +4 -4
  61. data/app/views/decidim/solutions/solutions/_sidebar_data.html.erb +2 -22
  62. data/app/views/decidim/solutions/solutions/show.html.erb +1 -3
  63. data/config/locales/ca.yml +24 -13
  64. data/config/locales/cs.yml +12 -11
  65. data/config/locales/en.yml +25 -12
  66. data/config/locales/es.yml +25 -11
  67. data/config/locales/oc.yml +13 -12
  68. data/db/migrate/20260526153523_remove_scope_from_challenges_and_problems.rb +9 -0
  69. data/lib/decidim/challenges/admin_engine.rb +7 -3
  70. data/lib/decidim/challenges/component.rb +2 -2
  71. data/lib/decidim/challenges/engine.rb +0 -1
  72. data/lib/decidim/challenges/test/factories.rb +1 -1
  73. data/lib/decidim/challenges/version.rb +3 -3
  74. data/lib/decidim/problems/test/factories.rb +1 -1
  75. data/lib/decidim/solutions/test/factories.rb +1 -1
  76. metadata +8 -7
  77. data/app/controllers/concerns/decidim/with_default_filters.rb +0 -23
@@ -19,7 +19,6 @@ module Decidim
19
19
  translatable_attribute :global_description, String
20
20
 
21
21
  attribute :decidim_component_id, Integer
22
- attribute :decidim_scope_id, Integer
23
22
  attribute :tags, String
24
23
  attribute :sdg_code, String
25
24
  attribute :state, Integer
@@ -32,7 +31,6 @@ module Decidim
32
31
  attribute :remove_card_image, Boolean, default: false
33
32
 
34
33
  validates :title, :local_description, :global_description, translatable_presence: true
35
- validates :scope, presence: true, if: ->(form) { form.decidim_scope_id.present? }
36
34
  validate :valid_state
37
35
 
38
36
  validates :start_date, presence: true, date: { before_or_equal_to: :end_date }
@@ -56,15 +54,10 @@ module Decidim
56
54
  end
57
55
  end
58
56
 
59
- # Finds the Scope from the given decidim_scope_id, uses participatory space scope if missing.
60
- #
61
- # Returns a Decidim::Scope
62
- def scope
63
- @scope ||= current_organization.scopes.find_by(id: decidim_scope_id)
57
+ def map_model(model)
58
+ self.state = Decidim::Challenges::Challenge.states[model.state]
64
59
  end
65
60
 
66
- def map_model(model); end
67
-
68
61
  private
69
62
 
70
63
  def valid_state
@@ -16,8 +16,6 @@ module Decidim
16
16
  translatable_attribute :description, String
17
17
 
18
18
  attribute :decidim_challenges_challenge_id, Integer
19
- attribute :decidim_sectorial_scope_id, Integer
20
- attribute :decidim_technological_scope_id, Integer
21
19
  attribute :tags, String
22
20
  attribute :causes, String
23
21
  attribute :groups_affected, String
@@ -28,8 +26,6 @@ module Decidim
28
26
  attribute :collaborating_entities, String
29
27
 
30
28
  validates :title, :description, translatable_presence: true
31
- validates :sectorial_scope, presence: true, if: ->(form) { form.decidim_sectorial_scope_id.present? }
32
- validates :technological_scope, presence: true, if: ->(form) { form.decidim_technological_scope_id.present? }
33
29
  validate :valid_state
34
30
  validates :decidim_challenges_challenge_id, presence: true
35
31
 
@@ -54,20 +50,6 @@ module Decidim
54
50
  end
55
51
  end
56
52
 
57
- # Finds the Sectorial Scope from the given decidim_sectorial_scope_id
58
- #
59
- # Returns a Decidim::Scope
60
- def sectorial_scope
61
- @sectorial_scope ||= current_organization.scopes.find_by(id: decidim_sectorial_scope_id)
62
- end
63
-
64
- # Finds the Technological Scope from the given decidim_technological_scope_id
65
- #
66
- # Returns a Decidim::Scope
67
- def technological_scope
68
- @technological_scope ||= current_organization.scopes.find_by(id: decidim_technological_scope_id)
69
- end
70
-
71
53
  # Finds the Challenge from the given decidim_challenges_challenge_id
72
54
  #
73
55
  # Returns a Decidim::Challenges::Challenge
@@ -75,7 +57,9 @@ module Decidim
75
57
  @challenge ||= @decidim_challenges_challenge_id ? Decidim::Challenges::Challenge.find(@decidim_challenges_challenge_id) : false
76
58
  end
77
59
 
78
- def map_model(model); end
60
+ def map_model(model)
61
+ self.state = Decidim::Problems::Problem.states[model.state]
62
+ end
79
63
 
80
64
  private
81
65
 
@@ -20,7 +20,7 @@ module Decidim
20
20
  attribute :author_id, Integer
21
21
  attribute :attachment, AttachmentForm
22
22
 
23
- attachments_attribute :documents
23
+ attachments_attribute :attachments
24
24
 
25
25
  validates :title, :description, presence: true, etiquette: true
26
26
  validates :project_status, :coordinating_entity, presence: true
@@ -31,8 +31,7 @@ module Decidim
31
31
  self.title = translated_attribute(model.title)
32
32
  self.description = translated_attribute(model.description)
33
33
 
34
- self.documents = model.attachments
35
- nil unless model.categorization
34
+ self.attachments = model.attachments
36
35
  end
37
36
 
38
37
  # Finds the Challenge from the given decidim_challenges_challenge_id
@@ -15,7 +15,7 @@ module Decidim
15
15
  include Decidim::CardHelper
16
16
  include WithSdgs
17
17
 
18
- delegate :title, :state, :published_state?, :withdrawn?, :amendable?, :emendation?, to: :model
18
+ delegate :state, :published_state?, :withdrawn?, :amendable?, :emendation?, to: :model
19
19
 
20
20
  def has_actions?
21
21
  return context[:has_actions] if context[:has_actions].present?
@@ -7,13 +7,9 @@ module Decidim
7
7
  module ChallengesHelper
8
8
  def filter_sections
9
9
  items = []
10
- items.append(method: :with_any_state, collection: filter_custom_state_values, label_scope: "decidim.shared.filters", id: "state")
11
- items.append(method: :related_to, collection: linked_classes_filter_values_for(Decidim::Challenges::Challenge), label_scope: "decidim.shared.filters", id: "related_to",
12
- type: :radio_buttons)
13
- if current_participatory_space.has_subscopes?
14
- items.append(method: :with_any_scope, collection: filter_global_scopes_values, label_scope: "decidim.shared.filters",
15
- id: "scope")
16
- end
10
+ items.append(method: :with_any_state, collection: filter_custom_state_values, label: t("state", scope: "decidim.challenges.challenges.filters"), id: "state")
11
+ items.append(method: :related_to, collection: linked_classes_filter_values_for(Decidim::Challenges::Challenge),
12
+ label: t("related_to", scope: "decidim.challenges.challenges.filters"), id: "related_to", type: :radio_buttons)
17
13
 
18
14
  items.reject { |item| item[:collection].blank? }
19
15
  end
@@ -7,16 +7,11 @@ module Decidim
7
7
  module ProblemsHelper
8
8
  def filter_sections
9
9
  items = []
10
- items.append(method: :with_any_state, collection: filter_custom_state_values, label_scope: "decidim.problems.problems.filters", id: "state")
11
- items.append(method: :related_to, collection: linked_classes_filter_values_for(Decidim::Challenges::Challenge), label_scope: "decidim.problems.problems.filters",
10
+ items.append(method: :with_any_state, collection: filter_custom_state_values, label: t("state", scope: "decidim.problems.problems.filters"), id: "state")
11
+ items.append(method: :related_to, collection: linked_classes_filter_values_for(Decidim::Challenges::Challenge),
12
+ label: t("related_to", scope: "decidim.problems.problems.filters"),
12
13
  id: "related_to", type: :radio_buttons)
13
14
 
14
- if current_participatory_space.has_subscopes?
15
- items.append(method: :with_any_sectorial_scope, collection: filter_global_scopes_values, label_scope: "decidim.problems.problems.filters", id: "sectorial_scope")
16
- items.append(method: :with_any_technological_scope, collection: filter_global_scopes_values, label_scope: "decidim.problems.problems.filters", id: "technological_scope")
17
- items.append(method: :with_any_territorial_scope, collection: filter_global_scopes_values, label_scope: "decidim.problems.problems.filters", id: "territorial_scope")
18
- end
19
-
20
15
  items.reject { |item| item[:collection].blank? }
21
16
  end
22
17
  end
@@ -9,9 +9,7 @@ module Decidim
9
9
 
10
10
  def text_editor_for_description(form)
11
11
  options = {
12
- class: "js-hashtags",
13
- hashtaggable: true,
14
- value: form_presenter.description(extras: false).strip,
12
+ value: form_presenter.description.strip,
15
13
  }
16
14
 
17
15
  text_editor_for(form, :description, options)
@@ -15,7 +15,7 @@ module Decidim
15
15
  include Decidim::CardHelper
16
16
  include WithSdgs
17
17
 
18
- delegate :title, :state, :published_state?, :withdrawn?, :amendable?, :emendation?, to: :model
18
+ delegate :state, :published_state?, :withdrawn?, :amendable?, :emendation?, to: :model
19
19
 
20
20
  def has_actions?
21
21
  return context[:has_actions] if context[:has_actions].present?
@@ -7,11 +7,8 @@ module Decidim
7
7
  module SolutionsHelper
8
8
  def filter_sections
9
9
  items = []
10
- if current_participatory_space.has_subscopes?
11
- items.append(method: :with_any_territorial_scope, collection: filter_global_scopes_values, label_scope: "decidim.problems.problems.filters",
12
- id: "territorial_scope")
13
- end
14
- items.append(method: :related_to, collection: linked_classes_filter_values_for(Decidim::Challenges::Challenge), label_scope: "decidim.solutions.solutions.filters",
10
+ items.append(method: :related_to, collection: linked_classes_filter_values_for(Decidim::Challenges::Challenge),
11
+ label: t("related_to", scope: "decidim.solutions.solutions.filters"),
15
12
  id: "related_to", type: :radio_buttons)
16
13
 
17
14
  items.reject { |item| item[:collection].blank? }
@@ -6,7 +6,6 @@ module Decidim
6
6
  class Challenge < Decidim::ApplicationRecord
7
7
  include Decidim::HasComponent
8
8
  include Decidim::FilterableResource
9
- include Decidim::ScopableResource
10
9
  include Decidim::Loggable
11
10
  include Decidim::Publicable
12
11
  include Decidim::Resourceable
@@ -17,11 +16,6 @@ module Decidim
17
16
  include Decidim::Randomable
18
17
  include Decidim::HasUploadValidations
19
18
 
20
- belongs_to :scope,
21
- foreign_key: "decidim_scope_id",
22
- class_name: "Decidim::Scope",
23
- optional: true
24
-
25
19
  has_many :surveys, class_name: "Decidim::Challenges::Survey", foreign_key: "decidim_challenge_id", dependent: :destroy
26
20
 
27
21
  VALID_STATES = [:proposal, :execution, :finished].freeze
@@ -57,11 +51,10 @@ module Decidim
57
51
  }
58
52
 
59
53
  def self.ransackable_scopes(_auth_object = nil)
60
- [:with_any_state, :search_text_cont, :with_any_sdgs_codes, :with_any_scope, :related_to]
54
+ [:with_any_state, :search_text_cont, :with_any_sdgs_codes, :related_to]
61
55
  end
62
56
 
63
57
  searchable_fields({
64
- scope_id: :decidim_scope_id,
65
58
  participatory_space: :itself,
66
59
  A: :title,
67
60
  B: :local_description,
@@ -76,6 +69,10 @@ module Decidim
76
69
  published_at.present?
77
70
  end
78
71
 
72
+ def presenter
73
+ Decidim::Challenges::ChallengePresenter.new(self)
74
+ end
75
+
79
76
  def remove_card_image; end
80
77
  end
81
78
  end
@@ -6,7 +6,6 @@ module Decidim
6
6
  class Problem < Decidim::ApplicationRecord
7
7
  include Decidim::HasComponent
8
8
  include Decidim::FilterableResource
9
- include Decidim::ScopableResource
10
9
  include Decidim::Loggable
11
10
  include Decidim::Publicable
12
11
  include Decidim::Resourceable
@@ -22,14 +21,6 @@ module Decidim
22
21
 
23
22
  belongs_to :challenge, foreign_key: "decidim_challenges_challenge_id", class_name: "Decidim::Challenges::Challenge"
24
23
 
25
- belongs_to :sectorial_scope,
26
- foreign_key: "decidim_sectorial_scope_id",
27
- class_name: "Decidim::Scope",
28
- optional: true
29
- belongs_to :technological_scope,
30
- foreign_key: "decidim_technological_scope_id",
31
- class_name: "Decidim::Scope",
32
- optional: true
33
24
  has_many :solutions,
34
25
  class_name: "Decidim::Solutions::Solution",
35
26
  foreign_key: "decidim_problems_problem_id", dependent: :restrict_with_exception
@@ -51,55 +42,11 @@ module Decidim
51
42
  joins(:challenge).where("decidim_challenges_challenges" => { sdg_code: Array(values).map(&:to_sym) })
52
43
  }
53
44
 
54
- scope :with_any_sectorial_scope, lambda { |*sectorial_scope_id|
55
- if sectorial_scope_id.include?("all")
56
- all
57
- else
58
- clean_scope_ids = sectorial_scope_id
59
-
60
- conditions = []
61
- conditions << "#{model_name.plural}.decidim_sectorial_scope_id IS NULL" if clean_scope_ids.delete("global")
62
- conditions.concat(["? = ANY(decidim_scopes.part_of)"] * clean_scope_ids.count) if clean_scope_ids.any?
63
-
64
- includes(:sectorial_scope).references(:decidim_scopes).where(conditions.join(" OR "), *clean_scope_ids.map(&:to_i))
65
- end
66
- }
67
-
68
- scope :with_any_technological_scope, lambda { |*technological_scope_id|
69
- if technological_scope_id.include?("all")
70
- all
71
- else
72
- clean_scope_ids = technological_scope_id
73
-
74
- conditions = []
75
- conditions << "#{model_name.plural}.decidim_technological_scope_id IS NULL" if clean_scope_ids.delete("global")
76
- conditions.concat(["? = ANY(decidim_scopes.part_of)"] * clean_scope_ids.count) if clean_scope_ids.any?
77
-
78
- includes(:technological_scope).references(:decidim_scopes).where(conditions.join(" OR "), *clean_scope_ids.map(&:to_i))
79
- end
80
- }
81
-
82
- scope :with_any_territorial_scope, lambda { |*territorial_scope_id|
83
- if territorial_scope_id.include?("all")
84
- all
85
- else
86
- clean_scope_ids = territorial_scope_id
87
-
88
- conditions = []
89
- conditions << "decidim_challenges_challenges.decidim_scope_id IS NULL" if clean_scope_ids.delete("global")
90
- conditions.concat(["? = ANY(decidim_scopes.part_of)"] * clean_scope_ids.count) if clean_scope_ids.any?
91
-
92
- includes(challenge: :scope).references(:decidim_scopes).where(conditions.join(" OR "), *clean_scope_ids.map(&:to_i))
93
- end
94
- }
95
-
96
45
  def self.ransackable_scopes(_auth_object = nil)
97
- [:with_any_state, :search_text_cont, :with_any_sdgs_codes,
98
- :with_any_sectorial_scope, :with_any_technological_scope, :with_any_territorial_scope, :related_to]
46
+ [:with_any_state, :search_text_cont, :with_any_sdgs_codes, :related_to]
99
47
  end
100
48
 
101
49
  searchable_fields({
102
- scope_id: "decidim_sectorial_scope_id",
103
50
  participatory_space: :itself,
104
51
  A: :title,
105
52
  B: :description,
@@ -113,6 +60,10 @@ module Decidim
113
60
  def published?
114
61
  published_at.present?
115
62
  end
63
+
64
+ def presenter
65
+ Decidim::Problems::ProblemPresenter.new(self)
66
+ end
116
67
  end
117
68
  end
118
69
  end
@@ -14,7 +14,6 @@ module Decidim
14
14
  include Decidim::TranslatableAttributes
15
15
  include Decidim::Randomable
16
16
  include Decidim::HasAttachments
17
- include Decidim::Publicable
18
17
 
19
18
  component_manifest_name "solutions"
20
19
 
@@ -32,22 +31,13 @@ module Decidim
32
31
  joins(:challenge).where("decidim_challenges_challenges" => { sdg_code: Array(values).map(&:to_sym) })
33
32
  }
34
33
 
35
- scope :with_any_territorial_scope, lambda { |*territorial_scope_id|
36
- if territorial_scope_id.include?("all")
37
- all
38
- else
39
- clean_scope_ids = territorial_scope_id
40
-
41
- conditions = []
42
- conditions << "decidim_challenges_challenges.decidim_scope_id IS NULL" if clean_scope_ids.delete("global")
43
- conditions.concat(["? = ANY(decidim_scopes.part_of)"] * clean_scope_ids.count) if clean_scope_ids.any?
44
-
45
- includes(problem: { challenge: :scope }).references(:decidim_scopes).where(conditions.join(" OR "), *clean_scope_ids.map(&:to_i))
46
- end
47
- }
48
-
49
34
  def self.ransackable_scopes(_auth_object = nil)
50
- [:search_text_cont, :with_any_territorial_scope, :with_any_sdgs_codes, :related_to]
35
+ [:search_text_cont, :with_any_sdgs_codes, :related_to]
36
+ end
37
+
38
+ def self.ransackable_attributes(_auth_object = nil)
39
+ %w(author_id beneficiaries coordinating_entity created_at decidim_challenges_challenge_id decidim_component_id decidim_problems_problem_id
40
+ description financing_type id indicators objectives project_status project_url published_at requirements tags title updated_at)
51
41
  end
52
42
 
53
43
  searchable_fields({
@@ -64,6 +54,10 @@ module Decidim
64
54
  def published?
65
55
  published_at.present?
66
56
  end
57
+
58
+ def presenter
59
+ Decidim::Solutions::SolutionPresenter.new(self)
60
+ end
67
61
  end
68
62
  end
69
63
  end
@@ -22,13 +22,11 @@ module Decidim
22
22
 
23
23
  allow! if permission_action.subject == :questionnaire && update_permission_action?
24
24
 
25
- allow! if permission_action.subject == :questionnaire_answers && index_permission_action?
25
+ allow! if permission_action.subject == :questionnaire_responses && index_permission_action?
26
26
 
27
- allow! if permission_action.subject == :questionnaire_answers && show_permission_action?
27
+ allow! if permission_action.subject == :questionnaire_responses && show_permission_action?
28
28
 
29
- allow! if permission_action.subject == :questionnaire && export_answers_permission_action?
30
-
31
- allow! if permission_action.subject == :questionnaire_answers && export_response_permission_action?
29
+ allow! if permission_action.subject == :questionnaire_responses && export_response_permission_action?
32
30
 
33
31
  permission_action
34
32
  end
@@ -67,10 +65,6 @@ module Decidim
67
65
  permission_action.action == :export_response
68
66
  end
69
67
 
70
- def export_answers_permission_action?
71
- permission_action.action == :export_answers
72
- end
73
-
74
68
  def index_permission_action?
75
69
  permission_action.action == :index
76
70
  end
@@ -11,8 +11,6 @@ module Decidim
11
11
  include Decidim::SanitizeHelper
12
12
  include Decidim::TranslatableAttributes
13
13
 
14
- delegate :url, to: :card_image, prefix: true
15
-
16
14
  def challenge
17
15
  __getobj__
18
16
  end
@@ -27,35 +25,34 @@ module Decidim
27
25
 
28
26
  # Render the challenge title
29
27
  #
30
- # links - should render hashtags as links?
31
- # extras - should include extra hashtags?
28
+ # html_escape - should escape the HTML special characters?
32
29
  #
33
30
  # Returns a String.
34
- def title(links: false, extras: true, html_escape: false)
31
+ def title(html_escape: false)
35
32
  text = translated_attribute(challenge.title)
36
33
  text = decidim_html_escape(text) if html_escape
37
34
 
38
- renderer = Decidim::ContentRenderers::HashtagRenderer.new(text)
39
- renderer.render(links:, extras:).html_safe
35
+ renderer = Decidim::ContentRenderers::BlobRenderer.new(text)
36
+ renderer.render.html_safe
40
37
  end
41
38
 
42
- def id_and_title(links: false, extras: true, html_escape: false)
43
- "##{challenge.id} - #{title(links:, extras:, html_escape:)}"
39
+ def id_and_title(html_escape: false)
40
+ "##{challenge.id} - #{title(html_escape:)}"
44
41
  end
45
42
 
46
43
  # Render the challenge local_description
47
44
  #
48
- # links - should render hashtags as links?
49
- # extras - should include extra hashtags?
45
+ # links - should render URLs as links?
46
+ # strip_tags - should remove the HTML tags?
50
47
  #
51
48
  # Returns a String.
52
- def local_description(links: false, extras: true, strip_tags: false)
49
+ def local_description(links: false, strip_tags: false)
53
50
  text = translated_attribute(challenge.local_description)
54
51
 
55
52
  text = strip_tags(sanitize_text(text)) if strip_tags
56
53
 
57
- renderer = Decidim::ContentRenderers::HashtagRenderer.new(text)
58
- text = renderer.render(links:, extras:).html_safe
54
+ renderer = Decidim::ContentRenderers::BlobRenderer.new(text)
55
+ text = renderer.render.html_safe
59
56
 
60
57
  text = Decidim::ContentRenderers::LinkRenderer.new(text).render if links
61
58
  text
@@ -63,17 +60,17 @@ module Decidim
63
60
 
64
61
  # Render the challenge global_description
65
62
  #
66
- # links - should render hashtags as links?
67
- # extras - should include extra hashtags?
63
+ # links - should render URLs as links?
64
+ # strip_tags - should remove the HTML tags?
68
65
  #
69
66
  # Returns a String.
70
- def global_description(links: false, extras: true, strip_tags: false)
67
+ def global_description(links: false, strip_tags: false)
71
68
  text = translated_attribute(challenge.global_description)
72
69
 
73
70
  text = strip_tags(sanitize_text(text)) if strip_tags
74
71
 
75
- renderer = Decidim::ContentRenderers::HashtagRenderer.new(text)
76
- text = renderer.render(links:, extras:).html_safe
72
+ renderer = Decidim::ContentRenderers::BlobRenderer.new(text)
73
+ text = renderer.render.html_safe
77
74
 
78
75
  text = Decidim::ContentRenderers::LinkRenderer.new(text).render if links
79
76
  text
@@ -25,35 +25,34 @@ module Decidim
25
25
 
26
26
  # Render the problem title
27
27
  #
28
- # links - should render hashtags as links?
29
- # extras - should include extra hashtags?
28
+ # html_escape - should escape the HTML special characters?
30
29
  #
31
30
  # Returns a String.
32
- def title(links: false, extras: true, html_escape: false)
31
+ def title(html_escape: false)
33
32
  text = translated_attribute(problem.title)
34
33
  text = decidim_html_escape(text) if html_escape
35
34
 
36
- renderer = Decidim::ContentRenderers::HashtagRenderer.new(text)
37
- renderer.render(links:, extras:).html_safe
35
+ renderer = Decidim::ContentRenderers::BlobRenderer.new(text)
36
+ renderer.render.html_safe
38
37
  end
39
38
 
40
- def id_and_title(links: false, extras: true, html_escape: false)
41
- "##{problem.id} - #{title(links:, extras:, html_escape:)}"
39
+ def id_and_title(html_escape: false)
40
+ "##{problem.id} - #{title(html_escape:)}"
42
41
  end
43
42
 
44
43
  # Render the problem description
45
44
  #
46
- # links - should render hashtags as links?
47
- # extras - should include extra hashtags?
45
+ # links - should render URLs as links?
46
+ # strip_tags - should remove the HTML tags?
48
47
  #
49
48
  # Returns a String.
50
- def description(links: false, extras: true, strip_tags: false)
49
+ def description(links: false, strip_tags: false)
51
50
  text = translated_attribute(problem.description)
52
51
 
53
52
  text = strip_tags(sanitize_text(text)) if strip_tags
54
53
 
55
- renderer = Decidim::ContentRenderers::HashtagRenderer.new(text)
56
- text = renderer.render(links:, extras:).html_safe
54
+ renderer = Decidim::ContentRenderers::BlobRenderer.new(text)
55
+ text = renderer.render.html_safe
57
56
 
58
57
  text = Decidim::ContentRenderers::LinkRenderer.new(text).render if links
59
58
  text