From ee5cd599aa39e289ba14cd939471ad582b7845d1 Mon Sep 17 00:00:00 2001 From: Rohan Mitchell Date: Thu, 23 Oct 2014 16:33:17 +1100 Subject: [PATCH] Add basic details for the single enterprise dashboard --- app/helpers/enterprises_helper.rb | 7 +++ .../single_enterprise_dashboard.html.haml | 48 ++++++++++++++----- 2 files changed, 42 insertions(+), 13 deletions(-) diff --git a/app/helpers/enterprises_helper.rb b/app/helpers/enterprises_helper.rb index 89555d3b4f..a5bf2ca794 100644 --- a/app/helpers/enterprises_helper.rb +++ b/app/helpers/enterprises_helper.rb @@ -19,6 +19,13 @@ module EnterprisesHelper enterprises.map(&:name).sort.join(', ') end + def enterprise_type_name(enterprise) + # TODO: When we can distinguish between profiles and producers that supply only (without + # their own store), include it here. + enterprise.sells == 'none' ? 'profile' : 'shopfront' + end + + def enterprise_confirm_delete_message(enterprise) if enterprise.supplied_products.present? "This will also delete the #{pluralize enterprise.supplied_products.count, 'product'} that this enterprise supplies. Are you sure you want to continue?" diff --git a/app/views/spree/admin/overview/single_enterprise_dashboard.html.haml b/app/views/spree/admin/overview/single_enterprise_dashboard.html.haml index 31cdc72a0f..2ab69e8557 100644 --- a/app/views/spree/admin/overview/single_enterprise_dashboard.html.haml +++ b/app/views/spree/admin/overview/single_enterprise_dashboard.html.haml @@ -1,17 +1,39 @@ --# - if @enterprise.sells == "unconfirmed" --# %h1 Welcome to the Open Food Network +#enterprise + %h1= @enterprise.name + %h2= enterprise_type_name(@enterprise) + + -# We need an action to render the welcome template, that this button can link to + %button Change type + +#message + Message bar + +.row + .alpha.seven.columns + See your profile live on the Open Food Network map. + %br/ + -# Can we pass an anchor here to zoom to our enterprise? + = link_to "#{@enterprise.name} live", main_app.map_path + + .two.columns + + .seven.columns.omega + Change or tweak any of the details of your profile + %br/ + = link_to "Manage #{@enterprise.name}", main_app.edit_admin_enterprise_path(@enterprise) -- if @enterprise.is_primary_producer - // Basic Producer +.row + .alpha.seven.columns + - if can? :admin, Spree::Product + Add and manage products + %br/ + = link_to "Manage products", bulk_edit_admin_products_path - // Producer with Shopfront + .two.columns - // Coming soon - Full Hub - // Email us if you want this option - -- else - // Shop Profile - - // Coming soon - Full Hub - // Email us if you want this option + .seven.columns.omega + - if can? :admin, OrderCycle + Add and manage order cycles + %br/ + = link_to "Manage order cycles", main_app.admin_order_cycles_path