From d5df73c6a25183498d432d78bd0dcd1dce970f60 Mon Sep 17 00:00:00 2001 From: Rob Harrington Date: Wed, 17 Dec 2014 15:17:29 +1100 Subject: [PATCH] Duplicate create basic version of enterprise serializer for lists, make shopfront_message input use textangular --- app/helpers/admin/injection_helper.rb | 4 ++-- app/serializers/api/admin/basic_enterprise_serializer.rb | 4 ++++ app/serializers/api/admin/enterprise_serializer.rb | 4 ++-- .../admin/enterprises/form/_shop_preferences.html.haml | 7 +++---- app/views/shop/_messages.html.haml | 4 ++-- 5 files changed, 13 insertions(+), 10 deletions(-) create mode 100644 app/serializers/api/admin/basic_enterprise_serializer.rb diff --git a/app/helpers/admin/injection_helper.rb b/app/helpers/admin/injection_helper.rb index f01f9b9b01..ec03378ff0 100644 --- a/app/helpers/admin/injection_helper.rb +++ b/app/helpers/admin/injection_helper.rb @@ -5,8 +5,8 @@ module Admin end def admin_inject_enterprises - admin_inject_json_ams_array("ofn.admin", "my_enterprises", @my_enterprises, Api::Admin::EnterpriseSerializer) + - admin_inject_json_ams_array("ofn.admin", "all_enterprises", @all_enterprises, Api::Admin::EnterpriseSerializer) + admin_inject_json_ams_array("ofn.admin", "my_enterprises", @my_enterprises, Api::Admin::BasicEnterpriseSerializer) + + admin_inject_json_ams_array("ofn.admin", "all_enterprises", @all_enterprises, Api::Admin::BasicEnterpriseSerializer) end def admin_inject_enterprise_relationships diff --git a/app/serializers/api/admin/basic_enterprise_serializer.rb b/app/serializers/api/admin/basic_enterprise_serializer.rb new file mode 100644 index 0000000000..f060dc4166 --- /dev/null +++ b/app/serializers/api/admin/basic_enterprise_serializer.rb @@ -0,0 +1,4 @@ +class Api::Admin::BasicEnterpriseSerializer < ActiveModel::Serializer + attributes :name, :id, :is_primary_producer, :is_distributor, :sells, :category, :payment_method_ids, :shipping_method_ids + attributes :producer_profile_only +end diff --git a/app/serializers/api/admin/enterprise_serializer.rb b/app/serializers/api/admin/enterprise_serializer.rb index 37c7e9af27..174c5c4daa 100644 --- a/app/serializers/api/admin/enterprise_serializer.rb +++ b/app/serializers/api/admin/enterprise_serializer.rb @@ -1,4 +1,4 @@ class Api::Admin::EnterpriseSerializer < ActiveModel::Serializer attributes :name, :id, :is_primary_producer, :is_distributor, :sells, :category, :payment_method_ids, :shipping_method_ids - attributes :producer_profile_only, :email -end + attributes :producer_profile_only, :email, :long_description, :preferred_shopfront_message +end \ No newline at end of file diff --git a/app/views/admin/enterprises/form/_shop_preferences.html.haml b/app/views/admin/enterprises/form/_shop_preferences.html.haml index a3c4cc3379..2d23f2f335 100644 --- a/app/views/admin/enterprises/form/_shop_preferences.html.haml +++ b/app/views/admin/enterprises/form/_shop_preferences.html.haml @@ -3,7 +3,6 @@ .three.columns.alpha = f.label "preferred_shopfront_message", t(:shopfront_message) .eight.columns.omega - -# %text-angular{'ng-model' => 'longDescription', 'id' => 'enterprise_long_description', 'name' => 'enterprise[long_description]', 'class' => 'text-angular', - -# 'ta-toolbar' => "[['h1','h2','h3','h4','p'],['bold','italics','underline','clear'],['insertLink']]", - -# 'placeholder' => 'Tell customers about yourself. This information appears on your public profile.'} - = f.text_area :preferred_shopfront_message, rows: 6, class: "fullwidth", placeholder: "An option explanation for customers detailing how your shopfront works. This text will appear at the top of your shop page, immediately above your products." \ No newline at end of file + %text-angular{'ng-model' => 'Enterprise.preferred_shopfront_message', 'id' => 'enterprise_preferred_shopfront_message', 'name' => 'enterprise[preferred_shopfront_message]', 'class' => 'text-angular', + 'ta-toolbar' => "[['h1','h2','h3','h4','p'],['bold','italics','underline','clear'],['insertLink']]", + 'placeholder' => 'Tell customers about yourself. This information appears on your public profile.'} diff --git a/app/views/shop/_messages.html.haml b/app/views/shop/_messages.html.haml index 7a0a5af811..2cff1b30b5 100644 --- a/app/views/shop/_messages.html.haml +++ b/app/views/shop/_messages.html.haml @@ -2,9 +2,9 @@ .row .small-12.columns .shopfront_closed_message - = current_distributor.preferred_shopfront_message + = current_distributor.preferred_shopfront_message.html_safe - elsif current_distributor.preferred_shopfront_message.present? .row .small-12.columns .shopfront_message - = current_distributor.preferred_shopfront_message + = current_distributor.preferred_shopfront_message.html_safe