Skip to content

Commit 49b3d65

Browse files
committed
Show message when no transactions are present
1 parent 3c78191 commit 49b3d65

1 file changed

Lines changed: 16 additions & 12 deletions

File tree

app/views/budgets/_budget.html.erb

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -80,18 +80,22 @@
8080
</div>
8181
</div>
8282
<ul class="divide-y divide-gray-500/20">
83-
<% budget.category.transactions.each do |item| %>
84-
<li class="flex justify-between items-center py-3">
85-
<strong class="text-gray-900 font-bold text-xs"><%= item.name %></strong>
86-
<div class="flex flex-col items-end">
87-
<span class="text-gray-900 font-bold text-xs">
88-
$<%= item.amount %>
89-
</span>
90-
<small class="text-gray-500 text-xs">
91-
<%= item.date.strftime("%d %b %Y") %>
92-
</small>
93-
</div>
94-
</li>
83+
<% if budget.category.transactions.size < 1 %>
84+
<li class="text-gray-500 text-sm text-center py-3">No transactions yet</li>
85+
<% else %>
86+
<% budget.category.transactions.each do |item| %>
87+
<li class="flex justify-between items-center py-3">
88+
<strong class="text-gray-900 font-bold text-xs"><%= item.name %></strong>
89+
<div class="flex flex-col items-end">
90+
<span class="text-gray-900 font-bold text-xs">
91+
$<%= item.amount %>
92+
</span>
93+
<small class="text-gray-500 text-xs">
94+
<%= item.date.strftime("%d %b %Y") %>
95+
</small>
96+
</div>
97+
</li>
98+
<% end %>
9599
<% end %>
96100
</ul>
97101
</div>

0 commit comments

Comments
 (0)