Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change layout and number of tweets for 2 columns #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lambda/web/app/models/tweet.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class << self
def ranking
order_by_score_desc
.reject { |t| t.delete_flag }
.take(15)
.take(30)
end

def all
Expand Down
12 changes: 11 additions & 1 deletion lambda/web/app/public/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,21 @@ h1 {
}

.contents {
margin: 0 20%;
margin: 0 5%;
background: #fff;
display: flex;
justify-content: center;
}

.ranking {
flex-grow: 1;
border: 1rem #000 solid;
}

.ranking:first-child {
border-right: none;
}

.ranking-list {
border-bottom: 1rem #000 solid;
}
Expand Down
48 changes: 25 additions & 23 deletions lambda/web/app/views/index.erb
Original file line number Diff line number Diff line change
Expand Up @@ -15,30 +15,32 @@
<h1>FASHION CHECK RANKING</h1>
</header>
<div class="contents">
<ul class="ranking">
<% @tweets.each.with_index(1) do |tweet, i| %>
<li id="ranking<%= i %>" class="ranking-list">
<div class="ranking-body">
<div class="ranking-num">
<%= i %>
<% 2.times do |i| %>
<ul class="ranking">
<% @tweets[(15 * i)...(15 * (i + 1))].each.with_index(15 * i + 1) do |tweet, i| %>
<li id="ranking<%= i %>" class="ranking-list">
<div class="ranking-body">
<div class="ranking-num">
<%= i %>
</div>
<div class="ranking-fav">
<%= tweet.score %><span>FAV</span>
</div>
<div class="ranking-user">
<a href="<%= tweet.tweet_url %>">
<div class="ranking-user-img">
<img src="<%= tweet.image_url %>" alt="<%= tweet.account_id %>">
</div>
<div class="ranking-user-name">
@<%= tweet.account_id %>
</div>
</a>
</div>
</div>
<div class="ranking-fav">
<%= tweet.score %><span>FAV</span>
</div>
<div class="ranking-user">
<a href="<%= tweet.tweet_url %>">
<div class="ranking-user-img">
<img src="<%= tweet.image_url %>" alt="<%= tweet.account_id %>">
</div>
<div class="ranking-user-name">
@<%= tweet.account_id %>
</div>
</a>
</div>
</div>
</li>
<% end %>
</ul>
</li>
<% end %>
</ul>
<% end %>
</div>
<footer>
© ZOZO Technologies, Inc.
Expand Down