Skip to content

Commit

Permalink
Implement feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
kcinay055679 committed Jul 26, 2024
1 parent 1acfcf6 commit fe881a1
Show file tree
Hide file tree
Showing 31 changed files with 53 additions and 124 deletions.
2 changes: 0 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -84,5 +84,3 @@ end
gem 'tzinfo-data', platforms: %i[mingw mswin x64_mingw jruby]

gem 'rails-controller-testing', '~> 1.0'

gem 'deepl-rb', '~> 2.5'
2 changes: 0 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@ GEM
database_cleaner-core (2.0.1)
date (3.3.4)
deep_merge (1.2.2)
deepl-rb (2.5.3)
devise (4.9.4)
bcrypt (~> 3.0)
orm_adapter (~> 0.1)
Expand Down Expand Up @@ -484,7 +483,6 @@ DEPENDENCIES
countries
cssbundling-rails
database_cleaner
deepl-rb (~> 2.5)
devise
dotenv
faker
Expand Down
4 changes: 2 additions & 2 deletions app/domain/people_search.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ def search_result

people.map do |p|
found_in(p).each do |result|
translated_attr_name = Person.human_attribute_name(result)
results.push({ person: { id: p.id, name: p.name }, found_in: translated_attr_name })
translated_attr = Person.human_attribute_name(result)
results.push({ person: { id: p.id, name: p.name }, found_in: translated_attr })
end
end
results
Expand Down
10 changes: 3 additions & 7 deletions app/helpers/auth_helper.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# frozen_string_literal: true

