<%
# Copyright (C) 2012 - present Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
%>

<div id="people-options" class="al-dropdown__container" style="position: relative;">
  <button type="button" class="al-trigger Button">
    <i class="icon-more" aria-hidden="true"></i>
    <span class="screenreader-only">More Options</span>
  </button>
  <ul class="al-options" role="menu" tabindex="0" aria-hidden="true">
    <% if @context.is_a?(Course) %>
      <% if can_do(@context, @current_user, :read_roster) %>
        <li role="presentation">
        <%= sidebar_button context_url(@context, :context_groups_url),
                           t('View User Groups'),
                           'group' %>
        </li>
      <% end %>

      <% if can_do(@context, @current_user, :manage_students && @context.enable_user_notes) %>
        <li role="presentation">
        <%= sidebar_button course_user_notes_path(@context),
                           t('View Faculty Journals') %>
        </li>
      <% end %>

      <% if can_do(@context, @current_user, :manage_admin_users, :manage_students, :read_prior_roster) %>
        <li role="presentation">
        <%= sidebar_button course_prior_users_path(@context),
                           t('View Prior Enrollments'),
                           'clock' %>
        </li>
      <% end %>
      <% if @context.user_is_instructor?(@current_user) && can_do(@context, @current_user, :read_reports) && can_do(@context, @current_user, :view_all_grades) %>
        <li role="presentation">
        <%= sidebar_button user_course_teacher_activity_url(@current_user, @context),
                           t('Student Interactions Report'),
                           'user' %>
        </li>
      <% end %>
    <% end %>

    <% if can_do(@context, @current_user, :read_roster) %>
      <li role="presentation">
      <%= sidebar_button context_url(@context, :context_user_services_url),
                         t('links.view_services', 'View Registered Services'),
                         'link' %>
      </li>
    <% end %>
    <% if @context.root_account.self_registration? && @context.grants_right?(@current_user, :generate_observer_pairing_code) %>
      <li role="presentation">
      <%= sidebar_button course_observer_pairing_codes_url(@context),
                         t('Export Pairing Codes'),
                         'export' %>
      </li>
    <%end %>
  </ul>
</div>
