Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve resume skills description #744

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug', platforms: %i[mri mingw x64_mingw]
# Use sqlite3 as the database for Active Record
gem 'debug'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Вроде в задачу не входило добавление гемов)

gem 'factory_bot_rails'
gem 'rubocop-performance'
gem 'rubocop-rails'
Expand Down
4 changes: 4 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@ GEM
activesupport (>= 4.2)
crass (1.0.6)
date (3.3.4)
debug (1.9.2)
irb (~> 1.10)
reline (>= 0.3.8)
devise (4.9.3)
bcrypt (~> 3.0)
orm_adapter (~> 0.1)
Expand Down Expand Up @@ -574,6 +577,7 @@ DEPENDENCIES
capybara
cocoon
counter_culture
debug
devise
devise-bootstrap-views
devise-i18n
Expand Down
54 changes: 28 additions & 26 deletions app/models/resume.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,33 @@
#
# Table name: resumes
#
# id :integer not null, primary key
# about_myself :text
# answers_count :integer default(0), not null
# awards_description :text
# city :string
# contact :string
# contact_email :string
# contact_phone :string
# contact_telegram :string
# english_fluency :string
# evaluated_ai :boolean
# evaluated_ai_state :string
# github_url :string
# hexlet_url :string
# impressions_count :integer default(0)
# locale :string
# name :string not null
# projects_description :text
# relocation :string
# skills_description :text
# state :string
# summary :text
# url :string
# created_at :datetime not null
# updated_at :datetime not null
# user_id :integer not null
# id :integer not null, primary key
# about_myself :text
# answers_count :integer default(0), not null
# awards_description :text
# city :string
# contact :string
# contact_email :string
# contact_phone :string
# contact_telegram :string
# english_fluency :string
# evaluated_ai :boolean
# evaluated_ai_state :string
# github_url :string
# hexlet_url :string
# impressions_count :integer default(0)
# locale :string
# name :string not null
# projects_description :text
# relocation :string
# skills_description :text(250)
# skills_description_old :text
# state :string
# summary :text
# url :string
# created_at :datetime not null
# updated_at :datetime not null
# user_id :integer not null
#
# Indexes
#
Expand Down Expand Up @@ -58,6 +59,7 @@ class Resume < ApplicationRecord
validates :name, presence: true
validates :github_url, presence: true, unless: :draft?
validates :summary, length: { minimum: 200 }, presence: true, unless: :draft?
validates :skills_description, length: { maximum: 250 }, presence: true, unless: :draft?
eKulshan marked this conversation as resolved.
Show resolved Hide resolved
validates :skills_description, presence: true, unless: :draft?
eKulshan marked this conversation as resolved.
Show resolved Hide resolved
validates :contact_email, presence: true, unless: :draft?
validates :contact_email, 'valid_email_2/email': true
Expand Down
9 changes: 8 additions & 1 deletion app/views/web/resumes/_information.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,14 @@ hr.my-auto
.col-sm-3
b = han('resume', 'skills_description')
.col-sm-9.hexlet-cv-content
== markdown2html @resume.skills_description
- if @resume.skills_description.nil?
== markdown2html @resume.skills_description_old
- else
.row
- @resume.skills_description.split("\n")[0..9].each_slice(5) do |skills_slice|
eKulshan marked this conversation as resolved.
Show resolved Hide resolved
.col-6
- skills_slice.each do |skill|
li = skill[0..24]
- if @resume.projects_description
.row.mb-3
.col-sm-3
Expand Down
9 changes: 8 additions & 1 deletion app/views/web/shared/_resume_form.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,15 @@
.mt-3
.mb-3
= f.input :summary, input_html: { rows: 10 }
- if resume.skills_description.nil? && resume.skills_description_old
.row.bg-body-tertiary.rounded-3.border.mb-3.align-items-center
.col-3
strong = t('.skill_description_new_requirements')
eKulshan marked this conversation as resolved.
Show resolved Hide resolved
.col-9
p.fw-bold = t('.skill_description_prev_input')
== markdown2html @resume.skills_description_old
.mb-3
= f.input :skills_description, input_html: { rows: 5 }
= f.input :skills_description, input_html: { rows: 10 }
.mb-3
= f.input :projects_description, as: :text, input_html: { rows: 10 }

