Auction index refactor layout

master
E. Almqvist 3 years ago
parent ddb7beebee
commit 0d4a1ee7d7
  1. 4
      src/lib/db_models.rb
  2. 4
      src/routes/auction.rb
  3. 25
      src/views/auction/index.slim
  4. 2
      src/views/auction/view.slim
  5. 53
      src/views/stylesheets/style.sass

@ -322,10 +322,10 @@ class Auction < EntityModel
def self.compose_query_filters(title=nil, categories=nil, price_rng=nil, expired=nil) def self.compose_query_filters(title=nil, categories=nil, price_rng=nil, expired=nil)
querystr = "SELECT * FROM Auction " querystr = "SELECT * FROM Auction "
querystr += "WHERE " if title or categories or price_rng or expired querystr += "WHERE " if (title and title.length != 0) or categories or price_rng or expired
filters = [] filters = []
filters << "LIKE '%#{title}%'" if title filters << "title LIKE '%#{title}%'" if title and title.length != 0
filters << "price BETWEEN #{price_rng[0]} AND #{price_rng[1]}" if price_rng && price_rng.length == 2 filters << "price BETWEEN #{price_rng[0]} AND #{price_rng[1]}" if price_rng && price_rng.length == 2
filters << "end_time < #{Time.now.to_i}" if !expired.nil? filters << "end_time < #{Time.now.to_i}" if !expired.nil?

@ -4,12 +4,10 @@ get "/auctions" do
#categories = (params[:categories].split ",").map {|id| id.to_i} #categories = (params[:categories].split ",").map {|id| id.to_i}
#price_rng = (params[:price_rng].split "-").map {|p| p.to_i} #price_rng = (params[:price_rng].split "-").map {|p| p.to_i}
expired = params[:expired] expired = params[:expired]
p "#####"
p expired
p "#####"
# TODO FIX THIS # TODO FIX THIS
auctions = Auction.search title #, categories, price_rng, expired auctions = Auction.search title #, categories, price_rng, expired
p auctions
serve :"auction/index", {auctions: auctions} serve :"auction/index", {auctions: auctions}
end end

@ -1,6 +1,6 @@
.content-container .content-container
#auctions #auctions
aside aside.card
h2 Search Filters h2 Search Filters
.form-container .form-container
form action="/auctions" method="get" form action="/auctions" method="get"
@ -15,14 +15,17 @@
label Expired? label Expired?
input type="submit" value="Search" input type="submit" value="Search"
article a.button href="/auctions" = "Clear Filters"
h2 Results
ul article.card
- auctions.each do |auction| h2 Results
li ul.list-container
a href="/auctions/#{auction.id}" - auctions.each do |auction|
| #{auction.title} li
- if auction.end_time and auction.end_time - Time.now.to_i <= 0 a href="/auctions/#{auction.id}"
span.red div style="background-image: url(#{auction.images[0].url})"
| [Expired] h3
| #{auction.title}
- if auction.end_time and auction.end_time - Time.now.to_i <= 0
span.red
| [Expired]

@ -51,7 +51,7 @@
input type="submit" value="Bid" input type="submit" value="Bid"
#auctionbid-container #auctionbid-container
h2 Bid History h2.tcenter Bid History
- if auction.bids.length >= 1 - if auction.bids.length >= 1
ul.list-container.card-container ul.list-container.card-container
- auction.bids.reverse_each do |bid| - auction.bids.reverse_each do |bid|

@ -330,7 +330,7 @@ ul.list-container
width: inherit width: inherit
h2 h2
text-align: left text-align: left
padding: 0 .8rem //padding: 0 .8rem
margin: 0 margin: 0
border-bottom: $border_size solid $shadow_clr border-bottom: $border_size solid $shadow_clr
font-size: 1rem font-size: 1rem
@ -447,12 +447,57 @@ ul.list-container
margin-left: 1rem margin-left: 1rem
// Auctions // Auctions
#auctions
display: flex
flex-direction: row
justify-content: center
height: inherit
width: 80%
padding: 2rem
a.button
border: $border_size solid $shadow_clr
border-radius: $border_radius
article
height: 90%
ul
height: 100%
li:hover
border: $border_size solid $special_clr
cursor: pointer
li
margin-top: 1.2rem
padding: 2px
border: $border_size solid $border_clr
border-radius: $border_radius
transition: .2s border
a
display: flex
text-decoration: none
color: $fg_clr
flex-direction: row
div
border-radius: $border_radius
width: 12rem
height: 8rem
background-repeat: no-repeat
background-position: center
background-size: cover
aside
width: 40rem
margin-right: 4rem
.form-container
form
padding: 0
width: inherit
#auctions_new #auctions_new
display: grid display: grid
#auctions
display: flex
flex-direction: column
#auction-view #auction-view
display: grid display: grid

Loading…
Cancel
Save