mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-01 02:03:22 +00:00
Fixed frontend HTML display
This commit is contained in:
committed by
Rob Harrington
parent
c43dea60b7
commit
b38eab11eb
@@ -14,10 +14,9 @@
|
||||
.filter-shopfront.property-selectors.inline-block
|
||||
%filter-selector{ 'selector-set' => "productPropertySelectors", objects: "[product] | propertiesWithValuesOf" }
|
||||
|
||||
%div{"ng-if" => "product.description"}
|
||||
%div{"ng-if" => "product.description_html"}
|
||||
%hr
|
||||
%p.text-small{"ng-bind" => "::product.description"}
|
||||
{{product.description}}
|
||||
%p.text-small{"ng-bind-html" => "product.description_html"}
|
||||
%hr
|
||||
|
||||
.columns.small-12.large-6
|
||||
|
||||
@@ -37,7 +37,7 @@ class Api::CachedProductSerializer < ActiveModel::Serializer
|
||||
include ActionView::Helpers::SanitizeHelper
|
||||
|
||||
attributes :id, :name, :permalink
|
||||
attributes :on_demand, :group_buy, :notes, :description
|
||||
attributes :on_demand, :group_buy, :notes, :description, :description_html
|
||||
attributes :properties_with_values
|
||||
|
||||
has_many :variants, serializer: Api::VariantSerializer
|
||||
@@ -49,8 +49,15 @@ class Api::CachedProductSerializer < ActiveModel::Serializer
|
||||
has_many :images, serializer: Api::ImageSerializer
|
||||
has_one :supplier, serializer: Api::IdSerializer
|
||||
|
||||
#return an unformatted descripton
|
||||
def description
|
||||
sanitize(object.description, options = {tags: "p, b, strong, em, i"}).html_safe
|
||||
strip_tags object.description
|
||||
end
|
||||
|
||||
#return a sanitized html description
|
||||
def description_html
|
||||
d = sanitize(object.description, options = {tags: "p, b, strong, em, i"})
|
||||
d.to_s.html_safe
|
||||
end
|
||||
|
||||
def properties_with_values
|
||||
|
||||
Reference in New Issue
Block a user