Expand Down
4 changes: 3 additions & 1 deletion config/locales/en.views.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@ en:
contacts: Contacts
main: Main
add: Add
additionally: Additionally
additionally: Additionally
skill_description_new_requirements: 'To improve the skills readability, we have changed the filling requirements'
skill_description_prev_input: 'Your previous input'
work_fields:
remove_work: Delete work experience
education_fields:
Expand Down
2 changes: 1 addition & 1 deletion config/locales/ru.activerecord.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ ru:
answer/comment: Комментарий
attributes:
user:
password: пароль
password: Пароль
resume_answer_likes_count: Количество лайков
first_name: Имя
last_name: Фамилия
Expand Down
2 changes: 2 additions & 0 deletions config/locales/ru.views.yml
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,8 @@ ru:
main: Основное
add: Заполнить
additionally: Дополнительно
skill_description_new_requirements: 'Для повышения читаемости навыков, мы изменили требования по заполнению.'
skill_description_prev_input: 'Ваш предыдущий ввод'
work_fields:
remove_work: Удалить опыт работы
education_fields:
Expand Down
2 changes: 1 addition & 1 deletion config/locales/simple_form.en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ en:
projects_description: Indicate the projects in which you participated
summary: *markdown_tips
about_myself: *markdown_tips
skills_description: *markdown_tips
skills_description: 'One skill per line, no more than 10, skill length 25 characters max'
city: Specify the city of your residence
direction_list: |
Specify your direction. Here you need to specify only what you can say about the X-developer, for example: Java-developer. The maximum length is 40 characters. Separate tags with commas.
Expand Down
2 changes: 1 addition & 1 deletion config/locales/simple_form.ru.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ ru:
salary_to: Обязательно к заполнению, если не указан нижний уровень зарплаты и зарплата не по договоренности
resume:
summary: *markdown_tips
skills_description: *markdown_tips
skills_description: 'Один навык - одна строка, не более 10, длинна навыка не более 25 символов'
city: Укажите город вашего проживания
direction_list: |
Укажите ваше направление. Здесь нужно указывать только то, про что можно сказать X-разработчик, например: Java-разработчик. Максимальная длина 40 символов. Тэги разделяйте запятыми.
Expand Down
6 changes: 6 additions & 0 deletions db/migrate/20240508043924_update_resume_skill_description.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
class UpdateResumeSkillDescription < ActiveRecord::Migration[7.0]
def change
rename_column :resumes, :skills_description, :skills_description_old
add_column :resumes, :skills_description, :text, limit: 250
end
eKulshan marked this conversation as resolved.
Show resolved Hide resolved
end
5 changes: 3 additions & 2 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema[7.0].define(version: 2024_01_19_100332) do
ActiveRecord::Schema[7.0].define(version: 2024_05_08_043924) do
create_table "career_items", force: :cascade do |t|
t.integer "order"
t.integer "career_id", null: false
Expand Down Expand Up @@ -215,7 +215,7 @@
t.datetime "updated_at", null: false
t.string "url"
t.text "summary"
t.text "skills_description"
t.text "skills_description_old"
t.string "github_url"
t.text "awards_description"
t.string "english_fluency"
Expand All @@ -233,6 +233,7 @@
t.string "evaluated_ai_state"
t.text "projects_description"
t.text "about_myself"
t.text "skills_description", limit: 250
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

прогони плиз еще раз миграцию, в схеме осталась валидация на длину на уровне базы

t.index ["user_id"], name: "index_resumes_on_user_id"
end

Expand Down
55 changes: 28 additions & 27 deletions test/factories/resumes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,33 @@
#
# Table name: resumes
#
# id :integer not null, primary key
# about_myself :text
# answers_count :integer default(0), not null
# awards_description :text
# city :string
# contact :string
# contact_email :string
# contact_phone :string
# contact_telegram :string
# english_fluency :string
# evaluated_ai :boolean
# evaluated_ai_state :string
# github_url :string
# hexlet_url :string
# impressions_count :integer default(0)
# locale :string
# name :string not null
# projects_description :text
# relocation :string
# skills_description :text
# state :string
# summary :text
# url :string
# created_at :datetime not null
# updated_at :datetime not null
# user_id :integer not null
# id :integer not null, primary key
# about_myself :text
# answers_count :integer default(0), not null
# awards_description :text
# city :string
# contact :string
# contact_email :string
# contact_phone :string
# contact_telegram :string
# english_fluency :string
# evaluated_ai :boolean
# evaluated_ai_state :string
# github_url :string
# hexlet_url :string
# impressions_count :integer default(0)
# locale :string
# name :string not null
# projects_description :text
# relocation :string
# skills_description :text(250)
# skills_description_old :text
# state :string
# summary :text
# url :string
# created_at :datetime not null
# updated_at :datetime not null
# user_id :integer not null
#
# Indexes
#
Expand All @@ -43,7 +44,7 @@
factory :resume do
name { Faker::Job.title }
summary
skills_description
skills_description { Array.new(10) { Faker::Hobby.activity }.join("\n") }
github_url
contact
contact_email { 'test@emil.com' }
Expand Down
Loading
Loading