Skip to content

Commit

Permalink
Show the total number of entries on the homepage
Browse files Browse the repository at this point in the history
---

For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/parterburn/dabble.me?shareId=XXXX-XXXX-XXXX-XXXX).
  • Loading branch information
parterburn committed Oct 22, 2024
1 parent 2d85503 commit ea9b2bf
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/controllers/entries_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ def show
def latest
@title = "Latest Entry"
@lastest_entry = current_user.entries.includes(:inspiration).sort_by(&:date).last
@total_entries = Entry.count
end

def random
Expand Down
4 changes: 4 additions & 0 deletions app/views/entries/latest.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@
Here's your latest entry...
%br

.col-md-8.col-md-offset-1
%h4
Total number of entries: #{format_number(@total_entries)}

.col-md-8.well.entry.col-md-offset-1{id: "entry-#{@lastest_entry.id}"}
= render :partial => 'entries/entry', :locals => {:entry => @lastest_entry}

Expand Down

0 comments on commit ea9b2bf

Please sign in to comment.