module AuthHelper
NAVBAR_REGEX = /^(?:\/(?:#{I18n.available_locales.join('|')}))?(\/[^\/]+)(?:\/|$)/

def session_path(_scope)
new_auth_user_session_path
end
Expand Down Expand Up @@ -34,12 +36,6 @@ def language_selector # rubocop:disable Metrics/AbcSize
end

def first_path
path_parts = Pathname(request.path).each_filename.to_a.map { |e| "/#{e}" }
return '' if path_parts.empty?

path_parts = path_parts.drop(1) if I18n.available_locales.include?(
path_parts.first.gsub('/', '').to_sym
)
path_parts.first
request.path.match(NAVBAR_REGEX)&.captures&.first
end
end
2 changes: 1 addition & 1 deletion app/helpers/date_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def date_range_label(model_with_dates)
end

def months
(1..12).map { |m| I18n.l(DateTime.parse(Date::MONTHNAMES[m]), format: '%B') }
t('date.month_names')
end

def date_range_end_label(model_with_dates)
Expand Down
2 changes: 1 addition & 1 deletion app/helpers/select_helper.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

module SelectHelper
def select_when_availabale(obj)
def select_when_available(obj)
selected = obj ? obj.path : ''
prompt = obj ? false : true
{ selected: selected, prompt: prompt, disabled: '' }
Expand Down
2 changes: 1 addition & 1 deletion app/models/person_role.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ class PersonRole < ApplicationRecord
def percent_must_be_a_number
return if percent.nil? || percent.between?(0, 200)

errors.add(:percent, :between_0_and_200) # rubocop:disable Naming/VariableNumber
errors.add(:percent, :valid_percent_range)
end
end
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_availabale(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), {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
2 changes: 1 addition & 1 deletion app/views/people/people_skills/_overview.html.haml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
%p.d-flex.align-items-center.profile-header
= "#{PeopleSkill.model_name.human(count:2)} (#{@person.people_skills.count})"
= "#{PeopleSkill.model_name.human(count: @person.people_skills.count)} (#{@person.people_skills.count})"

%div.ms-3
= form_with(url: person_people_skills_path(@person), method: :get, data: {controller: "filter", turbo_frame: "people-skills"}) do |f|
Expand Down
8 changes: 4 additions & 4 deletions app/views/skills/_header.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@
%label.btn.btn-outline-primary{"data-skillset-selected-target": "selectButton",
"data-action": "click->skillset-selected#selectButton", "data-skillset-selected-id-param": 0}
= form.radio_button :defaultSet, false, onClick: "this.form.requestSubmit()", class: "d-none"
= ti('all')
= t('skills.header.all')
%label.btn.btn-outline-primary{"data-skillset-selected-target": "selectButton",
"data-action": "click->skillset-selected#selectButton", "data-skillset-selected-id-param": 1}
= form.radio_button :defaultSet, "new", onClick: "this.form.requestSubmit()", class: "d-none"
= ti('new')
= t('skills.header.new')
%label.btn.btn-outline-primary{"data-skillset-selected-target": "selectButton",
"data-action": "click->skillset-selected#selectButton", "data-skillset-selected-id-param": 2}
= form.radio_button :defaultSet, true, onClick: "this.form.requestSubmit()", class: "d-none"
= ti('default')
= t('skills.header.default')
%span.d-flex.align-items-center.flex-wrap
%span.text-gray.me-1
= "#{ti('category')}:"
= "#{t('skills.header.category')}:"
= form.collection_select :category, Category.all_parents.order(:title), :id, :title, {include_blank: "Select a category"}, class: "form-select fit-content", onchange: 'this.form.requestSubmit();'
= export_action_link export_skills_path
= add_action_link_modal
2 changes: 1 addition & 1 deletion config/i18n-tasks.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# i18n-tasks finds and manages missing and unused translations: https://github.com/glebm/i18n-tasks
<% require './lib/custom_translation_matchers/dry_crud_ti_scanner' %>
# The "main" locale.
base_locale: de
## All available locales are inferred from the data by default. Alternatively, specify them explicitly:
Expand Down Expand Up @@ -148,6 +147,7 @@ ignore_missing:
- 'datetime.prompts.{month,year}'
- 'number.format.{delimiter, precision}'
- 'helpers.select.prompt'
- 'date.month_names'

## Consider these keys used:
# ignore_unused:
Expand Down
2 changes: 1 addition & 1 deletion config/locales/crud.de.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ de:
cancel: Abbrechen
save: Speichern
search: Suchen
confirm_delete: Wollen Sie diesen Eintrag wirklich löschen?
confirm_delete: Willst du diesen Eintrag wirklich löschen?
errors:
header:
one: 'Ein Fehler verhinderte das Speichern dieses Eintrages:'
Expand Down
2 changes: 1 addition & 1 deletion config/locales/crud.en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ en:
confirm_delete: Do you really want to delete this entry?
errors:
header:
one: '1 error prohibited this entry from being saved:'
one: 'One error prohibited this entry from being saved:'
other: "%{count} errors prohibited this entry from being saved:"
link:
add: Add
Expand Down
4 changes: 2 additions & 2 deletions config/locales/crud.fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ fr:
confirm_delete: Voulez-vous vraiment supprimer cette entrée ?
errors:
header:
one: 'Une erreur a empêché l''enregistrement de cette entrée :'
other: "%{count} Des erreurs ont empêché l'enregistrement de cette entrée :"
one: 'Une erreur a empêché l''enregistrement de cette entrée:'
other: "%{count} Des erreurs ont empêché l'enregistrement de cette entrée:"
link:
add: Créer
delete: Supprimer
Expand Down
2 changes: 1 addition & 1 deletion config/locales/crud.it.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ it:
confirm_delete: Vuoi davvero eliminare questo elemento?
errors:
header:
one: '1 errore impedisce il salvataggio di questo elemento:'
one: 'Un errore impedisce il salvataggio di questo elemento:'
other: "%{count} errori impediscono il salvataggio di questo elemento:"
link:
add: Aggiungi
Expand Down
24 changes: 9 additions & 15 deletions config/locales/de.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,20 +75,14 @@ de:
global:
search_placeholder: CVs durchsuchen...
search_skills: Skills ebenfalls durchsuchen
date_range_picker:
from: Von
till_today: Bis Heute
to: Bis
today: Heute
with_enddate: Mit Enddatum
errors:
messages:
between_0_and_200: muss zwischen 0 und 200 liegen.
cannot_remove: darf nicht gelöscht werden.
invalid_date_range: muss vor dem Enddatum sein.
max_size_10MB: sollte nicht grösser als 10MB sein.
max_size_error: sollte nicht grösser als 10MB sein.
max_size_10MB: darf nicht grösser als 10MB sein.
max_size_error: darf nicht grösser als 10MB sein.
profile-not-found: Profil konnte nicht gefunden werden.
valid_percent_range: muss zwischen 0 und 200 liegen.
global:
date:
from: Von
Expand All @@ -103,7 +97,7 @@ de:
admin_panel: Admin Panel
devise: Devise
mockdata: Mockdata
no_omniauth_providers: An error, no Omniauth providers are available, please contact the administrator.
no_omniauth_providers: Ein Fehler ist aufgetreten, es sind keine Omniauth-Anbieter verfügbar, bitte kontaktieren Sie den Administrator.
sign_in: Anmelden
sign_in_with: Mit %{provider} anmelden
sign_out: Abmelden
Expand Down Expand Up @@ -199,13 +193,13 @@ de:
unrated: Nicht bewertet
interest: Interesse
levels:
expert: Esperto
expert: Experte
junior: Junior
level: Esperienza
professional: Professionale
level: Level
professional: Professionell
senior: Senior
trainee: Apprendista
unweighted: Non valutato
trainee: Azubi
unweighted: Nicht bewertet
people_skills:
global:
link:
Expand Down
2 changes: 1 addition & 1 deletion config/locales/devise.en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,5 +90,5 @@ en:
not_found: not found
not_locked: was not locked
not_saved:
one: '1 error prohibited this %{resource} from being saved:'
one: 'One error prohibited this %{resource} from being saved:'
other: "%{count} errors prohibited this %{resource} from being saved:"
2 changes: 1 addition & 1 deletion config/locales/devise.fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ fr:
reset_password_sent_at: E-mail de réinitialisation du mot de passe envoyé le
reset_password_token: Jeton de réinitialisation du mot de passe
sign_in_count: Nombre d'inscriptions
terms_accepted_at: CONDITIONS GÉNÉRALES DE VENTE
terms_accepted_at: Conditions générales de vente
unconfirmed_email: Adresse e-mail non confirmée
unlock_token: Jeton de déverrouillage
updated_at: Mis à jour le
Expand Down
8 changes: 1 addition & 7 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,20 +75,14 @@ en:
global:
search_placeholder: Search CVs...
search_skills: Search skills as well
date_range_picker:
from: From
till_today: Until today
to: Until
today: Today
with_enddate: With end date
errors:
messages:
between_0_and_200: must be between 0 and 200.
cannot_remove: must not be deleted.
invalid_date_range: must be before the end date.
max_size_10MB: should not be larger than 10MB.
max_size_error: should not be larger than 10MB.
profile-not-found: Profile could not be found.
valid_percent_range: must be between 0 and 200.
global:
date:
from: From
Expand Down
10 changes: 2 additions & 8 deletions config/locales/fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,20 +75,14 @@ fr:
global:
search_placeholder: Chercher dans les CV...
search_skills: Rechercher également des compétences
date_range_picker:
from: De
till_today: Jusqu'à aujourd'hui
to: Jusqu'à
today: Aujourd'hui
with_enddate: Avec date de fin
errors:
messages:
between_0_and_200: doit être compris entre 0 et 200.
cannot_remove: ne doit pas être supprimé.
invalid_date_range: doit être antérieure à la date de fin.
max_size_10MB: ne doit pas dépasser 10 Mo.
max_size_error: ne doit pas dépasser 10 Mo.
profile-not-found: Le profil n'a pas été trouvé.
valid_percent_range: doit être compris entre 0 et 200.
global:
date:
from: De
Expand All @@ -103,7 +97,7 @@ fr:
admin_panel: Panneau d'administration
devise: Devise
mockdata: Mockdata
no_omniauth_providers: An error, no Omniauth providers are available, please contact the administrator.
no_omniauth_providers: Une erreur s'est produite, aucun fournisseur Omniauth n'est disponible, veuillez contacter l'administrateur.
sign_in: S'inscrire
sign_in_with: 'S''inscrire avec %{provider} '
sign_out: Se désinscrire
Expand Down
8 changes: 1 addition & 7 deletions config/locales/it.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,20 +75,14 @@ it:
global:
search_placeholder: Ricerca CV...
search_skills: Anche le capacità di ricerca
date_range_picker:
from: Da
till_today: Fino ad oggi
to: Fino a quando
today: Oggi
with_enddate: Con data di scadenza
errors:
messages:
between_0_and_200: deve essere compreso tra 0 e 200.
cannot_remove: non deve essere cancellato.
invalid_date_range: deve essere precedente alla data di scadenza.
max_size_10MB: non dovrebbe essere più grande di 10 MB.
max_size_error: non dovrebbe essere più grande di 10 MB.
profile-not-found: Il profilo non è stato trovato.
valid_percent_range: deve essere compreso tra 0 e 200.
global:
date:
from: Da
Expand Down
3 changes: 2 additions & 1 deletion 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_06_03_085509) do
ActiveRecord::Schema[7.0].define(version: 2024_06_24_122411) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"

Expand Down Expand Up @@ -148,6 +148,7 @@
t.string "email"
t.integer "department_id"
t.string "shortname"
t.integer "ptime_employee_id"
t.index ["company_id"], name: "index_people_on_company_id"
end

Expand Down
46 changes: 0 additions & 46 deletions lib/custom_translation_matchers/dry_crud_ti_scanner.rb

This file was deleted.

2 changes: 1 addition & 1 deletion spec/features/advanced_trainings_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
describe 'Simple interactions' do
it 'shows all' do
within('turbo-frame#advanced_training') do
expect(page).to have_content('Januar 2010 - Januar 2012')
expect(page).to have_content('2010 - 2012')
expect(page).to have_content('Course about how to clean')
end
end
Expand Down
2 changes: 2 additions & 0 deletions spec/features/auth_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
end

it 'Admin can create new skill' do
require 'pry'; binding.pry # rubocop:disable Style/Semicolon,Lint/Debugger

visit skills_path
click_link(href: new_skill_path)
expect(page).to have_field('skill_title')
Expand Down
Loading

0 comments on commit fe881a1

Please sign in to comment.