Skip to content
This repository has been archived by the owner on Jul 30, 2019. It is now read-only.

Commit

Permalink
Merge 14fc07b into 9d66dfb
Browse files Browse the repository at this point in the history
  • Loading branch information
gemfarmer committed May 18, 2016
2 parents 9d66dfb + 14fc07b commit 89a4fd5
Show file tree
Hide file tree
Showing 7 changed files with 78 additions and 7 deletions.
7 changes: 7 additions & 0 deletions app/assets/stylesheets/_uswds-grid-overrides.scss
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,10 @@ $small: new-breakpoint(min-width $small-screen 1);
.usa-grid-top-padding {
padding-top: 1.25em;
}


.usa-width-one-half {
&:nth-child(2n) {
@include omega();
}
}
27 changes: 24 additions & 3 deletions app/assets/stylesheets/blocks/_auction.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
.auction-wrapper {
display: flex;
-ms-flex-wrap: wrap;
-webkit-flex-wrap: wrap;
flex-wrap: wrap;
-ms-justify-content: space-between;
-webkit-justify-content: space-between;
justify-content: space-between;
}

textarea#auction_summary {
height: 150px;
width: 500px;
Expand All @@ -8,8 +18,6 @@ textarea#auction_description {
width: 500px;
}



.auction-description {
h1 {
margin-top: 0;
Expand Down Expand Up @@ -39,12 +47,20 @@ textarea#auction_description {
}

.issue-list-item {
border: 1px solid $color-gray-neutral;
background-color: $color-white;
border: 1px solid $color-gray-neutral;
border-radius: $border-radius;
display: flex !important;
-ms-flex-direction: column;
-webkit-flex-direction: column;
flex-direction: column;
font-weight: $font-light;
margin-bottom: $site-margins;

.issue-content-wrapper {
flex: 1 0 auto;
}

.issue-label {
margin-top: 0.75rem;
}
Expand All @@ -67,6 +83,7 @@ textarea#auction_description {
color: $color-white;
padding: $base-padding 3rem;
padding-bottom: 0;
width: 100%;

.current-bid-box {
position: relative;
Expand Down Expand Up @@ -126,6 +143,10 @@ textarea#auction_description {
&:last-of-type {
margin-right: 0;
}

span {
font-weight: $font-normal;
}
}

.issue-icon {
Expand Down
4 changes: 2 additions & 2 deletions app/views/auctions/_list_item.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div class='usa-width-one-whole issue-list-item'>
<div class="usa-grid">
<div class='usa-width-one-half issue-list-item'>
<div class="usa-grid issue-content-wrapper">
<div class='usa-width-one-whole issue-label'>
<h3 class='issue-title'>
<a href="<%= auction_path(auction) %>"><%= auction.title %></a> <span class="usa-label-big <%= auction.label_class %>"><%= auction.label %></span>
Expand Down
2 changes: 1 addition & 1 deletion app/views/auctions/_winning_bid.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<% if auction.bids? %>
<div class="issue-bids-info-item"><% if defined? for_winners_page %><% else %>
<div class="issue-bids-info-item">Winning bid: </div>
<span>Winning bid: </span>
<% end %><%= auction.highlighted_bid_amount_as_currency %></div>

<% else %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/auctions/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<section class="usa-grid">
<h2>Issues open for bid</h2>

<div class="usa-grid-full">
<div class="usa-grid-full auction-wrapper">
<%= render partial: @view_model.auctions_list_partial %>
</div>
</section>
4 changes: 4 additions & 0 deletions features/auctions.feature
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ Feature: Basic Auction Views
And I should see a "Bid" button
And there should be meta tags for the index page for 1 open and 0 future auctions

Scenario: Default ordering for the micropurchase homepage
When I visit the home page
Then the auction previews should be in descending order by end date timestamp

Scenario: Many auctions
Given there are many different auctions
When I visit the home page
Expand Down
39 changes: 39 additions & 0 deletions spec/controllers/auctions_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,45 @@
expect(auction).to be_a(AuctionViewModel)
expect(auction.id).to eq(auction_record.id)
end

context 'the list of auctions is sorted' do
it 'renders them descending by datetime' do

Timecop.freeze

date_start = Time.current - 3.days
date_latest = Time.current + 3.days
date_middle = Time.current + 2.days
date_first = Time.current + 1.days

auction_record_1 = create(
:auction,
start_datetime: date_start,
end_datetime: date_middle)

auction_record_2 = create(
:auction,
start_datetime: date_start,
end_datetime: date_latest)

auction_record_3 = create(
:auction,
start_datetime: date_start,
end_datetime: date_first)

get :index
auctions = assigns(:view_model).auctions

auction_1 = auctions[0]
auction_2 = auctions[1]
auction_3 = auctions[2]

expect(auction_1).to be_a(AuctionViewModel)
expect(auction_1.end_datetime).to eq(date_latest)
expect(auction_2.end_datetime).to eq(date_middle)
expect(auction_3.end_datetime).to eq(date_first)
end
end
end

describe '#show' do
Expand Down

0 comments on commit 89a4fd5

Please sign in to comment.