Skip to content

Commit

Permalink
Improve resume (#708)
Browse files Browse the repository at this point in the history
* update form

* awards_descriptions deprecated

* exept serialize

* add column to resume

* fix test

* improve layout resume

* fix

* add new fild to evaluated resume

* improve resume.pdf

* improve contact info

* move contacts

* fix resume

* fix base layout

* fix contact info

* rename column
  • Loading branch information
usernaimandrey authored Dec 20, 2023
1 parent a2d5d78 commit dba4dcd
Show file tree
Hide file tree
Showing 20 changed files with 241 additions and 210 deletions.
4 changes: 0 additions & 4 deletions app/controllers/web/resumes/pdfs_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@ def show
end

@user = resource_resume.user
@resume_contact_information = resource_resume
.serializable_hash
.deep_symbolize_keys
.slice(:city, :contact_telegram, :contact_phone, :contact_email, :contact)
@resume_educations = resource_resume.educations.web
@resume_works = resource_resume.works.web

Expand Down
4 changes: 2 additions & 2 deletions app/forms/web/account/resume_form.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,20 @@ class Web::Account::ResumeForm < Resume

attrs = %i[
name
hexlet_url
github_url
contact
contact_email
contact_phone
contact_telegram summary
skills_description
summary
awards_description
english_fluency
city
relocation
skill_list
direction_list
about_my_self
project_descriptions
]

nested_attrs = {
Expand Down
4 changes: 2 additions & 2 deletions app/forms/web/admin/resume_form.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ class Web::Admin::ResumeForm < Resume
attrs = %i[
state_event
name
hexlet_url
github_url
contact
contact_email
Expand All @@ -15,12 +14,13 @@ class Web::Admin::ResumeForm < Resume
locale
summary
skills_description
awards_description
english_fluency
city
relocation
skill_list
direction_list
about_my_self
project_descriptions
]

nested_attrs = {
Expand Down
7 changes: 2 additions & 5 deletions app/models/resume.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ class Resume < ApplicationRecord
extend Enumerize
extend TagResumePresenter

mark_as_outdated :hexlet_url, :awards_description

has_paper_trail
is_impressionable counter_cache: true

Expand All @@ -15,7 +17,6 @@ class Resume < ApplicationRecord
enumerize :relocation, in: %i[not_specified another_country another_city another_city_country not_ready], scope: true, predicates: { prefix: true }

validates :name, presence: true
validates :english_fluency, presence: true, if: -> { locale_ru? }
validates :github_url, presence: true
validates :summary, presence: true, length: { minimum: 200 }
validates :skills_description, presence: true
Expand Down Expand Up @@ -99,8 +100,4 @@ def self.ransackable_attributes(_auth_object = nil)
def self.ransackable_associations(_auth_object = nil)
%w[directions user skills answers]
end

def locale_ru?
locale == 'ru'
end
end
4 changes: 2 additions & 2 deletions app/services/resume_auto_answer_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ def evaluate_resume(resume)

def prepare_resume(resume)
resume_content = resume
.serializable_hash
.serializable_hash(except: %i[hexlet_url awards_description])
.deep_symbolize_keys
.slice(:name, :summary, :skills_description, :awards_description, :contact_phone, :contact_email)
.slice(:name, :summary, :project_descriptions, :about_my_self, :skills_description, :contact_phone, :contact_email)
.values
.join('\n')
work_content = resume.works.reduce('') do |acc, work|
Expand Down
109 changes: 55 additions & 54 deletions app/views/web/resumes/_information.html.slim
Original file line number Diff line number Diff line change
@@ -1,78 +1,60 @@
.d-flex
h2.my-4.me-3 = t('.basic')
h2.my-4.me-3 = t('.contacts')
hr.my-auto.w-100

- if @resume.user.first_name?
.row.mb-3
- if @resume.contact_email
.row.mt-3.mb-4
.col-sm-3
b = han('user', 'name')
b = han('resume', 'contact_email')
.col-sm-9
= link_to @resume.user, user_path(@resume.user)
- if @resume.city
.row.mb-3
.col-sm-3
b = han('resume', 'city')
.col-sm-9.hexlet-cv-content
== markdown2html @resume.city
- if @resume.relocation
.row.mb-3
.col-sm-3
b = han('resume', 'relocation')
.col-sm-9.hexlet-cv-content
== markdown2html @resume.relocation_text
.row.mb-3
.col-sm-3
b = han('resume', 'summary')
.col-sm-9.hexlet-cv-content
== markdown2html @resume.summary
.row.mb-3
.col-sm-3
b = han('resume', 'skills_description')
.col-sm-9.hexlet-cv-content
== markdown2html @resume.skills_description
- if @resume.awards_description?
.row.mb-3
.col-sm-3
b = han('resume', 'awards_description')
.col-sm-9.hexlet-cv-content
== markdown2html @resume.awards_description
- if @resume.locale == 'ru'
.row
= @resume.contact_email

- if @resume.contact_phone
.row.mt-3.mb-4
.col-sm-3
b = han('resume', 'english_fluency')
b = han('resume', 'contact_phone')
.col-sm-9
= @resume.english_fluency.text
.row.mt-3.mb-4
.col-sm-3
b = han('resume', 'hexlet')
.col-sm-9
= link_to @resume.hexlet_url, @resume.hexlet_url, target: '_blank', rel: :noopener
= @resume.contact_phone

.row.mt-3.mb-4
.col-sm-3
b = han('resume', 'github')
.col-sm-9
= link_to @resume.github_url, @resume.github_url, target: '_blank', rel: :noopener
- if @resume.contact
.row.mt-3.mb-4
.col-sm-3
b = han('resume', 'contact_phone')
.col-sm-9
= @resume.contact_phone
.row.mt-3.mb-4
.col-sm-3
b = han('resume', 'contact_email')
.col-sm-9
= @resume.contact_email

- if @resume.contact_telegram
.row.mt-3.mb-4
.col-sm-3
b = han('resume', 'contact_telegram')
.col-sm-9
= @resume.contact_telegram

- if @resume.contact
.row.mt-3.mb-4
.col-sm-3
b = han('resume', 'contact')
.col-sm-9
= @resume.contact
= @resume.contact_telegram

.d-flex
hr.my-auto.w-100

.row.mb-3
.col-sm-3
b = han('resume', 'summary')
.col-sm-9.hexlet-cv-content
== markdown2html @resume.summary
.row.mb-3
.col-sm-3
b = han('resume', 'skills_description')
.col-sm-9.hexlet-cv-content
== markdown2html @resume.skills_description
- if @resume.project_descriptions
.row.mb-3
.col-sm-3
b = han('resume', 'project_descriptions')
.col-sm-9.hexlet-cv-content
== markdown2html @resume.project_descriptions

- if @resume_works.any?
.d-flex
Expand Down Expand Up @@ -110,3 +92,22 @@
- elsif education.end_date
| &nbsp;-&nbsp;
= education.end_date.to_formatted_s(:month_and_year)

.d-flex
hr.my-auto.w-100

.row.mb-3
.col-sm-3
b = han('resume', 'about_my_self')
.col-sm-9.hexlet-cv-content
- if @resume.relocation && [email protected]_not_specified?
= @resume.relocation_text
br
- if @resume.locale == 'ru' && @resume.english_fluency
= @resume.english_fluency.text
br
- if @resume.city
= "#{han('resume', 'city')} #{@resume.city}"
br

== markdown2html @resume.about_my_self
97 changes: 57 additions & 40 deletions app/views/web/resumes/pdfs/base.slim
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,45 @@
.col-12
h1.text-center.display-4.mb-2 = @user
h2.text-center.lead = resource_resume

h2.my-4 = t('.contacts')
hr.w-100
- if resource_resume.contact_email
.row.mt-3.mb-4
.col-sm-3
b = han('resume', 'contact_email')
.col-sm-9
= resource_resume.contact_email

- if resource_resume.contact_phone
.row.mt-3.mb-4
.col-sm-3
b = han('resume', 'contact_phone')
.col-sm-9
= resource_resume.contact_phone

.row.mt-3.mb-4
.col-sm-3
b = han('resume', 'github')
.col-sm-9
= link_to resource_resume.github_url, resource_resume.github_url, target: '_blank', rel: 'noopener'

- if resource_resume.contact_telegram
.row.mt-3.mb-4
.col-sm-3
b = han('resume', 'contact_telegram')
.col-sm-9
= resource_resume.contact_telegram

- if resource_resume.contact
.row.mt-3.mb-4
.col-sm-3
b = han('resume', 'contact')
.col-sm-9
= resource_resume.contact

.col-12
h2.my-4 = t('.basic')
h2.my-4 = t('.summary')
hr.w-100

.col-sm-9.hexlet-cv-content.lead
Expand All @@ -17,48 +54,12 @@
.col-12.hexlet-cv-content.lead
== markdown2html resource_resume.skills_description

- if resource_resume.awards_description?
- if resource_resume.project_descriptions
.col-12
h2.my-4 = han('resume', 'awards_description')
h2.my-4 = han('resume', 'project_descriptions')
hr.w-100

.col-12.hexlet-cv-content.lead
== markdown2html resource_resume.awards_description

- if resource_resume.english_fluency?
.col-12
h2.my-4.me-3 = han('resume', 'english_fluency')
hr.w-100
.col-12.lead
= resource_resume.english_fluency.text

.col-12
h2.my-4 = han('resume', 'github')
hr.w-100
.col-12.lead
= link_to resource_resume.github_url, resource_resume.github_url, target: '_blank', rel: 'noopener'

- if resource_resume.hexlet_url?
.col-12
h2.my-4 = han('resume', 'hexlet')
hr.w-100
.col-12.lead
= link_to resource_resume.hexlet_url, resource_resume.hexlet_url, target: '_blank', rel: 'noopener'

- @resume_contact_information.each do |field, content|
- if content.present?
.col-12
h2.my-4 = han('resume', field)
hr.w-100
.col-12.lead
= content

- if resource_resume.relocation?
.col-12
h2.my-4 = han('resume', 'relocation')
hr.w-100
.col-12.lead
= resource_resume.relocation.text
== markdown2html resource_resume.project_descriptions

- if @resume_works.any?
.col-12
Expand Down Expand Up @@ -97,3 +98,19 @@
- elsif education.end_date
| &nbsp;-&nbsp;
= education.end_date.to_formatted_s(:month_and_year)

.col-12
h2.my-4 = han('resume', 'about_my_self')
hr.w-100
.col-12.hexlet-cv-content.lead
- if resource_resume.relocation && !resource_resume.relocation_not_specified?
= resource_resume.relocation_text
br
- if resource_resume.locale == 'ru' && resource_resume.english_fluency
= resource_resume.english_fluency.text
br
- if resource_resume.city
= resource_resume.city
br

== markdown2html resource_resume.about_my_self
22 changes: 5 additions & 17 deletions app/views/web/resumes/show.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,16 @@
resume: @resume, educations: @resume_educations, works: @resume_works

= content_for :header do
.d-flex.justify-content-between
.d-flex.justify-content-center
.m-1
= @resume
= link_to @resume.user.full_name, user_path(@resume.user)
- if current_or_guest_user.admin?
.m-1
= link_to edit_admin_resume_path(@resume), class: 'btn btn-primary' do
= link_to edit_admin_resume_path(@resume), class: 'btn btn-outline-primary' do
span.bi.bi-gear

/ .d-flex.mb-3.text-muted
/ .d-flex.me-4
/ .me-2= t('.published')
/ .fw-light
/ = distance_of_time_in_words_to_now @resume.created_at
/ .d-flex.me-4
/ .me-2= t('.views')
/ .fw-light= 3
/ .d-flex.me-4
/ .me-2= t('.answers')
/ .fw-light= 3
/ .d-flex.me-4
/ .me-2= t('.likes')
/ .fw-light= 3
h3.text-center = @resume

- if @resume.archived?
.alert.alert-warning = t('.archived')

Expand Down
Loading

0 comments on commit dba4dcd

Please sign in to comment.