mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-01 02:03:22 +00:00
Merge pull request #3799 from idanceinbetween/product-description-field-text-formatting-3757
added buttons to form and updated sanitizer to allow extra formatting
This commit is contained in:
@@ -1 +1 @@
|
||||
angular.module("admin.products", ["textAngular", "admin.utils"])
|
||||
angular.module("admin.products", ["textAngular", "admin.utils"])
|
||||
|
||||
@@ -55,7 +55,7 @@ class Api::CachedProductSerializer < ActiveModel::Serializer
|
||||
|
||||
#return a sanitized html description
|
||||
def description_html
|
||||
d = sanitize(object.description, tags: "p, b, strong, em, i")
|
||||
d = sanitize(object.description, tags: "p, b, strong, em, i, a, u", attributes: "href, target")
|
||||
d.to_s.html_safe
|
||||
end
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
= f.field_container :description do
|
||||
= f.label :description, t(:description)
|
||||
%text-angular{'id' => 'product_description', 'name' => 'product[description]', 'class' => 'text-angular', 'textangular-strip' => true, 'ta-paste' => "stripFormatting($html)", 'ta-toolbar' => "[['bold','italics','clear']]"}
|
||||
%text-angular{'id' => 'product_description', 'name' => 'product[description]', 'class' => 'text-angular', "textangular-links-target-blank" => true, 'ta-toolbar' => "[['bold','italics','underline','clear'],['insertLink']]"}
|
||||
= sanitize(@product.description)
|
||||
= f.error_message_on :description
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@
|
||||
= f.field_container :description do
|
||||
= f.label :product_description, t(:product_description)
|
||||
%br/
|
||||
%text-angular{'id' => 'product_description', 'name' => 'product[description]', 'class' => 'text-angular', 'textangular-strip' => true, 'ta-paste' => "stripFormatting($html)", 'ta-toolbar' => "[['bold','italics','clear']]"}
|
||||
%text-angular{'id' => 'product_description', 'name' => 'product[description]', 'class' => 'text-angular', "textangular-links-target-blank" => true, 'ta-toolbar' => "[['bold','italics','underline','clear'],['insertLink']]"}
|
||||
= f.error_message_on :description
|
||||
.four.columns.omega{ style: "text-align: center" }
|
||||
%fieldset.no-border-bottom{ id: "image" }
|
||||
|
||||
Reference in New Issue
Block a user