123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110 |
- = render partial: 'activities/prev_next'
- %h1
- = t 'activities.edit'
- = render 'form', activity: @activity
- %h2
- = t 'activities.organizers.manage'
- .row
- .col-md-6
- %h4#organizers-add
- = t 'activities.organizers.add'
- - if @non_organizers.count > 0
- = form_tag(group_activity_change_organizer_path(@group, @activity), method: 'post') do
- .form-group
- = select_tag(:participant_id, options_for_select(@non_organizers_options))
- .form-group
- = hidden_field_tag(:new_state, true)
- = submit_tag(t('activities.organizers.add'), class: 'btn btn-success')
- - else
- = t 'activities.organizers.no_non_organizers'
- .col-md-6
- %h4#organizers-remove
- = t 'activities.organizers.remove'
- - if @organizers.count > 0
- = form_tag(group_activity_change_organizer_path(@group, @activity), method: 'post') do
- .form-group
- = select_tag(:participant_id, options_for_select(@organizers_options))
- .form-group
- = hidden_field_tag(:new_state, false)
- = submit_tag(t('activities.organizers.remove'), class: 'btn btn-danger')
- - else
- = t 'activities.organizers.no_organizers'
- %h2
- = t 'activities.subgroups.manage'
- .row
- .col-md-6
- %h4#subgroups-add
- = t 'activities.subgroups.create'
- = form_for(@subgroup, url: group_activity_create_subgroup_path(@group, @activity), method: :post) do |f|
- - if @subgroup.errors.any?
- .has-error.form-group#error_explanation
- %ul
- - @subgroup.errors.full_messages.each do |message|
- %li= message
- .form-group{ class: [ ('has-error' if @subgroup.errors.any?) ] }
- %label
- = t 'activerecord.attributes.subgroup.name'
- = f.text_field :name, class: 'form-control'
- .form-group
- .check-box
- %label
- = f.check_box :is_assignable
- = t 'activerecord.attributes.subgroup.is_assignable'
- (
- %i.fas.fa-random
- )
- = f.submit t('activities.subgroups.create'), class: 'btn btn-success'
- .col-md-6#subgroups
- - if @activity.subgroups.blank?
- %p
- = t 'activities.subgroups.none'
- - else
- %table.table
- %tr
- %th
- = t 'activerecord.attributes.subgroup.name'
- %th
- %i.fas.fa-random
- %th
- %i.fas.fa-cogs
- - @subgroups.each do |sg|
- %tr
- %td
- = sg.name
- = surround '(', ')' do
- = sg.participants.count
- %td
- = 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
- - if sg.is_assignable
- %i.fas.fa-check
- - else
- %i.fas.fa-times
- %td
- = 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
- %i.fas.fa-trash
- = link_to(group_activity_edit_subgroups_path(@group, @activity), class: 'btn btn-default') do
- %i.fas.fa-edit
- = t 'activities.subgroups.edit'
- .btn-group
- = link_to t(:back), group_activity_path(@group, @activity), class: 'btn btn-default'
- = link_to t(:overview), group_activities_path(@group), class: 'btn btn-default'
|