diff --git a/config.rb b/config.rb index 7a0dc38..9d1fa9c 100644 --- a/config.rb +++ b/config.rb @@ -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 = [ @@ -55,3 +62,6 @@ {}, {}, ] + +# Here you could load your week plan from another file +#require_relative './my_summer_plan' diff --git a/config/locales/de.yml b/config/locales/de.yml index 15d9da1..72f0a7e 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -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: [ @@ -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:" diff --git a/my_summer_plan.rb b/my_summer_plan.rb new file mode 100644 index 0000000..25532d3 --- /dev/null +++ b/my_summer_plan.rb @@ -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 + {}, +] diff --git a/one-on-one.rb b/one-on-one.rb index 982cf41..27c7849 100755 --- a/one-on-one.rb +++ b/one-on-one.rb @@ -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) @@ -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 diff --git a/planner.rb b/planner.rb index 91c3b96..3aee1a4 100755 --- a/planner.rb +++ b/planner.rb @@ -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 @@ -283,6 +286,10 @@ def daily_calendar_page pdf, date end end end + + + + end # Horizontal lines