Skip to content

Commit d161026

Browse files
committed
added project stats in dashboard
1 parent db0f75d commit d161026

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

app/controllers/home_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
class HomeController < ApplicationController
22
def index
3-
@projects = current_user.projects.where(is_deleted: false).includes(:demo_picture_attachment, :latest_journal_entry)
3+
@projects = current_user.projects.where(is_deleted: false).includes(:demo_picture_attachment, :latest_journal_entry, :followers, :kudos)
44
@viral_projects = Project.where(viral: true, is_deleted: false)
55
.order_by_recent_journal
66
.limit(10)

app/views/home/_project.html.erb

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,27 @@
77
<div class="flex flex-col space-y-2 grow">
88
<%= link_to project_path(project), class: "grow" do %>
99
<p class="text-lg md:text-2xl font-rc-full"><%= project.title %></p>
10+
<div class="flex gap-3 text-xs md:text-sm opacity-75 mt-1">
11+
<span class="flex items-center gap-1">
12+
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-3.5">
13+
<path stroke-linecap="round" stroke-linejoin="round" d="M2.036 12.322a1.012 1.012 0 0 1 0-.639C3.423 7.51 7.36 4.5 12 4.5c4.64 0 8.573 3.007 9.963 7.178.07.207.07.431 0 .639C20.577 16.49 16.64 19.5 12 19.5c-4.64 0-8.573-3.007-9.963-7.178Z" />
14+
<path stroke-linecap="round" stroke-linejoin="round" d="M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z" />
15+
</svg>
16+
<%= pluralize(project.views_count, "view") %>
17+
</span>
18+
<span class="flex items-center gap-1">
19+
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-3.5">
20+
<path stroke-linecap="round" stroke-linejoin="round" d="M15 19.128a9.38 9.38 0 0 0 2.625.372 9.337 9.337 0 0 0 4.121-.952 4.125 4.125 0 0 0-7.533-2.493M15 19.128v-.003c0-1.113-.285-2.16-.786-3.07M15 19.128v.106A12.318 12.318 0 0 1 8.624 21c-2.331 0-4.512-.645-6.374-1.766l-.001-.109a6.375 6.375 0 0 1 11.964-3.07M12 6.375a3.375 3.375 0 1 1-6.75 0 3.375 3.375 0 0 1 6.75 0Zm8.25 2.25a2.625 2.625 0 1 1-5.25 0 2.625 2.625 0 0 1 5.25 0Z" />
21+
</svg>
22+
<%= pluralize(project.followers.size, "follower") %>
23+
</span>
24+
<span class="flex items-center gap-1">
25+
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-3.5">
26+
<path stroke-linecap="round" stroke-linejoin="round" d="M21 8.25c0-2.485-2.099-4.5-4.688-4.5-1.935 0-3.597 1.126-4.312 2.733-.715-1.607-2.377-2.733-4.313-2.733C5.1 3.75 3 5.765 3 8.25c0 7.22 9 12 9 12s9-4.78 9-12Z" />
27+
</svg>
28+
<%= pluralize(project.kudos.size, "kudo") %>
29+
</span>
30+
</div>
1031
<% if project.review_status.present? %>
1132
<p class="text-xs md:text-sm opacity-75 mt-1">
1233
Status: <%= project.review_status.titleize %>

0 commit comments

Comments
 (0)