-
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.
* create controller method to load correct picture path, add uploads to assets path, move cancel button on edit view and fix view not loading when department name missing * add default avatar to public directory * make view display nil properties of person as -, create picture controller and remove picture_path method from people_controller, use new picture controller to load pictures correctly in view * start working on updating roles by renaming the params in the form and overriding the update method in the controller * Implement first yet not usable version of modal * Implement second version of CV export with working modal * implement view of cv-export modal * implement cv export and its modal * transform values of query parameters to string * fix template issue by using andpercent operator * implement feature specs to check modal * use before each block in describe to sign in as user * resolve rubocop offenses * remove duplicated update method * modify validation method * make rubocop happy * delete unnecessary test files --------- Co-authored-by: Jannik Pulfer <[email protected]> Co-authored-by: megli2 <[email protected]>
- Loading branch information
1 parent
3f6c69b
commit 8d78715
Showing
12 changed files
with
115 additions
and
24 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# frozen_string_literal: true | ||
|
||
class People::ExportCvController < ApplicationController | ||
def show | ||
render 'show' | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# frozen_string_literal: true | ||
|
||
class PictureController < ApplicationController | ||
def show | ||
picture_url = @person.picture.file.nil? ? default_avatar_path : @person.picture.url | ||
send_file(picture_url, disposition: 'inline') | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# frozen_string_literal: true | ||
|
||
module PictureHelper | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import {Controller} from "@hotwired/stimulus" | ||
|
||
export default class extends Controller { | ||
static targets = ['container', 'switch', 'label'] | ||
levels = {"1": "Trainee", "2": "Junior", "3": "Professional", "4": "Senior", "5": "Expert"} | ||
showSwitch = false; | ||
|
||
connect() { | ||
this.toggleSwitch(); | ||
} | ||
|
||
toggleSwitch() { | ||
this.containerTarget.style.display = !this.showSwitch ? 'none' : 'block'; | ||
this.showSwitch = !this.showSwitch | ||
} | ||
|
||
toggleLevel() { | ||
this.labelTarget.textContent = this.levels[this.switchTarget.value] | ||
} | ||
} |
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,19 @@ | ||
= form_with(url: person_path(format: 'odt'), method: 'get', data: {controller: "skills-filter"}) do |f| | ||
.mb-2.w-100 | ||
= f.label 'Niederlassung (für Footer):', class: "form-label w-100" | ||
= f.collection_select :location, BranchAdress.all, :id, :short_name, {}, class: "form-select w-100" | ||
.mb-2.w-100.form-check.form-switch | ||
= f.check_box :includeCS, class: "form-check-input" | ||
= f.label 'Kernkompetenzen - Skills', class: "form-check-label w-100" | ||
.mb-2.w-100.form-check.form-switch | ||
= f.check_box :skillsByLevel, class: "form-check-input", "data-action": "click->skills-filter#toggleSwitch" | ||
= f.label "Skills nach Level", class: "form-check-label w-100" | ||
%div{"data-skills-filter-target": "container"} | ||
= f.label "trainee", "data-skills-filter-target": "label", class: "w-100" | ||
= f.range_field :levelValue, min: 1, max: 5, value: 1, class: "form-range w-25", "data-action": "change->skills-filter#toggleLevel", "data-skills-filter-target": "switch" | ||
.mb-2.w-100.form-check.form-switch | ||
= f.check_box :anon, class: "form-check-input" | ||
= f.label "Anonymisierter CV", class: "form-check-label w-100" | ||
.mb-1.mt-4 | ||
= f.button "Herunterladen", class:"btn btn-primary","aria-label":"Close" | ||
= link_to "Cancel", skills_path, class: "btn btn-outline-secondary", "data-bs-dismiss":"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,2 @@ | ||
= render "remote_modal", title: "CV-Export" do | ||
= render "export_form" |
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,28 @@ | ||
require 'rails_helper' | ||
|
||
describe :people do | ||
before(:each) do | ||
sign_in auth_users(:user), scope: :auth_user | ||
visit root_path | ||
end | ||
|
||
describe 'CV-Export', type: :feature, js: true do | ||
it 'should display range after switch was clicked' do | ||
visit person_path(people(:bob)) | ||
page.find('a', text: 'Export').click | ||
|
||
expect(page).not_to have_field('levelValue') | ||
page.first('#skillsByLevel').click | ||
expect(page).to have_field('levelValue') | ||
end | ||
|
||
it 'should display correct label when range increased' do | ||
visit person_path(people(:bob)) | ||
page.find('a', text: 'Export').click | ||
|
||
page.first('#skillsByLevel').click | ||
page.find('#levelValue').set(5) | ||
expect(page).to have_text('Expert') | ||
end | ||
end | ||
end |