Changing 'shop' column and panel to 'package'

This commit is contained in:
Rob Harrington
2015-06-11 09:46:13 +08:00
parent e3d7c00c8e
commit 5a08344812
7 changed files with 50 additions and 29 deletions

View File

@@ -0,0 +1,24 @@
angular.module("admin.enterprises").controller "EnterpriseIndexRowCtrl", ($scope) ->
$scope.producerText = ->
switch $scope.enterprise.is_primary_producer
when true
"Producer"
else
"Non-Producer"
$scope.packageText = ->
switch $scope.enterprise.is_primary_producer
when true
switch $scope.enterprise.sells
when "none"
"Profile"
when "own"
"Shop"
when "any"
"Hub"
else
switch $scope.enterprise.sells
when "none"
"Profile"
else
"Hub"

View File

@@ -8,6 +8,6 @@ angular.module("admin.enterprises").controller 'enterprisesCtrl', ($scope, Enter
$scope.columns = Columns.setColumns
name: { name: "Name", visible: true }
producer: { name: "Producer", visible: true }
shop: { name: "Shop", visible: true }
package: { name: "Package", visible: true }
status: { name: "Status", visible: true }
manage: { name: "Manage", visible: true }

View File

@@ -0,0 +1,2 @@
angular.module("admin.enterprises").controller 'indexPackagePanelCtrl', ($scope, $controller) ->
angular.extend this, $controller('indexPanelCtrl', {$scope: $scope})

View File

@@ -1,2 +0,0 @@
angular.module("admin.enterprises").controller 'indexShopPanelCtrl', ($scope, $controller) ->
angular.extend this, $controller('indexPanelCtrl', {$scope: $scope})

View File

@@ -1,5 +1,5 @@
.enterprise_shop_panel
%form{ name: "shop", id: "shop", novalidate: true, ng: { controller: 'indexShopPanelCtrl' } }
.enterprise_package_panel
%form{ name: "package", id: "package", novalidate: true, ng: { controller: 'indexPackagePanelCtrl' } }
-# Have to use hidden:'true' on this input rather than type:'hidden' as the latter seems to break ngPattern and therefore validation
%input{ hidden: "true", name: "sells", ng: { required: true, pattern: "/^(none|own|any)$/", value: "enterprise.sells"} }
%input{ hidden: "true", name: "producer_profile_only", ng: { required: "enterprise.is_primary_producer=='none'", disabled: "enterprise.is_primary_producer!='none'", value: "enterprise.producer_profile_only"} }
@@ -15,31 +15,29 @@
%p A Hub Profile gives you the ability to list your enterprise on the Open Food Network. Your enterprise will be visible on the map, and will be searchable in listings.
%p Profile enterprises cannot create products, and so are unable to trade with other enterprises through the Open Food Network.
.info{ ng: { show: "!enterprise.is_primary_producer && enterprise.sells=='any'" } }
%h3 Hub Shop
%p
%strong COST: %2 OF SALES, CAPPED AT $50 PER MONTH
%p A Full Shop enables an enterprise to aggregate produce and to sell it through a shop on the Open Food Network.
%p A Hub Shop enables an enterprise to aggregate produce from other enterprises and to sell it through a shop on the Open Food Network.
%p Hubs can take many forms, whether they be a food co-op, a buying group, a veggie-box program, or a local grocery store.
%p The Open Food Network aims to support as many hub models as possible, so no matter your situation, we want to provide the tools you need to run your organisation or local food business.
%p If you also want to sell your own products, you will need to switch this enterprise to be a producer.
-# Producer Info
.info{ ng: { show: "enterprise.is_primary_producer && enterprise.sells=='none' && enterprise.producer_profile_only==false" } }
%h3 No Shop
%h3 Profile Only
%p
%strong COST: ALWAYS FREE
%p If you prefer to focus on producing food, and want to leave the work of selling it to someone else, you won't require a shop on the Open Food Network.
%p Producers without a shop can still market their produce through the Open Food Network by connecting and trading with existing shops.
%p Producers with a profile can market their produce through the Open Food Network by connecting and trading with existing shops.
.info{ ng: { show: "enterprise.is_primary_producer && enterprise.sells=='own' && enterprise.producer_profile_only==false" } }
%h3 Producer Shop
@@ -66,19 +64,18 @@
%a.button.selector{ ng: { click: "enterprise.sells='none'", class: "{selected: enterprise.sells=='none'}" } }
.top
%h3 Profile Only
%p Sell through other shops
%p Connect through OFN
.bottom ALWAYS FREE
%a.button.selector{ ng: { click: "enterprise.sells='any'", class: "{selected: enterprise.sells=='any'}" } }
.top
%h3 Hub Shop
%p Sell through other shops
%p Sell produce from others
.bottom ALWAYS FREE
%div{ ng: { if: "enterprise.is_primary_producer"} }
%a.button.selector{ ng: { click: "enterprise.sells='none'", class: "{selected: enterprise.sells=='none'}" } }
.top
%h3 No Shop
%p Sell through other shops
%h3 Profile Only
.bottom ALWAYS FREE
%a.button.selector{ ng: { click: "enterprise.sells='own'", class: "{selected: enterprise.sells=='own'}" } }
.top
@@ -90,8 +87,8 @@
CAPPED AT $50 PER MONTH
%a.button.selector{ ng: { click: "enterprise.sells='any';", class: "{selected: enterprise.sells=='any'}" } }
.top
%h3 Hub Shop
%p Aggregate and sell produce
%h3 Producer Hub
%p Sell produce from self and others
.bottom
\%2 OF SALES
%br

View File

@@ -1,4 +1,4 @@
.enterprise_shop_panel, .enterprise_producer_panel {
.enterprise_package_panel, .enterprise_producer_panel {
padding: 20px 0px;
.error {

View File

@@ -41,27 +41,27 @@
.row{ ng: { show: "loaded() && filteredEnterprises.length > 0" }, bindonce: true }
%table.index#enterprises
%col.name{ width: "28%"}
%col.producer{ width: "18%"}
%col.shop{ width: "18%"}
%col.status{ width: "18%"}
%col.manage{ width: "18%"}
%col.name{ width: "28%", ng: { show: 'columns.name.visible' } }
%col.producer{ width: "18%", ng: { show: 'columns.producer.visible' }}
%col.package{ width: "18%", ng: { show: 'columns.package.visible' }}
%col.status{ width: "18%", ng: { show: 'columns.status.visible' }}
%col.manage{ width: "18%", ng: { show: 'columns.manage.visible' }}
%thead
%tr{ ng: { controller: "ColumnsCtrl" } }
%th.name{ ng: { show: 'columns.name.visible' } }
Name
%th.producer{ ng: { show: 'columns.producer.visible' } } Producer?
%th.shop{ ng: { show: 'columns.shop.visible' } } Shop?
%th.package{ ng: { show: 'columns.package.visible' } } Package
%th.status{ ng: { show: 'columns.status.visible' } } Status
%th.manage{ ng: { show: 'columns.manage.visible' } } Manage
%tbody{ :id => "e_{{enterprise.id}}", ng: { repeat: "enterprise in filteredEnterprises = ( allEnterprises | filter:{ name: quickSearch } )" } }
%tbody{ :id => "e_{{enterprise.id}}", ng: { repeat: "enterprise in filteredEnterprises = ( allEnterprises | filter:{ name: quickSearch } )", controller: 'EnterpriseIndexRowCtrl' } }
%tr.enterprise.panel-toggle-row{ object: "enterprise", ng: { class: { even: "'even'", odd: "'odd'"} } }
%td.name{ ng: { show: 'columns.name.visible' } }
%span{ bo: { bind: "enterprise.name" } }
%td.producer.panel-toggle.text-center{ ng: { show: 'columns.producer.visible' }, name: "producer" }
%h5{ ng: { bind: "enterprise.is_primary_producer ? 'Producer' : 'Non-Producer'" } }
%td.shop.panel-toggle.text-center{ ng: { show: 'columns.shop.visible' }, name: "shop" }
%h5{ ng: { bind: "enterprise.sells=='none' ? 'No Shop' : 'Shop'" } }
%h5{ ng: { bind: "producerText()" } }
%td.package.panel-toggle.text-center{ ng: { show: 'columns.package.visible' }, name: "package" }
%h5{ ng: { bind: "packageText()" } }
%td.status.panel-toggle.text-center{ ng: { show: 'columns.status.visible' }, name: "status" }
%h5 Status
%td.manage{ ng: { show: 'columns.manage.visible' } }
@@ -69,7 +69,7 @@
Manage
%i.icon-arrow-right
%tr.panel-row{ object: "enterprise", panels: "{producer: 'enterprise_producer', shop: 'enterprise_shop', status: 'enterprise_status'}" }
%tr.panel-row{ object: "enterprise", panels: "{producer: 'enterprise_producer', package: 'enterprise_package', status: 'enterprise_status'}" }