Sprankelprachtig aan/afmeldsysteem

show.html.haml 7.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  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. %h2
  79. = @num_participants
  80. = t 'activities.participant.plural'
  81. = render partial: "state_counts", locals: {counts: @counts}
  82. %table.table.table-bordered
  83. - @participants.each do |p|
  84. %tr{class: p.row_class, data: {person_id: p.person.id, activity_id: @activity.id}}
  85. %td
  86. = p.person.full_name
  87. - if p.is_organizer
  88. %i.fa.fa-star-o
  89. %td
  90. = 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: "--"
  91. %td
  92. - if p.person.id == current_person.id || all_buttons
  93. = render partial: "activities/presence_buttons", locals: {activity: @activity, person: p.person, state: p.attending}
  94. .hidden-sm.hidden-md.hidden-lg
  95. .panel.panel-default.panel-success
  96. .panel-heading
  97. %a{role: 'button', href: '#present-collapse', data: {toggle: 'collapse'}, 'aria-expanded': 'false'}
  98. %span.sv-show-collapsed
  99. %i.fa.fa-angle-down
  100. %span.sv-show-expanded
  101. %i.fa.fa-angle-up
  102. = t 'activities.state.present'
  103. %span.badge
  104. = @counts[true] || "0"
  105. %table.table.collapse#present-collapse
  106. %tbody
  107. - @participants.where(attending: true).each do |p|
  108. %tr{data: {person_id: p.person.id, activity_id: @activity.id}}
  109. %td
  110. = p.person.full_name
  111. - if p.is_organizer
  112. %i.fa.fa-star-o
  113. %td
  114. - if p.person.id == current_person.id || all_buttons
  115. = render partial: "activities/presence_buttons", locals: {activity: @activity, person: p.person, state: p.attending}
  116. %tr{data: {person_id: p.person_id, activity_id: @activity.id}}
  117. %td{colspan: "2"}
  118. = 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: "--"
  119. .panel.panel-default
  120. .panel-heading
  121. %a{role: 'button', href: '#unknown-collapse', data: {toggle: 'collapse'}, 'aria-expanded': 'false'}
  122. %span.sv-show-collapsed
  123. %i.fa.fa-angle-down
  124. %span.sv-show-expanded
  125. %i.fa.fa-angle-up
  126. = t 'activities.state.need_response'
  127. %span.badge
  128. = @counts[nil] || "0"
  129. %table.table.collapse#unknown-collapse
  130. %tbody
  131. - @participants.where(attending: nil).each do |p|
  132. %tr{data: {person_id: p.person.id, activity_id: @activity.id}}
  133. %td
  134. = p.person.full_name
  135. - if p.is_organizer
  136. %i.fa.fa-star-o
  137. %td
  138. - if p.person.id == current_person.id || all_buttons
  139. = render partial: "activities/presence_buttons", locals: {activity: @activity, person: p.person, state: p.attending}
  140. %tr{data: {person_id: p.person_id, activity_id: @activity.id}}
  141. %td{colspan: "2"}
  142. = 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: "--"
  143. .panel.panel-default.panel-danger
  144. .panel-heading
  145. %a{role: 'button', href: '#absent-collapse', data: {toggle: 'collapse'}, 'aria-expanded': 'false'}
  146. %span.sv-show-collapsed
  147. %i.fa.fa-angle-down
  148. %span.sv-show-expanded
  149. %i.fa.fa-angle-up
  150. = t 'activities.state.absent'
  151. %span.badge
  152. = @counts[false] || "0"
  153. %table.table.collapse#absent-collapse
  154. %tbody
  155. - @participants.where(attending: false).each do |p|
  156. %tr{data: {person_id: p.person.id, activity_id: @activity.id}}
  157. %td
  158. = p.person.full_name
  159. - if p.is_organizer
  160. %i.fa.fa-star-o
  161. %td
  162. - if p.person.id == current_person.id || all_buttons
  163. = render partial: "activities/presence_buttons", locals: {activity: @activity, person: p.person, state: p.attending}
  164. %tr{data: {person_id: p.person_id, activity_id: @activity.id}}
  165. %td{colspan: "2"}
  166. = 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: "--"