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
- Auction searching at index 40%
- Post editing
- User reviews
- Yardoc 50%

@ -350,7 +350,7 @@ class Auction < EntityModel
if ah_ids == [] then
ah_ids = Auction_Category_relation.category_auction_ids(catid) # first time then include all
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
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
.range-container
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:
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
input type="checkbox" name="expired" checked=("checked" if params[:expired] == "on")
@ -29,25 +29,29 @@
article.post-container.card
h2 Results
ul.list-container
- auctions.each do |auction|
li
a href="/auctions/#{auction.id}"
div style="background-image: url(#{auction.images[0].url})"
.info-container
h3
| #{auction.title}
- if auction.time_left > 0
| (
span.red
| #{auction.time_left_s}
| )
- if auction.end_time and auction.end_time - Time.now.to_i <= 0
span.red
| [Expired]
h4
| Posted by: #{auction.poster.name}
h4
| #{COINS_PREFIX}#{auction.current_bid}#{COINS_SUFFIX}
p
| #{auction.description}
- if auctions.length > 0
ul.list-container
- auctions.each do |auction|
li
a href="/auctions/#{auction.id}"
div style="background-image: url(#{auction.images[0].url})"
.info-container
h3
| #{auction.title}
- if auction.time_left > 0
| (
span.red
| #{auction.time_left_s}
| )
- if auction.end_time and auction.end_time - Time.now.to_i <= 0
span.red
| [Expired]
h4
| Posted by: #{auction.poster.name}
h4
| #{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
width: 100%
h3.tcenter
opacity: .4
font-weight: normal
margin: 42% 0
#settings
form
@ -481,9 +475,9 @@ ul.list-container
border-radius: $border_radius
aside.card
width: 40rem
width: 20rem
margin-right: 4rem
margin-top: 8rem
margin-top: 4rem
.form-container
form
padding: 0
@ -491,6 +485,13 @@ ul.list-container
article.post-container
height: 90%
width: 50rem
h3.tcenter
opacity: .4
font-weight: normal
margin: 42% 0
ul
height: 100%

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

Loading…
Cancel
Save