Commit 527115fd authored by Kaspar Vollenweider's avatar Kaspar Vollenweider 👻 Committed by Kaspar
Browse files

show external feature

parent a9d3b1cb
......@@ -26,6 +26,8 @@ Style/FrozenStringLiteralComment:
Layout/MultilineOperationIndentation:
EnforcedStyle: indented
Style/FormatString:
Enabled: false
Style/AsciiComments:
Enabled: false
Metrics/LineLength:
......
......@@ -103,4 +103,12 @@ module ApplicationHelper
no_images: true, no_links: true, no_styles: true, hard_wrap: true)
sanitize(markdown.render(content))
end
def boolean_glyph(value)
if value
content_tag(:i, '', class: 'glyphicon glyphicon-ok text-success')
else
content_tag(:i, '', class: 'glyphicon glyphicon-remove text-danger')
end
end
end
......@@ -18,9 +18,16 @@ module FilterDropdownHelper
end
def dropdown_list_element(attribute, filter_links, t_scope, *q_filters)
dropdown_li_container(
dropdown_toggle_link(toggler_text(attribute, q_filters, t_scope)),
dropdown_menu(filter_links, q_filters)
)
end
def dropdown_li_container(toggler, menu)
content_tag :li, class: 'dropdown' do
concat dropdown_toggle_link(attribute, t_scope, q_filters)
concat dropdown_menu(filter_links, q_filters)
concat toggler
concat menu
end
end
......@@ -47,23 +54,41 @@ module FilterDropdownHelper
end
def dropdown_menu(filter_links, q_filters)
content_tag :ul, class: 'dropdown-menu' do
concat content_tag(:li, link_to(t('all'), url_for(q: search_parameters.except(*q_filters))))
concat content_tag :li, '', class: 'divider', role: 'separator'
dropdown_ul(content_tag(:li, all_link_to(q_filters))) do
filter_links.each { |item| concat item }
end
end
def dropdown_toggle_link(attribute, t_scope, q_filter)
def all_link_to(q_filters)
link_to t('all'), url_for(q: search_parameters.except(*q_filters))
end
def dropdown_ul(all_list_link)
content_tag :ul, class: 'dropdown-menu' do
concat all_list_link
concat dropdown_devider
yield
end
end
def dropdown_devider
content_tag :li, '', class: 'divider', role: 'separator'
end
def dropdown_toggle_link(title_text)
content_tag :a, dropdown_toggler_options do
concat toggler_text(attribute, q_filter, t_scope)
concat content_tag(:span, '', class: 'caret')
concat title_text + ' '
concat bootstrap_caret
end
end
def bootstrap_caret
content_tag :span, '', class: 'caret'
end
def toggler_text(attribute, q_filter, t_scope)
return "#{t_attr(attribute)} " if q_filter.size > 1
"#{t_attr(attribute)}: #{translate_value(search_parameters[q_filter[0]], t_scope)} "
return t_attr(attribute) if q_filter.size > 1
'%s: %s' % [t_attr(attribute), translate_value(search_parameters[q_filter[0]], t_scope)]
end
def dropdown_toggler_options
......
......@@ -102,6 +102,22 @@ class Volunteer < ApplicationRecord
assignments.size.positive?
end
def external?
external
end
def internal?
!external
end
def internal_and_assignments?
internal? && assignments?
end
def self_applicant?
registrar.blank?
end
def seeking_clients?
SEEKING_CLIENTS.include?(state)
end
......
......@@ -21,6 +21,7 @@
th= sort_link @q, :expectations
th= sort_link @q, :interests
th= sort_link @q, :state
th= sort_link @q, :external
th= t('registered_by')
th colspan=(action_name == 'index' ? '5' : '2')
......
......@@ -15,6 +15,7 @@
th= t_attr(:expectations, Volunteer)
th= t_attr(:interests, Volunteer)
th= t_attr(:state, Volunteer)
th= t_attr(:external, Volunteer)
tbody
tr
......@@ -32,3 +33,4 @@
td = volunteer.expectations
td = volunteer.interests
td = t("simple_form.options.volunteer.state.#{volunteer.state}")
td = volunteer.external? ? t_attr(:external) : t_attr(:internal)
......@@ -14,11 +14,8 @@ tr
td = volunteer.expectations
td = volunteer.interests
td = t("simple_form.options.volunteer.state.#{volunteer.state}")
td
- if volunteer.registrar.present?
= volunteer.registrar.full_name
- else
= t('volunteer_self_applicant')
td = volunteer.external? ? t_attr(:external) : t_attr(:internal)
td = volunteer.self_applicant? ? t('volunteer_self_applicant') : volunteer.registrar.full_name
- if action_name == 'index'
= render 'index_actions', subject: volunteer
- if volunteer.seeking_clients?
......
......@@ -23,13 +23,13 @@ nav.navbar.section-navigation
- elsif @volunteer.certificates.size > 1
li= button_link t('.show_certificates'), volunteer_certificates_path(@volunteer)
ul.list-inline
- if @volunteer.assignments.any?
- if @volunteer.internal_and_assignments?
li = button_link t('.report_hours'), new_volunteer_hour_url(@volunteer)
li = button_link t('.hour_reports'), volunteer_hours_path(@volunteer)
li= button_link current_user.volunteer? ? t('edit_profile') : t_title(:edit), edit_volunteer_path(@volunteer)
li= form_navigation_btn :back, with_row: false
- if policy(Volunteer).checklist?
- if @volunteer.internal? && policy(Volunteer).checklist?
h3= t('checklist')
.table-responsive
table.table.table-no-border-top
......@@ -111,17 +111,17 @@ h3= t('personal_background')
tr
td= t_attr(:rejection_text)
td= @volunteer.rejection_text
- if @volunteer.internal?
tr
td= t_attr(:bank_details)
td= @volunteer.full_bank_details
tr
td= t_attr(:waive)
td= t(@volunteer.waive)
tr
td= t_attr(:zurich)
td
dl.dl-horizontal
dt= t(@volunteer.zurich)
tr
td= t_attr(:bank_details)
td= @volunteer.full_bank_details
tr
td= t_attr(:waive)
td= t(@volunteer.waive)
td #{t_attr(:external)} / #{t_attr(:internal)}
td= @volunteer.external? ? t_attr(:external) : t_attr(:internal)
h3= t_attr(:single_accompaniment)
.table-responsive
......@@ -132,12 +132,17 @@ h3= t_attr(:single_accompaniment)
th.text-center= t_attr(single)
tbody
tr
- Volunteer::SINGLE_ACCOMPANIMENTS.each do |single|
td.text-center
- if @volunteer.read_attribute(single)
i.glyphicon.glyphicon-ok.text-success
- else
i.glyphicon.glyphicon-remove.text-danger
- @volunteer.slice(Volunteer::SINGLE_ACCOMPANIMENTS).values.each do |value|
td.text-center= boolean_glyph(value)
.table-responsive
table.table.table-striped
thead
tr
th= t_attr(:zurich)
tbody
tr
td.text-center= boolean_glyph(@volunteer.zurich)
h3= t_attr(:group_accompaniment)
.table-responsive
......@@ -149,12 +154,9 @@ h3= t_attr(:group_accompaniment)
= t_attr(group)
tbody
tr
- Volunteer::GROUP_ACCOMPANIMENTS.each do |group|
td.text-center
- if @volunteer.read_attribute(group)
i.glyphicon.glyphicon-ok.text-success
- else
i.glyphicon.glyphicon-remove.text-danger
- @volunteer.slice(Volunteer::GROUP_ACCOMPANIMENTS).values.each do |value|
td.text-center= boolean_glyph(value)
- if @volunteer.other_offer_desc?
tr
td= t_attr(:other_offer_desc)
......
......@@ -245,6 +245,7 @@ de:
additional_phone_numbers: Zusätzliche Telefonnummern
assignment_count: Anzahl begleitungen
external: Extern
internal: Intern
bank: Name der Bank
bank_account: Kontodaten eingetragen
bank_details: Name der Bank / IBAN
......
......@@ -164,6 +164,7 @@ en:
additional_phone_numbers: Additional phone numbers
address: Address
external: External
internal: Internal
bank_account: Bank account details entered
bank_details: Bank / IBAN
children: Children
......
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