= hidden_field(:user, :has_cohorts_in_form, :value => true)
%fieldset
  %legend
    Cohorts
  %ul.options-list
    - projects = projects.sort_by &:name
    - projects.each do |p|
      - p.cohorts.each_with_index do |c, i|
        %li
          = check_box_tag "user[cohort_ids][]", c.id, @user.portal_teacher.cohorts.include?(c)
          %label
            = c.fullname

= hidden_field(:user, :has_cohorts_in_form, :value => true)
%fieldset
  %legend
    Cohorts
  %ul.options-list
    - projects = projects.sort_by &:name
    - projects.each do |p|
      - p.cohorts.each_with_index do |c, i|
        %li
          = check_box_tag "user[cohort_ids][]", c.id, @user.portal_teacher.cohorts.include?(c), disabled: !policy(@current_user).add_teachers_to_cohorts?
          %label
            = c.fullname

Disable cohort checkboxes for users who aren't authorized.
Disable cohort checkboxes for users who aren't authorized.

