Sprankelprachtig aan/afmeldsysteem

show.html.haml 6.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. - all_buttons = @activity.may_change?(current_person)
  2. = render partial: 'activities/prev_next'
  3. .row
  4. .col-md-9
  5. .panel.panel-default
  6. .panel-heading
  7. .btn-group.pull-right
  8. %button.btn.btn-default.dropdown-toggle.btn-xs{data: {toggle: 'dropdown'}, 'aria-haspopup': true, 'aria-expanded': false}
  9. %i.fas.fa-cogs
  10. %span.caret
  11. %ul.dropdown-menu
  12. %li
  13. %a.copy-reactions{data: {activity: @activity.id, absent: true}}
  14. %i.fas.fa-copy
  15. = t 'activities.participant.copy_absent'
  16. %a.copy-reactions{data: {activity: @activity.id, present: true, absent: true, unknown: true}}
  17. %i.fas.fa-copy
  18. = t 'activities.participant.copy_responses'
  19. - if all_buttons
  20. %li.divider{role: 'separator'}
  21. %li
  22. = link_to edit_group_activity_path(@group, @activity) do
  23. %i.fas.fa-pencil
  24. = t :edit
  25. = @activity.name
  26. %table.table
  27. - unless @organizers.blank?
  28. %tr
  29. %td
  30. = t 'activities.attrs.organizers'
  31. %td
  32. = @organizers
  33. - unless @activity.description.blank?
  34. %tr
  35. %td
  36. = t 'activities.attrs.description'
  37. %td
  38. = @activity.description
  39. - unless @activity.location.blank?
  40. %tr
  41. %td
  42. = t 'activities.attrs.where'
  43. %td
  44. = @activity.location
  45. %tr
  46. %td
  47. = t 'activities.attrs.when'
  48. %td
  49. = l @activity.start, format: :long
  50. - if @activity.end
  51. \-
  52. - if @activity.end.to_date == @activity.start.to_date
  53. = l @activity.end, format: '%H:%M'
  54. - else
  55. = l @activity.end, format: :long
  56. - if @activity.deadline
  57. %tr
  58. %td
  59. = t 'activities.attrs.deadline'
  60. %td
  61. = l @activity.deadline, format: :long
  62. - if @assignable_subgroups.any?
  63. %tr
  64. %td
  65. = t 'activerecord.models.subgroup.other'
  66. %td
  67. = @assignable_subgroups.join(', ')
  68. - if @ownparticipant&.subgroup
  69. %tr
  70. %td
  71. = t 'activities.participant.yoursubgroup'
  72. %td
  73. = @ownparticipant.subgroup.name
  74. - if @ownparticipant
  75. .col-md-3
  76. .panel.panel-default
  77. .panel-heading
  78. = t 'activities.participant.yourresponse'
  79. .panel-body
  80. = render partial: "activities/wide_presence_buttons", locals: {activity: @activity, person: @ownparticipant.person, state: @ownparticipant.attending}
  81. = editable @ownparticipant,
  82. :notes,
  83. url: presence_group_activity_path(@activity.group, @activity, person_id: @ownparticipant.person_id),
  84. title: t('activities.participant.notes'),
  85. value: @ownparticipant.notes,
  86. emptytext: t('activities.participant.add_notes')
  87. .hidden-xs
  88. .row
  89. .col-md-6
  90. %h2
  91. %span.state-count.all-count
  92. = @num_participants
  93. = t 'activities.participant.plural'
  94. = render partial: "state_counts", locals: {counts: @counts}
  95. .col-md-6
  96. - if @activity.subgroups.any?
  97. = select_tag(:subgroup_filter, options_for_select(@subgroup_ids), class: 'form-control subgroup-filter')
  98. %table.table.table-bordered
  99. - @participants.each do |p|
  100. %tr.participant-row.countable{class: p.row_class, data: {person_id: p.person.id, activity_id: @activity.id, subgroup_id: p.subgroup_id}}
  101. %td
  102. = p.person.full_name
  103. - if p.is_organizer
  104. %i.fas.fa-star-o
  105. %td
  106. = editable p, :notes, url: presence_group_activity_path(@activity.group, @activity, person_id: p.person_id), title: t('activities.participant.notes'), value: p.notes, emptytext: "--"
  107. %td
  108. - if p.person.id == current_person.id || all_buttons
  109. = render partial: "activities/presence_buttons", locals: {activity: @activity, person: p.person, state: p.attending}
  110. .hidden-sm.hidden-md.hidden-lg
  111. - if @activity.subgroups.any?
  112. .panel.panel-default
  113. .panel-heading
  114. = t 'activerecord.models.subgroup.other'
  115. .panel-body
  116. = select_tag(:subgroup_filter, options_for_select(@subgroup_ids), class: 'form-control subgroup-filter')
  117. .panel.panel-default.panel-success
  118. .panel-heading
  119. %a{role: 'button', href: '#present-collapse', data: {toggle: 'collapse'}, 'aria-expanded': 'false'}
  120. %span.sv-show-collapsed
  121. %i.fas.fa-angle-down
  122. %span.sv-show-expanded
  123. %i.fas.fa-angle-up
  124. = t 'activities.state.present'
  125. %span.badge.state-count.present-count
  126. = @counts[true] || "0"
  127. %table.table.collapse#present-collapse
  128. %tbody
  129. - @participants.where(attending: true).each do |p|
  130. = render partial: "mobile_participant_row", locals: {participant: p, show_all_buttons: all_buttons}
  131. .panel.panel-default
  132. .panel-heading
  133. %a{role: 'button', href: '#unknown-collapse', data: {toggle: 'collapse'}, 'aria-expanded': 'false'}
  134. %span.sv-show-collapsed
  135. %i.fas.fa-angle-down
  136. %span.sv-show-expanded
  137. %i.fas.fa-angle-up
  138. = t 'activities.state.need_response'
  139. %span.badge.state-count.unknown-count
  140. = @counts[nil] || "0"
  141. %table.table.collapse#unknown-collapse
  142. %tbody
  143. - @participants.where(attending: nil).each do |p|
  144. = render partial: "mobile_participant_row", locals: {participant: p, show_all_buttons: all_buttons}
  145. .panel.panel-default.panel-danger
  146. .panel-heading
  147. %a{role: 'button', href: '#absent-collapse', data: {toggle: 'collapse'}, 'aria-expanded': 'false'}
  148. %span.sv-show-collapsed
  149. %i.fas.fa-angle-down
  150. %span.sv-show-expanded
  151. %i.fas.fa-angle-up
  152. = t 'activities.state.absent'
  153. %span.badge.state-count.absent-count
  154. = @counts[false] || "0"
  155. %table.table.collapse#absent-collapse
  156. %tbody
  157. - @participants.where(attending: false).each do |p|
  158. = render partial: "mobile_participant_row", locals: {participant: p, show_all_buttons: all_buttons}