Sprankelprachtig aan/afmeldsysteem

edit.html.haml 3.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. = render partial: 'activities/prev_next'
  2. %h1
  3. = t 'activities.edit'
  4. = render 'form', activity: @activity
  5. %h2
  6. = t 'activities.organizers.manage'
  7. .row
  8. .col-md-6
  9. %h4#organizers-add
  10. = t 'activities.organizers.add'
  11. - if @non_organizers.count > 0
  12. = form_tag(group_activity_change_organizer_path(@group, @activity), method: 'post') do
  13. .form-group
  14. = select_tag(:participant_id, options_for_select(@non_organizers_options))
  15. .form-group
  16. = hidden_field_tag(:new_state, true)
  17. = submit_tag(t('activities.organizers.add'), class: 'btn btn-success')
  18. - else
  19. = t 'activities.organizers.no_non_organizers'
  20. .col-md-6
  21. %h4#organizers-remove
  22. = t 'activities.organizers.remove'
  23. - if @organizers.count > 0
  24. = form_tag(group_activity_change_organizer_path(@group, @activity), method: 'post') do
  25. .form-group
  26. = select_tag(:participant_id, options_for_select(@organizers_options))
  27. .form-group
  28. = hidden_field_tag(:new_state, false)
  29. = submit_tag(t('activities.organizers.remove'), class: 'btn btn-danger')
  30. - else
  31. = t 'activities.organizers.no_organizers'
  32. %h2
  33. = t 'activities.subgroups.manage'
  34. .row
  35. .col-md-6
  36. %h4#subgroups-add
  37. = t 'activities.subgroups.create'
  38. = form_for(@subgroup, url: group_activity_create_subgroup_path(@group, @activity), method: :post) do |f|
  39. - if @subgroup.errors.any?
  40. .has-error.form-group#error_explanation
  41. %ul
  42. - @subgroup.errors.full_messages.each do |message|
  43. %li= message
  44. .form-group{ class: [ ('has-error' if @subgroup.errors.any?) ] }
  45. %label
  46. = t 'activerecord.attributes.subgroup.name'
  47. = f.text_field :name, class: 'form-control'
  48. .form-group
  49. .check-box
  50. %label
  51. = f.check_box :is_assignable
  52. = t 'activerecord.attributes.subgroup.is_assignable'
  53. (
  54. %i.fas.fa-random
  55. )
  56. = f.submit t('activities.subgroups.create'), class: 'btn btn-success'
  57. .col-md-6#subgroups
  58. - if @activity.subgroups.blank?
  59. %p
  60. = t 'activities.subgroups.none'
  61. - else
  62. %table.table
  63. %tr
  64. %th
  65. = t 'activerecord.attributes.subgroup.name'
  66. %th
  67. %i.fas.fa-random
  68. %th
  69. %i.fas.fa-cogs
  70. - @subgroups.each do |sg|
  71. %tr
  72. %td
  73. = sg.name
  74. = surround '(', ')' do
  75. = sg.participants.count
  76. %td
  77. = link_to group_activity_update_subgroup_path(@group, @activity, sg.id, 'subgroup[is_assignable]' => !sg.is_assignable), method: :patch, class: 'btn btn-default btn-xs' do
  78. - if sg.is_assignable
  79. %i.fas.fa-check
  80. - else
  81. %i.fas.fa-times
  82. %td
  83. = link_to group_activity_destroy_subgroup_path(@group, @activity, sg.id), method: :delete, class: 'btn btn-danger btn-xs', data: {confirm: I18n.t(:areyousure)} do
  84. %i.fas.fa-trash
  85. = link_to(group_activity_edit_subgroups_path(@group, @activity), class: 'btn btn-default') do
  86. %i.fas.fa-edit
  87. = t 'activities.subgroups.edit'
  88. .btn-group
  89. = link_to t(:back), group_activity_path(@group, @activity), class: 'btn btn-default'
  90. = link_to t(:overview), group_activities_path(@group), class: 'btn btn-default'