Sprankelprachtig aan/afmeldsysteem

show.html.haml 7.7KB

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