diff --git a/app/assets/javascripts/admin/products/products.js.coffee b/app/assets/javascripts/admin/products/products.js.coffee index 1952c8dded..402db8b7ff 100644 --- a/app/assets/javascripts/admin/products/products.js.coffee +++ b/app/assets/javascripts/admin/products/products.js.coffee @@ -1 +1 @@ -angular.module("admin.products", ["admin.utils"]) \ No newline at end of file +angular.module("admin.products", ["textAngular", "admin.utils"]) \ No newline at end of file diff --git a/app/assets/javascripts/templates/product_modal.html.haml b/app/assets/javascripts/templates/product_modal.html.haml index 4b21c054a4..8eeab88a0f 100644 --- a/app/assets/javascripts/templates/product_modal.html.haml +++ b/app/assets/javascripts/templates/product_modal.html.haml @@ -17,6 +17,7 @@ %div{"ng-if" => "product.description"} %hr %p.text-small{"ng-bind" => "::product.description"} + {{product.description}} %hr .columns.small-12.large-6 diff --git a/app/assets/stylesheets/admin/openfoodnetwork.css.scss b/app/assets/stylesheets/admin/openfoodnetwork.css.scss index 4b5703d317..4c16feb3c0 100644 --- a/app/assets/stylesheets/admin/openfoodnetwork.css.scss +++ b/app/assets/stylesheets/admin/openfoodnetwork.css.scss @@ -200,6 +200,13 @@ table#listing_enterprise_groups { // textAngular wysiwyg text-angular { + .ta-toolbar { + border: 1px solid #cdd9e4; + padding: 0.4em; + margin-bottom: -1px; + background-color: #f1f1f1; + border-radius: 0.25em 0.25em 0 0; + } .ta-scroll-window > .ta-bind { max-height: 400px; min-height: 100px; @@ -216,6 +223,7 @@ text-angular { margin-right: 8px; button { padding: 5px 10px; + margin-right: 0.25em; } } } diff --git a/app/overrides/spree/admin/products/_form/add_description_wysiwyg.html.haml.deface b/app/overrides/spree/admin/products/_form/add_description_wysiwyg.html.haml.deface new file mode 100644 index 0000000000..fca5a217d0 --- /dev/null +++ b/app/overrides/spree/admin/products/_form/add_description_wysiwyg.html.haml.deface @@ -0,0 +1,2 @@ +/ replace "[data-hook=admin_product_form_left] code[erb-loud]:contains('f.text_area :description')" + \ No newline at end of file diff --git a/app/overrides/spree/admin/products/new/replace_form.html.haml.deface b/app/overrides/spree/admin/products/new/replace_form.html.haml.deface index 3fd5a74cb1..73347a78ef 100644 --- a/app/overrides/spree/admin/products/new/replace_form.html.haml.deface +++ b/app/overrides/spree/admin/products/new/replace_form.html.haml.deface @@ -72,7 +72,7 @@ = f.field_container :description do = f.label :product_description, t(:product_description) %br/ - = f.text_area :description, class: 'fullwidth', rows: 3 + %text-angular{'id' => 'product_description', 'name' => 'product[description]', 'class' => 'text-angular', '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" } diff --git a/app/serializers/api/product_serializer.rb b/app/serializers/api/product_serializer.rb index aa353173dc..1e612f59f5 100644 --- a/app/serializers/api/product_serializer.rb +++ b/app/serializers/api/product_serializer.rb @@ -50,7 +50,7 @@ class Api::CachedProductSerializer < ActiveModel::Serializer has_one :supplier, serializer: Api::IdSerializer def description - strip_tags object.description + sanitize(object.description, options = {tags: "p, b, strong, em, i"}).html_safe end def properties_with_values