Skip to content

Commit

Permalink
start fixing cv search
Browse files Browse the repository at this point in the history
  • Loading branch information
kcinay055679 committed Jul 30, 2024
1 parent d1a7044 commit f4ce3bf
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 5 deletions.
4 changes: 2 additions & 2 deletions app/helpers/select_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

module SelectHelper
def select_when_available(obj)
selected = obj ? obj.path : ''
prompt = obj ? false : true
selected = obj || ''
prompt = selected.blank?
{ selected: selected, prompt: prompt, disabled: '' }
end

Expand Down
2 changes: 1 addition & 1 deletion app/views/people/_search.html.haml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
%div.d-flex.align-items-center.justify-content-between
%div.d-flex.col-9.gap-3
%span.col-6{"data-controller": "dropdown"}
= collection_select :person_id, :person, Person.all.sort_by {|p| p.name.downcase }, :path, :name, select_when_available(person), {data:{"dropdown-target": "dropdown" , action: "change->dropdown#handleChange"}}
= collection_select :person_id, :person, Person.all.sort_by {|p| p.name.downcase }, :path, :name, select_when_available(person&.path), {data:{"dropdown-target": "dropdown" , action: "change->dropdown#handleChange"}}
%div.d-flex.align-items-center.text-gray
= "#{t '.updated_at'}: #{@person&.last_updated_at.strftime("%d.%m.%Y")}" if @person&.last_updated_at
%a.d-flex.justify-content-between#new-person-button
Expand Down
4 changes: 4 additions & 0 deletions config/locales/de.yml
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,10 @@ de:
global:
link:
add: Skill hinzufügen (max. 5)
people_skills/filter_form:
global:
link:
add: Skill hinzufügen (max. 5)
profile:
updated_at: Zuletzt bearbeitet
skills:
Expand Down
9 changes: 7 additions & 2 deletions spec/features/people_skill_search_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@
visit(people_skills_path)
fill_out_row("JUnit", 5, 3)
add_and_fill_out_row("Rails", 4, 5)
add_and_fill_out_row("ember", 5, 4)
add_and_fill_out_row("Bash", 5, 2)
add_and_fill_out_row("cunit", 5, 2)

expect(page).to have_text("Wally Allround")
end
Expand Down Expand Up @@ -72,9 +75,11 @@

def add_and_fill_out_row(skill, level, interest)
old_row_number = last_row[:id][-1, 1].to_i
click_link "Skill hinzufügen (max. 5)"
click_link(t("people_skills.global.link.add"))

new_row_id = "filter-row-#{old_row_number + 1}"
expect(page).to have_css("[id='#{new_row_id}']")
expect(page).to have_selector("[id='#{new_row_id}']")

fill_out_row(skill, level, interest)
end

Expand Down

0 comments on commit f4ce3bf

Please sign in to comment.