-# Expects locals: object
- if object && object.respond_to?('projects') && current_visitor.has_role?('admin', 'manager')
  = field_set_tag 'Projects' do
    .aligned
      %ul.menu_h
        - prop_name = "#{object.class.name.underscore}[project_ids][]"
        -# Hidden field handles a case when all checkboxes are unchecked.
        = hidden_field_tag prop_name
        - project_assigned = Hash[object.projects.map { |p| [p.id, true ] }]
        - Admin::Project.all.each do |project|
          - if policy(project).visible?
            %li
              - label_str = "project_#{project.id}"
              = label_tag label_str, project.name
              = check_box_tag prop_name, project.id, project_assigned[project.id], id: label_str
          - elsif project_assigned[project.id]
            -# This is necessary to keep hidden projects still assigned to the material.
            = hidden_field_tag prop_name, project.id
-# Expects locals: object
- if object && object.respond_to?('projects') && current_visitor.has_role?('admin', 'manager')
  = field_set_tag 'Projects' do
    .aligned
      %ul.menu_h
        - prop_name = "#{object.class.name.underscore}[project_ids][]"
        -# Hidden field handles a case when all checkboxes are unchecked.
        = hidden_field_tag prop_name
        - project_assigned = Hash[object.projects.map { |p| [p.id, true ] }]
        - Admin::Project.all.each do |project|
          %li
            - label_str = "project_#{project.id}"
            = label_tag label_str, project.name
            = check_box_tag prop_name, project.id, project_assigned[project.id], id: label_str

Remove projects filtering from material settings
Remove projects filtering from material settings

- it's not necessary anyway, as this section is visible only for admins
- it fixes the tests (rspec couldn't find `policy` helper in some cases, shared examples)

[#111001332]
[#111001376]
[#111001560]
[#111001428]
