Skeleton for the search results.

This commit is contained in:
alexs
2013-08-08 11:42:45 +10:00
parent 44e06fe7fc
commit f45ed42bdb
5 changed files with 16 additions and 1 deletions

View File

@@ -31,4 +31,10 @@ class EnterprisesController < BaseController
@searcher = Spree::Config.searcher_class.new(options)
@products = @searcher.retrieve_products
end
def search
suburb = Suburb.find_by_postcode(params[:postcode])
@enterpsises = Enterprise.all
render :layout => "landing_page"
end
end

View File

@@ -65,6 +65,10 @@ class Enterprise < ActiveRecord::Base
count(distinct: true)
end
def self.search_near(suburb)
Enterprise.near [suburb.latitude, suburb.longitude]
end
def has_supplied_products_on_hand?
self.supplied_products.where('count_on_hand > 0').present?
end

View File

@@ -0,0 +1,4 @@
- @enterpsises.each do |enterprise|
.row
.large-12.columns
= enterprise.name

View File

@@ -5,7 +5,7 @@
.large-10.large-centered.columns
#postcode_select_box
.row
= form_tag do
= form_tag search_enterprises_path do
.large-10.columns
= text_field_tag :postcode, "", class: "right", placeholder: "Enter your postcode..."
.large-2.columns

View File

@@ -4,6 +4,7 @@ Openfoodweb::Application.routes.draw do
resources :enterprises do
get :suppliers, :on => :collection
get :distributors, :on => :collection
post :search, :on => :collection
end
namespace :admin do