app/helpers/decidim/proposals/application_helper.rb in decidim-proposals-0.26.10 vs app/helpers/decidim/proposals/application_helper.rb in decidim-proposals-0.27.0.rc1
- old
+ new
@@ -38,16 +38,14 @@
state = proposal.internal_state if proposal.answered? && !proposal.published_state?
case state
when "accepted"
"text-success"
- when "rejected"
+ when "rejected", "withdrawn"
"text-alert"
when "evaluating"
"text-warning"
- when "withdrawn"
- "text-alert"
else
"text-info"
end
end
@@ -95,27 +93,16 @@
# 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?
+ ((@proposal.official? || @proposal.official_meeting?) && not_from_participatory_text(@proposal))
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
+ Decidim::ContentProcessor.render(render_sanitized_content(proposal, :body), "div")
end
# Returns :text_area or :editor based on the organization' settings.
def text_editor_for_proposal_body(form)
options = {
@@ -181,10 +168,10 @@
end
def filter_origin_values
origin_values = []
origin_values << TreePoint.new("official", t("decidim.proposals.application_helper.filter_origin_values.official")) if component_settings.official_proposals_enabled
- origin_values << TreePoint.new("citizens", t("decidim.proposals.application_helper.filter_origin_values.citizens"))
+ origin_values << TreePoint.new("participants", t("decidim.proposals.application_helper.filter_origin_values.participants"))
origin_values << TreePoint.new("user_group", t("decidim.proposals.application_helper.filter_origin_values.user_groups")) if current_organization.user_groups_enabled?
origin_values << TreePoint.new("meeting", t("decidim.proposals.application_helper.filter_origin_values.meetings"))
TreeNode.new(
TreePoint.new("", t("decidim.proposals.application_helper.filter_origin_values.all")),