Verified Commit 079372fa authored by Markus Koller's avatar Markus Koller 🦊
Browse files

Rename profile link in navigation

parent 2e50ddad
......@@ -87,10 +87,10 @@ module ApplicationHelper
end
def profile_link(user)
if user.profile
edit_profile_path(user.profile)
elsif user.volunteer?
if user.volunteer?
edit_volunteer_path(user.volunteer)
elsif user.profile
edit_profile_path(user.profile)
else
edit_user_path(user)
end
......
......@@ -38,15 +38,13 @@ nav.navbar.navbar-top.hidden-print
span= "#{current_user.full_name} #{t("role.#{current_user.role}")}"
span.caret
ul.dropdown-menu
- if current_user.volunteer?
li
= link_to 'Profil anzeigen', edit_volunteer_path(current_user.volunteer.id)
- else
li
- if current_user.profile.blank?
= link_to 'Profil erfassen', new_profile_path
- else
= link_to 'Profil anzeigen', current_user.profile
li
- if current_user.volunteer?
= link_to 'Profil bearbeiten', profile_link(current_user)
- elsif current_user.profile.blank?
= link_to 'Profil erfassen', new_profile_path
- else
= link_to 'Profil bearbeiten', edit_profile_path(current_user.profile)
- if policy(current_user).edit?
li
= link_to 'Login bearbeiten', edit_user_path(current_user)
......
......@@ -32,7 +32,7 @@ class FeedbacksTest < ApplicationSystemTestCase
within '.navbar-top' do
click_link I18n.t("role.#{@user_volunteer.role}"), href: '#'
end
click_link 'Profil anzeigen'
click_link 'Profil bearbeiten'
within '.assignments-table' do
click_link 'Feedback Liste', href: polymorphic_path([@volunteer, @assignment, Feedback])
end
......@@ -47,7 +47,7 @@ class FeedbacksTest < ApplicationSystemTestCase
within '.navbar-top' do
click_link I18n.t("role.#{@user_volunteer.role}"), href: '#'
end
click_link 'Profil anzeigen'
click_link 'Profil bearbeiten'
within '.group-assignments-table' do
click_link 'Feedback Liste', href: polymorphic_path([@volunteer, @group_offer, Feedback])
end
......
......@@ -15,11 +15,6 @@ class HoursTest < ApplicationSystemTestCase
create :group_assignment, group_offer: @group_offer1, volunteer: @volunteer1,
period_start: 7.weeks.ago
login_as @user_volunteer1
visit root_url
within '.navbar-top' do
click_link I18n.t("role.#{@user_volunteer1.role}"), href: '#'
end
click_link 'Profil anzeigen'
end
test 'volunteer can create hour report for an assignment' do
......
......@@ -68,30 +68,12 @@ class ProfilesTest < ApplicationSystemTestCase
within '.navbar-top' do
click_link I18n.t("role.#{@user_without_profile.role}"), href: '#'
end
click_link 'Profil anzeigen'
click_link 'Profil bearbeiten', match: :first
click_link 'Zurück'
assert page.has_text? @user_without_profile.profile.contact.first_name
assert page.has_text? @user_without_profile.profile.contact.last_name
end
test 'user can change the password from profile page' do
login_as @user
visit profile_path(@user.profile.id)
click_link 'Login bearbeiten'
assert page.has_field? 'Passwort'
assert page.has_field? 'Email'
assert page.has_field? 'Rolle'
fill_in 'Passwort', with: 'abcdefghijk'
fill_in 'Email', with: 'new@email.com'
click_button 'Login aktualisieren'
user = User.find @user.id
assert user.valid_password? 'abcdefghijk'
assert_equal user.email, 'new@email.com'
end
test 'profileless user gets new profile link on show profile' do
login_as @user_without_profile
visit user_path(@user_without_profile)
......
......@@ -33,7 +33,7 @@ class TrialFeedbacksTest < ApplicationSystemTestCase
within '.navbar-top' do
click_link I18n.t("role.#{@user_volunteer.role}"), href: '#'
end
click_link 'Profil anzeigen'
click_link 'Profil bearbeiten'
within '.assignments-table' do
click_link 'Probezeit Feedback Liste'
end
......@@ -48,7 +48,7 @@ class TrialFeedbacksTest < ApplicationSystemTestCase
within '.navbar-top' do
click_link I18n.t("role.#{@user_volunteer.role}"), href: '#'
end
click_link 'Profil anzeigen'
click_link 'Profil bearbeiten'
within '.group-assignments-table' do
click_link 'Probezeit Feedback Liste'
end
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment