Skip to content

Commit

Permalink
Add views and translations for resume preview
Browse files Browse the repository at this point in the history
  • Loading branch information
beherit197777 committed Nov 28, 2024
1 parent 4557690 commit 39d9bfa
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 0 deletions.
3 changes: 3 additions & 0 deletions app/views/web/account/resumes/index.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
span.ms-3
= link_to edit_account_resume_path(resume) do
span.bi.bi-pencil-square.text-muted
span.ms-3
= link_to preview_account_resume_path(resume) do
span.bi.bi-eye-fill.text-muted
.card-body
h5.card-title
= link_to_unless resume.draft?, resume, resume_path(resume)
Expand Down
28 changes: 28 additions & 0 deletions app/views/web/account/resumes/preview.html.slim
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
= content_for :meta do
= structured_data_tag 'resume',
resume: @resume, educations: @resume_educations, works: @resume_works

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

h3.text-center = @resume

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

- if policy(@resume).download?
.mb-2.d-flex.justify-content-end
= link_to resume_pdf_path(@resume, 'base', format: :pdf),
class: 'me-3', title: t('web.resumes.show.print'), target: :_blank, rel: 'noopener' do
i.bi.bi-printer-fill
= link_to resume_pdf_path(@resume, 'base'), title: t('web.resumes.show.download') do
i.bi.bi-download

.mb-5
= render 'web/resumes/information'
2 changes: 2 additions & 0 deletions config/locales/ru.views.yml
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,8 @@ ru:
header: Редактирование резюме
index:
header: Мои резюме
preview:
not_accessible: Нет Доступа
profiles:
form:
info_for_user: Давайте познакомимся =). Заполните, пожалуйста, фамилию, имя и можете рассказать немного о себе.
Expand Down
17 changes: 17 additions & 0 deletions test/controllers/web/account/resumes_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
class Web::Account::ResumesControllerTest < ActionDispatch::IntegrationTest
setup do
@user = users(:one)
@other_user = users(:two)
sign_in(@user)
@draft_resume = resumes(:one_draft)
end

test '#index' do
Expand Down Expand Up @@ -190,4 +192,19 @@ class Web::Account::ResumesControllerTest < ActionDispatch::IntegrationTest
resume = Resume.find_by(name: attrs[:name])
assert { !resume }
end

test '#preview for draft resume' do
get preview_account_resume_path(@draft_resume)
assert_response :success
assert_select 'h1', @user.full_name
assert_select 'h3', @draft_resume.name
end

test '#preview for resume not owned by user' do
sign_out(@user)
sign_in(@other_user)
assert_raises ActiveRecord::RecordNotFound do
get preview_account_resume_path(@draft_resume)
end
end
end
6 changes: 6 additions & 0 deletions test/fixtures/resumes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -149,3 +149,9 @@ full_en:
summary: |
A self-taught programmer who has chosen the path of constant self-improvement. I value beautiful and concise code, I love functional programming (the great trinity of map, filter, reduce). I work with languages ​​such as JS, Ruby, PHP, Python, Elixir, Clojure (to varying degrees of skill, of course). I admire the LISP family of languages, so much so that I am writing my own LISP interpreter in Elixir as a pet project. At the moment, I am delving into Unix OS in order to further improve my DevOps skills.
answers_count: 1

one_draft:
<<: *DEFAULTS
state: draft
user: one
contact_email: [email protected]

0 comments on commit 39d9bfa

Please sign in to comment.