Skip to content

Commit

Permalink
remove addional helper
Browse files Browse the repository at this point in the history
  • Loading branch information
microstudi committed Jan 31, 2024
1 parent ff7d8d4 commit f66aa76
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ module ApplicationHelper
include Decidim::Comments::CommentsHelper
include PaginateHelper
include ProposalVotesHelper
include ProposalPresenterHelper
include ::Decidim::EndorsableHelper
include ::Decidim::FollowableHelper
include Decidim::MapHelper
Expand Down Expand Up @@ -83,6 +82,38 @@ def minimum_votes_per_user_enabled?
minimum_votes_per_user.positive?
end

def not_from_collaborative_draft(proposal)
proposal.linked_resources(:proposals, "created_from_collaborative_draft").empty?
end

def not_from_participatory_text(proposal)
proposal.participatory_text_level.nil?
end

# If the proposal is official or the rich text editor is enabled on the
# frontend, the proposal body is considered as safe content; that's unless
# the proposal comes from a collaborative_draft or a participatory_text.
def safe_content?
(rich_text_editor_in_public_views? && not_from_collaborative_draft(@proposal)) ||
safe_content_admin?
end

# For admin entered content, the proposal body can contain certain extra
# tags, such as iframes.
def safe_content_admin?
(@proposal.official? || @proposal.official_meeting?) && not_from_participatory_text(@proposal)
end

# If the content is safe, HTML tags are sanitized, otherwise, they are stripped.
def render_proposal_body(proposal)
sanitized = render_sanitized_content(proposal, :body)
if safe_content?
Decidim::ContentProcessor.render_without_format(sanitized).html_safe
else
Decidim::ContentProcessor.render(sanitized, "div")
end
end

# Returns :text_area or :editor based on the organization' settings.
def text_editor_for_proposal_body(form)
options = {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module Proposals
class DiffRenderer < BaseDiffRenderer
include ActionView::Helpers::TextHelper
include ActionView::Helpers::TagHelper
include ProposalPresenterHelper
include ApplicationHelper
include SanitizeHelper

delegate :organization, to: :proposal, prefix: :current
Expand Down

0 comments on commit f66aa76

Please sign in to comment.