-
Notifications
You must be signed in to change notification settings - Fork 2
Custom Fields
In this example, we'll add 3 dynamic skills to list in a bullet point list.
If you want your skills list to be static (same for every resume), then edit your .odt template directly, just as you would if you were editing a Word Document.
If you want to be prompted to enter new skills during the resume creation process, follow the instructions below.
To add custom variables, head to classes/controller.rb
This line:
resgen = ODFReport::Report.new(@config['coverpath']) do |merge|
Is the start of the custom PDF. merge is the variable to pay attention to, as it creates the loop that is sent off to the PDF creator.
Look for this comment:
# pass it to the writer doc - if you want to further customize your cover sheet, follow suit with the variables below
Copy (notice merge is present?):
merge.add_field :position, "#{position}"
Below the above line, add the following:
merge.add_field :skill1, "#{skill1}"
merge.add_field :skill2, "#{skill2}"
merge.add_field :skill3, "#{skill3}"
To add custom verbiage to your prompt, head to the view class
Follow the existing structure and create a new method (just make sure it's within the class and not after the outer end or before the initial class definition):
def skill1
puts green("Enter a skill to highlight:")
end
def skill2
puts green("Another skill:")
end
def skill3
puts green("And one more skill:")
end
We're going to head back to the controller class
Beneath:
# make sure this is a new application
@model.checkdir employer_dir
We're going to add our new prompts. I recommend doing so after this employer check, otherwise you'll waste time filling everything out only to find out this is an employer you've applied to before.
Add the following:
@view.skill1
skill1 = gets.chomp
@view.skill2
skill2 = gets.chomp
@view.skill3
skill3 = gets.chomp
Remember merge.add_field :skill1, "#{skill1}"
from earlier? The :skill1
is what we need to add to our template.
skill1
translates to [SKILL1]
that needs to be added to your .odt template in order to be modified dynamically. Follow suit for any additional fields you're adding.
If you think others would find your new fields beneficial, please submit a pull request; improvements are welcome and appreciated!