diff --git a/app/assets/stylesheets/search/enteprise_search.css.scss b/app/assets/stylesheets/search/enteprise_search.css.scss index 8756c84300..23f4842bf8 100644 --- a/app/assets/stylesheets/search/enteprise_search.css.scss +++ b/app/assets/stylesheets/search/enteprise_search.css.scss @@ -8,16 +8,4 @@ font-size: 0.8em; color: #b7b7b7; } - - a { - &:link { - color: #000; - } - &:visited { - color: #000; - } - &:hover { - color: $primary-color; - } - } } \ No newline at end of file diff --git a/app/assets/stylesheets/search/foundation_and_overrides.scss b/app/assets/stylesheets/search/foundation_and_overrides.scss index 14257601a8..0067405845 100644 --- a/app/assets/stylesheets/search/foundation_and_overrides.scss +++ b/app/assets/stylesheets/search/foundation_and_overrides.scss @@ -1300,9 +1300,24 @@ $topbar-link-font-size: emCalc(16); // $topbar-sticky-class: ".sticky"; + +@import 'foundation'; + textarea { min-height: emCalc(120) !important; } -@import 'foundation'; +a { + &:link { + color: #000; + } + + &:visited { + color: #000; + } + + &:hover { + color: $primary-color; + } +} diff --git a/app/assets/stylesheets/search/home.css.scss b/app/assets/stylesheets/search/home.css.scss index 0101aa1fbb..754db09702 100644 --- a/app/assets/stylesheets/search/home.css.scss +++ b/app/assets/stylesheets/search/home.css.scss @@ -30,6 +30,18 @@ @include button($padding, $bg, $radius, $full-width, $disabled, $is-input); } + + a { + &:link { + color: #FFF; + } + &:visited { + color: #FFF; + } + &:hover { + color: $primary-color; + } + } } .backstretch img { @@ -45,18 +57,6 @@ height: 100%; } -a { - &:link { - color: #FFF; - } - &:visited { - color: #FFF; - } - &:hover { - color: $primary-color; - } -} - #home-page-nav { ul { diff --git a/app/assets/stylesheets/search/products.css.scss b/app/assets/stylesheets/search/products.css.scss new file mode 100644 index 0000000000..117a70dcde --- /dev/null +++ b/app/assets/stylesheets/search/products.css.scss @@ -0,0 +1,8 @@ +@import "foundation/variables"; +@import "foundation/components/global"; + +.products { + margin: 0, emCalc(20); + border: 1px solid black; + padding: emCalc(10); +} \ No newline at end of file diff --git a/app/controllers/enterprises_controller.rb b/app/controllers/enterprises_controller.rb index 7826711925..348f385982 100644 --- a/app/controllers/enterprises_controller.rb +++ b/app/controllers/enterprises_controller.rb @@ -32,6 +32,19 @@ class EnterprisesController < BaseController @products = @searcher.retrieve_products end + # essentially the new 'show' action that renders non-spree view + # will need to be renamed into show once the old one is removed + def shop_front + options = {:enterprise_id => params[:id]} + options.merge(params.reject { |k,v| k == :id }) + + @enterprise = Enterprise.find params[:id] + + @searcher = Spree::Config.searcher_class.new(options) + @products = @searcher.retrieve_products + render :layout => "landing_page" + end + def search @suburb = Suburb.find(params[:suburb_id]) if params[:suburb_id].present? @enterpsises = Enterprise.find_near(@suburb) diff --git a/app/views/enterprises/search.html.haml b/app/views/enterprises/search.html.haml index 43eced047f..1071d79ee4 100644 --- a/app/views/enterprises/search.html.haml +++ b/app/views/enterprises/search.html.haml @@ -10,7 +10,7 @@ - @enterpsises.each do |enterprise| .row.search-result .large-12.columns - = link_to enterprise.name, enterprise_path(enterprise) + = link_to enterprise.name, shop_front_enterprise_path(enterprise.id) %span.secondary-info= "#{enterprise.city}, #{enterprise.state_name}" .large-8.columns = gmaps4rails(@enterprises_json) diff --git a/app/views/enterprises/shop_front.html.haml b/app/views/enterprises/shop_front.html.haml new file mode 100644 index 0000000000..79364d368a --- /dev/null +++ b/app/views/enterprises/shop_front.html.haml @@ -0,0 +1,15 @@ +.row + .large-12.columns + %h2= @enterprise.name +.row + .large-12.columns= @enterprise.long_description.andand.html_safe + +.row + .large-12.columns + .products + - @products.each_slice(4).to_a.each do |products_row| + .row + - products_row.each do |product| + .large-4.columns.centered + .clearfix= link_to small_image(product), product + = link_to product.name, product diff --git a/config/routes.rb b/config/routes.rb index 5df9bf20dd..b3889b2277 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -2,9 +2,15 @@ Openfoodweb::Application.routes.draw do root :to => 'spree/home#index' resources :enterprises do - get :suppliers, :on => :collection - get :distributors, :on => :collection - post :search, :on => :collection + collection do + get :suppliers + get :distributors + post :search + end + + member do + get :shop_front + end end resources :suburbs