Skip to content

Commit

Permalink
Make some changes to the daily packet header area
Browse files Browse the repository at this point in the history
  • Loading branch information
jonallured committed Nov 4, 2024
1 parent 4b490dd commit e0c6ed4
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
6 changes: 5 additions & 1 deletion app/models/daily_packet.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class DailyPacket < ApplicationRecord
validates :reading_list_pace, presence: true

def built_on_phrase
"#{built_on.to_fs}, week #{built_on.cweek}"
"#{built_on.to_fs}\nweek #{built_on.cweek}"
end

def feedbin_oldest_phrase
Expand All @@ -23,6 +23,10 @@ def feedbin_unread_phrase
"unread: #{feedbin_unread_count}"
end

def headline_phrase
"Daily Packet ##{id}"
end

def reading_list_phrase
"#{reading_list_pace} pages/day"
end
Expand Down
8 changes: 4 additions & 4 deletions app/models/daily_packet/pdf_view.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ def build
end

def draw_front_page
text "Daily Packet", style: :bold_italic, size: 42
text daily_packet.headline_phrase, style: :bold_italic, size: 42

move_up 34
move_up 45

text daily_packet.built_on_phrase, align: :right, size: 18
text daily_packet.built_on_phrase, align: :right, size: 14

stroke do
horizontal_rule
Expand All @@ -40,7 +40,7 @@ def draw_front_page
warm_fuzzy = daily_packet.warm_fuzzy
text warm_fuzzy.title, size: 16
text warm_fuzzy.body, size: 12
text "\n- #{warm_fuzzy.author}, #{warm_fuzzy.received_at.to_fs}", size: 12, align: :right
text "\n- #{warm_fuzzy.author}, #{warm_fuzzy.received_at.to_date.to_fs}", size: 12, align: :right

move_down 20

Expand Down
7 changes: 4 additions & 3 deletions spec/models/daily_packet/pdf_view_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,13 @@
page_one_strings, page_two_strings, page_three_strings = inspector.pages.map { |page| page[:strings] }

expect(page_one_strings).to eq([
"Daily Packet",
"07/07/2007, week 27",
"Daily Packet ##{daily_packet.id}",
"07/07/2007",
"week 27",
"Random Warm Fuzzy",
"Alright Haircut",
"Your haircut is adequate.",
"- Wife, 01/01/1970 12:00:00am",
"- Wife, 01/01/1970",
"Reading Pace",
"7.7 pages/day",
"Feedbin Stats",
Expand Down

0 comments on commit e0c6ed4

Please sign in to comment.