diff --git a/app/models/education_entry.rb b/app/models/education_entry.rb index f5e22e5..88b3d2a 100644 --- a/app/models/education_entry.rb +++ b/app/models/education_entry.rb @@ -1,3 +1,6 @@ class EducationEntry < ApplicationRecord belongs_to :user + default_scope -> { order(reference_date: :desc) } + + scope :active, -> { where.not(reference_date: nil) } end diff --git a/app/models/skill.rb b/app/models/skill.rb index 4ad4f1a..599983f 100644 --- a/app/models/skill.rb +++ b/app/models/skill.rb @@ -1,3 +1,6 @@ class Skill < ApplicationRecord belongs_to :user + + default_scope -> { order(order: :asc) } + scope :active, -> { where.not(order: nil) } end diff --git a/app/models/work_experience.rb b/app/models/work_experience.rb index be1bad4..16d7ef0 100644 --- a/app/models/work_experience.rb +++ b/app/models/work_experience.rb @@ -1,4 +1,6 @@ class WorkExperience < ApplicationRecord belongs_to :user - default_scope -> { order(reference_date: :desc) } + default_scope -> { order(reference_date: :desc) } + + scope :active, -> { where.not(reference_date: nil) } end diff --git a/app/views/templates/awesome/awesome-cv.cls b/app/views/templates/awesome/awesome-cv.cls index f2e717a..466d61a 100644 --- a/app/views/templates/awesome/awesome-cv.cls +++ b/app/views/templates/awesome/awesome-cv.cls @@ -726,6 +726,15 @@ \vspace{-4.0mm} } +% Define an environment for cvitems(for cventry) +\newenvironment{nobulletcvitems}{% + \vspace{-4.0mm} + \begin{justify} +}{% + \end{justify} + \vspace{-4.0mm} +} + %------------------------------------------------------------------------------- % Commands for elements of Cover Letter diff --git a/app/views/templates/awesome/resume.html.erb b/app/views/templates/awesome/resume.html.erb index af4f3c1..9abc357 100644 --- a/app/views/templates/awesome/resume.html.erb +++ b/app/views/templates/awesome/resume.html.erb @@ -13,6 +13,20 @@ % CC BY-SA 4.0 (https://creativecommons.org/licenses/by-sa/4.0/) % +% \usepackage{amssymb} + +\renewcommand{\labelenumi}{A} +\renewcommand{\labelenumii}{A} +\renewcommand{\labelitemi}{B} +\renewcommand{\labelitemii}{B} +\renewcommand{\labelitemiii}{B} + +\renewcommand{\labelcvitemi}{B} + +\renewcommand{\labelenumi}{A} + + + %------------------------------------------------------------------------------- % CONFIGURATIONS @@ -51,16 +65,16 @@ %------------------------------------------------------------------------------- % Available options: circle|rectangle,edge/noedge,left/right % \photo[rectangle,edge,right]{./examples/profile} -\name{<%= @user.name %>}{} -\position{<%= @user.title %>} -\address{<%= @user.address %>} +\name{<%= @user.name.tex_safe %>}{} +\position{<%= @user.title.tex_safe %>} +\address{<%= @user.address.tex_safe %>} -\mobile{<%= @user.phone %>} -\email{<%= @user.email %>} +\mobile{<%= @user.phone.tex_safe %>} +\email{<%= @user.email.tex_safe %>} %\dateofbirth{January 1st, 1970} -\homepage{<%= @user.other_page_url %>} -\github{<%= @user.github %>} -\linkedin{<%= @user.linkedin %>} +\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} @@ -87,7 +101,7 @@ % Leave any of these blank if they are not needed \makecvfooter {\today} - {<%= @user.name %>~~~·~~~Resume} + {<%= @user.name.tex_safe %>~~~·~~~Resume} {\thepage} %------------------------------------------------------------------------------- @@ -101,7 +115,7 @@ \begin{cvparagraph} %--------------------------------------------------------- -<%= @user.objective %> +<%= @user.objective.tex_safe %> \end{cvparagraph} %------------------------------------------------------------------------------- @@ -116,10 +130,10 @@ \begin{cvskills} %--------------------------------------------------------- -<% @user.skills.each do |s| %> +<% @user.skills.active.each do |s| %> \cvskill - {<%= s.title %>} % Category - {<%= s.detail %>} % Skills + {<%= s.title.tex_safe %>} % Category + {<%= s.detail.tex_safe %>} % Skills <% end %> \end{cvskills} @@ -135,16 +149,16 @@ \begin{cventries} %--------------------------------------------------------- -<% @user.work_experiences.each do |w| %> +<% @user.work_experiences.active.each do |w| %> \cventry - {<%= w.title %>} % Job title - {<%= w.employer %>} % Organization + {<%= w.title.tex_safe %>} % Job title + {<%= w.employer.tex_safe %>} % Organization {} % Location - {<%= w.period %>} % Date(s) + {<%= w.period.tex_safe %>} % Date(s) { \begin{cvitems} % Description(s) of tasks/responsibilities - <% w.items_csv&.split(",")&.each do |i| %> - \item {<%= i %>} + <% w.items_csv&.split(";")&.each do |i| %> + \item {<%= i.tex_safe %>} <% end %> \end{cvitems} } @@ -164,17 +178,29 @@ \begin{cventries} %--------------------------------------------------------- -<% @user.education_entries.each do |e| %> +<% @user.education_entries.active.each do |e| %> \cventry - {<%= e.institution %>} % Institution - {<%= e.title %>} % Degree - {<%= e.location %>} % Location - {<%= e.period %>} % Date(s) - { - \begin{cvitems} % Description(s) bullet points - \item {<%= e.period %>} - \end{cvitems} - } + {<%= e.institution.tex_safe %>} % Institution + {<%= e.title.tex_safe %>} % Degree + {<%= e.location.tex_safe %>} % Location + {<%= e.period.tex_safe %>} % Date(s) + <% + education_details_arr = e.items_csv&.split(";") + %> + <% if education_details_arr.empty? %> + { + \begin{nobulletcvitems} + \end{nobulletcvitems} + } + <% else %> + { + \begin{cvitems} + <% education_details_arr.each do |item| %> + \item {<%= item.tex_safe %>} + <% end %> + \end{cvitems} + } + <% end %> <% end %> %--------------------------------------------------------- \end{cventries} diff --git a/config/initializers/tex_strings.rb b/config/initializers/tex_strings.rb new file mode 100644 index 0000000..44252ff --- /dev/null +++ b/config/initializers/tex_strings.rb @@ -0,0 +1,14 @@ +class String + SPECIAL_TEX_CHAR_TABLE = { + "'" => "\\textquotesingle ", + "\"" => "\\textquotedbl " # TODO: see which one works.. "\textquotedbl " + }.freeze + + def tex_safe + safe_string = self.dup + SPECIAL_TEX_CHAR_TABLE.each_pair do |key, replacement| + safe_string.gsub!(key,replacement) + end + safe_string + end +end