Skip to content

Commit 75dc191

Browse files
authored
Fix : Blank Space when the User Has all private circuits CircuitVerse#2001 (CircuitVerse#2718)
* fix: blank space when user has all private circuits
1 parent a568dbd commit 75dc191

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

app/controllers/users/circuitverse_controller.rb

+2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ class Users::CircuitverseController < ApplicationController
1111
def index
1212
@profile = ProfileDecorator.new(@user)
1313
@projects = @user.rated_projects
14+
@is_admin = @current_user ? @profile.id == @current_user.id : false
15+
@public_projects_exist = @is_admin || @user.projects.open.exists?
1416
end
1517

1618
def edit; end

app/views/users/circuitverse/_dashboard.html.erb

+9
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
<% if public_projects_exist %>
12
<% projects.each do |project| %>
23
<% if policy(project).check_direct_view_access? %>
34
<div class="col-xs-12 col-sm-12 col-md-6 col-lg-4 users-circuits-column circuit-card-js">
@@ -33,3 +34,11 @@
3334
<% end %>
3435

3536
<% end %>
37+
<% else %>
38+
<div class="col-12">
39+
<div class="search-no-results-image">
40+
<%= image_tag "SVGs/noProject.svg", alt: "No result image" %>
41+
<h6><%= @user.name %> doesn't have any projects.</h6>
42+
</div>
43+
</div>
44+
<% end %>

app/views/users/circuitverse/index.html.erb

+2-2
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@
7676
</div>
7777
</div>
7878
<% else %>
79-
<%= render partial: "dashboard" , locals: {projects: @user.projects} %>
79+
<%= render partial: "dashboard" , locals: {projects: @user.projects, public_projects_exist: @public_projects_exist } %>
8080
<% end %>
8181
</div>
8282
<div id="favourite-circuits-div" class="row center-row circuit-page">
@@ -159,7 +159,7 @@
159159
};
160160

161161
const fuse = new Fuse(projectList, options);
162-
162+
163163
// on key up
164164
$('.users-circuits-search').keyup(() => {
165165
const searchQuery = $('.users-circuits-search').val().toLowerCase().trim();

0 commit comments

Comments
 (0)