fix semester process create journal link to work in all cases

parent 4a86df7b
......@@ -58,16 +58,12 @@ class JournalsController < ApplicationController
end
def handle_semester_feedback_quote
return unless params[:semester_feedback]
@semester_feedback = SemesterFeedback.find_by(id: params[:semester_feedback_id])
return unless @semester_feedback
return unless params[:sp_volunteer_id]
@journal.category = :feedback
@journal.title = "Semester Prozess Feedback vom #{I18n.l(@semester_feedback.created_at.to_date)}: "
@journal.body = @semester_feedback.slice(:goals, :achievements, :future, :comments).map do |key, sfb_quote|
"#{I18n.t("activerecord.attributes.feedback.#{key}")}:\n«#{sfb_quote}»" if sfb_quote.present?
end.compact.join("\n\n")
@semester_process_volunteer = SemesterProcessVolunteer.find(params[:sp_volunteer_id])
@journal.journalable = @semester_process_volunteer.volunteer
@journal.title = "Semester Prozess Feedback vom #{I18n.l(@semester_process_volunteer.created_at.to_date)}: "
end
def journal_params
......
......@@ -27,8 +27,7 @@ h1 Semester Prozess
td.index-action-cell.hidden-print
= button_link icon_span(:edit), review_semester_review_semester_url(spv), title: 'Bearbeiten'
= button_link icon_span(:journal), volunteer_journals_path(spv.volunteer), title: 'Journal'
= button_link icon_span(:journal_new),
new_volunteer_journal_path(spv.volunteer, semester_feedback_id: spv.semester_feedbacks.ids, semester_feedback: 1),
= button_link icon_span(:journal_new), new_volunteer_journal_path(spv.volunteer, sp_volunteer_id: spv.id),
title: 'Neuen Journal eintrag mit Zitat erstellen'
= button_link icon_span(:hours), volunteer_hours_path(spv.volunteer), title: 'Stunden'
td
......
Markdown is supported
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