Auction: search frontend progress

master
E. Almqvist 3 years ago
parent bd29fb90a1
commit a2d0989bda
  1. 8
      src/app.rb
  2. 2
      src/db_models.rb
  3. 5
      src/views/auction/index.slim

@ -154,7 +154,13 @@ end
# Auction stuff
get "/auctions" do
serve :"auction/index"
title = params[:title]
#categories = (params[:categories].split ",").map {|id| id.to_i}
#price_rng = (params[:price_rng].split "-").map {|p| p.to_i}
isopen = params[:isopen]
auctions = Auction.search title#, categories, price_rng, isopen
serve :"auction/index", {auctions: auctions}
end
get "/auctions/new" do

@ -236,7 +236,7 @@ class Auction < EntityModel
def self.compose_query_filters(title=nil, categories=nil, price_rng=nil, isopen=nil)
querystr = "SELECT * FROM Auction "
querystr += "WHERE " if title or categories or price_rng or time_left
querystr += "WHERE " if title or categories or price_rng or isopen
filters = []
filters << "LIKE '%#{title}%'" if title

@ -15,3 +15,8 @@
input type="submit" value="Search"
article
h2 Results
ul
- auctions.each do |auction|
li
| #{auction["title"]}

Loading…
Cancel
Save