Skip to content

Self-hosted project management for devs and their clients: tickets, time tracking, docs and meetings, with an AI assistant that cites its sources. AGPL-3.0.

2.0 KB
Raw Blame
<%# locals: (entry:, selected: nil, member: nil) %>
<% person = entry.person %>
<% name = person_display_name(person: person, user: entry.user) %>
<% if person %>
  <% url = organisation_person_path(@current_organisation, person) %>
  <% param, id = 'person_id', person.id %>
  <% open = selected&.id == person.id %>
<% else %>
  <% url = member_organisation_people_path(@current_organisation, entry.user.id) %>
  <% param, id = 'member_id', entry.user.id %>
  <% open = member&.id == entry.user.id %>
<% end %>
<%# Enter and Space open the row like a click: the row is the only control. %>
<% row_data = { controller: 'list-row', action: 'click->list-row#click keydown.enter->list-row#click keydown.space->list-row#click',
                people_row: true,
                list_row_url_value: url, list_row_id_value: id, list_row_param_value: param,
                list_row_params_value: PeopleHelper::SELECTION_PARAMS.to_json,
                list_row_frame_value: Organisations::PeopleController::DETAIL_FRAME_ID } %>
<% kind_word = entry.member? ? t('views.organisations.people.show.kind.member') : t('views.organisations.people.show.kind.contact') %>
<%= tag.li data: row_data, tabindex: 0, class: "people-row #{'selected-row' if open}" do %>
  <%# The chip says member or contact: filled or an outline, the word in its
      tooltip and for a screen reader after the name. %>
  <%= render Neo::Users::AvatarComponent.new(user: entry.user, size: :small, fallback_initials: person_initials(name), title: kind_word,
                                              class: "people-avatar #{'people-avatar--contact' unless entry.member?}") %>
  <span class="people-row__text">
    <span class="people-row__name"><%= name %><span class="sr-only">, <%= kind_word %></span></span>
    <% sub = entry.detail %>
    <% if sub %>
      <span class="people-row__sub"><%= sub %></span>
    <% end %>
  </span>
  <% last = entry.last_contact %>
  <%= tag.span(last ? last_contact_age(last.at) : '', class: 'people-row__last', title: (last_contact_text(last) if last)) %>
<% end %>