Auction search index refactor

master
E. Almqvist 3 years ago
parent 27fb2c344a
commit 3751b72c7d
  1. 1
      src/TODO.md
  2. 2
      src/lib/db_models.rb
  3. 0
      src/views/auction/edit.slim
  4. 52
      src/views/auction/index.slim
  5. 17
      src/views/stylesheets/style.sass
  6. 48
      src/views/user/profile.slim

@ -1,5 +1,4 @@
# TODO # TODO
- Auction searching at index 40%
- Post editing - Post editing
- User reviews - User reviews
- Yardoc 50% - Yardoc 50%

@ -350,7 +350,7 @@ class Auction < EntityModel
if ah_ids == [] then if ah_ids == [] then
ah_ids = Auction_Category_relation.category_auction_ids(catid) # first time then include all ah_ids = Auction_Category_relation.category_auction_ids(catid) # first time then include all
else else
ah_ids |= Auction_Category_relation.category_auction_ids(catid) # union ah_ids |= Auction_Category_relation.category_auction_ids(catid) # do union for all ids (prevent dupes)
end end
end end
filters << "id IN (#{ah_ids.join(", ")})" # check if the auction id is any of the ids calculated above filters << "id IN (#{ah_ids.join(", ")})" # check if the auction id is any of the ids calculated above

@ -10,9 +10,9 @@
label Price range label Price range
.range-container .range-container
label for="price-min" From: label for="price-min" From:
input type="number" name="min_price" value="#{params[:min_price].to_f >= 0 ? params[:min_price] : ""}" min="#{MIN_INIT_PRICE}" max="#{MAX_INIT_PRICE}" input type="number" name="min_price" value="#{params[:min_price]}" min="#{MIN_INIT_PRICE}" max="#{MAX_INIT_PRICE}"
label for="price-max" To: label for="price-max" To:
input type="number" name="max_price" value="#{params[:min_price].to_f >= 0 ? params[:min_price] : ""}" min="#{MIN_INIT_PRICE}" max="#{MAX_INIT_PRICE}" input type="number" name="max_price" value="#{params[:min_price]}" min="#{MIN_INIT_PRICE}" max="#{MAX_INIT_PRICE}"
.checkbox-container .checkbox-container
input type="checkbox" name="expired" checked=("checked" if params[:expired] == "on") input type="checkbox" name="expired" checked=("checked" if params[:expired] == "on")
@ -29,25 +29,29 @@
article.post-container.card article.post-container.card
h2 Results h2 Results
ul.list-container
- auctions.each do |auction| - if auctions.length > 0
li ul.list-container
a href="/auctions/#{auction.id}" - auctions.each do |auction|
div style="background-image: url(#{auction.images[0].url})" li
.info-container a href="/auctions/#{auction.id}"
h3 div style="background-image: url(#{auction.images[0].url})"
| #{auction.title} .info-container
- if auction.time_left > 0 h3
| ( | #{auction.title}
span.red - if auction.time_left > 0
| #{auction.time_left_s} | (
| ) span.red
- if auction.end_time and auction.end_time - Time.now.to_i <= 0 | #{auction.time_left_s}
span.red | )
| [Expired] - if auction.end_time and auction.end_time - Time.now.to_i <= 0
h4 span.red
| Posted by: #{auction.poster.name} | [Expired]
h4 h4
| #{COINS_PREFIX}#{auction.current_bid}#{COINS_SUFFIX} | Posted by: #{auction.poster.name}
p h4
| #{auction.description} | #{COINS_PREFIX}#{auction.current_bid}#{COINS_SUFFIX}
p
| #{auction.description}
- else
h3.tcenter No results :(

@ -429,12 +429,6 @@ ul.list-container
max-height: 50rem max-height: 50rem
width: 100% width: 100%
h3.tcenter
opacity: .4
font-weight: normal
margin: 42% 0
#settings #settings
form form
@ -481,9 +475,9 @@ ul.list-container
border-radius: $border_radius border-radius: $border_radius
aside.card aside.card
width: 40rem width: 20rem
margin-right: 4rem margin-right: 4rem
margin-top: 8rem margin-top: 4rem
.form-container .form-container
form form
padding: 0 padding: 0
@ -491,6 +485,13 @@ ul.list-container
article.post-container article.post-container
height: 90% height: 90%
width: 50rem
h3.tcenter
opacity: .4
font-weight: normal
margin: 42% 0
ul ul
height: 100% height: 100%

@ -43,28 +43,28 @@
#posts.card #posts.card
h2 Recent posts h2 Recent posts
- if user.auctions.length > 0 article.post-container.card
article.post-container.card - if user.auctions.length > 0
ul.list-container ul.list-container
- user.auctions.reverse.each do |auction| - user.auctions.reverse.each do |auction|
li li
a href="/auctions/#{auction.id}" a href="/auctions/#{auction.id}"
div style="background-image: url(#{auction.images[0].url})" div style="background-image: url(#{auction.images[0].url})"
.info-container .info-container
h3 h3
| #{auction.title} | #{auction.title}
- if auction.time_left > 0 - if auction.time_left > 0
| ( | (
span.red span.red
| #{auction.time_left_s} | #{auction.time_left_s}
| ) | )
- if auction.end_time and auction.end_time - Time.now.to_i <= 0 - if auction.end_time and auction.end_time - Time.now.to_i <= 0
span.red span.red
| [Expired] | [Expired]
h4 h4
| #{COINS_PREFIX}#{auction.current_bid}#{COINS_SUFFIX} | #{COINS_PREFIX}#{auction.current_bid}#{COINS_SUFFIX}
p p
| #{auction.description} | #{auction.description}
- else - else
h3.tcenter No activity yet... h3.tcenter No activity yet...

Loading…
Cancel
Save