Commit 99be69a6 authored by Chrysanthi Lagodimou's avatar Chrysanthi Lagodimou Committed by Andi Staub
Browse files

add volunteer journal consistent with client one

parent c41908e0
Pipeline #12727 passed with stage
in 42 minutes and 33 seconds
button.btn.btn-primary(data-toggle='collapse' data-target='#journalBlock' type='button' aria-expanded='false' aria-controls='journalBlock')
= 'Journal'
#journalBlock.collapse
ul.list-inline
li= button_link t('add_journal_entry'), url_for([journaled_for, Journal]) + '/new'
- if journaled_for.journals.any?
.table-responsive
table.table
thead
tr
th= t_attr(:created_at)
th= t_attr(:category, Journal)
th= t_attr(:text, Journal)
th= t_attr(:author, Journal)
th
tbody
- journaled_for.journals.each do |record|
tr
td= l(record.created_at.to_date)
td= t("category.#{record.category}")
td= word_wrap(record.body) if record.body
td= link_to record.user.full_name, record.user.profile
td= link_to t_action(:edit), url_for([journaled_for, record]) + '/edit'
hr
......@@ -6,12 +6,13 @@ h1= @volunteer.contact.full_name
h4= "#{t_attr(:rejection_text)}: #{@volunteer.rejection_text}"
nav.navbar.section-navigation
ul.list-inline.pull-right
- if policy(Volunteer).can_manage?
li= button_link 'Journal', polymorphic_path([@volunteer, Journal]), 'primary'
ul.list-inline
- if policy(Volunteer).acceptance?
li.button-acceptance = link_to t(".acceptance.#{@volunteer.acceptance}"), '#',
class: "btn btn-acceptance-#{@volunteer.acceptance}"
- if policy(Volunteer).can_manage?
= render 'journals/journal_block', journaled_for: @volunteer
ul.list-inline
- if @volunteer.seeking_clients?
li= button_link t_title(:new, Assignment), new_assignment_path(volunteer_id: @volunteer)
......
......@@ -508,7 +508,6 @@ de:
volunteer: Freiwillige/n
volunteer_application: Freiwilligen Anmeldung
add_entry: Eintrag Hinzufügen
add_journal_entry: Journaleintrag verfassen
add_relative: Verwandte hinzufügen
all: Alle
application_submitted: 'Ihre Anmeldung wurde erfolgreich abgeschickt.'
......
......@@ -337,7 +337,6 @@ en:
volunteer_application: Volunteer Registration
volunteer_experience_desc: If you have any experiences with voluntary work, please describe any further here.
add_entry: Add entry
add_journal_entry: Write a journal entry
add_relative: Add family member
all: All
application_submitted: Your registration has been successfully sent.
......
......@@ -5,24 +5,19 @@ class JournalsTest < ApplicationSystemTestCase
@user = create :user
@volunteer = create :volunteer, journals: [FactoryBot.create(:journal, user: @user)],
acceptance: :accepted
@client = create :client, journals: [FactoryBot.create(:journal, user: @user)]
@journal_volunteer = @volunteer.journals.first
@client_volunteer = @client.journals.first
login_as @user
end
test 'volunteer has link to his journal entry' do
test 'volunteer_has_link_to_their_journal_entry' do
visit volunteer_path(@volunteer)
click_button 'Journal'
within '.collapse .table-responsive' do
assert page.has_link? @journal_volunteer.user.full_name
assert page.has_text? @journal_volunteer.body
end
click_link 'Journal'
assert page.has_link? @journal_volunteer.user.full_name
assert page.has_text? @journal_volunteer.body
end
test 'can_create_journal_entry_by_link_button_in_show' do
Journal.with_deleted(&:really_destroy!)
visit client_path(@client)
visit client_path(create(:client))
first('a', text: 'Journal').click
click_link 'New Journal'
assert page.has_text? 'New Journal'
......@@ -34,22 +29,17 @@ class JournalsTest < ApplicationSystemTestCase
end
test 'can_delete_a_journal_through_edit' do
superadmin = create :user
Journal.with_deleted.map(&:really_destroy!)
create :journal, journalable: @volunteer, user: superadmin, body: 'bogus_journal_text'
login_as superadmin
visit volunteer_path(@volunteer)
click_button 'Journal'
assert page.has_text? 'bogus_journal_text'
click_link 'Journal'
assert page.has_text? @journal_volunteer.body
first('a', text: 'Edit').click
assert page.has_text? 'Edit Journal'
page.accept_confirm do
first('a', text: 'Delete').click
end
assert page.has_text? 'Journal was successfully deleted.'
click_button 'Journal'
refute page.has_link? @journal_volunteer.user.full_name
click_link 'Journal'
refute page.has_text? @journal_volunteer.body
end
end
......@@ -202,7 +202,9 @@ class VolunteersTest < ApplicationSystemTestCase
volunteer = create :volunteer
create :assignment, volunteer: volunteer
visit volunteer_path(volunteer)
refute page.has_link? 'Journal'
within '.assignments-table' do
refute page.has_link? 'Journal'
end
end
test 'department_manager_can_see_volunteer_index_and_only_seeking_clients_volunteers' do
......
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