Implementing monthly billing description logic in required pages

This commit is contained in:
Rob Harrington
2015-10-28 11:40:01 +11:00
parent 5b72f53738
commit c1d04af5cc
5 changed files with 32 additions and 37 deletions

View File

@@ -0,0 +1,8 @@
angular.module("admin.enterprises").directive "monthlyPricingDescription", (monthlyBillDescription) ->
restrict: 'E'
scope:
joiner: "@"
template: "<span ng-bind-html='billDescription'></span>"
link: (scope, element, attrs) ->
joiners = { comma: ", ", newline: "<br>" }
scope.billDescription = monthlyBillDescription.replace("{joiner}", joiners[scope.joiner])

View File

@@ -15,7 +15,8 @@
%h3 Hub Shop
%p
%strong COST: 2% OF SALES, CAPPED AT $50 PER MONTH
%strong
%monthly-pricing-description{ joiner: "comma" }
%p Your enterprise is the backbone of your local food system. You aggregate produce from other enterprises and can sell it through your shop on the Open Food Network.
@@ -53,7 +54,8 @@
%h3 Producer Shop
%p
%strong COST: 2% OF SALES, CAPPED AT $50 PER MONTH
%strong
%monthly-pricing-description{ joiner: "comma" }
%p Sell your products directly to customers through your very own Open Food Network shopfront.
@@ -63,7 +65,8 @@
%h3 Producer Hub
%p
%strong COST: 2% OF SALES, CAPPED AT $50 PER MONTH
%strong
%monthly-pricing-description{ joiner: "comma" }
%p Your enterprise is the backbone of your local food system. You can sell your own produce as well as produce aggregated from other enterprises through your shopfront on the Open Food Network.
@@ -94,9 +97,7 @@
%h3 Hub Shop
%p Sell produce from others
.bottom
\2% OF SALES
%br
CAPPED AT $50 PER MONTH
%monthly-pricing-description{ joiner: "newline" }
%div{ ng: { switch: { when: "true" } } }
%a.button.selector.producer-profile{ ng: { click: "enterprise.owned && (enterprise.sells='none')", class: "{selected: enterprise.sells=='none', disabled: !enterprise.owned}" } }
@@ -109,17 +110,14 @@
%h3 Producer Shop
%p Sell your own produce
.bottom
\2% OF SALES
%br
CAPPED AT $50 PER MONTH
%monthly-pricing-description{ joiner: "newline" }
%a.button.selector.producer-hub{ ng: { click: "enterprise.owned && (enterprise.sells='any')", class: "{selected: enterprise.sells=='any', disabled: !enterprise.owned}" } }
.top
%h3 Producer Hub
%p Sell produce from self and others
.bottom
\2% OF SALES
%br
CAPPED AT $50 PER MONTH
%monthly-pricing-description{ joiner: "newline" }
%a.button.update.fullwidth{ ng: { show: "enterprise.owned", class: "{disabled: saved() && !saving, saving: saving}", click: "save()" } }
%span{ ng: {hide: "saved() || saving" } }

View File

@@ -1,5 +1,7 @@
module Admin
module InjectionHelper
include BusinessModelConfigurationHelper
def admin_inject_enterprise
admin_inject_json_ams "admin.enterprises", "enterprise", @enterprise, Api::Admin::EnterpriseSerializer
end
@@ -78,6 +80,10 @@ module Admin
admin_inject_json_ams_array "admin.orders", "orderCycles", @order_cycles, Api::Admin::BasicOrderCycleSerializer, current_user: spree_current_user
end
def admin_inject_monthly_bill_description
render partial: "admin/json/injection_ams", locals: {ngModule: "admin.enterprises", name: "monthlyBillDescription", json: monthly_bill_description.to_json}
end
def admin_inject_spree_api_key
render partial: "admin/json/injection_ams", locals: {ngModule: 'ofn.admin', name: 'SpreeApiKey', json: "'#{@spree_api_key.to_s}'"}
end

View File

@@ -1,4 +1,5 @@
= admin_inject_enterprise
= admin_inject_monthly_bill_description
= form_for @enterprise, url: main_app.register_admin_enterprise_path(@enterprise),
html: { name: "change_type", id: "change_type", novalidate: true, "ng-app" => "admin.enterprises", "ng-controller"=> 'changeTypeFormCtrl' } do |change_type_form|
@@ -16,9 +17,6 @@
.bottom ALWAYS FREE
%p.description
Add your products to Open Food Network, allowing hubs to stock your products in their stores.
%br
%br
Having a profile, and making connections within your local food system through the Open Food Network will always be free.
.producer_shop.option.one-third.column
%a.full-width.button.selector{ ng: { click: "sells='own'", class: "{selected: sells=='own'}" } }
@@ -26,17 +24,13 @@
%h3 Producer Shop
%p Sell your own produce
.bottom
\%2 OF SALES
%br
CAPPED AT $50 PER MONTH
%monthly-pricing-description{ joiner: "newline" }
%p.description
Sell your products directly to customers through your very own Open Food Network shopfront.
%br
%br
A Producer Shop is for your produce only, if you want to sell produce grown/produced off site, select 'Producer Hub'.
%br
%br
You will be billed for 2% of your actual transactions, capped at $50 a month (so if you dont sell anything you dont pay anything, but you never pay more than $50 a month).
.full_hub.option.one-third.column.omega
%a.full-width.button.selector{ ng: { click: "sells='any'", class: "{selected: sells=='any'}" } }
@@ -44,15 +38,10 @@
%h3 Producer Hub
%p Sell produce from self and others
.bottom
\%2 OF SALES
%br
CAPPED AT $50 PER MONTH
%monthly-pricing-description{ joiner: "newline" }
%p.description
Your enterprise is the backbone of your local food system. You can sell your own produce as well as produce aggregated from other enterprises through your shopfront on the Open Food Network.
%br
%br
You will be billed for 2% of your actual transactions, capped at $50 a month (so if you dont sell anything you dont pay anything, but you never pay more than $50 a month).
-# %p.description
-# Test out having your own shopfront with full access to all Shopfront features for 30 days.
@@ -69,9 +58,6 @@
.bottom ALWAYS FREE
%p.description
People can find and contact you on the Open Food Network. Your enterprise will be visible on the map, and will be searchable in listings.
%br
%br
Having a profile, and making connections within your local food system through the Open Food Network will always be free.
.full_hub.option.one-third.column
%a.full-width.button.selector{ ng: { click: "sells='any'", class: "{selected: sells=='any'}" } }
@@ -79,14 +65,10 @@
%h3 Hub Shop
%p Sell produce from others
.bottom
\%2 OF SALES
%br
CAPPED AT $50 PER MONTH
%monthly-pricing-description{ joiner: "newline" }
%p.description
Your enterprise is the backbone of your local food system. You aggregate produce from other enterprises and can sell it through your shop on the Open Food Network.
%br
%br
You will be billed for 2% of your actual transactions, capped at $50 a month (so if you dont sell anything you dont pay anything, but you never pay more than $50 a month).
.row

View File

@@ -8,6 +8,7 @@
%li#new_product_link
= button_link_to "New Enterprise", main_app.new_admin_enterprise_path, :icon => 'icon-plus', :id => 'admin_new_enterprise_link'
= admin_inject_monthly_bill_description
= render 'admin/shared/enterprises_sub_menu'
= render :partial => 'spree/shared/error_messages', :locals => { :target => @enterprise_set }