Skip to content

Commit

Permalink
feature/697 no skills added message (#726)
Browse files Browse the repository at this point in the history
* Add removing and styling of message

* Add test for message
  • Loading branch information
ManuelMoeri authored Jun 11, 2024
1 parent 6324796 commit e1f53d4
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 20 deletions.
4 changes: 4 additions & 0 deletions app/assets/stylesheets/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -361,3 +361,7 @@ a > img {
width: 16px;
height: 16px;
}

.x-img {
cursor: pointer;
}
34 changes: 17 additions & 17 deletions app/javascript/controllers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ application.register("dropdown", DropdownController)
import DynamicFieldsController from "./dynamic_fields_controller"
application.register("dynamic-fields", DynamicFieldsController)

import FilterController from "./filter_controller"
application.register("filter", FilterController)

import HighlightController from "./highlight_controller"
application.register("highlight", HighlightController)

Expand All @@ -25,35 +28,32 @@ application.register("lang-selection", LangSelectionController)
import NationalityTwoController from "./nationality_two_controller"
application.register("nationality-two", NationalityTwoController)

import PeopleController from "./people_controller"
application.register("people", PeopleController)

import PeopleSkillsController from "./people_skills_controller"
application.register("people-skills", PeopleSkillsController)

import PeopleSkillsFilterController from "./people_skills_filter_controller"
application.register("people-skills-filter", PeopleSkillsFilterController)

import ProfileTabController from "./profile_tab_controller"
application.register("profile-tab", ProfileTabController)

import RemoteModalController from "./remote_modal_controller"
application.register("remote-modal", RemoteModalController)

import ScrollController from "./scroll_controller"
application.register("scroll", ScrollController)

import SearchController from "./search_controller"
application.register("search", SearchController)

import SkillsFilterController from "./skills_filter_controller"
application.register("skills-filter", SkillsFilterController)

import DropdownLinksController from "./dropdown_controller"
application.register("dropdown", DropdownLinksController)

import PeopleSkillsController from "./people_skills_controller"
application.register("people-skills", PeopleSkillsController)

import SkillsEmptySpaceController from "./skills_empty_space_controller"
application.register("skills-empty-space", SkillsEmptySpaceController)

import PeopleSkillsFilterController from "./people_skills_filter_controller"
application.register("people-skills-filter", PeopleSkillsFilterController)

import ScrollController from "./scroll_controller"
application.register("scroll", ScrollController)
import SkillsFilterController from "./skills_filter_controller"
application.register("skills-filter", SkillsFilterController)

import SkillsetSelectedController from "./skillset_selected_controller"
application.register("skillset-selected", SkillsetSelectedController)

import FilterController from "./filter_controller"
application.register("filter", FilterController)
9 changes: 9 additions & 0 deletions app/javascript/controllers/people_controller.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { Controller } from "@hotwired/stimulus";

export default class extends Controller {
static targets = ["message"]

remove() {
this.messageTarget.remove();
}
}
7 changes: 4 additions & 3 deletions app/views/people/_cv.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
= link_to image_tag("export.svg") + "Export", export_cv_person_path(@person), data: { turbo_frame: "remote_modal" }
%div.w-100{data: { "scroll-target": "parent"}}
- if @person.people_skills.count == 0
%span
%p.alert.alert-info= t('profile.no_skills_rated_msg')
%span{"data-controller": "people", "data-people-target": "message"}
%p.alert.alert-info.d-flex.justify-content-between
= t('profile.no_skills_rated_msg')
= image_tag("x.svg", "data-action": "click->people#remove", class: "x-img")
= render('profile')
= render('core_competences')
= render('people/person_relations/index', list: @person.educations.list, id: "educations")
Expand Down
13 changes: 13 additions & 0 deletions spec/features/people_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -304,4 +304,17 @@ def add_language(language)
expect(Person.all.find_by(name: "Hansjakobli")).to be_nil
end
end

describe 'Visit person', type: :feature, js: true do
let(:longmax) { people(:longmax) }

before(:each) do
sign_in auth_users(:user), scope: :auth_user
end

it 'should display message when no skills are rated' do
visit person_path(longmax)
expect(page).to have_selector('p.alert.alert-info.d-flex.justify-content-between', text: I18n.t('profile.no_skills_rated_msg'))
end
end
end

0 comments on commit e1f53d4

Please sign in to comment.