Sprankelprachtig aan/afmeldsysteem

show.html.haml 7.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  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')
  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.panel-success
  100. .panel-heading
  101. %a{role: 'button', href: '#present-collapse', data: {toggle: 'collapse'}, 'aria-expanded': 'false'}
  102. %span.sv-show-collapsed
  103. %i.fa.fa-angle-down
  104. %span.sv-show-expanded
  105. %i.fa.fa-angle-up
  106. = t 'activities.state.present'
  107. %span.badge
  108. = @counts[true] || "0"
  109. %table.table.collapse#present-collapse
  110. %tbody
  111. - @participants.where(attending: true).each do |p|
  112. %tr{data: {person_id: p.person.id, activity_id: @activity.id}}
  113. %td
  114. = p.person.full_name
  115. - if p.is_organizer
  116. %i.fa.fa-star-o
  117. %td
  118. - if p.person.id == current_person.id || all_buttons
  119. = render partial: "activities/presence_buttons", locals: {activity: @activity, person: p.person, state: p.attending}
  120. %tr{data: {person_id: p.person_id, activity_id: @activity.id}}
  121. %td{colspan: "2"}
  122. = 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: "--"
  123. .panel.panel-default
  124. .panel-heading
  125. %a{role: 'button', href: '#unknown-collapse', data: {toggle: 'collapse'}, 'aria-expanded': 'false'}
  126. %span.sv-show-collapsed
  127. %i.fa.fa-angle-down
  128. %span.sv-show-expanded
  129. %i.fa.fa-angle-up
  130. = t 'activities.state.need_response'
  131. %span.badge
  132. = @counts[nil] || "0"
  133. %table.table.collapse#unknown-collapse
  134. %tbody
  135. - @participants.where(attending: nil).each do |p|
  136. %tr{data: {person_id: p.person.id, activity_id: @activity.id}}
  137. %td
  138. = p.person.full_name
  139. - if p.is_organizer
  140. %i.fa.fa-star-o
  141. %td
  142. - if p.person.id == current_person.id || all_buttons
  143. = render partial: "activities/presence_buttons", locals: {activity: @activity, person: p.person, state: p.attending}
  144. %tr{data: {person_id: p.person_id, activity_id: @activity.id}}
  145. %td{colspan: "2"}
  146. = 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: "--"
  147. .panel.panel-default.panel-danger
  148. .panel-heading
  149. %a{role: 'button', href: '#absent-collapse', data: {toggle: 'collapse'}, 'aria-expanded': 'false'}
  150. %span.sv-show-collapsed
  151. %i.fa.fa-angle-down
  152. %span.sv-show-expanded
  153. %i.fa.fa-angle-up
  154. = t 'activities.state.absent'
  155. %span.badge
  156. = @counts[false] || "0"
  157. %table.table.collapse#absent-collapse
  158. %tbody
  159. - @participants.where(attending: false).each do |p|
  160. %tr{data: {person_id: p.person.id, activity_id: @activity.id}}
  161. %td
  162. = p.person.full_name
  163. - if p.is_organizer
  164. %i.fa.fa-star-o
  165. %td
  166. - if p.person.id == current_person.id || all_buttons
  167. = render partial: "activities/presence_buttons", locals: {activity: @activity, person: p.person, state: p.attending}
  168. %tr{data: {person_id: p.person_id, activity_id: @activity.id}}
  169. %td{colspan: "2"}
  170. = 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: "--"