diff --git a/.gitignore b/.gitignore index 886f714..b91127c 100644 --- a/.gitignore +++ b/.gitignore @@ -33,3 +33,9 @@ # Ignore master key for decrypting credentials and more. /config/master.key + + +*.tex +*.log +*.pdf +*.aux \ No newline at end of file diff --git a/app/controllers/work_experiences_controller.rb b/app/controllers/work_experiences_controller.rb index 469e1a7..e552834 100644 --- a/app/controllers/work_experiences_controller.rb +++ b/app/controllers/work_experiences_controller.rb @@ -1,6 +1,17 @@ class WorkExperiencesController < ApplicationController before_action :set_work_experience, only: %i[ show edit update destroy ] + def cv + @full_name = "Rodolfo Leyes" + # render layout: false, content_type: "application/octet-stream" + tex_content = render_to_string(layout: false) + File.open("./temp.tex", "w") do |f| + f << tex_content + end + `pdflatex -interaction=batchmode temp.tex` + render file: "#{Rails.root}/temp.pdf", layout: false + end + # GET /work_experiences or /work_experiences.json def index @work_experiences = WorkExperience.all diff --git a/template.tex b/app/views/work_experiences/cv.html.erb similarity index 98% rename from template.tex rename to app/views/work_experiences/cv.html.erb index ed6ab76..2ae0128 100644 --- a/template.tex +++ b/app/views/work_experiences/cv.html.erb @@ -56,7 +56,7 @@ % HEADER SECTION %---------------------------------------------------------------------------------------- -{\fontsize{36}{36}\selectfont\scshape\textls[200]{John Smith}} % Your name at the top +{\fontsize{36}{36}\selectfont\scshape\textls[200]{<%= @full_name %>}} % Your name at the top \vspace{1.5cm} % Extra whitespace after the large name at the top diff --git a/config/routes.rb b/config/routes.rb index 6238958..a118f34 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -4,4 +4,6 @@ Rails.application.routes.draw do # Defines the root path route ("/") # root "articles#index" + + get "cv", to: "work_experiences#cv" end