如何在rails will

编程入门 行业动态 更新时间:2024-10-21 06:43:59
如何在rails will_paginate中添加div类clearfix(How to add a div class clearfix in a rails will_paginate)

如何将<div class="clearfix visible-lg-block visible-md-block visible-sm-block"></div>添加到此代码中? 我遇到的问题是每个分页用户并不总是相同的高度,当高度关闭时,下一行会搞砸。 我需要在每行之后插入代码中的<div class="clearfix visible-lg-block visible-md-block visible-sm-block"></div>

<div class="row community"> <% @users.in_groups_of(3, false).each do |users| %> <% users.each do |user| %> <div class="col-md-4 col-sm-6 col-xs-6"> <div class="col-xs-12"> <center><p class="user-name"><%= link_to user.name, user %></p></center> </div> <div class="col-xs-4"> <div class="user-image"> <%= link_to image_tag(user.photo.thumb.url, class: "circular"), user %> </div> </div> <div class="col-xs-8 community"> <ul class="name-head"> <li class="witty"> <%= user.profile %> </li> <% if current_user == user %> <li class="update"><%= link_to "Update Your Bio", edit_user_path(current_user) %></li> <% end %> <li class="follow"> <% unless current_user == user %> <%= render partial: "follow_form", locals: { user: user } %> <% end %> </li> </ul> </div> <div class="col-xs-12"> <div class="following-list"> <div class="col-xs-4"> <a href="<%= following_user_path(user.id) %>"> <center><strong id="following" class:"stat"> <%= user.following.count %><br> following </strong></center> </a> </div> <div class="col-xs-4"> <a href="<%= followers_user_path(user.id) %>"> <center><strong id="followers" class="stat"> <%= user.followers.count %><br> followers </strong></center> </a> </div> <div class="col-xs-4"> <a href="<%= user_path(user.id) %>"> <center><strong id="photo-count" class="stat"> <%= user.photos.count %><br> photos </strong></center> </a> </div> </div> </div> </div> <% end %> <% end %> </div> <%= will_paginate @users %>

How do I add <div class="clearfix visible-lg-block visible-md-block visible-sm-block"></div> into this code? The problem I am having is that each paginated user will not always be the same height and when the heights are off the next row gets messed up. I need the <div class="clearfix visible-lg-block visible-md-block visible-sm-block"></div> to be inserted into the code after each row etc

<div class="row community"> <% @users.in_groups_of(3, false).each do |users| %> <% users.each do |user| %> <div class="col-md-4 col-sm-6 col-xs-6"> <div class="col-xs-12"> <center><p class="user-name"><%= link_to user.name, user %></p></center> </div> <div class="col-xs-4"> <div class="user-image"> <%= link_to image_tag(user.photo.thumb.url, class: "circular"), user %> </div> </div> <div class="col-xs-8 community"> <ul class="name-head"> <li class="witty"> <%= user.profile %> </li> <% if current_user == user %> <li class="update"><%= link_to "Update Your Bio", edit_user_path(current_user) %></li> <% end %> <li class="follow"> <% unless current_user == user %> <%= render partial: "follow_form", locals: { user: user } %> <% end %> </li> </ul> </div> <div class="col-xs-12"> <div class="following-list"> <div class="col-xs-4"> <a href="<%= following_user_path(user.id) %>"> <center><strong id="following" class:"stat"> <%= user.following.count %><br> following </strong></center> </a> </div> <div class="col-xs-4"> <a href="<%= followers_user_path(user.id) %>"> <center><strong id="followers" class="stat"> <%= user.followers.count %><br> followers </strong></center> </a> </div> <div class="col-xs-4"> <a href="<%= user_path(user.id) %>"> <center><strong id="photo-count" class="stat"> <%= user.photos.count %><br> photos </strong></center> </a> </div> </div> </div> </div> <% end %> <% end %> </div> <%= will_paginate @users %>

最满意答案

我不认为这可以使用bootstrap clearfix以及rails block functino / will_paginate。 一些选项是: clearfix每个第n个子节点或向包含div添加固定高度的css属性,这将使它们具有相同的大小。

I don't think this is possible to use the bootstrap clearfix along with the rails block functino/will_paginate. Some options are: clearfix every nth child or adding a fixed-height css property to the containing div which will make them the same size.

更多推荐

本文发布于:2023-08-01 15:55:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1361521.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:如何在   rails

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!