-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature/603 notes core competences (#629)
* begin with template implementation of core competences * implement icon and corresponding text * finish template and inline form * fix cancel button by removing unnecessary modal class * implement test helper and adjust rows of textarea * use partial to display competence-notes * use css class to dipslay line breaks instead of helper * write feature specs * use default functionality of crud controller to update competence notes * rename id of field * rename partial and increase width of text area * implement group.by helper function and use it in template view * write tests and modify fixtures to check whether feature works as expected * revert changes on capybara and resolve rubocop offenses * move logic of grouping entities to helper class * use scope to filter people_skills which are core_competences * make rubocop happy again * clean up code by implementing helpers * adjust rows of textarea * add wait in test * increase wait time * change title of test data to avoid line break * Add word break for non space containing competence strings * Cleanup competence show hash looping * create partials for profile view --------- Co-authored-by: Robin Steiner <[email protected]>
- Loading branch information
Showing
16 changed files
with
195 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# frozen_string_literal: true | ||
|
||
class People::CompetenceNotesController < CrudController | ||
|
||
def self.model_class | ||
Person | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
%div.border.border-secondary-subtle.border-1.d-flex.flex-column | ||
%div.profile-header.mw-100.border-bottom | ||
Kernkompetenzen | ||
%div.d-flex.flex-column.ms-5.mt-3.mb-3 | ||
- group_person_skills_by_category(@person).each do |parent_skill, children_skills| | ||
%div.d-flex.flex-row.align-items-center.border-bottom.border-1.pb-3.pt-3.core-competence | ||
%span.text-gray.w-25= parent_skill.title | ||
- children_skills.each do | person_skill | | ||
%span= person_skill.skill.title | ||
- if person_skill != children_skills.last | ||
%div.circle-divider.ms-2.me-2 | ||
%div.d-flex.flex-row.border-bottom.border-1.pb-3.pt-3 | ||
%span.text-gray.w-25 Notizen Member | ||
%span.w-75.d-flex.align-items-center | ||
= render('people/competence_notes/show') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
%div | ||
=render partial:"people/search", :locals => {person: @person} | ||
%div.profile-header.mw-100.border-bottom | ||
Personalien | ||
%div.mt-4 | ||
%turbo-frame{id: "#{dom_id @person}"} | ||
%div.d-flex.flex-xl-row.flex-column | ||
%div.col-xl-3.col-12 | ||
%img.rounded-circle{src: "/people/#{@person.id}/picture?#{Time.now.to_f}", width: '141', height: '141'} | ||
%div.mt-3= link_to "Bearbeiten", edit_person_path, id: "edit-button" | ||
%div.pe-5.col-xl-3.col-12 | ||
%table.fixed-table | ||
%tbody | ||
%th.fw-normal.text-gray Name | ||
%tr | ||
%td.text-break.pb-1= @person.name | ||
%th.fw-normal.text-gray Email | ||
%tr | ||
%td.text-break.pb-1= @person.email | ||
%th.fw-normal.text-gray Abschluss | ||
%tr | ||
%td.text-break.pb-1= @person.title | ||
%th.fw-normal.text-gray Funktion | ||
- unless @person.person_roles.empty? | ||
- @person.person_roles.each do |person_role| | ||
%tr | ||
%td.pb-1= person_role_string(person_role) | ||
- else | ||
%tr | ||
%td - | ||
%th.fw-normal.text-gray Organisationseinheit | ||
%tr | ||
%td.pb-1= @person.department.nil? ? '-' : @person.department.name | ||
%th.fw-normal.text-gray Firma | ||
%tr | ||
%td= @person.company.name | ||
%div.pe-5.col-xl-3.col-12 | ||
%table.fixed-table | ||
%tbody | ||
%th.fw-normal.text-gray Geburtsdatum | ||
%tr | ||
%td.pb-1= @person.birthdate.to_date.strftime('%d.%m.%Y') | ||
%th.fw-normal.text-gray Nationalität | ||
%tr | ||
%td.text-break.pb-1= nationality_string(@person.nationality, @person.nationality2) | ||
%th.fw-normal.text-gray Wohnort (Stadt) | ||
%tr | ||
%td.text-break.pb-1= @person.location | ||
%th.fw-normal.text-gray Zivilstand | ||
%tr | ||
%td.pb-1= t("marital_statuses.#{@person.marital_status}") | ||
%th.fw-normal.text-gray Kürzel | ||
%tr | ||
%td= @person.shortname.blank? ? '-' : @person.shortname | ||
|
||
%div.col-xl-3.col-12 | ||
%div.fw-normal.text-gray Sprachen | ||
%div.border.border-dark-subtle.mt-1.p-2.rounded | ||
- @person.language_skills.each do |language| | ||
%div.mb-1= "#{language.language}: #{language.level} - #{language.certificate}" | ||
= link_to "Show all", people_path, {"data-turbo"=>false} | ||
|
||
%div.d-flex.justify-content-end | ||
=link_to image_tag("plus-lg.svg", class: "text-primary")+ "Export", export_cv_person_path(@person), class: "btn text-primary", data: { turbo_frame: "remote_modal" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
%turbo-frame{id: "competence-notes"} | ||
%div.d-flex | ||
%div.persisted-line-breaks= @person.competence_notes | ||
%div.d-flex.flex-row | ||
= link_to image_tag("pencil-square.svg", class: "text-primary me-2 ms-0 d-flex align-items-center", width: '16', height: '16')+ "Bearbeiten", | ||
competence_notes_person_path(@person), class: "d-flex align-items-center", id: "edit-link" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
%turbo-frame{id: "competence-notes"} | ||
= form_with model: @person do |f| | ||
.mb-4.w-100 | ||
= f.text_area :competence_notes, class: "form-control w-75", value: @person.competence_notes, | ||
rows: @person.competence_notes.lines.count | ||
.mb-1.mt-4 | ||
= f.button "Speichern", class:"btn btn-primary","aria-label":"Close", id: 'save' | ||
= link_to "Abbrechen", person_path(@person), class: "btn btn-outline-secondary", id: 'cancel' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
= render('people/competence_notes/show') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,64 +1,3 @@ | ||
%div | ||
=render partial:"people/search", :locals => {person: @person} | ||
%div.person-profile-header.mw-100.border-bottom | ||
Personalien | ||
%div.mt-4 | ||
%turbo-frame{id: "#{dom_id @person}"} | ||
%div.d-flex.flex-xl-row.flex-column | ||
%div.col-xl-3.col-12 | ||
%img.rounded-circle{src: "/people/#{@person.id}/picture?#{Time.now.to_f}", width: '141', height: '141'} | ||
%div.mt-3= link_to "Bearbeiten", edit_person_path, id: "edit-button" | ||
%div.pe-5.col-xl-3.col-12 | ||
%table.fixed-table | ||
%tbody | ||
%th.fw-normal.text-gray Name | ||
%tr | ||
%td.text-break.pb-1= @person.name | ||
%th.fw-normal.text-gray Email | ||
%tr | ||
%td.text-break.pb-1= @person.email | ||
%th.fw-normal.text-gray Abschluss | ||
%tr | ||
%td.text-break.pb-1= @person.title | ||
%th.fw-normal.text-gray Funktion | ||
- unless @person.person_roles.empty? | ||
- @person.person_roles.each do |person_role| | ||
%tr | ||
%td.pb-1= person_role_string(person_role) | ||
- else | ||
%tr | ||
%td - | ||
%th.fw-normal.text-gray Organisationseinheit | ||
%tr | ||
%td.pb-1= @person.department.nil? ? '-' : @person.department.name | ||
%th.fw-normal.text-gray Firma | ||
%tr | ||
%td= @person.company.name | ||
%div.pe-5.col-xl-3.col-12 | ||
%table.fixed-table | ||
%tbody | ||
%th.fw-normal.text-gray Geburtsdatum | ||
%tr | ||
%td.pb-1= @person.birthdate.to_date.strftime('%d.%m.%Y') | ||
%th.fw-normal.text-gray Nationalität | ||
%tr | ||
%td.text-break.pb-1= nationality_string(@person.nationality, @person.nationality2) | ||
%th.fw-normal.text-gray Wohnort (Stadt) | ||
%tr | ||
%td.text-break.pb-1= @person.location | ||
%th.fw-normal.text-gray Zivilstand | ||
%tr | ||
%td.pb-1= t("marital_statuses.#{@person.marital_status}") | ||
%th.fw-normal.text-gray Kürzel | ||
%tr | ||
%td= @person.shortname.blank? ? '-' : @person.shortname | ||
= render('profile') | ||
= render('core_competences') | ||
|
||
%div.col-xl-3.col-12 | ||
%div.fw-normal.text-gray Sprachen | ||
%div.border.border-dark-subtle.mt-1.p-2.rounded | ||
- @person.language_skills.each do |language| | ||
%div.mb-1= "#{language.language}: #{language.level} - #{language.certificate}" | ||
= link_to "Show all", people_path, {"data-turbo"=>false} | ||
|
||
%div.d-flex.justify-content-end | ||
=link_to image_tag("plus-lg.svg", class: "text-primary")+ "Export", export_cv_person_path(@person), class: "btn text-primary", data: { turbo_frame: "remote_modal" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
require 'rails_helper' | ||
|
||
describe "Core competences" do | ||
before(:each) do | ||
sign_in auth_users(:user), scope: :auth_user | ||
visit root_path | ||
end | ||
|
||
it 'should display core competences' do | ||
visit person_path(people(:bob)) | ||
expect(page).to have_selector('.core-competence', count: 1) | ||
expect(page).to have_text('Software-Engineering') | ||
expect(page).to have_text('Rails') | ||
end | ||
|
||
it 'should display competence notes and edit link correctly' do | ||
visit person_path(people(:alice)) | ||
expect(page).to have_text('LaTex\n Puppet\n Bash') | ||
expect(page).to have_selector('#edit-link') | ||
end | ||
|
||
it 'should update competence notes' do | ||
visit person_path(people(:alice)) | ||
page.find('#edit-link').click | ||
expect(page).to have_selector('.form-control') | ||
|
||
fill_in 'person_competence_notes', with: 'Hello World here' | ||
page.find('#save').click | ||
expect(page).to have_text('Hello World here') | ||
end | ||
|
||
it 'should not update competence notes when clicking cancel button' do | ||
visit person_path(people(:alice)) | ||
page.find('#edit-link').click | ||
expect(page).to have_selector('.form-control') | ||
|
||
fill_in 'person_competence_notes', with: 'Hello World here' | ||
page.find('#cancel').click | ||
expect(page).to have_text('LaTex\n Puppet\n Bash') | ||
end | ||
|
||
it 'should display skill with same parent category in same row with divider' do | ||
visit person_path(people(:alice)) | ||
expect(page).to have_selector('.circle-divider') | ||
expect(page).to have_selector('.core-competence', count: 1, text: "Software-Engineering\nRails\nember") | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters