Sprankelprachtig aan/afmeldsysteem

show.html.haml 6.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  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 @ownparticipant
  59. .col-md-3
  60. .panel.panel-default
  61. .panel-heading
  62. = t 'activities.participant.yourresponse'
  63. .panel-body
  64. = render partial: "activities/wide_presence_buttons", locals: {activity: @activity, person: @ownparticipant.person, state: @ownparticipant.attending}
  65. = editable @ownparticipant,
  66. :notes,
  67. url: presence_group_activity_path(@activity.group, @activity, person_id: @ownparticipant.person_id),
  68. title: t('activities.participant.notes'),
  69. value: @ownparticipant.notes,
  70. emptytext: t('activities.participant.add_notes')
  71. .hidden-xs
  72. %h2
  73. = @num_participants
  74. = t 'activities.participant.plural'
  75. = render partial: "state_counts", locals: {counts: @counts}
  76. %table.table.table-bordered
  77. - @participants.each do |p|
  78. %tr{class: p.row_class, data: {person_id: p.person.id, activity_id: @activity.id}}
  79. %td
  80. = p.person.full_name
  81. - if p.is_organizer
  82. %i.fa.fa-star-o
  83. %td
  84. = 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: "--"
  85. %td
  86. - if p.person.id == current_person.id || all_buttons
  87. = render partial: "activities/presence_buttons", locals: {activity: @activity, person: p.person, state: p.attending}
  88. .hidden-sm.hidden-md.hidden-lg
  89. .panel.panel-default.panel-success
  90. .panel-heading
  91. %a{role: 'button', href: '#present-collapse', data: {toggle: 'collapse'}, 'aria-expanded': 'false'}
  92. %span.sv-show-collapsed
  93. %i.fa.fa-angle-down
  94. %span.sv-show-expanded
  95. %i.fa.fa-angle-up
  96. = t 'activities.state.present'
  97. %span.badge
  98. = @counts[true] || "0"
  99. %table.table.collapse#present-collapse
  100. %tbody
  101. - @participants.where(attending: true).each do |p|
  102. %tr{data: {person_id: p.person.id, activity_id: @activity.id}}
  103. %td
  104. = p.person.full_name
  105. - if p.is_organizer
  106. %i.fa.fa-star-o
  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. %tr{data: {person_id: p.person_id, activity_id: @activity.id}}
  111. %td{colspan: "2"}
  112. = 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: "--"
  113. .panel.panel-default
  114. .panel-heading
  115. %a{role: 'button', href: '#unknown-collapse', data: {toggle: 'collapse'}, 'aria-expanded': 'false'}
  116. %span.sv-show-collapsed
  117. %i.fa.fa-angle-down
  118. %span.sv-show-expanded
  119. %i.fa.fa-angle-up
  120. = t 'activities.state.need_response'
  121. %span.badge
  122. = @counts[nil] || "0"
  123. %table.table.collapse#unknown-collapse
  124. %tbody
  125. - @participants.where(attending: nil).each do |p|
  126. %tr{data: {person_id: p.person.id, activity_id: @activity.id}}
  127. %td
  128. = p.person.full_name
  129. - if p.is_organizer
  130. %i.fa.fa-star-o
  131. %td
  132. - if p.person.id == current_person.id || all_buttons
  133. = render partial: "activities/presence_buttons", locals: {activity: @activity, person: p.person, state: p.attending}
  134. %tr{data: {person_id: p.person_id, activity_id: @activity.id}}
  135. %td{colspan: "2"}
  136. = 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: "--"
  137. .panel.panel-default.panel-danger
  138. .panel-heading
  139. %a{role: 'button', href: '#absent-collapse', data: {toggle: 'collapse'}, 'aria-expanded': 'false'}
  140. %span.sv-show-collapsed
  141. %i.fa.fa-angle-down
  142. %span.sv-show-expanded
  143. %i.fa.fa-angle-up
  144. = t 'activities.state.absent'
  145. %span.badge
  146. = @counts[false] || "0"
  147. %table.table.collapse#absent-collapse
  148. %tbody
  149. - @participants.where(attending: false).each do |p|
  150. %tr{data: {person_id: p.person.id, activity_id: @activity.id}}
  151. %td
  152. = p.person.full_name
  153. - if p.is_organizer
  154. %i.fa.fa-star-o
  155. %td
  156. - if p.person.id == current_person.id || all_buttons
  157. = render partial: "activities/presence_buttons", locals: {activity: @activity, person: p.person, state: p.attending}
  158. %tr{data: {person_id: p.person_id, activity_id: @activity.id}}
  159. %td{colspan: "2"}
  160. = 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: "--"