Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tried to merge alle changes and i18n for the Ooos #9

Open
wants to merge 19 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,18 @@
WINTER_SEMESTER_START = 10 # October

# Use these if you have sprints of a weekly interval
USE_SPRINTS = false
SPRINT_EPOCH = Date.parse('2023-01-04')
SPRINT_LENGTH = 14

# This is the defaul plan for a week
# Change it here or use a separate file to load it, if your week plan changes regularly

# Names by day of week, 0 is Sunday.
OOOS_BY_WDAY = [nil, nil, ['Juan'], ['Kelly'], nil, ['Alex', 'Edna'], nil]
# If you want to have your one on one pages laid out side by side, set this to true
OOOS_SIDE_BY_SIDE = false


# Repeating tasks by day of week, 0 is Sunday. Nested index is the row.
TASKS_BY_WDAY = [
Expand All @@ -55,3 +62,6 @@
{},
{},
]

# Here you could load your week plan from another file
#require_relative './my_summer_plan'
4 changes: 3 additions & 1 deletion config/locales/de.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
de:
date:
day_names: [Sonntag, Montag, Dienstag, Mittwoch, Donnerstag, Freitag, Samstag]
day_names:
[Sonntag, Montag, Dienstag, Mittwoch, Donnerstag, Freitag, Samstag]
abbr_day_names: [So, Mo, Di, Mi, Do, Fr, Sa]
month_names:
[
Expand Down Expand Up @@ -55,6 +56,7 @@ de:
content_outline: "Inhaltsübersicht"
semester_overview: "Semesterübersicht"
weekly_overview: "Wochenübersicht"

personal_notes: "Persönliches/Notizen:"
personal_notes_example: "(Partner, Kinder, Haustiere, Hobbies, Freunde, Vorgeschichte, etc.)"
their_update: "Ihr Update:"
Expand Down
33 changes: 33 additions & 0 deletions my_summer_plan.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
OOOS_BY_WDAY = [nil, nil, ['Alex', 'John', 'Marvin'], ['Tony', 'Jim'], nil, nil, nil]

TASKS_BY_WDAY = [
{ 0 => 'Plan your week' }, # Sunday
{ 0 => 'Trello', # Monday
15 => 'Emails'
},
{ 0 => 'Trello', # Tuesday
15 => 'Emails'
},
{ 0 => 'Trello', # Wednesday

15 => 'Emails'
},
{ 0 => 'Trello', # Thursday
15 => 'Emails'
},
{ 0 => 'Trello', # Friday
16 => 'Week-Shutdown'},
{ 0 => 'Sport' },
]


APPOINTMENTS_BY_WDAY = [
{},
# Montag
{9 => 'Plan this week', 18 => 'Gym'}, # Monday
{9 => 'Mails'},
{}, # Wednesday
{},
{16 => 'Weekly Wrapup'}, # Friday
{},
]
57 changes: 44 additions & 13 deletions one-on-one.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,12 @@ def one_on_one_page pdf, name, date
})

# Back of the page
begin_new_page pdf, :left
if (OOOS_SIDE_BY_SIDE)
begin_new_page pdf, :right
else
begin_new_page pdf, :left
end


pdf.grid([0, 0],[1, 1]).bounding_box do
pdf.text name, heading_format(align: :left)
Expand Down Expand Up @@ -79,28 +84,54 @@ def one_on_one_page pdf, name, date
pdf = init_pdf

options[:weeks].times do |week|
begin_new_page(pdf, :right) unless week.zero?
if (OOOS_SIDE_BY_SIDE)
begin_new_page(pdf, :left) unless week.zero?
else
begin_new_page(pdf, :right) unless week.zero?
end

monday = sunday.next_day(1)
next_sunday = sunday.next_day(7)
puts "Generating one-on-one forms for #{date_range(monday, next_sunday)}"

hole_punches pdf
#pdf = init_pdf
hole_punches pdf

OOOS_BY_WDAY
.each_with_index
.reject { |names, _| names.nil? }
.flat_map { |names, wday| names.map {|name| [name, sunday.next_day(wday)] } }
.sort_by { |name, date| "#{name}#{date.iso8601}" } # Sort by name or date, as you like
.each_with_index { |name_and_date, index|
# If you want to have your one on one pages laid out side by side,
# you need to add a blank or notes page in the beginning
## we add a notes page at the beginning to start on a left page
if OOOS_SIDE_BY_SIDE
heading_left = I18n.t('notes_heading')
notes_page pdf, heading_left
begin_new_page pdf, :left
end

OOOS_BY_WDAY
.each_with_index
.reject { |names, _| names.nil? }
.flat_map { |names, wday| names.map {|name| [name, sunday.next_day(wday)] } }
.sort_by { |name, date| "#{name}#{date.iso8601}" } # Sort by name or date, as you like
.each_with_index { |name_and_date, index|
if OOOS_SIDE_BY_SIDE
begin_new_page(pdf, :left) unless index.zero?
else
begin_new_page(pdf, :right) unless index.zero?
one_on_one_page(pdf, *name_and_date)
}
end
one_on_one_page(pdf, *name_and_date)
}

sunday = sunday.next_day(7)
end

puts "Saving to #{FILE_NAME}"
pdf.render_file FILE_NAME


# we add a notes page at the end to end on a left page, if in side by side mode
if OOOS_SIDE_BY_SIDE
begin_new_page pdf, :left
heading_left = I18n.t('notes_heading')
notes_page pdf, heading_left
end


puts "Saving to #{FILE_NAME}"
pdf.render_file FILE_NAME
11 changes: 9 additions & 2 deletions planner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -251,8 +251,11 @@ def daily_calendar_page pdf, date
left_header = I18n.l(date, format: :medium)
right_header = I18n.l(date, format: :weekday)
left_subhed = date.strftime("#{I18n.t('quarter', number: quarter(date))} #{I18n.t('week')} %W #{I18n.t('day')} %j")
# right_subhed = business_days_left_in_year(date)
right_subhed = business_days_left_in_sprint(date)
if (USE_SPRINTS)
right_subhed = business_days_left_in_sprint(date)
else
right_subhed = business_days_left_in_year(date)
end
pdf.grid([0, first_column],[1, 1]).bounding_box do
pdf.text left_header, heading_format(align: :left)
end
Expand Down Expand Up @@ -283,6 +286,10 @@ def daily_calendar_page pdf, date
end
end
end




end

# Horizontal lines
Expand Down