Verified Commit bfe2a787 authored by Kaspar Vollenweider's avatar Kaspar Vollenweider 👻
Browse files

fix bootstrap overwrite bug on action show and sanitize hour views

- bootstrap caused the sticky footer not to be working on pages with action show
   (as they add body.show class). So the display: flex was overwritten with
   bootstraps .show { display: block !important; } directive in that case
- several problems in the hour views fixed
  1. double h1 tags removed
  2. wrong indents in table index view
  3. restore consistency with other views navigations
parent e85198fb
Pipeline #22893 passed with stage
in 53 minutes and 54 seconds
......@@ -46,3 +46,9 @@ $navbar-default-bg: $white;
// Print preview
$print-preview-shadow: 0 0 .5cm rgba(0, 0, 0, .5);
// fix problem that bootstraps _utilities.scss#L30 adds .show { display: block !important }
// so on pages with action show the flex based sticky footer was not working
body.show {
display: flex !important;
}
......@@ -22,7 +22,7 @@ class HoursController < ApplicationController
end
def create
@hour = Hour.new(hour_params)
@hour = Hour.new(hour_params.merge(volunteer: @volunteer))
@hour.hourable ||= find_hourable
authorize @hour
simple_form_params
......
= simple_form_for(*@simple_form_for_params) do |f|
= simple_error_notice f
= f.hidden_field :volunteer_id, value: params[:volunteer_id] || @hour.volunteer.id
- if @hour.hourable.present?
h3 Einsatz
p.m-b-20= @hour.hourable.to_label
- else
.row
.col-xs-12
- if @volunteer.assignment_group_offer_collection.size == 1
= f.input :hourable_id_and_type, as: :select, collection: @volunteer.assignment_group_offer_collection,
required: true, selected: @volunteer.assignment_group_offer_collection.first.last
- else
= f.input :hourable_id_and_type, as: :select, collection: @volunteer.assignment_group_offer_collection,
required: true
.row: .col-xs-12
- if @volunteer.assignment_group_offer_collection.size == 1
- hourable_selected = @volunteer.assignment_group_offer_collection[0].last
= f.input :hourable_id_and_type, as: :select, collection: @volunteer.assignment_group_offer_collection,
required: true, selected: hourable_selected
.row
.col-xs-12.col-md-6
......@@ -24,5 +20,6 @@
= f.input :activity
.col-xs-12
= f.input :comments
.col-xs-12
= f.button :submit
ul.list-inline
li= button_link navigation_glyph(:back), default_redirect || @volunteer
li= f.button :submit
.row
.col-xs-12
h1= t_title(:edit)
h1= t_title(:edit)
= render 'form'
.row
.col-xs-12
= button_link navigation_glyph(:back), @volunteer
- if policy(Hour).supervisor?
h1= @volunteer.contact.full_name
h1 Stunden Rapporte
.row
.col-xs-12
h4.pull-right
= t('total_hours')
=< @volunteer.hours.total_hours
= form_navigation_btn :new
h1
- if policy(Hour).supervisor?
= @volunteer.contact.full_name
' Stunden Rapporte
h4.pull-right
= t('total_hours')
=< @volunteer.hours.total_hours
ul.list-inline
li= button_link navigation_glyph(:back), @volunteer
li= button_link t_title(:new), new_volunteer_hour_path(@volunteer)
.table-responsive
table.table
thead
tr
th.hidden-print Aktionen
- if policy(Hour).supervisor?
th= t_model(Volunteer)
th= t_attr(:hourable)
th= t_attr(:meeting_date)
th= t_attr(:duration)
th= t_attr(:activity)
th= t_attr(:comments)
tbody
- @hours.each do |record|
tr
td.index-action-cell.hidden-print
= button_link navigation_glyph(:show), volunteer_hour_path(@volunteer, record),
title: 'Anzeigen'
= button_link navigation_glyph(:edit), edit_volunteer_hour_path(@volunteer, record),
title: 'Bearbeiten'
= button_link navigation_glyph(:delete), volunteer_hour_path(@volunteer, record),
confirm_deleting(record, 'btn btn-default').merge(title: 'Löschen')
- if current_user.superadmin?
td= link_to @volunteer.contact.full_name, edit_volunteer_path(@volunteer)
td
- if record.assignment?
- if policy(Hour).supervisor?
= link_to record.hourable.client.contact.full_name, client_path(record.hourable.client)
- else
= record.hourable.client.contact.full_name
- else
= link_to record.hourable.to_label, group_offer_path(record.hourable)
td= l(record.meeting_date)
td= record.hours
td= record.activity
td= record.comments
table.table
thead
tr
th.hidden-print Aktionen
- if policy(Hour).supervisor?
th= t_model(Volunteer)
th= t_attr(:hourable)
th Datum des Kurses/Treffens
th Stundenzahl
th= t_attr(:activity)
th= t_attr(:comments)
tbody
- @hours.each do |record|
tr
td.index-action-cell.hidden-print
= button_link navigation_glyph(:show), volunteer_hour_path(@volunteer, record),
title: 'Anzeigen'
= button_link navigation_glyph(:edit), edit_volunteer_hour_path(@volunteer, record),
title: 'Bearbeiten'
= button_link navigation_glyph(:delete), volunteer_hour_path(@volunteer, record),
confirm_deleting(record, 'btn btn-default').merge(title: 'Löschen')
- if current_user.superadmin?
td= link_to @volunteer.contact.full_name, edit_volunteer_path(@volunteer)
td
- if record.assignment?
= link_to_if policy(Hour).supervisor?, record.hourable.client.contact.full_name, client_path(record.hourable.client)
- else
= link_to record.hourable.to_label, group_offer_path(record.hourable)
td= l(record.meeting_date)
td= record.hours
td= record.activity
td= record.comments
= form_navigation_btn :new
.row
.col-xs-12
= button_link navigation_glyph(:back), @volunteer
ul.list-inline
li= button_link navigation_glyph(:back), @volunteer
li= button_link t_title(:new), new_volunteer_hour_path(@volunteer)
.row
.col-xs-12
h1= t('.report_hours')
h1= t('.report_hours')
= render 'form'
.row
.col-xs-12
= button_link navigation_glyph(:back), default_redirect || @volunteer
.row
.col-xs-12
.table-responsive
table.table.table-no-border-top
tbody
- if policy(Hour).supervisor?
tr
td= t_model(Volunteer)
td= @hour.volunteer.contact.full_name
- if @hour.assignment?
tr
td= t_model(Client)
td= @hour.hourable.client.contact.full_name
- else
tr
td= t_model(GroupOffer)
td= @hour.hourable.title
tr
td= t_attr(:meeting_date)
td= l(@hour.meeting_date)
tr
td= t_attr(:duration)
td= @hour.hours
tr
td= t_attr(:activity)
td= @hour.activity
tr
td= t_attr(:comments)
td= @hour.comments
h1 Stundeneintrag
.table-responsive.m-t-30
table.table.table-no-border-top
tbody
tr
- if policy(Hour).supervisor?
td= t_model(Volunteer)
td= @hour.volunteer.contact.full_name
- if @hour.assignment?
td= t_model(Client)
td= @hour.hourable.client.contact.full_name
- else
td= t_model(GroupOffer)
td= @hour.hourable.title
tr
td= t_attr(:meeting_date)
td= l(@hour.meeting_date)
tr
td= t_attr(:duration)
td= @hour.hours
tr
td= t_attr(:activity)
td= @hour.activity
tr
td= t_attr(:comments)
td= @hour.comments
.row
.col-xs-12
= button_link t_title(:edit, Hour), params.to_unsafe_h.merge({action: 'edit'})
.row: .col-xs-12
= button_link t_title(:edit, Hour), params.to_unsafe_h.merge({ action: 'edit' })
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