Skip to content

Commit

Permalink
Upgrade turbo-rails to v8 (#802)
Browse files Browse the repository at this point in the history
* Upgrade turbo-rails package to v8 and remove unused puzzle shell links from head tag

* Fix cv download

* Use unique ids in people skills edit form to make turbo maintain scroll position

* Fix testhelper after changing ids in people skills form

* Fix for attribute of labels in people skills edit form

* Fix scroll-to feature on the skills view of a person
  • Loading branch information
RandomTannenbaum authored Feb 21, 2025
1 parent 654e953 commit 67d0439
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 23 deletions.
2 changes: 0 additions & 2 deletions app/views/layouts/application.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,8 @@
%meta{:content => "width=device-width,initial-scale=1", :name => "viewport"}/
= csrf_meta_tags
= csp_meta_tag
= stylesheet_link_tag "application", "https://unpkg.com/@puzzleitc/puzzle-shell/dist/style.css"
= stylesheet_link_tag "application", "data-turbo-track": "reload"
= javascript_include_tag "application", "data-turbo-track": "reload", type: "module"
= javascript_include_tag "application", "https://unpkg.com/@puzzleitc/puzzle-shell/dist/bundle.js", type: "module"
= favicon_link_tag "favicon.png"
%body.d-flex.justify-content-center{"data-controller": "skills-empty-space"}
%div.content{"data-skills-empty-space-target": "container"}
Expand Down
2 changes: 1 addition & 1 deletion app/views/people/export_cv/_export_form.html.haml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
= form_with(url: person_path(format: 'odt'), method: 'get', data: {controller: "skills-filter"}) do |f|
= form_with(url: person_path(format: 'odt'), method: 'get', data: {controller: "skills-filter", turbo: false}) do |f|
.mb-2.w-100
= f.label :location, class: "form-label w-100"
= f.collection_select :location, BranchAdress.all, :id, :short_name, {selected: (BranchAdress.find_by(default_branch_adress: true) || BranchAdress.first).id}, class: "form-select w-100"
Expand Down
12 changes: 6 additions & 6 deletions app/views/people/people_skills/_edit_form.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,23 @@
= ff.hidden_field :unrated, value: false, id: "unrated-field-#{ff.object.skill.id}"
%div.col-2
%div.d-flex.flex-column.align-items-center
= ff.label :level
= ff.label :level, for: "level_#{ff.object.skill_id}"
= ff.label(ti("people_skills.levels.#{ExpertiseTopicSkillValue.skill_levels.key(ff.object.level - 1)}"), {"data-people-skills-target": "label"})
- range_min = (ff.object.id.nil? || ff.object.level != 0) ? 1 : 0
= ff.range_field :level, min: range_min, max: 5, class: "form-range w-75",
= ff.range_field :level, min: range_min, max: 5, class: "form-range w-75", id: "level_#{ff.object.skill_id}",
"data-action": "change->people-skills#displayLevelLabel people-skills#rateSkill",
"data-people-skills-target": "switch"
%div.col-2
%div.d-flex.flex-column.align-items-center
= render partial: "edit_interest_stars", locals: { ff: ff }
%div.col-2
%div.d-flex.flex-row.form-check
= ff.check_box :certificate, { class: "form-check-input me-2", "data-action": "change->people-skills#rateSkill" }
= ff.label :certificate
= ff.check_box :certificate, { class: "form-check-input me-2", id: "certificate_#{ff.object.skill_id}", "data-action": "change->people-skills#rateSkill" }
= ff.label :certificate, for: "certificate_#{ff.object.skill_id}"
%div.col-2
%div.d-flex.flex-row.form-check
= ff.check_box :core_competence, { class: "form-check-input me-2", "data-action": "change->people-skills#rateSkill" }
= ff.label :core_competence
= ff.check_box :core_competence, { class: "form-check-input me-2", id: "core_competence_#{ff.object.skill_id}", "data-action": "change->people-skills#rateSkill" }
= ff.label :core_competence, for: "core_competence_#{ff.object.skill_id}"
= ff.hidden_field :skill_id
%div.col-2
- if ff.object.id.nil?
Expand Down
2 changes: 1 addition & 1 deletion app/views/people/people_skills/_overview.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

= turbo_frame_tag 'people-skills' do
- Category.all_parents.each do |category|
%div.profile-header.mw-100.border-bottom.mt-4{id: category.title, "data-scroll-target": "scrollItem"}
%div.profile-header.mw-100.border-bottom.mt-4{id: category.title.parameterize, "data-scroll-target": "scrollItem"}
= category.title
- ([category] + category.children.to_a).each do |category_child|
- people_skills_of_category = people_skills_of_category(category_child)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"private": true,
"dependencies": {
"@hotwired/stimulus": "^3.2.2",
"@hotwired/turbo-rails": "^7.3.0",
"@hotwired/turbo-rails": "^8.0.12",
"@popperjs/core": "^2.11.8",
"autoprefixer": "^10.4.17",
"bootstrap": "^5.3.2",
Expand Down
6 changes: 3 additions & 3 deletions spec/support/people_skills_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ def validate_people_skill(person, skill_name)
people_skill = people_skill_from_skill_name(person, skill_name)
skill_div = find("#default-skill-#{people_skill.skill.id}")
within skill_div do
expect(page).to have_field('person_people_skills_attributes_0_level', with: people_skill.level)
expect(page).to have_field("level_#{people_skill.skill_id}", with: people_skill.level)
validate_skill_level_label(people_skill.level)
validate_interest(people_skill.interest)
expect(find("#person_people_skills_attributes_0_certificate").checked?).to eq people_skill.certificate
expect(find("#person_people_skills_attributes_0_core_competence").checked?).to eq people_skill.core_competence
expect(find("#certificate_#{people_skill.skill_id}").checked?).to eq people_skill.certificate
expect(find("#core_competence_#{people_skill.skill_id}").checked?).to eq people_skill.core_competence
end
end

Expand Down
18 changes: 9 additions & 9 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -132,18 +132,18 @@
resolved "https://registry.yarnpkg.com/@hotwired/stimulus/-/stimulus-3.2.2.tgz#071aab59c600fed95b97939e605ff261a4251608"
integrity sha512-eGeIqNOQpXoPAIP7tC1+1Yc1yl1xnwYqg+3mzqxyrbE5pg5YFBZcA6YoTiByJB6DKAEsiWtl6tjTJS4IYtbB7A==

"@hotwired/turbo-rails@^7.3.0":
version "7.3.0"
resolved "https://registry.yarnpkg.com/@hotwired/turbo-rails/-/turbo-rails-7.3.0.tgz#422c21752509f3edcd6c7b2725bbe9e157815f51"
integrity sha512-fvhO64vp/a2UVQ3jue9WTc2JisMv9XilIC7ViZmXAREVwiQ2S4UC7Go8f9A1j4Xu7DBI6SbFdqILk5ImqVoqyA==
"@hotwired/turbo-rails@^8.0.12":
version "8.0.12"
resolved "https://registry.yarnpkg.com/@hotwired/turbo-rails/-/turbo-rails-8.0.12.tgz#6f1a2661122c0a2bf717f3bc68b5106638798c89"
integrity sha512-ZXwu9ez+Gd4RQNeHIitqOQgi/LyqY8J4JqsUN0nnYiZDBRq7IreeFdMbz29VdJpIsmYqwooE4cFzPU7QvJkQkA==
dependencies:
"@hotwired/turbo" "^7.3.0"
"@hotwired/turbo" "^8.0.12"
"@rails/actioncable" "^7.0"

"@hotwired/turbo@^7.3.0":
version "7.3.0"
resolved "https://registry.yarnpkg.com/@hotwired/turbo/-/turbo-7.3.0.tgz#2226000fff1aabda9fd9587474565c9929dbf15d"
integrity sha512-Dcu+NaSvHLT7EjrDrkEmH4qET2ZJZ5IcCWmNXxNQTBwlnE5tBZfN6WxZ842n5cHV52DH/AKNirbPBtcEXDLW4g==
"@hotwired/turbo@^8.0.12":
version "8.0.12"
resolved "https://registry.yarnpkg.com/@hotwired/turbo/-/turbo-8.0.12.tgz#50aa8345d7f62402680c6d2d9814660761837001"
integrity sha512-l3BiQRkD7qrnQv6ms6sqPLczvwbQpXt5iAVwjDvX0iumrz6yEonQkNAzNjeDX25/OJMFDTxpHjkJZHGpM9ikWw==

"@nodelib/[email protected]":
version "2.1.5"
Expand Down

0 comments on commit 67d0439

Please sign in to comment.