Commit f917a73d authored by Kaspar Vollenweider's avatar Kaspar Vollenweider 👻
Browse files

Merge branch...

Merge branch 'features/list_responses_has_journal_create_link_with_citation_of_feedback_in_journal_entry' into 'develop'

Features/list responses has journal create link with citation of feedback in journal entry

See merge request !813
parents 58863adb 616cc56b
Pipeline #28186 passed with stage
in 39 minutes and 42 seconds
......@@ -27,3 +27,4 @@ lib/access_import_test/*.xlsx
.stylelintrc
doc
/.idea
.vscode/
......@@ -23,7 +23,7 @@ gem 'country_select'
gem 'devise'
gem 'devise-i18n'
gem 'devise_invitable'
gem 'font-awesome-rails'
gem 'font-awesome-sass'
gem 'i18n_data'
gem 'i18n_rails_helpers'
gem 'jbuilder'
......
......@@ -183,8 +183,8 @@ GEM
railties (>= 3.0.0)
ffaker (2.9.0)
ffi (1.9.25)
font-awesome-rails (4.7.0.4)
railties (>= 3.2, < 6.0)
font-awesome-sass (5.3.1)
sassc (>= 1.11)
globalid (0.4.1)
activesupport (>= 4.2.0)
hashery (2.1.2)
......@@ -467,7 +467,7 @@ DEPENDENCIES
devise_invitable
factory_bot_rails
ffaker
font-awesome-rails
font-awesome-sass
i18n_data
i18n_rails_helpers
i18n_yaml_sorter
......@@ -513,4 +513,4 @@ DEPENDENCIES
wkhtmltopdf-binary
BUNDLED WITH
1.16.2
1.16.4
......@@ -3,7 +3,8 @@
@import 'inplace_fields';
@import 'bootstrap-datepicker3';
@import "font-awesome";
@import 'font-awesome-sprockets';
@import 'font-awesome';
@import 'jquery-ui/core';
@import 'jquery-ui/autocomplete';
@import 'jquery-ui/theme';
......
......@@ -11,6 +11,7 @@ class JournalsController < ApplicationController
def new
@journal = @journaled.journals.new
handle_feedback_quote
authorize @journal
end
......@@ -56,6 +57,17 @@ class JournalsController < ApplicationController
@journaled = Volunteer.find(params[:volunteer_id])
end
def handle_feedback_quote
return unless params[:feedback_id]
@feedback = Feedback.find_by(id: params[:feedback_id])
return unless @feedback
@journal.category = :feedback
@journal.title = "Feedback vom #{I18n.l(@feedback.created_at.to_date)}: "
@journal.body = @feedback.slice(:goals, :achievements, :future, :comments).map do |key, fb_quote|
"#{I18n.t("activerecord.attributes.feedback.#{key}")}:\n«#{fb_quote}»" if fb_quote.present?
end.compact.join("\n\n")
end
def journal_params
params.require(:journal).permit(
:category, :user_id, :body, :title, :client_id, :volunteer_id
......
module NavigationAndButtonHelper
GLYPH_TRANSLATE = {
show: { text: 'Anzeigen', glyph: 'eye-open' },
edit: { text: 'Bearbeiten', glyph: 'pencil' },
delete: { text: 'Löschen', glyph: 'trash' },
terminate: { text: 'Beenden', glyph: 'off' },
activate: { text: 'Aktivieren', glyph: 'ok' },
deactivate: { text: 'Deaktivieren', glyph: 'remove' },
back: { text: 'Zurück', glyph: 'arrow-left' },
print: { text: 'Ausdrucken', glyph: 'print' },
download: { text: 'Herunterladen', glyph: 'download-alt' },
yes: { text: 'Ja', glyph: 'ok' },
no: { text: 'Nein', glyph: 'remove' },
journal: { text: 'Journal', glyph: 'book' },
hours: { text: 'Stunden erfassen', glyph: 'time' },
billing_expenses: { text: 'Spesen', glyph: 'usd' },
assignment: { text: 'Begleitung', glyph: 'user' },
certificate: { text: 'Nachweis', glyph: 'education' }
show: { text: 'Anzeigen', icon_type: 'eye-open' },
edit: { text: 'Bearbeiten', icon_type: 'pencil' },
delete: { text: 'Löschen', icon_type: 'trash' },
terminate: { text: 'Beenden', icon_type: 'off' },
activate: { text: 'Aktivieren', icon_type: 'ok' },
deactivate: { text: 'Deaktivieren', icon_type: 'remove' },
back: { text: 'Zurück', icon_type: 'arrow-left' },
print: { text: 'Ausdrucken', icon_type: 'print' },
download: { text: 'Herunterladen', icon_type: 'download-alt' },
yes: { text: 'Ja', icon_type: 'ok' },
no: { text: 'Nein', icon_type: 'remove' },
journal: { text: 'Journal', icon_type: 'book' },
journal_new: { text: 'Neuen Journal eintrag erstellen', type: :fa, icon_type: :edit },
hours: { text: 'Stunden erfassen', icon_type: 'time' },
billing_expenses: { text: 'Spesen', icon_type: 'usd' },
assignment: { text: 'Begleitung', icon_type: 'user' },
certificate: { text: 'Nachweis', icon_type: 'education' },
xlsx: { text: 'Excel herunterladen', type: :fa, icon_type: 'file-excel-o' },
truthy: { text: 'true', icon_type: :ok, extra_class: 'text-success' },
falsy: { text: 'false', icon_type: :remove, extra_class: 'text-danger' }
}.freeze
def form_navigation_btn(action, cols: 12, with_row: true, md_cols: nil, with_col: false,
......@@ -50,13 +54,13 @@ module NavigationAndButtonHelper
def glyph_action_button_link(action_type, target, **options)
options[:title] ||= GLYPH_TRANSLATE[action_type.to_sym][:text]
yield_button_link(target, **options) do
navigation_glyph(action_type)
icon_span(action_type)
end
end
def make_nav_button(action)
if action == :back
text = navigation_glyph(:back)
text = icon_span(:back)
action = :index
else
text = t_title(action)
......@@ -67,33 +71,23 @@ module NavigationAndButtonHelper
def boolean_glyph(value)
if value
content_tag(:i, '', class: 'glyphicon glyphicon-ok text-success')
icon_span(:truthy)
else
content_tag(:i, '', class: 'glyphicon glyphicon-remove text-danger')
icon_span(:falsy)
end
end
def navigation_glyph(icon_type = :back)
glyph_span(GLYPH_TRANSLATE[icon_type.to_sym])
end
def glyph_span(text: 'Zurück', glyph: 'arrow-left')
tag.span(class: "glyphicon glyphicon-#{glyph}") do
tag.span(text, class: 'sr-only')
def icon_span(icon = :back)
glyph = GLYPH_TRANSLATE[icon]
style = icon_class(glyph&.fetch(:icon_type, 'arrow-left'), glyph&.fetch(:type, :glyphicon),
glyph&.fetch(:extra_class, nil))
tag.span(class: style) do
tag.span(glyph&.fetch(:text, 'Zurück'), class: 'sr-only')
end
end
def navigation_fa_icon(icon_type = :xlsx)
translate_fa = {
xlsx: { text: 'Excel herunterladen', fa_type: 'file-excel-o' }
}
fa_span(translate_fa[icon_type.to_sym])
end
def fa_span(text: 'xlsx', fa_type: 'file-excel-o')
tag.span(class: "fa fa-#{fa_type}") do
tag.span(text, class: 'sr-only')
end
def icon_class(icon_type = 'arrow-left', type = :glyphicon, extra_class = nil)
"#{type} #{type}-#{icon_type} #{extra_class}"
end
def assignment_status_badge(assignment, css = 'btn-xs')
......
......@@ -14,7 +14,7 @@ table.table.table-striped.assignment-logs-table
tr
td.index-action-cell.hidden-print
- if policy(assignment.assignment).show? && assignment.assignment.pdf.exists?
= button_link navigation_glyph(:download), assignment_path(assignment.assignment, format: :pdf),
= button_link icon_span(:download), assignment_path(assignment.assignment, format: :pdf),
title: 'Herunterladen'
td= link_to_if(policy(Client).show?, assignment.client.contact.full_name, assignment.client)
td= l(assignment.period_start) if assignment.period_start
......
tr
td.index-action-cell.hidden-print
- if policy(assignment).show?
= button_link navigation_glyph(:show), assignment, title: 'Anzeigen'
= button_link icon_span(:show), assignment, title: 'Anzeigen'
- if policy(assignment).edit?
= button_link navigation_glyph(:edit), edit_polymorphic_path(assignment), title: 'Bearbeiten'
= button_link icon_span(:edit), edit_polymorphic_path(assignment), title: 'Bearbeiten'
- if policy(assignment).show? && assignment.pdf.exists?
= button_link navigation_glyph(:download), assignment_path(assignment, format: :pdf), title: 'Herunterladen'
= button_link icon_span(:download), assignment_path(assignment, format: :pdf), title: 'Herunterladen'
td.button-acceptance= assignment_status_badge(assignment)
- if controller_name != 'volunteers'
td = link_to_if policy(assignment.volunteer).show?, assignment.volunteer, edit_volunteer_path(assignment.volunteer)
......
......@@ -2,5 +2,5 @@ ul.list-inline
li = form_navigation_btn :back, with_row: false
li = assignment_status_badge(assignment, 'btn')
- if assignment.pdf.exists?
li= button_link navigation_glyph(:download), assignment_path(assignment, format: :pdf),
li= button_link icon_span(:download), assignment_path(assignment, format: :pdf),
title: 'Herunterladen', target: '_blank'
......@@ -20,7 +20,7 @@ nav.navbar.section-navigation.hidden-print
{ q: :active_or_not_yet_active, text: 'Aktiv', value: 'true' },
{ q: :inactive, text: 'Inaktiv', value: 'true' })
li= button_link 'Beendete Begleitungen', terminated_index_assignments_path, dimension: :sm
li= button_link navigation_fa_icon(:xlsx), url_for(format: :xlsx, q: search_parameters), dimension: :sm
li= link_to navigation_glyph(:print), url_for(print: :true, q: search_parameters), { class: 'btn btn-default btn-sm', target: '_blank' }
li= button_link icon_span(:xlsx), url_for(format: :xlsx, q: search_parameters), dimension: :sm
li= link_to icon_span(:print), url_for(print: :true, q: search_parameters), { class: 'btn btn-default btn-sm', target: '_blank' }
hr
h1= @volunteer.contact.full_name
= button_link navigation_glyph(:back), volunteers_path
= button_link icon_span(:back), volunteers_path
= render 'volunteers/show_excerpt', volunteer: @volunteer
......@@ -52,7 +52,7 @@ nav.navbar.section-navigation
- @need_accompanying.each do |client|
tr
td.index-action-cell.hidden-print
= button_link navigation_glyph(:show), client, title: 'Anzeigen'
= button_link icon_span(:show), client, title: 'Anzeigen'
= button_link t('reserve'), new_assignment_url(client_id: client, volunteer_id: @volunteer)
- if policy(Client).superadmin_privileges?
td.button-acceptance = link_to t("acceptance.#{client.acceptance}"), '#',
......
......@@ -3,7 +3,7 @@ h1 Beendete Begleitungen
nav.navbar.section-navigation.hidden-print
hr
ul.list-inline
li= button_link navigation_glyph(:back), assignments_path, dimension: :sm
li= button_link icon_span(:back), assignments_path, dimension: :sm
li= clear_filter_button
= custom_filter_dropdown('Ende Bestätigt',
{ q: :termination_submitted_by_id_not_null, text: 'Bestätigt', value: 'true' },
......@@ -34,8 +34,8 @@ nav.navbar.section-navigation.hidden-print
- @assignments.each do |assignment|
tr
td.index-action-cell.hidden-print
= button_link navigation_glyph(:show), assignment_path(assignment), title: 'Anzeigen'
= button_link navigation_glyph(:edit), edit_assignment_path(assignment), title: 'Bearbeiten'
= button_link icon_span(:show), assignment_path(assignment), title: 'Anzeigen'
= button_link icon_span(:edit), edit_assignment_path(assignment), title: 'Bearbeiten'
- if policy(Assignment).verify_termination?
td
= link_to_if(assignment.termination_verified_by.blank?, 'Beendigung Quittieren',
......
......@@ -2,11 +2,11 @@ h4.label-list
- availability_collection.each do |availability|
- if available.read_attribute(availability)
span.label.label-success>
=> navigation_glyph(:yes)
=> icon_span(:yes)
= t("availability.#{availability}")
- else
span.label.label-danger>
=> navigation_glyph(:no)
=> icon_span(:no)
= t("availability.#{availability}")
.row
......
......@@ -5,7 +5,7 @@
- if(request.format.html? || request.format.js?)
- if @billing_expense.edited_amount?
span.helper_label.hidden-print= " (manuell überschrieben)"
span.hidden-print =navigation_glyph :edit
span.hidden-print =icon_span :edit
span.field_input= text_field_tag 'billing_expense[overwritten_amount]',
@billing_expense.final_amount,
data: { remote: true, url: update_overwritten_amount_billing_expense_path(@billing_expense), method: :put }
......@@ -14,7 +14,7 @@ h1
li=> f.button :submit, 'Auswahl herunterladen', data: { disable_with: false }
li
- if @volunteer
=> button_link navigation_glyph(:back), @volunteer
=> button_link icon_span(:back), @volunteer
- else
=> button_link 'Spesenformulare erfassen', new_billing_expense_path(q: params[:q].permit!)
......@@ -39,12 +39,12 @@ h1
td= check_box_tag 'selected_billing_expenses[]', record.id,
@selected_billing_expenses.include?(record.id.to_s)
td.index-action-cell.hidden-print
= button_link navigation_glyph(:show), billing_expense_path(record),
= button_link icon_span(:show), billing_expense_path(record),
title: 'Anzeigen'
= button_link navigation_glyph(:download), billing_expense_path(record, format: :pdf),
= button_link icon_span(:download), billing_expense_path(record, format: :pdf),
title: 'Herunterladen'
- if policy(BillingExpense).destroy?
= button_link navigation_glyph(:delete), billing_expense_path(record),
= button_link icon_span(:delete), billing_expense_path(record),
confirm_deleting(record, 'btn btn-default').merge(title: 'Löschen')
- unless @volunteer
td= link_to record.volunteer.contact.full_name, edit_volunteer_path(record.volunteer)
......
......@@ -6,7 +6,7 @@ h1 Spesenformulare erfassen
= simple_form_for @billing_expense do |f|
= hidden_field_tag 'selected_semester', @selected_billing_semester
ul.list-inline
= button_link navigation_glyph(:back), billing_expenses_path
= button_link icon_span(:back), billing_expenses_path
li= clear_filter_button
= custom_filter_dropdown(t_attr(:semester, BillingExpense), *@billing_semester_filters)
li= f.button :submit, 'Selektierte Spesenformulare erstellen', 'data-confirm' => 'Sind Sie sicher dass Sie die Spesenformulare für die ausgewählten Freiwilligen erstellen möchten?'
......
......@@ -35,4 +35,4 @@
ul.list-inline
li= f.button :submit
li= button_link navigation_glyph(:back), edit_volunteer_path(@volunteer)
li= button_link icon_span(:back), edit_volunteer_path(@volunteer)
h1= t('.volunteers_certificates', name: @volunteer.contact.full_name)
ul.list-inline
li= button_link navigation_glyph(:back), edit_volunteer_path(@volunteer), dimension: :sm
li= button_link icon_span(:back), edit_volunteer_path(@volunteer), dimension: :sm
li= button_link t_title(:new), new_volunteer_certificate_path(@volunteer), dimension: 'sm'
.table-responsive
table.table
......@@ -15,13 +15,13 @@ ul.list-inline
- @certificates.each do |certificate|
tr
td.index-action-cell.hidden-print
= button_link navigation_glyph(:show),
= button_link icon_span(:show),
volunteer_certificate_path(certificate.volunteer, certificate),
title: 'Anzeigen'
= button_link navigation_glyph(:edit),
= button_link icon_span(:edit),
edit_volunteer_certificate_path(certificate.volunteer, certificate),
title: 'Bearbeiten'
= button_link navigation_glyph(:delete),
= button_link icon_span(:delete),
volunteer_certificate_path(certificate.volunteer, certificate),
confirm_deleting(certificate, 'btn btn-default').merge(title: 'Löschen')
td= l(certificate.created_at.to_date)
......
......@@ -3,10 +3,10 @@
nav.navbar.section-navigation
ul.list-inline
li= button_link t_title(:edit), edit_volunteer_certificate_path(@volunteer, @certificate)
li= button_link navigation_glyph(:print), volunteer_certificate_path(@volunteer, @certificate, print: true)
li= button_link icon_span(:print), volunteer_certificate_path(@volunteer, @certificate, print: true)
li= button_link t_action(:download), volunteer_certificate_path(@volunteer, @certificate, format: :pdf)
li= link_to navigation_glyph(:delete), volunteer_certificate_path(@volunteer, @certificate), confirm_deleting(@certificate, 'btn btn-default')
li= button_link navigation_glyph(:back), :back
li= link_to icon_span(:delete), volunteer_certificate_path(@volunteer, @certificate), confirm_deleting(@certificate, 'btn btn-default')
li= button_link icon_span(:back), :back
hr
.certificate
......
......@@ -17,7 +17,7 @@ h1 Klienten Wartezeitbenachrichtigung
td= link_to notification.user.full_name, notification.user.profile
td.index-action-cell.hidden-print
span= link_to t_action(:edit), edit_client_notification_path(notification)
span= link_to navigation_glyph(:delete), client_notification_path(notification), confirm_deleting(notification)
span= link_to icon_span(:delete), client_notification_path(notification), confirm_deleting(notification)
= form_navigation_btn :new
= button_link navigation_glyph(:back), clients_path
= button_link icon_span(:back), clients_path
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