jeudi 5 juillet 2018

Rails+Bootstrap - Display posts in a grid

I'm working on my project and exactly the section of articles. I want to display 8 articles on the main page (2 in a row) and the rest under them - as in the picture (sorry for this drawing)

drawing

Here is the code of this section with articles, they do not want to display after 2 in a row only one by one is

<section class="articles">
<div class="container" >
<% @posts.take(3).each do |post| %>
<div class="row">
<div class="col-md-6">
<figure>
<%= link_to image_tag post.image.url %>
<p class="title">
<figcaption><%= raw link_to post.title, post  %></figcaption>
<figure>
</p>
</div>
</div>
<% end %>
</div>
</section>

Aucun commentaire:

Enregistrer un commentaire