Skip to content

Commit 45e49f5

Browse files
committed
Fix part of publiclab#8542 Enhance Followers/Following Page
1 parent 56139e9 commit 45e49f5

File tree

3 files changed

+103
-19
lines changed

3 files changed

+103
-19
lines changed
+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
.follow-list{
2+
margin: -1px;
3+
list-style-type: none;
4+
}
5+
.follow-list .follow-img img{
6+
max-width: 100%;
7+
}
8+
.follow-list{
9+
margin: -1px;
10+
list-style-type: none;
11+
}
12+
.follow-list {
13+
padding: 0;
14+
}
15+
.follow-list > li {
16+
float: left;
17+
width: 50%;
18+
}
19+
.follow-list > li > a {
20+
display: block;
21+
text-decoration: none;
22+
color: #000;
23+
padding: 0.625rem;
24+
margin: 1px;
25+
background: #fff;
26+
}
27+
.follow-list > li > a:after,
28+
.follow-list > li > a:before {
29+
content: "";
30+
display: table;
31+
clear: both;
32+
}
33+
.follow-list .follow-img {
34+
float: left;
35+
width: 3rem;
36+
height: 3rem;
37+
overflow: hidden;
38+
background: #efeff4;
39+
}
40+
.follow-list .follow-info {
41+
margin-left: 3.625rem;
42+
}
43+
.follow-list .follow-info h4 {
44+
margin: 0.3125rem 0;
45+
font-size: 0.875rem;
46+
font-weight: 600;
47+
}
48+
.follow-list .follow-info p {
49+
color: #666;
50+
margin: 0;
51+
}
52+
53+
@media (max-width: 767px) {
54+
.follow-list > li {
55+
float: none;
56+
width: auto;
57+
}
58+
}

app/views/users/show_follow.html.erb

+44-19
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
<%= stylesheet_link_tag "show_follow" %>
2+
13
<div class="container">
24
<h3><%= @user.username %></h3>
35
<ul class="nav nav-tabs border-0">
@@ -9,22 +11,45 @@
911
</li>
1012
</ul>
1113
<% if @users.length > 0 %>
12-
<table class="table">
13-
<tbody>
14-
<% @users.each do |user| %>
15-
<tr class="followers-row">
16-
<td><%= link_to "<i class='fa fa-user-o'></i> #{user.username}".html_safe, user_path(user.username) %>
17-
</tr>
18-
<% end %>
19-
</table>
20-
<% if @pagy %>
21-
<%= raw pagy_bootstrap_nav @pagy %>
22-
<% else %>
23-
<%= will_paginate @users, renderer: WillPaginate::ActionView::BootstrapLinkRenderer %>
24-
<% end %>
25-
<% else %>
26-
<p class="pt-3 border-top">
27-
<%= @user.username %><%= @title === "Followers" ? " has no followers yet" : " is not following anyone yet" %>
28-
</p>
29-
<% end %>
30-
</div>
14+
15+
<div class="profile-container border-top p-2">
16+
<div class="row row-space-20">
17+
<div class="col-md-8">
18+
<div class="tab-content p-0">
19+
20+
<div class="tab-pane fade active show" id="profile-follows">
21+
22+
<ul class="follow-list clearfix">
23+
24+
<% @users.each do |user| %>
25+
26+
<li>
27+
28+
<%= link_to user_path(user.username) do %>
29+
<div class="follow-img"><img src="<%= user.profile_image %>" alt="" /></div>
30+
<div class="follow-info">
31+
<h4> <%= user.username %>
32+
</h4>
33+
<p><small><%= user.followers.where(status: 1).length %> followers, <%= user.following_users.where(status: 1).length %> following</small></p>
34+
</div>
35+
<% end %>
36+
</li>
37+
<% end %>
38+
39+
</ul>
40+
</div>
41+
</div>
42+
</div>
43+
</div>
44+
</br>
45+
<% if @pagy %>
46+
<%= raw pagy_bootstrap_nav @pagy %>
47+
</div>
48+
<% else %>
49+
<%= will_paginate @users, renderer: WillPaginate::ActionView::BootstrapLinkRenderer %>
50+
<% end %>
51+
<% else %>
52+
<p class="pt-3 border-top">
53+
<%= @user.username %><%= @title === "Followers" ? " has no followers yet" : " is not following anyone yet" %>
54+
</p>
55+
<% end %>

config/initializers/assets.rb

+1
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,5 @@
3939
'spam2.css',
4040
'spam2.js',
4141
'print_new.css',
42+
'show_follow.css',
4243
]

0 commit comments

Comments
 (0)