11 changed files with 234 additions and 101 deletions
@ -0,0 +1,42 @@ |
|||||
|
Trestle.resource(:cover_letters) do |
||||
|
menu do |
||||
|
item :cover_letters, icon: "fa fa-envelope", priority: 2 |
||||
|
end |
||||
|
|
||||
|
form do |item| |
||||
|
concat Trestle::Form::Automatic.new(admin).render(self, item) |
||||
|
# text_area :objective |
||||
|
end |
||||
|
|
||||
|
# Customize the table columns shown on the index view. |
||||
|
table do |
||||
|
column :company_name |
||||
|
column :title |
||||
|
column :user |
||||
|
column :created_at, align: :center |
||||
|
actions do |toolbar, instance, admin| |
||||
|
toolbar.edit if admin && admin.actions.include?(:edit) |
||||
|
toolbar.delete if admin && admin.actions.include?(:destroy) |
||||
|
toolbar.link 'Coverletter', instance, action: :generate_coverletter, method: :get, style: :primary, icon: "fa fa-file-pdf", target: "_blank" |
||||
|
end |
||||
|
end |
||||
|
|
||||
|
controller do |
||||
|
def generate_coverletter |
||||
|
cover_letter = admin.find_instance(params) |
||||
|
ac = ActionController::Base.new() |
||||
|
tex_content = ac.render_to_string(layout: false, template: 'templates/awesome/coverletter', locals: { "@cover_letter": cover_letter } ) |
||||
|
destination_dir = "#{Rails.root}/app/views/templates/awesome" |
||||
|
`cd #{destination_dir} && make clean` |
||||
|
File.open("#{destination_dir}/coverletter.tex", "w") do |f| |
||||
|
f << tex_content |
||||
|
end |
||||
|
`cd #{destination_dir} && make coverletter.pdf` |
||||
|
render file: "#{destination_dir}/coverletter.pdf", layout: false |
||||
|
end |
||||
|
end |
||||
|
|
||||
|
routes do |
||||
|
get :generate_coverletter, on: :member |
||||
|
end |
||||
|
end |
||||
@ -1,35 +1,9 @@ |
|||||
Trestle.resource(:education_entries) do |
Trestle.resource(:education_entries) do |
||||
menu do |
menu do |
||||
item :education_entries, icon: "fa fa-star" |
item :education_entries, icon: "fa fa-graduation-cap", priority: 4 |
||||
end |
end |
||||
|
|
||||
# Customize the table columns shown on the index view. |
form do |item| |
||||
# |
concat Trestle::Form::Automatic.new(admin).render(self, item) |
||||
# table do |
end |
||||
# column :name |
|
||||
# column :created_at, align: :center |
|
||||
# actions |
|
||||
# end |
|
||||
|
|
||||
# Customize the form fields shown on the new/edit views. |
|
||||
# |
|
||||
# form do |education_entry| |
|
||||
# text_field :name |
|
||||
# |
|
||||
# row do |
|
||||
# col { datetime_field :updated_at } |
|
||||
# col { datetime_field :created_at } |
|
||||
# end |
|
||||
# end |
|
||||
|
|
||||
# By default, all parameters passed to the update and create actions will be |
|
||||
# permitted. If you do not have full trust in your users, you should explicitly |
|
||||
# define the list of permitted parameters. |
|
||||
# |
|
||||
# For further information, see the Rails documentation on Strong Parameters: |
|
||||
# http://guides.rubyonrails.org/action_controller_overview.html#strong-parameters |
|
||||
# |
|
||||
# params do |params| |
|
||||
# params.require(:education_entry).permit(:name, ...) |
|
||||
# end |
|
||||
end |
end |
||||
|
|||||
@ -1,35 +1,9 @@ |
|||||
Trestle.resource(:skills) do |
Trestle.resource(:skills) do |
||||
menu do |
menu do |
||||
item :skills, icon: "fa fa-star" |
item :skills, icon: "fa fa-toolbox", priority: 5 |
||||
end |
end |
||||
|
|
||||
# Customize the table columns shown on the index view. |
form do |item| |
||||
# |
concat Trestle::Form::Automatic.new(admin).render(self, item) |
||||
# table do |
end |
||||
# column :name |
|
||||
# column :created_at, align: :center |
|
||||
# actions |
|
||||
# end |
|
||||
|
|
||||
# Customize the form fields shown on the new/edit views. |
|
||||
# |
|
||||
# form do |skill| |
|
||||
# text_field :name |
|
||||
# |
|
||||
# row do |
|
||||
# col { datetime_field :updated_at } |
|
||||
# col { datetime_field :created_at } |
|
||||
# end |
|
||||
# end |
|
||||
|
|
||||
# By default, all parameters passed to the update and create actions will be |
|
||||
# permitted. If you do not have full trust in your users, you should explicitly |
|
||||
# define the list of permitted parameters. |
|
||||
# |
|
||||
# For further information, see the Rails documentation on Strong Parameters: |
|
||||
# http://guides.rubyonrails.org/action_controller_overview.html#strong-parameters |
|
||||
# |
|
||||
# params do |params| |
|
||||
# params.require(:skill).permit(:name, ...) |
|
||||
# end |
|
||||
end |
end |
||||
|
|||||
@ -1,35 +1,5 @@ |
|||||
Trestle.resource(:work_experiences) do |
Trestle.resource(:work_experiences) do |
||||
menu do |
menu do |
||||
item :work_experiences, icon: "fa fa-star" |
item :work_experiences, icon: "fa fa-user-nurse", priority: 3 |
||||
end |
end |
||||
|
|
||||
# Customize the table columns shown on the index view. |
|
||||
# |
|
||||
# table do |
|
||||
# column :name |
|
||||
# column :created_at, align: :center |
|
||||
# actions |
|
||||
# end |
|
||||
|
|
||||
# Customize the form fields shown on the new/edit views. |
|
||||
# |
|
||||
# form do |work_experience| |
|
||||
# text_field :name |
|
||||
# |
|
||||
# row do |
|
||||
# col { datetime_field :updated_at } |
|
||||
# col { datetime_field :created_at } |
|
||||
# end |
|
||||
# end |
|
||||
|
|
||||
# By default, all parameters passed to the update and create actions will be |
|
||||
# permitted. If you do not have full trust in your users, you should explicitly |
|
||||
# define the list of permitted parameters. |
|
||||
# |
|
||||
# For further information, see the Rails documentation on Strong Parameters: |
|
||||
# http://guides.rubyonrails.org/action_controller_overview.html#strong-parameters |
|
||||
# |
|
||||
# params do |params| |
|
||||
# params.require(:work_experience).permit(:name, ...) |
|
||||
# end |
|
||||
end |
end |
||||
|
|||||
@ -0,0 +1,11 @@ |
|||||
|
class CoverLetter < ApplicationRecord |
||||
|
belongs_to :user |
||||
|
|
||||
|
default_scope -> { order(order: :asc) } |
||||
|
scope :active, -> { where.not(order: nil) } |
||||
|
|
||||
|
|
||||
|
def tex_paragraph |
||||
|
csv_paragraphs.split(";").join("\n").tex_safe |
||||
|
end |
||||
|
end |
||||
@ -0,0 +1,131 @@ |
|||||
|
<% |
||||
|
user = @cover_letter.user |
||||
|
%> |
||||
|
%!TEX TS-program = xelatex |
||||
|
%!TEX encoding = UTF-8 Unicode |
||||
|
% Awesome CV LaTeX Template for Cover Letter |
||||
|
% |
||||
|
% This template has been downloaded from: |
||||
|
% https://github.com/posquit0/Awesome-CV |
||||
|
% |
||||
|
% Authors: |
||||
|
% Claud D. Park <posquit0.bj@gmail.com> |
||||
|
% Lars Richter <mail@ayeks.de> |
||||
|
% |
||||
|
% Template license: |
||||
|
% CC BY-SA 4.0 (https://creativecommons.org/licenses/by-sa/4.0/) |
||||
|
% |
||||
|
|
||||
|
%------------------------------------------------------------------------------- |
||||
|
% CONFIGURATIONS |
||||
|
%------------------------------------------------------------------------------- |
||||
|
% A4 paper size by default, use 'letterpaper' for US letter |
||||
|
\documentclass[11pt, a4paper]{awesome-cv} |
||||
|
|
||||
|
% Configure page margins with geometry |
||||
|
\geometry{left=1.4cm, top=.8cm, right=1.4cm, bottom=1.8cm, footskip=.5cm} |
||||
|
|
||||
|
% Color for highlights |
||||
|
% Awesome Colors: awesome-emerald, awesome-skyblue, awesome-red, awesome-pink, awesome-orange |
||||
|
% awesome-nephritis, awesome-concrete, awesome-darknight |
||||
|
\colorlet{awesome}{awesome-red} |
||||
|
% Uncomment if you would like to specify your own color |
||||
|
% \definecolor{awesome}{HTML}{CA63A8} |
||||
|
|
||||
|
% Colors for text |
||||
|
% Uncomment if you would like to specify your own color |
||||
|
% \definecolor{darktext}{HTML}{414141} |
||||
|
% \definecolor{text}{HTML}{333333} |
||||
|
% \definecolor{graytext}{HTML}{5D5D5D} |
||||
|
% \definecolor{lighttext}{HTML}{999999} |
||||
|
% \definecolor{sectiondivider}{HTML}{5D5D5D} |
||||
|
|
||||
|
% Set false if you don't want to highlight section with awesome color |
||||
|
\setbool{acvSectionColorHighlight}{true} |
||||
|
|
||||
|
% If you would like to change the social information separator from a pipe (|) to something else |
||||
|
\renewcommand{\acvHeaderSocialSep}{\quad\textbar\quad} |
||||
|
|
||||
|
|
||||
|
%------------------------------------------------------------------------------- |
||||
|
% PERSONAL INFORMATION |
||||
|
% Comment any of the lines below if they are not required |
||||
|
%------------------------------------------------------------------------------- |
||||
|
% Available options: circle|rectangle,edge/noedge,left/right |
||||
|
\name{<%= user.name.tex_safe %>}{} |
||||
|
\position{<%= user.title.tex_safe %>} |
||||
|
\address{<%= user.address.tex_safe %>} |
||||
|
|
||||
|
\mobile{<%= user.phone.tex_safe %>} |
||||
|
\email{<%= user.email.tex_safe %>} |
||||
|
%\dateofbirth{January 1st, 1970} |
||||
|
\homepage{<%= user.other_page_url.tex_safe %>} |
||||
|
\github{<%= user.github.tex_safe %>} |
||||
|
\linkedin{<%= user.linkedin.tex_safe %>} |
||||
|
% \gitlab{gitlab-id} |
||||
|
% \stackoverflow{SO-id}{SO-name} |
||||
|
% \twitter{@twit} |
||||
|
% \skype{skype-id} |
||||
|
% \reddit{reddit-id} |
||||
|
% \medium{madium-id} |
||||
|
% \kaggle{kaggle-id} |
||||
|
% \googlescholar{googlescholar-id}{name-to-display} |
||||
|
%% \firstname and \lastname will be used |
||||
|
% \googlescholar{googlescholar-id}{} |
||||
|
% \extrainfo{extra information} |
||||
|
|
||||
|
% \quote{``Be the change that you want to see in the world."} |
||||
|
|
||||
|
|
||||
|
%------------------------------------------------------------------------------- |
||||
|
% LETTER INFORMATION |
||||
|
% All of the below lines must be filled out |
||||
|
%------------------------------------------------------------------------------- |
||||
|
% The company being applied to |
||||
|
\recipient |
||||
|
{<%= @cover_letter.company_name.tex_safe %>} |
||||
|
{ Company Recruitment Team } |
||||
|
% The date on the letter, default is the date of compilation |
||||
|
\letterdate{\today} |
||||
|
% The title of the letter |
||||
|
\lettertitle{<%= @cover_letter.title.tex_safe %>} |
||||
|
% How the letter is opened |
||||
|
\letteropening{Dear Mr./Ms./Dr. LastName,} |
||||
|
% How the letter is closed |
||||
|
\letterclosing{Sincerely,} |
||||
|
% Any enclosures with the letter |
||||
|
\letterenclosure[Attached]{Curriculum Vitae} |
||||
|
|
||||
|
|
||||
|
%------------------------------------------------------------------------------- |
||||
|
\begin{document} |
||||
|
|
||||
|
% Print the header with above personal information |
||||
|
% Give optional argument to change alignment(C: center, L: left, R: right) |
||||
|
\makecvheader[R] |
||||
|
|
||||
|
% Print the footer with 3 arguments(<left>, <center>, <right>) |
||||
|
% Leave any of these blank if they are not needed |
||||
|
\makecvfooter |
||||
|
{\today} |
||||
|
{<%= user.name.tex_safe %>~~~·~~~Cover Letter} |
||||
|
{} |
||||
|
|
||||
|
% Print the title with above letter information |
||||
|
\makelettertitle |
||||
|
|
||||
|
%------------------------------------------------------------------------------- |
||||
|
% LETTER CONTENT |
||||
|
%------------------------------------------------------------------------------- |
||||
|
\begin{cvletter} |
||||
|
|
||||
|
<%= @cover_letter.tex_paragraph %> |
||||
|
|
||||
|
\end{cvletter} |
||||
|
|
||||
|
|
||||
|
%------------------------------------------------------------------------------- |
||||
|
% Print the signature and enclosures with above letter information |
||||
|
\makeletterclosing |
||||
|
|
||||
|
\end{document} |
||||
@ -0,0 +1,14 @@ |
|||||
|
class AddCoverLetters < ActiveRecord::Migration[7.0] |
||||
|
def change |
||||
|
create_table :cover_letters do |t| |
||||
|
t.string :title |
||||
|
t.string :company_name |
||||
|
t.string :job_application |
||||
|
t.date :date_override |
||||
|
t.integer :order, default: 0 |
||||
|
t.references :user |
||||
|
t.text :csv_paragraphs |
||||
|
t.timestamps |
||||
|
end |
||||
|
end |
||||
|
end |
||||
Loading…
Reference in new issue