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.

feat(people): build the people page after the design

Guido Boykefecaf3eb6a4e
diff --git a/app/assets/stylesheets/application.tailwind.css b/app/assets/stylesheets/application.tailwind.css
index fe4c730..9602c1a 100644
--- a/app/assets/stylesheets/application.tailwind.css
+++ b/app/assets/stylesheets/application.tailwind.css
@@ -385,3 +385,98 @@
ONLY the light action steps (200-500), NOT lime-50 (own-post tint). */
.bg-btn-primary, .mobile-primary, .bg-lime-200, .bg-lime-300, .bg-lime-400, .bg-lime-500,
[class*="bg-lime-200"], [class*="bg-lime-300"], [class*="bg-lime-400"] { color: #14110c; }
+
+/* Personen: the shared people directory (organisations/people). One column
+ of rows, the person in the lane. Hairlines everywhere; only the main action
+ (the primary Neo button) carries the hard edge and the offset shadow, as on
+ the rebuilt tickets. Tokens only, so all three themes follow. */
+@layer components {
+ .people-head { @apply flex items-start gap-4 px-6 pt-5; }
+ .people-head__title { @apply flex min-w-0 flex-col gap-1; }
+ .people-head__h1 { @apply text-[22px] font-bold leading-tight tracking-tight text-heading; }
+ .people-head__count { @apply text-[13px] text-muted; }
+ .people-head__action { margin-inline-start: auto; }
+ .people-tools { @apply flex flex-wrap items-center gap-2 px-6 pb-3 pt-4; }
+ .people-search { width: 260px; max-width: 100%; }
+ .people-search__field { @apply flex items-center gap-2 rounded-lg border border-cream-400 bg-surface-raised px-2.5 py-1.5 text-[13px] text-muted; }
+ .people-search__field input { @apply min-w-0 flex-1 border-0 bg-transparent p-0 text-[13px] text-heading outline-none focus:ring-0; }
+ .people-search__field:focus-within { border-color: rgb(var(--ink)); }
+ .people-filters { @apply flex flex-wrap items-center gap-2; }
+ .people-pill { @apply inline-flex items-baseline gap-1.5 rounded-full border border-cream-300 bg-surface-raised px-3 py-1 text-[13px] text-heading no-underline hover:bg-cream-200; }
+ .people-pill--active { @apply border-cream-600 font-semibold; background-color: rgb(var(--selected-row)); }
+ .people-pill__count { @apply font-mono text-[11px] font-normal text-muted; }
+ .people-list { @apply mx-6 mb-6 border-t border-ink; }
+ .people-row { @apply -mx-2 flex cursor-pointer items-center gap-3 border-b border-cream-200 px-2 py-2.5 outline-none hover:bg-cream-100 focus-visible:bg-cream-100; }
+ .people-row.selected-row { background-color: rgb(var(--selected-row)); }
+ .people-row.selected-row .people-row__name { @apply font-semibold; }
+ .people-row__text { @apply flex min-w-0 flex-1 flex-col gap-0.5; }
+ .people-row__line { @apply flex min-w-0 items-baseline gap-2; }
+ .people-row__name { @apply truncate text-sm font-medium text-heading; }
+ .people-row__sub { @apply truncate text-xs text-muted; }
+ .people-row__chevron { @apply hidden text-xs text-cream-400; }
+ .people-mobile-grid .people-row__chevron { @apply inline; }
+ .people-badge { @apply shrink-0 rounded-full border border-cream-300 bg-cream-100 px-1.5 text-[11px] text-cream-600; }
+ /* Members keep the chip's own tone; contacts (no account) a lighter one.
+ Scoped to the page so it wins over the chip's utility classes. */
+ .people-page .people-avatar { @apply font-mono font-normal; }
+ .people-page .people-avatar--contact { @apply border-cream-300 bg-surface-raised text-cream-600; }
+ .people-empty { @apply flex flex-col items-start gap-2.5 px-6 pt-8; }
+ .people-empty__icon { @apply text-2xl text-cream-500; }
+ .people-empty__title { @apply text-[15px] font-semibold text-heading; }
+ .people-empty__text { @apply text-[13px] leading-relaxed text-muted; }
+ .people-text-action { color: rgb(var(--text-action)); @apply text-[13px] hover:underline; }
+ .people-quiet-action { @apply text-[13px] text-cream-600 hover:text-heading; }
+ .people-ghost-action { @apply inline-flex items-center gap-1.5 rounded-md px-2 py-1 text-[13px] text-cream-600 no-underline hover:bg-cream-200 hover:text-heading; }
+ .people-icon-action { @apply inline-grid h-[30px] w-[30px] place-items-center rounded-md text-[13px] text-cream-500 hover:bg-cream-200 hover:text-heading; }
+ .people-secondary-action { @apply inline-flex items-center gap-1.5 rounded-lg border border-cream-400 bg-surface-raised px-3 py-1.5 text-[13px] text-heading no-underline hover:border-cream-600; }
+ .people-danger-action { color: #A03227; margin-inline-start: -8px; @apply self-start; }
+ .dark .people-danger-action { color: var(--wash-danger-text); }
+ .people-lane { @apply flex flex-col gap-4; }
+ .people-detail, .people-form-wrap { @apply flex flex-col gap-4; }
+ .people-lane__head { @apply flex items-center gap-1; }
+ .people-lane__kind { @apply mr-auto text-xs text-muted; }
+ .people-lane__divider { @apply mx-1 h-4 w-px bg-cream-200; }
+ .people-identity { @apply flex items-center gap-3.5; }
+ .people-identity__text { @apply flex min-w-0 flex-col gap-1; }
+ .people-identity__name { @apply text-[22px] font-semibold leading-tight tracking-tight text-heading; }
+ .people-identity__status { @apply inline-flex items-center gap-2 text-[13px] text-cream-700; }
+ .people-identity__status i { @apply text-muted; }
+ .people-callout { @apply flex items-baseline gap-2.5 rounded-lg border border-cream-300 bg-cream-50 px-3 py-2.5 text-[13px] leading-normal text-heading; }
+ .people-callout__body { @apply flex min-w-0 flex-1 flex-col items-start gap-2; }
+ .people-callout--quiet { @apply border-transparent; }
+ .people-callout--warning { border-color: #C08A3E; }
+ .people-callout--warning > i { color: #C08A3E; }
+ .people-callout--danger { @apply border-red-200 bg-red-50 text-red-800; }
+ .people-callout__name { @apply font-semibold text-heading; }
+ .people-fields { @apply flex flex-col border-t border-cream-200; }
+ .people-fields__row { @apply flex items-baseline gap-3.5 border-b border-cream-200 py-2; }
+ .people-fields__row dt { @apply w-24 shrink-0 text-[13px] text-muted; }
+ .people-fields__row dd { @apply min-w-0 break-words text-sm text-heading; }
+ .people-fields__row--stacked { @apply flex-col gap-0.5; }
+ .people-fields__row--stacked dt { @apply w-auto text-xs; }
+ .people-fields__link { color: rgb(var(--text-action)); @apply inline-flex items-center gap-2 hover:underline; }
+ .people-fields__link i { @apply text-xs; }
+ .people-fields__link--mono { @apply font-mono; }
+ .people-tap { min-height: 52px; @apply flex items-center gap-3 rounded-[10px] border border-cream-300 bg-cream-50 px-3.5 text-[15px] text-heading no-underline; }
+ .people-tap--mono { @apply font-mono; }
+ .people-tap__hint { margin-inline-start: auto; @apply font-sans text-xs text-muted; }
+ .people-note h3 { @apply mb-1.5 text-[13px] font-normal text-muted; }
+ .people-note p { @apply whitespace-pre-line text-sm leading-relaxed text-cream-700; }
+ .people-footer { @apply flex flex-col gap-2 border-t border-cream-200 pt-3.5; }
+ .people-footer__created { @apply text-xs text-muted; }
+ .people-footer__readonly { @apply text-xs text-muted; }
+ .people-history { @apply flex flex-col gap-1.5; }
+ .people-history li { @apply flex items-baseline gap-2.5 text-[13px] text-cream-600; }
+ .people-history li span { @apply min-w-0 flex-1; }
+ .people-history time { @apply shrink-0 font-mono text-xs text-muted; }
+ .people-form { @apply flex flex-col gap-3.5; }
+ .people-form__title { @apply mr-auto text-[17px] font-semibold text-heading; }
+ .people-form__field { @apply flex flex-col gap-1; }
+ .people-form__field label { @apply text-xs text-muted; }
+ .people-form__required { color: #A03227; }
+ .people-input { @apply box-border w-full rounded-lg border border-cream-400 bg-surface-raised px-2.5 py-2 text-sm text-heading focus:border-ink focus:outline-none focus:ring-1 focus:ring-ink; }
+ .people-input--area { @apply resize-y leading-normal; }
+ .people-input--locked { @apply bg-cream-100 text-cream-700; }
+ .people-form__actions { @apply flex items-center gap-4 pt-0.5; }
+ .people-page :is(a, button, input, select, textarea, li[tabindex]):focus-visible { outline: 2px solid rgb(var(--ink)); outline-offset: 2px; }
+}
diff --git a/app/components/neo/users/avatar_component.rb b/app/components/neo/users/avatar_component.rb
index 21509b4..0e8231c 100644
--- a/app/components/neo/users/avatar_component.rb
+++ b/app/components/neo/users/avatar_component.rb
@@ -36,7 +36,8 @@ module Neo
xs: 'w-5 h-5 text-[9px]',
small: 'w-[26px] h-[26px] text-[10px]',
medium: 'w-8 h-8 text-xs',
- detail: 'w-[34px] h-[34px] text-xs'
+ detail: 'w-[34px] h-[34px] text-xs',
+ large: 'w-[52px] h-[52px] text-[15px]'
}.freeze
CHIP_CLASSES = 'neo-user-avatar rounded-[5px] bg-cream-200 border border-cream-300 font-bold text-cream-900'
diff --git a/app/controllers/concerns/CLAUDE.md b/app/controllers/concerns/CLAUDE.md
index ba8f0b3..e67bf3f 100644
--- a/app/controllers/concerns/CLAUDE.md
+++ b/app/controllers/concerns/CLAUDE.md
@@ -91,7 +91,9 @@ Route `meetings_view_configuration`, derselbe Controller wie die Projekt-Route).
Die Personenliste (`Organisations::PeopleController`, 26.10.2026) ist die sechste Bahn:
`ViewportSwitchable` + `People::Directory`, ohne Filterleiste und Spaltenwahl, dieselben
Stimulus-Controller (`layout-toggle`, `index-page`, `list-row`, `lane-link`); Speichern und
-Löschen verlassen die Bahn (`_top`) und landen mit `?person_id=` wieder auf der Liste.
+Löschen verlassen die Bahn (`_top`) und landen mit `?person_id=` wieder auf der Liste. Zwei
+Auswahlparameter schließen sich aus: `person_id` (eine Zeile) und `member_id` (ein Mitglied ohne
+eigene Zeile, `PeopleController#member`); `user_id` gehört zur Formular-Gruppe.
Der Entscheid für EINE kanonische Listen-Architektur steht aus; bis dahin gilt für neue
Listen-Features: am ähnlichsten Bestands-Feature orientieren und die Wahl im PR begründen.
Seit 10.09.2026 teilen Tickets und Knowledge immerhin die OBERFLÄCHE der Liste-mit-Bahn
diff --git a/app/controllers/organisations/people_controller.rb b/app/controllers/organisations/people_controller.rb
index 3f027d5..0060724 100644
--- a/app/controllers/organisations/people_controller.rb
+++ b/app/controllers/organisations/people_controller.rb
@@ -5,7 +5,9 @@
# together. One page with a lane, the shape of "Alle Meetings"
# (MeetingsOverviewController): the list on the left, the person or the form in
# the lane frame on the right. The address carries the lane state:
-# ?person_id= for a person, ?new=person for the form.
+# ?person_id= for a person, ?member_id= for a member who has no row of their
+# own yet (name and email from the account, "Angaben ergänzen"), ?new=person
+# for the form.
#
# show, new and edit answer the lane frame (a row click, the "+", "Bearbeiten");
# a full visit of them lands on the index with the same lane state. The index
@@ -39,9 +41,23 @@ module Organisations
@people = policy_scope(Person)
return render_lane_frame if lane_frame_request?
- @entries = directory.entries
+ load_list
@lane_person = selected_person
- @form_person = new_person if @lane_person.nil? && new_person_requested?
+ @lane_member = selected_member if @lane_person.nil?
+ @form_person = new_person if @lane_person.nil? && @lane_member.nil? && new_person_requested?
+ end
+
+ # A member without a row of their own, in the lane. Only a member the
+ # reader may see on the members page (People::Directory), else 404; a
+ # member who has a row opens that row.
+ def member
+ authorize Person, :index?
+ entry = directory.member_entry(params[:user_id])
+ raise ActiveRecord::RecordNotFound unless entry
+ return redirect_to(index_path(**member_lane(entry))) unless turbo_frame_request?
+ return render_frame(:detail, person: entry.person) if entry.person
+
+ render_frame(:member, member: entry.user)
end
def show
@@ -112,7 +128,7 @@ module Organisations
def render_refused_save(result, id)
@form_person = refused_form_person(result, id)
@form_message = result.code == :stale_object ? t('controllers.people.update.stale') : result.errors.to_sentence
- @entries = directory.entries
+ load_list
set_viewport_mode
render :index, status: :unprocessable_content
end
@@ -128,8 +144,27 @@ module Organisations
end
def directory
- People::Directory.new(viewer: current_user, organisation: current_organisation,
- query: params[:q], kind: params[:kind])
+ @directory ||= People::Directory.new(viewer: current_user, organisation: current_organisation,
+ query: params[:q], kind: params[:kind])
+ end
+
+ def load_list
+ @entries = directory.entries
+ @counts = directory.counts
+ end
+
+ def member_lane(entry)
+ entry.person ? { person_id: entry.person.id } : { member_id: entry.user.id }
+ end
+
+ # ?member_id=: the account of a visible member without a row. A member who
+ # has a row is opened through that row (person_id), never twice.
+ def selected_member
+ id = params[:member_id]
+ return unless id.is_a?(String) && id.present?
+
+ entry = directory.member_entry(id)
+ entry.user if entry && entry.person.nil?
end
# A member row without a person row opens the form with the member chosen
@@ -165,8 +200,11 @@ module Organisations
# The lane alone, as a full visit of the same address shows it.
def render_lane_frame
person = selected_person
+ member = selected_member unless person
if person
render_frame(:detail, person: person)
+ elsif member
+ render_frame(:member, member: member)
elsif new_person_requested?
render_frame(:form, person: new_person)
else
@@ -174,9 +212,10 @@ module Organisations
end
end
- def render_frame(state, person: nil, status: :ok)
+ def render_frame(state, person: nil, member: nil, status: :ok)
render html: helpers.turbo_frame_tag(DETAIL_FRAME_ID) {
- helpers.render(partial: 'organisations/people/lane', locals: { state: state, person: person, message: nil })
+ helpers.render(partial: 'organisations/people/lane',
+ locals: { state: state, person: person, member: member, message: nil })
}, layout: false, status: status
end
diff --git a/app/helpers/people_helper.rb b/app/helpers/people_helper.rb
index 1283b67..81973eb 100644
--- a/app/helpers/people_helper.rb
+++ b/app/helpers/people_helper.rb
@@ -3,45 +3,51 @@
# The people directory page (Organisations::PeopleController): the wiring of
# its list and lane, and the words of a person's history.
module PeopleHelper
+ # The two things a row can open in the lane: a person row, or a member who
+ # has no row of their own yet. They exclude each other.
+ SELECTION_PARAMS = %w[person_id member_id].freeze
+
# The page wrapper's data: the lane (layout-toggle, index-page) and the
# desktop/mobile switch, the same controllers as "Alle Meetings"
# (meeting_list_page_data), without its filter bar and column picker.
- def people_page_data(viewport_mode:, selected:, form_open:)
+ def people_page_data(viewport_mode:, selected:, form_open:, member: nil)
detail_frame_id = Organisations::PeopleController::DETAIL_FRAME_ID
- unresolved = people_unresolved_lane_params(selected: selected, form_open: form_open)
+ unresolved = people_unresolved_lane_params(selected: selected, member: member, form_open: form_open)
{
controller: 'layout-toggle index-page viewport',
layout_toggle_list_frame_ids_value: [Organisations::PeopleController::LIST_FRAME_ID].to_json,
layout_toggle_detail_frame_id_value: detail_frame_id,
layout_toggle_content_selector_value: '.person-content',
- layout_toggle_selected_row_selector_value: '.selected-row[data-person-id]',
- layout_toggle_selection_params_value: %w[person_id].to_json,
+ layout_toggle_selected_row_selector_value: '.selected-row[data-people-row]',
+ layout_toggle_selection_params_value: SELECTION_PARAMS.to_json,
layout_toggle_list_filter_params_value: Organisations::PeopleController::LIST_PARAMS.to_json,
layout_toggle_storage_key_value: 'layoutState:people',
layout_toggle_unresolved_selection_value: (unresolved.to_json if unresolved.any?),
viewport_breakpoint_value: MeetingsHelper::LANE_FULL_PAGE_BELOW_PX,
viewport_current_mode_value: viewport_mode,
- index_page_param_name_value: 'person_id',
+ index_page_param_name_value: SELECTION_PARAMS.join(','),
index_page_frame_id_value: detail_frame_id,
index_page_content_selector_value: '.person-content',
index_page_placeholder_id_value: 'person-display-placeholder',
index_page_placeholder_class_value: 'ticket-placeholder px-4',
index_page_placeholder_title_value: t('views.organisations.people.index.placeholder_title'),
index_page_placeholder_body_value: t('views.organisations.people.index.placeholder_body'),
- index_page_selected_row_selector_value: '.selected-row[data-person-id]',
+ index_page_selected_row_selector_value: '.selected-row[data-people-row]',
index_page_skip_if_content_visible_value: 'true',
index_url: organisation_people_path(current_organisation),
- lane_params: lane_params_json(selection: %w[person_id], form: %w[new user_id])
+ lane_params: lane_params_json(selection: SELECTION_PARAMS, form: %w[new user_id])
}.compact
end
# Lane parameters of this visit the server did not open (an unknown or
# unreadable person_id, a form the reader may not open). layout-toggle takes
# them out of the address, so the page stays the list.
- def people_unresolved_lane_params(selected:, form_open:)
+ def people_unresolved_lane_params(selected:, form_open:, member: nil)
unresolved = {}
person_id = params[:person_id]
unresolved['person_id'] = person_id if person_id.is_a?(String) && person_id.present? && selected.nil?
+ member_id = params[:member_id]
+ unresolved['member_id'] = member_id if member_id.is_a?(String) && member_id.present? && member.nil?
new_state = params[:new]
unresolved['new'] = new_state if new_state.is_a?(String) && new_state.present? && !form_open
user_id = params[:user_id]
@@ -66,6 +72,59 @@ module PeopleHelper
person.user if active
end
+ # The link state under the name: [icon, words]. A member, a row whose member
+ # left (shown as a contact, without the account's name), or no account.
+ def person_link_state(person, member)
+ if member
+ ['bi-person-check', t('views.organisations.people.show.linked_member', name: viewer_display_name(member))]
+ elsif person&.user_id
+ ['bi-person-dash', t('views.organisations.people.show.former_member')]
+ else
+ ['bi-person-dash', t('views.organisations.people.show.no_account')]
+ end
+ end
+
+ # A member row with none of the details the directory is for yet.
+ def person_bare?(person)
+ person.nil? || %i[function department phone notes].all? { |field| person.public_send(field).blank? }
+ end
+
+ # The lines of the lane: label, value, and for email and phone the link. An
+ # active member's email is the account's (the form locks it).
+ def person_fields(person, member)
+ email = member ? member.email : person&.email
+ phone = person&.phone
+ [
+ ({ label: Person.human_attribute_name(:function), value: person.function } if person&.function.present?),
+ ({ label: Person.human_attribute_name(:department), value: person.department } if person&.department.present?),
+ ({ label: Person.human_attribute_name(:company), value: person.company } if person&.company.present?),
+ ({ label: Person.human_attribute_name(:email), value: email, href: "mailto:#{email}", icon: 'bi-envelope' } if email.present?),
+ if phone.present?
+ { label: Person.human_attribute_name(:phone), value: phone, href: "tel:#{phone.gsub(/[^\d+]/, '')}",
+ icon: 'bi-telephone', mono: true, action: t('views.organisations.people.show.call') }
+ end
+ ].compact
+ end
+
+ # The data of a link that opens the form for a member without a row
+ # ("Angaben ergänzen", "Bearbeiten" in the member's lane). Like the "+": the
+ # PAGE address names the member too (?new=person&user_id=), so a narrow
+ # screen and a reload open the form with the member chosen.
+ def add_member_details_link(member)
+ new_state = Organisations::PeopleController::NEW_STATE
+ {
+ href: organisation_people_path(current_organisation, list_state.merge('new' => new_state, 'user_id' => member.id)),
+ data: {
+ controller: 'lane-link',
+ action: 'click->lane-link#click',
+ lane_link_url_value: new_organisation_person_path(current_organisation, user_id: member.id),
+ lane_link_frame_value: Organisations::PeopleController::DETAIL_FRAME_ID,
+ lane_link_set_value: { new: new_state, user_id: member.id }.to_json,
+ lane_link_remove_value: SELECTION_PARAMS.to_json
+ }
+ }
+ end
+
# Initials for a contact's avatar (no account, no picture).
def person_initials(name)
name.to_s.split.first(2).map { |part| part[0] }.join.upcase
diff --git a/app/services/people/directory.rb b/app/services/people/directory.rb
index f795ae3..0369ffd 100644
--- a/app/services/people/directory.rb
+++ b/app/services/people/directory.rb
@@ -41,33 +41,51 @@ module People
end
def entries
- return [] unless PersonPolicy.view_allowed?(@viewer, @organisation)
-
- ActsAsTenant.with_tenant(@organisation) do
- list = []
- list.concat(member_entries) unless @kind == 'contacts'
- list.concat(contact_entries) unless @kind == 'members'
- list.select! { |entry| matches?(entry) } if @query.present?
- sorted(list)
- end
+ everyone.select { |entry| kind_matches?(entry) && (@query.blank? || matches?(entry)) }
+ end
+
+ # How many people the page holds, before search and filter: the head line
+ # and the three filters (all, members, contacts) count the same list.
+ def counts
+ members = everyone.count(&:member?)
+ { 'all' => everyone.size, 'members' => members, 'contacts' => everyone.size - members }
+ end
+
+ # The member half's entry for one account, or nil when the viewer may not
+ # see that member (or it is no active member): the lane of a member who has
+ # no row of their own yet.
+ def member_entry(user_id)
+ everyone.find { |entry| entry.member? && entry.user.id == user_id.to_s }
end
# The other entries with the same normalized name as this person: rows and
# members that may be the same person (the duplicate hint, read only).
def duplicates_of(person)
- return [] unless PersonPolicy.view_allowed?(@viewer, @organisation)
-
- ActsAsTenant.with_tenant(@organisation) do
- same = (member_entries + contact_entries).select do |entry|
- entry.sort_name == person.normalized_name && entry.person&.id != person.id &&
- !(entry.user && entry.user.id == person.user_id)
- end
- sorted(same)
+ everyone.select do |entry|
+ entry.sort_name == person.normalized_name && entry.person&.id != person.id &&
+ !(entry.user && entry.user.id == person.user_id)
end
end
private
+ # Everything the viewer may see, sorted, read once per directory.
+ def everyone
+ @everyone ||= if PersonPolicy.view_allowed?(@viewer, @organisation)
+ ActsAsTenant.with_tenant(@organisation) { sorted(member_entries + contact_entries) }
+ else
+ []
+ end
+ end
+
+ def kind_matches?(entry)
+ case @kind
+ when 'members' then entry.member?
+ when 'contacts' then !entry.member?
+ else true
+ end
+ end
+
def sorted(list)
list.sort_by { |entry| [entry.sort_name, entry.person&.id.to_s, entry.user&.id.to_s] }
end
@@ -85,7 +103,7 @@ module People
def contact_entries
active_member_ids = Membership.where(organisation: @organisation, active: true).select(:user_id)
- rows = people.where(user_id: nil).or(people.where.not(user_id: active_member_ids)).includes(:user)
+ rows = people.where(user_id: nil).or(people.where.not(user_id: active_member_ids))
rows.map { |person| Entry.new(kind: :contact, user: nil, person: person, sort_name: person.normalized_name) }
end
diff --git a/app/views/organisations/people/_bare_hint.html.erb b/app/views/organisations/people/_bare_hint.html.erb
new file mode 100644
index 0000000..a215c89
--- /dev/null
+++ b/app/views/organisations/people/_bare_hint.html.erb
@@ -0,0 +1,13 @@
+<%# locals: (member:, url: nil, link: nil) %>
+<%# A member whose details are still empty: say what is missing, and offer to
+ add it to those who may write. %>
+<div class="people-callout people-callout--quiet">
+ <div class="people-callout__body">
+ <p><%= t('views.organisations.people.show.bare_text', first_name: member.first_name.presence || viewer_display_name(member)) %></p>
+ <% if url || link %>
+ <%= link_to(link ? link[:href] : url, class: 'people-secondary-action', data: link&.dig(:data)) do %>
+ <i class="bi bi-pencil" aria-hidden="true"></i><%= t('views.organisations.people.show.add_details') %>
+ <% end %>
+ <% end %>
+ </div>
+</div>
diff --git a/app/views/organisations/people/_detail.html.erb b/app/views/organisations/people/_detail.html.erb
index 76e10d1..51cddc7 100644
--- a/app/views/organisations/people/_detail.html.erb
+++ b/app/views/organisations/people/_detail.html.erb
@@ -1,103 +1,77 @@
<%# locals: (person:) %>
-<%# One person: the fields, the link state, who created the row, the
- history, and rows that may be the same person (read only). Edit and
- delete only for those who may write (PersonPolicy). %>
-<% fields = %i[function department company email phone] %>
+<%# One person row: what it is, the fields, the note, who created it, the
+ history, rows that may be the same person (read only), and delete. For a
+ member the row holds the extra details; name and email come from the
+ account, and "delete" removes only those details (the account stays). %>
<% member = person_member_user(person) %>
-<div class="people-detail space-y-6">
- <div class="flex flex-wrap items-start gap-3">
- <% if member %>
- <%= render Neo::Users::AvatarComponent.new(user: member, size: :medium) %>
- <% else %>
- <%= render Neo::Users::AvatarComponent.new(user: nil, size: :medium, fallback_initials: person_initials(person.name)) %>
- <% end %>
- <div class="min-w-0 flex-1">
- <h2 class="text-[22px] leading-snug font-bold text-heading"><%= person_display_name(person: person, user: member) %></h2>
- <p class="text-sm text-muted">
- <% if member %>
- <%= t('views.organisations.people.show.linked_member', name: viewer_display_name(member)) %>
- <% elsif person.user_id %>
- <%= t('views.organisations.people.show.former_member') %>
- <% else %>
- <%= t('views.organisations.people.show.no_account') %>
- <% end %>
- </p>
- </div>
- <% if policy(person).update? %>
- <div class="flex shrink-0 items-center gap-2">
- <%= render Neo::Buttons::ButtonComponent.new(variant: :secondary, size: :small, icon: 'pencil',
- url: edit_organisation_person_path(@current_organisation, person)) do %>
- <%= t('views.organisations.people.show.edit') %>
+<% can_write = policy(person).update? %>
+<% name = person_display_name(person: person, user: member) %>
+<% kind = member ? 'member' : 'contact' %>
+<div class="people-detail">
+ <%= render 'organisations/people/lane_head',
+ kind_label: t("views.organisations.people.show.kind.#{kind}"),
+ edit_url: (edit_organisation_person_path(@current_organisation, person) if can_write) %>
+
+ <% status_icon, status = person_link_state(person, member) %>
+ <%= render 'organisations/people/identity', name: name, user: member, status_icon: status_icon, status: status %>
+
+ <% duplicates = People::Directory.new(viewer: current_user, organisation: @current_organisation).duplicates_of(person) %>
+ <% if duplicates.any? %>
+ <div class="people-callout people-callout--warning">
+ <i class="bi bi-people" aria-hidden="true"></i>
+ <div class="people-callout__body">
+ <% duplicates.each do |entry| %>
+ <p>
+ <%= t('views.organisations.people.show.duplicate_prefix') %>
+ <%= link_to person_display_name(person: entry.person, user: entry.user),
+ organisation_people_path(@current_organisation, list_state.merge(entry.person ? { 'person_id' => entry.person.id } : { 'member_id' => entry.user.id })),
+ data: { turbo_frame: '_top' }, class: 'people-callout__name' %>
+ (<%= entry.member? ? t('views.organisations.people.index.member_badge') : t('views.organisations.people.show.contact_label') %>).
+ </p>
<% end %>
- <%= render Neo::Buttons::ButtonComponent.new(
- variant: :danger, size: :small, icon: 'trash',
- form: { action: organisation_person_path(@current_organisation, person, list_state), method: :delete,
- data: { turbo_frame: '_top' } },
- confirm: t('views.organisations.people.show.delete_confirm'),
- title: t('views.organisations.people.show.delete')
- ) do %>
- <%= t('views.organisations.people.show.delete') %>
+ <% if can_write && member.nil? && duplicates.any?(&:member?) %>
+ <%= link_to t('views.organisations.people.show.duplicate_link'), edit_organisation_person_path(@current_organisation, person),
+ class: 'people-text-action' %>
<% end %>
</div>
- <% end %>
- </div>
+ </div>
+ <% end %>
- <dl class="grid grid-cols-[max-content_1fr] gap-x-6 gap-y-2 text-sm">
- <% fields.each do |field| %>
- <% value = person.public_send(field) %>
- <% next if value.blank? %>
- <dt class="text-muted"><%= Person.human_attribute_name(field) %></dt>
- <dd class="min-w-0 break-words text-heading">
- <% if field == :email %>
- <%= mail_to value %>
- <% elsif field == :phone %>
- <%= link_to value, "tel:#{value.gsub(/[^\d+]/, '')}" %>
- <% else %>
- <%= value %>
- <% end %>
- </dd>
- <% end %>
- </dl>
+ <% if member && person_bare?(person) %>
+ <%= render 'organisations/people/bare_hint', member: member, url: (edit_organisation_person_path(@current_organisation, person) if can_write) %>
+ <% end %>
+
+ <%= render 'organisations/people/fields', fields: person_fields(person, member) %>
<% if person.notes.present? %>
- <section>
- <h3 class="mb-1 text-sm font-semibold text-heading"><%= Person.human_attribute_name(:notes) %></h3>
- <p class="width-text whitespace-pre-line text-sm text-heading"><%= person.notes %></p>
+ <section class="people-note">
+ <h3><%= Person.human_attribute_name(:notes) %></h3>
+ <p class="width-text"><%= person.notes %></p>
</section>
<% end %>
- <% duplicates = People::Directory.new(viewer: current_user, organisation: @current_organisation).duplicates_of(person) %>
- <% if duplicates.any? %>
- <section class="rounded-lg border border-cream-300 bg-cream-50 p-3">
- <h3 class="mb-1 text-sm font-semibold text-heading"><%= t('views.organisations.people.show.duplicates_title') %></h3>
- <ul class="space-y-1 text-sm">
- <% duplicates.each do |entry| %>
- <li>
- <% if entry.person %>
- <%# A full visit, like a row: the address names the person shown. %>
- <%= link_to person_display_name(person: entry.person, user: entry.user),
- organisation_people_path(@current_organisation, list_state.merge('person_id' => entry.person.id)),
- data: { turbo_frame: '_top' } %>
- <% else %>
- <%= viewer_display_name(entry.user) %>
- <% end %>
- <span class="text-muted">
- (<%= entry.member? ? t('views.organisations.people.index.member_badge') : t('views.organisations.people.show.contact_label') %>)
- </span>
- </li>
- <% end %>
- </ul>
- </section>
- <% end %>
+ <div class="people-footer">
+ <p class="people-footer__created">
+ <% if person.creator %>
+ <%= t('views.organisations.people.show.created_by', name: viewer_display_name(person.creator), date: l(person.created_at.to_date, format: :default)) %>
+ <% else %>
+ <%= t('views.organisations.people.show.created_at', date: l(person.created_at.to_date, format: :default)) %>
+ <% end %>
+ </p>
+ <%= render 'organisations/people/history', person: person %>
+ </div>
- <p class="text-xs text-muted">
- <% if person.creator %>
- <%= t('views.organisations.people.show.created_by', name: viewer_display_name(person.creator),
- date: l(person.created_at.to_date, format: :default)) %>
- <% else %>
- <%= t('views.organisations.people.show.created_at', date: l(person.created_at.to_date, format: :default)) %>
+ <% if can_write %>
+ <% key = member ? 'remove_details' : 'delete' %>
+ <%= render Neo::Buttons::ButtonComponent.new(
+ variant: :ghost, size: :small, icon: 'trash',
+ form: { action: organisation_person_path(@current_organisation, person, list_state), method: :delete, data: { turbo_frame: '_top' } },
+ confirm: t("views.organisations.people.show.#{key}_confirm", name: name),
+ class: 'people-danger-action'
+ ) do %>
+ <%= t("views.organisations.people.show.#{key}") %>
<% end %>
- </p>
-
- <%= render 'organisations/people/history', person: person %>
+ <% else %>
+ <p class="people-footer__readonly"><%= t('views.organisations.people.show.read_only') %></p>
+ <% end %>
</div>
diff --git a/app/views/organisations/people/_fields.html.erb b/app/views/organisations/people/_fields.html.erb
new file mode 100644
index 0000000..cc8667e
--- /dev/null
+++ b/app/views/organisations/people/_fields.html.erb
@@ -0,0 +1,36 @@
+<%# locals: (fields:) %>
+<%# Label and value per line; email and phone are links. On a phone they are
+ large tap targets instead ("anrufen"). %>
+<% if @viewport_mode == 'mobile' %>
+ <% plain, links = fields.partition { |field| field[:href].nil? } %>
+ <% if plain.any? %>
+ <dl class="people-fields">
+ <% plain.each do |field| %>
+ <div class="people-fields__row people-fields__row--stacked"><dt><%= field[:label] %></dt><dd><%= field[:value] %></dd></div>
+ <% end %>
+ </dl>
+ <% end %>
+ <% links.each do |field| %>
+ <%= link_to field[:href], class: "people-tap #{'people-tap--mono' if field[:mono]}" do %>
+ <i class="bi <%= field[:icon] %>" aria-hidden="true"></i><%= field[:value] %>
+ <% if field[:action] %><span class="people-tap__hint"><%= field[:action] %></span><% end %>
+ <% end %>
+ <% end %>
+<% elsif fields.any? %>
+ <dl class="people-fields">
+ <% fields.each do |field| %>
+ <div class="people-fields__row">
+ <dt><%= field[:label] %></dt>
+ <dd>
+ <% if field[:href] %>
+ <%= link_to field[:href], class: "people-fields__link #{'people-fields__link--mono' if field[:mono]}" do %>
+ <i class="bi <%= field[:icon] %>" aria-hidden="true"></i><%= field[:value] %>
+ <% end %>
+ <% else %>
+ <%= field[:value] %>
+ <% end %>
+ </dd>
+ </div>
+ <% end %>
+ </dl>
+<% end %>
diff --git a/app/views/organisations/people/_form.html.erb b/app/views/organisations/people/_form.html.erb
index cccb409..4fb7dad 100644
--- a/app/views/organisations/people/_form.html.erb
+++ b/app/views/organisations/people/_form.html.erb
@@ -3,68 +3,102 @@
lands on the list with the person open, a refused save renders the page
again with this form and its reason. lock_version travels along, so a save
over someone else's change is refused instead of overwriting it. The list
- state rides in hidden fields, so the list after a save keeps it. %>
-<% url = person.persisted? ? organisation_person_path(@current_organisation, person) : organisation_people_path(@current_organisation) %>
-<% input_class = 'block w-full py-2 px-3 border border-cream-300 rounded-lg bg-surface-raised focus:outline-none focus:border-ink focus:ring-1 focus:ring-ink' %>
-<h2 class="text-[22px] leading-snug font-bold text-heading mb-4">
- <%= person.persisted? ? t('views.organisations.people.form.edit_title') : t('views.organisations.people.form.new_title') %>
-</h2>
+ state rides in hidden fields, so the list after a save keeps it.
-<% if message.present? %>
- <p class="mb-4 rounded-lg border border-red-200 bg-red-50 p-3 text-sm text-red-800" role="alert"><%= message %></p>
-<% end %>
+ A row of an active member takes name and email from the account: both are
+ shown, locked, and not sent. Its link is fixed, so the member select is
+ left out (no user_id sent: SavePerson keeps the link). A new row and a
+ contact may be linked. %>
+<% member = person_member_user(person) %>
+<% url = person.persisted? ? organisation_person_path(@current_organisation, person) : organisation_people_path(@current_organisation) %>
+<% title = person.persisted? || member ? t('views.organisations.people.form.edit_title', name: person_display_name(person: person, user: member)) : t('views.organisations.people.form.new_title') %>
+<% cancel_url = person.persisted? ? organisation_person_path(@current_organisation, person) : organisation_people_path(@current_organisation, list_state) %>
+<div class="people-form-wrap">
+ <div class="people-lane__head" data-lane-head data-lane-index-url="<%= organisation_people_path(@current_organisation) %>">
+ <h2 class="people-form__title"><%= title %></h2>
+ <%= link_to cancel_url, class: 'people-icon-action', title: t('views.organisations.people.show.close'),
+ data: ({ lane_close: true, turbo_frame: '_top' } unless person.persisted?) do %>
+ <i class="bi bi-x-lg" aria-hidden="true"></i>
+ <% end %>
+ </div>
-<%= form_with model: person, url: url, scope: :person, class: 'people-form space-y-4', data: { turbo_frame: '_top' } do |f| %>
- <% list_state.each do |name, value| %>
- <%= hidden_field_tag name, value %>
- <% end %>
- <% if person.persisted? %>
- <%= f.hidden_field :lock_version %>
+ <% if message.present? %>
+ <p class="people-callout people-callout--danger" role="alert"><%= message %></p>
<% end %>
- <div>
- <%= f.label :user_id, Person.human_attribute_name(:user), class: 'block text-sm font-medium text-cream-700 mb-1' %>
- <%= f.select :user_id, member_options_for(person),
- { include_blank: t('views.organisations.people.form.no_member') }, class: input_class %>
- <p class="mt-1 text-xs text-muted"><%= t('views.organisations.people.form.member_hint') %></p>
- </div>
+ <%= form_with model: person, url: url, scope: :person, class: 'people-form', data: { turbo_frame: '_top' } do |f| %>
+ <% list_state.each do |name, value| %>
+ <%= hidden_field_tag name, value %>
+ <% end %>
+ <% if person.persisted? %>
+ <%= f.hidden_field :lock_version %>
+ <% elsif member %>
+ <%# "Angaben ergänzen": the chosen member, checked again on save. %>
+ <%= f.hidden_field :user_id %>
+ <% end %>
- <div>
- <%= f.label :name, class: 'block text-sm font-medium text-cream-700 mb-1' %>
- <%# A row of an active member shows the member's own name; the copy here
- only shows once the link is gone or the member left, so it is not
- edited while the member is active. %>
- <%= f.text_field :name, class: input_class, maxlength: Person::MAX_FIELD_LENGTH, readonly: person_member_user(person).present? %>
- </div>
+ <div class="people-form__field">
+ <%= f.label :name do %>
+ <%= Person.human_attribute_name(:name) %><span class="people-form__required" aria-hidden="true"> *</span>
+ <% end %>
+ <% if member %>
+ <%= text_field_tag 'person_name_locked', viewer_display_name(member), id: 'person_name', readonly: true, disabled: true, autocomplete: 'off',
+ class: 'people-input people-input--locked' %>
+ <% else %>
+ <%= f.text_field :name, class: 'people-input', maxlength: Person::MAX_FIELD_LENGTH, required: true,
+ placeholder: t('views.organisations.people.form.placeholders.name') %>
+ <% end %>
+ </div>
- <% %i[function department company].each do |field| %>
- <div>
- <%= f.label field, class: 'block text-sm font-medium text-cream-700 mb-1' %>
- <%= f.text_field field, class: input_class, maxlength: Person::MAX_FIELD_LENGTH %>
+ <% %i[function department company].each do |field| %>
+ <div class="people-form__field">
+ <%= f.label field %>
+ <%= f.text_field field, class: 'people-input', maxlength: Person::MAX_FIELD_LENGTH,
+ placeholder: t("views.organisations.people.form.placeholders.#{field}") %>
+ </div>
+ <% end %>
+
+ <div class="people-form__field">
+ <%= f.label :email %>
+ <% if member %>
+ <%= email_field_tag 'person_email_locked', member.email, id: 'person_email', readonly: true, disabled: true, autocomplete: 'off',
+ class: 'people-input people-input--locked' %>
+ <% else %>
+ <%= f.email_field :email, class: 'people-input', maxlength: Person::MAX_FIELD_LENGTH,
+ placeholder: t('views.organisations.people.form.placeholders.email') %>
+ <% end %>
</div>
- <% end %>
- <div class="grid grid-cols-1 gap-4 sm:grid-cols-2">
- <div>
- <%= f.label :email, class: 'block text-sm font-medium text-cream-700 mb-1' %>
- <%= f.email_field :email, class: input_class, maxlength: Person::MAX_FIELD_LENGTH %>
+ <div class="people-form__field">
+ <%= f.label :phone %>
+ <%= f.telephone_field :phone, class: 'people-input', maxlength: Person::MAX_FIELD_LENGTH,
+ placeholder: t('views.organisations.people.form.placeholders.phone') %>
</div>
- <div>
- <%= f.label :phone, class: 'block text-sm font-medium text-cream-700 mb-1' %>
- <%= f.telephone_field :phone, class: input_class, maxlength: Person::MAX_FIELD_LENGTH %>
+
+ <div class="people-form__field">
+ <%= f.label :notes %>
+ <%= f.text_area :notes, rows: 4, class: 'people-input people-input--area', maxlength: Person::MAX_NOTES_LENGTH,
+ placeholder: t('views.organisations.people.form.placeholders.notes') %>
</div>
- </div>
- <div>
- <%= f.label :notes, class: 'block text-sm font-medium text-cream-700 mb-1' %>
- <%= f.text_area :notes, rows: 5, class: input_class, maxlength: Person::MAX_NOTES_LENGTH %>
- </div>
+ <% unless member %>
+ <div class="people-form__field">
+ <%= f.label :user_id, t('views.organisations.people.form.link_label') %>
+ <%= f.select :user_id, member_options_for(person), { include_blank: t('views.organisations.people.form.no_member') },
+ class: 'people-input' %>
+ </div>
+ <% end %>
- <p class="text-xs text-muted"><i class="bi bi-eye" aria-hidden="true"></i> <%= t('views.organisations.people.form.shared_hint') %></p>
+ <p class="people-callout people-callout--quiet">
+ <i class="bi bi-eye" aria-hidden="true"></i><%= t('views.organisations.people.form.shared_hint') %>
+ </p>
- <div class="flex items-center gap-3">
- <%= render Neo::Buttons::ButtonComponent.new(variant: :primary, size: :medium, type: 'submit') do %>
- <%= t('views.organisations.people.form.save') %>
- <% end %>
- </div>
-<% end %>
+ <div class="people-form__actions">
+ <%= render Neo::Buttons::ButtonComponent.new(variant: :primary, size: :medium, type: 'submit') do %>
+ <%= t('views.organisations.people.form.save') %>
+ <% end %>
+ <%= link_to t('views.organisations.people.form.cancel'), cancel_url, class: 'people-quiet-action',
+ data: ({ turbo_frame: '_top' } unless person.persisted?) %>
+ </div>
+ <% end %>
+</div>
diff --git a/app/views/organisations/people/_history.html.erb b/app/views/organisations/people/_history.html.erb
index de78e33..34f9493 100644
--- a/app/views/organisations/people/_history.html.erb
+++ b/app/views/organisations/people/_history.html.erb
@@ -1,18 +1,15 @@
<%# locals: (person:) %>
-<%# The history of one person: who created and changed the row and which
- fields, never the values (PersonTrackable). Read straight from the row's
- activities, like time_session_groups/_activities. %>
-<% activities = person.activities.includes(:actor).order(created_at: :desc).limit(20).to_a %>
+<%# The history of one person: who changed which field, never the values
+ (PersonTrackable). Read straight from the row's activities, like
+ time_session_groups/_activities. %>
+<% activities = person.activities.includes(:actor).where.not(action: 'created').order(created_at: :desc).limit(20).to_a %>
<% if activities.any? %>
- <section>
- <h3 class="mb-2 text-sm font-semibold text-heading"><%= t('views.organisations.people.history.title') %></h3>
- <ul class="space-y-1 text-xs text-muted">
- <% activities.each do |activity| %>
- <li>
- <time datetime="<%= activity.created_at.iso8601 %>"><%= l(activity.created_at, format: :short) %></time>
- <span class="text-heading"><%= person_history_line(activity) %></span>
- </li>
- <% end %>
- </ul>
- </section>
+ <ul class="people-history" aria-label="<%= t('views.organisations.people.history.title') %>">
+ <% activities.each do |activity| %>
+ <li>
+ <span><%= person_history_line(activity) %></span>
+ <time datetime="<%= activity.created_at.iso8601 %>"><%= l(activity.created_at.to_date, format: :short) %></time>
+ </li>
+ <% end %>
+ </ul>
<% end %>
diff --git a/app/views/organisations/people/_identity.html.erb b/app/views/organisations/people/_identity.html.erb
new file mode 100644
index 0000000..bb560fc
--- /dev/null
+++ b/app/views/organisations/people/_identity.html.erb
@@ -0,0 +1,10 @@
+<%# locals: (name:, user: nil, status_icon:, status:) %>
+<%# The big avatar, the name and the link state of a person or a member. %>
+<div class="people-identity">
+ <%= render Neo::Users::AvatarComponent.new(user: user, size: :large, fallback_initials: person_initials(name),
+ class: "people-avatar #{'people-avatar--contact' unless user}") %>
+ <div class="people-identity__text">
+ <h2 class="people-identity__name"><%= name %></h2>
+ <p class="people-identity__status"><i class="bi <%= status_icon %>" aria-hidden="true"></i><%= status %></p>
+ </div>
+</div>
diff --git a/app/views/organisations/people/_lane.html.erb b/app/views/organisations/people/_lane.html.erb
index dadd2db..152c20f 100644
--- a/app/views/organisations/people/_lane.html.erb
+++ b/app/views/organisations/people/_lane.html.erb
@@ -1,13 +1,13 @@
-<%# locals: (state:, person: nil, message: nil) %>
-<%# What the lane frame holds: a person (:detail), the form (:form, new or
- edit), or nothing yet (:empty). Rendered by the index on a full visit and
- alone for a frame request (show, new, edit, a lane request of the index). %>
-<div class="person-content min-w-0 relative">
+<%# locals: (state:, person: nil, member: nil, message: nil) %>
+<%# What the lane frame holds: a person row (:detail), a member without a row
+ (:member), the form (:form, new or edit), or nothing yet (:empty).
+ Rendered by the index on a full visit and alone for a frame request. %>
+<div class="person-content people-lane min-w-0 relative">
<% if state == :detail %>
- <%= render 'organisations/people/lane_head', closes: :lane %>
<%= render 'organisations/people/detail', person: person %>
+ <% elsif state == :member %>
+ <%= render 'organisations/people/member', member: member %>
<% elsif state == :form %>
- <%= render 'organisations/people/lane_head', closes: (person.persisted? ? :edit : :new_form), person: person %>
<%= render 'organisations/people/form', person: person, message: message %>
<% else %>
<div id="person-display-placeholder" class="ticket-placeholder px-4 py-10 text-center">
diff --git a/app/views/organisations/people/_lane_head.html.erb b/app/views/organisations/people/_lane_head.html.erb
index 6c6ed8e..e0a1e0d 100644
--- a/app/views/organisations/people/_lane_head.html.erb
+++ b/app/views/organisations/people/_lane_head.html.erb
@@ -1,30 +1,19 @@
-<%# locals: (closes:, person: nil) %>
-<%# The head of the lane: the type and the way out. An open person closes the
- lane in place (layout-toggle); the new form leaves to the list, the edit
- form goes back to its person. %>
-<% icon_button = 'inline-flex h-8 w-8 items-center justify-center rounded-md text-cream-500 transition-colors hover:bg-cream-200 hover:text-cream-900 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ink' %>
-<div class="flex items-center gap-4 mb-2" data-lane-head data-lane-index-url="<%= organisation_people_path(@current_organisation) %>">
- <span class="hidden lg:inline font-mono text-[13px] tracking-wide text-cream-500">
- <%= t('views.organisations.people.show.type_label') %>
- </span>
- <div class="ml-auto">
- <% if closes == :lane %>
- <button type="button" class="<%= icon_button %> hidden lg:inline-flex"
- title="<%= t('views.organisations.people.show.close') %>"
- data-lane-close data-action="click->layout-toggle#closeContent">
- <i class="bi bi-x-lg" aria-hidden="true"></i>
- </button>
- <% elsif closes == :edit %>
- <%= link_to organisation_person_path(@current_organisation, person), class: "#{icon_button} inline-flex",
- title: t('views.organisations.people.form.cancel') do %>
- <i class="bi bi-x-lg" aria-hidden="true"></i>
- <% end %>
- <% else %>
- <%= link_to organisation_people_path(@current_organisation, list_state), class: "#{icon_button} inline-flex",
- title: t('views.organisations.people.show.close'),
- data: { lane_close: true, turbo_frame: '_top' } do %>
- <i class="bi bi-x-lg" aria-hidden="true"></i>
- <% end %>
+<%# locals: (kind_label:, edit_url: nil, edit_link: nil) %>
+<%# The head of an open person: what it is (member, contact), "Bearbeiten" for
+ those who may write, and the way out. The ✕ closes the lane in place
+ (layout-toggle); on a phone the mobile view brings its own way back. %>
+<div class="people-lane__head" data-lane-head data-lane-index-url="<%= organisation_people_path(@current_organisation) %>">
+ <span class="people-lane__kind"><%= kind_label %></span>
+ <% if edit_url || edit_link %>
+ <%= link_to(edit_link ? edit_link[:href] : edit_url, class: 'people-ghost-action', data: edit_link&.dig(:data)) do %>
+ <i class="bi bi-pencil" aria-hidden="true"></i><%= t('views.organisations.people.show.edit') %>
<% end %>
- </div>
+ <% end %>
+ <% unless @viewport_mode == 'mobile' %>
+ <span class="people-lane__divider" aria-hidden="true"></span>
+ <button type="button" class="people-icon-action" title="<%= t('views.organisations.people.show.close') %>"
+ data-lane-close data-action="click->layout-toggle#closeContent">
+ <i class="bi bi-x-lg" aria-hidden="true"></i>
+ </button>
+ <% end %>
</div>
diff --git a/app/views/organisations/people/_list_head.html.erb b/app/views/organisations/people/_list_head.html.erb
index 68a88df..0fc0d8c 100644
--- a/app/views/organisations/people/_list_head.html.erb
+++ b/app/views/organisations/people/_list_head.html.erb
@@ -1,50 +1,64 @@
-<%# locals: () %>
-<%# The head of the list: title box with the "+", the search and the three
- filters (all, members, contacts). A search or a filter is a full visit of
- the index; the open person travels along. %>
+<%# locals: (counts:) %>
+<%# The head of the list: the title with the count line, the main action, the
+ search and the three filters with their counts. A search or a filter is a
+ full visit of the index; the open person travels along. Only the main
+ action carries the hard edge and the offset shadow, everything else is a
+ hairline (the rule of the rebuilt tickets). %>
<% frame_id = Organisations::PeopleController::DETAIL_FRAME_ID %>
-<%= render NeoTitleBoxComponent.new(title: t('views.organisations.people.index.title'), variant: :organisation) do |box| %>
- <%# The "+" opens the form in the lane, only for those who may write. %>
- <% if policy(Person).create? %>
- <% box.with_title_action do %>
- <%= render Neo::Buttons::IconButtonComponent.new(
- variant: :primary,
- icon: 'plus-lg',
- size: :medium,
- title: t('views.organisations.people.index.new_person'),
- url: organisation_people_path(@current_organisation, list_state.merge('new' => Organisations::PeopleController::NEW_STATE)),
- data: {
- controller: 'lane-link',
- action: 'click->lane-link#click',
- lane_link_url_value: new_organisation_person_path(@current_organisation),
- lane_link_frame_value: frame_id,
- lane_link_set_value: { new: Organisations::PeopleController::NEW_STATE }.to_json,
- lane_link_remove_value: %w[person_id user_id].to_json,
- lane_link_focus_value: '#person_name'
- }
- ) %>
+<% mobile = @viewport_mode == 'mobile' %>
+<% add_url = organisation_people_path(@current_organisation, list_state.merge('new' => Organisations::PeopleController::NEW_STATE)) %>
+<% add_data = {
+ controller: 'lane-link',
+ action: 'click->lane-link#click',
+ lane_link_url_value: new_organisation_person_path(@current_organisation),
+ lane_link_frame_value: frame_id,
+ lane_link_set_value: { new: Organisations::PeopleController::NEW_STATE }.to_json,
+ lane_link_remove_value: %w[person_id member_id user_id].to_json,
+ lane_link_focus_value: '#person_name'
+ } %>
+<%# On a phone the shell already names the page; the head keeps the count and
+ a square "+". %>
+<div class="people-head">
+ <div class="people-head__title">
+ <% unless mobile %>
+ <h1 class="people-head__h1"><%= t('views.organisations.people.index.title') %></h1>
+ <% end %>
+ <p class="people-head__count">
+ <%= t('views.organisations.people.index.count_line', count: counts['all'], members: counts['members'], contacts: counts['contacts']) %>
+ </p>
+ </div>
+ <% if policy(Person).create? && mobile %>
+ <%= render Neo::Buttons::IconButtonComponent.new(variant: :primary, icon: 'plus-lg', size: :large, url: add_url,
+ title: t('views.organisations.people.index.new_person'),
+ class: 'people-head__action', data: add_data) %>
+ <% elsif policy(Person).create? %>
+ <%= render Neo::Buttons::ButtonComponent.new(variant: :primary, size: :medium, icon: 'plus-lg', url: add_url,
+ class: 'people-head__action', data: add_data) do %>
+ <%= t('views.organisations.people.index.new_person') %>
<% end %>
<% end %>
-<% end %>
+</div>
-<div class="people-list-head flex flex-wrap items-center gap-3 mb-4">
- <%= form_with url: organisation_people_path(@current_organisation), method: :get, class: 'flex-1 min-w-48', data: { turbo_frame: '_top' } do %>
+<div class="people-tools">
+ <%= form_with url: organisation_people_path(@current_organisation), method: :get, class: 'people-search', data: { turbo_frame: '_top' } do %>
<%= hidden_field_tag :kind, list_state['kind'] if list_state['kind'] %>
- <%= hidden_field_tag :person_id, params[:person_id] if params[:person_id].is_a?(String) %>
- <label for="people-search" class="sr-only"><%= t('views.organisations.people.index.search_label') %></label>
- <%= search_field_tag :q, list_state['q'], id: 'people-search', autocomplete: 'off',
- placeholder: t('views.organisations.people.index.search_placeholder'),
- class: 'block w-full py-2 px-4 border border-cream-300 rounded-lg bg-surface-raised focus:outline-none focus:border-ink focus:ring-1 focus:ring-ink' %>
+ <label for="people-search" class="people-search__field">
+ <i class="bi bi-search" aria-hidden="true"></i>
+ <span class="sr-only"><%= t('views.organisations.people.index.search_label') %></span>
+ <%= search_field_tag :q, list_state['q'], id: 'people-search', autocomplete: 'off',
+ placeholder: t('views.organisations.people.index.search_placeholder') %>
+ </label>
<% end %>
- <nav class="flex items-center gap-2" aria-label="<%= t('views.organisations.people.index.filter_label') %>">
+ <nav class="people-filters" aria-label="<%= t('views.organisations.people.index.filter_label') %>">
<% People::Directory::KINDS.each do |kind| %>
<% active = (list_state['kind'] || 'all') == kind %>
- <%= link_to t("views.organisations.people.index.kinds.#{kind}"),
- organisation_people_path(@current_organisation, list_state.merge('kind' => (kind == 'all' ? nil : kind)).compact),
- class: "inline-flex items-center rounded-full border px-3 py-1 text-sm #{active ? 'border-ink bg-ink text-cream-50' : 'border-cream-300 text-cream-700 hover:bg-cream-100'}",
- 'aria-current': (active ? 'true' : nil),
- data: { turbo_frame: '_top' } %>
+ <%= link_to organisation_people_path(@current_organisation, list_state.merge('kind' => (kind == 'all' ? nil : kind)).compact),
+ class: "people-pill #{'people-pill--active' if active}", 'aria-current': (active ? 'true' : nil),
+ data: { turbo_frame: '_top' } do %>
+ <%= t("views.organisations.people.index.kinds.#{kind}") %>
+ <span class="people-pill__count"><%= counts[kind] %></span>
+ <% end %>
<% end %>
</nav>
</div>
diff --git a/app/views/organisations/people/_member.html.erb b/app/views/organisations/people/_member.html.erb
new file mode 100644
index 0000000..13839b4
--- /dev/null
+++ b/app/views/organisations/people/_member.html.erb
@@ -0,0 +1,25 @@
+<%# locals: (member:) %>
+<%# A member who has no row of their own yet: name and email from the account,
+ and the invitation to add the details. "Angaben ergänzen" opens the form
+ with the member chosen (?new=person&user_id=). %>
+<% can_write = policy(Person).create? %>
+<% add_link = add_member_details_link(member) if can_write %>
+<div class="people-detail">
+ <%= render 'organisations/people/lane_head', kind_label: t('views.organisations.people.show.kind.member'),
+ edit_link: add_link %>
+ <%= render 'organisations/people/identity', name: viewer_display_name(member), user: member, status_icon: 'bi-person-check',
+ status: t('views.organisations.people.show.linked_member', name: viewer_display_name(member)) %>
+ <%= render 'organisations/people/bare_hint', member: member, link: add_link %>
+ <%= render 'organisations/people/fields', fields: person_fields(nil, member) %>
+ <% membership = Membership.find_by(organisation: @current_organisation, user: member) %>
+ <% if membership %>
+ <div class="people-footer">
+ <p class="people-footer__created">
+ <%= t('views.organisations.people.show.from_account', date: l(membership.created_at.to_date, format: :default)) %>
+ </p>
+ </div>
+ <% end %>
+ <% unless can_write %>
+ <p class="people-footer__readonly"><%= t('views.organisations.people.show.read_only') %></p>
+ <% end %>
+</div>
diff --git a/app/views/organisations/people/_results.html.erb b/app/views/organisations/people/_results.html.erb
index 9822130..ab5fed6 100644
--- a/app/views/organisations/people/_results.html.erb
+++ b/app/views/organisations/people/_results.html.erb
@@ -1,24 +1,31 @@
-<%# locals: (entries:, selected: nil) %>
-<%# The rows of the directory (People::Directory). A row with a person row
- opens it in the lane (list-row); a member without one is plain text, with
- "Angaben ergänzen" for those who may write. %>
+<%# locals: (entries:, counts:, selected: nil, member: nil) %>
+<%# The rows of the directory (People::Directory), one column: name with a
+ "Mitglied" badge, function and company below. Every row opens the lane:
+ a person row through person_id, a member without a row through member_id. %>
<turbo-frame id="<%= Organisations::PeopleController::LIST_FRAME_ID %>">
- <% if entries.empty? %>
- <div class="flex items-center justify-center min-h-[40vh]">
- <% if list_state.any? %>
- <%= render 'shared/empty_content', variant: :no_results, icon_class: 'bi bi-search',
- title: t('views.organisations.people.index.empty_no_results') %>
- <% else %>
- <%= render 'shared/empty_content', variant: :first_time, icon_class: 'bi bi-people',
- title: t('views.organisations.people.index.empty_title'),
- description: t('views.organisations.people.index.empty_description') %>
- <% end %>
- </div>
- <% else %>
- <ul class="people-list divide-y divide-cream-200">
+ <% if entries.any? %>
+ <ul class="people-list">
<% entries.each do |entry| %>
- <%= render 'organisations/people/row', entry: entry, selected: selected %>
+ <%= render 'organisations/people/row', entry: entry, selected: selected, member: member %>
<% end %>
</ul>
+ <% elsif list_state['q'].present? %>
+ <div class="people-empty">
+ <p class="people-empty__title"><%= t('views.organisations.people.index.no_hits_title', query: list_state['q']) %></p>
+ <p class="people-empty__text"><%= t('views.organisations.people.index.no_hits_text') %></p>
+ <%= link_to t('views.organisations.people.index.clear_search'),
+ organisation_people_path(@current_organisation, list_state.except('q')), class: 'people-text-action',
+ data: { turbo_frame: '_top' } %>
+ </div>
+ <% elsif counts['all'].zero? %>
+ <div class="people-empty">
+ <i class="bi bi-people people-empty__icon" aria-hidden="true"></i>
+ <p class="people-empty__title"><%= t('views.organisations.people.index.empty_title') %></p>
+ <p class="people-empty__text width-text"><%= t('views.organisations.people.index.empty_description') %></p>
+ </div>
+ <% else %>
+ <div class="people-empty">
+ <p class="people-empty__text"><%= t("views.organisations.people.index.empty_kind.#{list_state['kind']}", default: t('views.organisations.people.index.empty_no_results')) %></p>
+ </div>
<% end %>
</turbo-frame>
diff --git a/app/views/organisations/people/_row.html.erb b/app/views/organisations/people/_row.html.erb
index 813d885..f5e0bd2 100644
--- a/app/views/organisations/people/_row.html.erb
+++ b/app/views/organisations/people/_row.html.erb
@@ -1,46 +1,33 @@
-<%# locals: (entry:, selected: nil) %>
+<%# locals: (entry:, selected: nil, member: nil) %>
<% person = entry.person %>
<% name = person_display_name(person: person, user: entry.user) %>
-<% row_data = if person
- { controller: 'list-row', action: 'click->list-row#click', person_id: person.id,
- list_row_url_value: organisation_person_path(@current_organisation, person),
- list_row_id_value: person.id, list_row_param_value: 'person_id',
- list_row_params_value: %w[person_id].to_json,
- list_row_frame_value: Organisations::PeopleController::DETAIL_FRAME_ID }
- else
- {}
- end %>
-<%= tag.li data: row_data, tabindex: (person ? -1 : nil),
- class: "people-row flex items-center gap-3 px-3 py-2.5 #{'cursor-pointer hover:bg-cream-100' if person} #{'selected-row' if person && selected&.id == person.id}" do %>
- <% if entry.user %>
- <%= render Neo::Users::AvatarComponent.new(user: entry.user, size: :small) %>
- <% else %>
- <%= render Neo::Users::AvatarComponent.new(user: nil, size: :small, fallback_initials: person_initials(name)) %>
- <% end %>
- <div class="min-w-0 flex-1">
- <div class="flex min-w-0 items-center gap-2">
- <span class="truncate text-sm font-medium text-heading"><%= name %></span>
+<% 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 %>
+<% row_data = { controller: 'list-row', action: 'click->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 } %>
+<%= tag.li data: row_data, tabindex: 0, class: "people-row #{'selected-row' if open}" do %>
+ <%= render Neo::Users::AvatarComponent.new(user: entry.user, size: :small, fallback_initials: person_initials(name),
+ class: "people-avatar #{'people-avatar--contact' unless entry.member?}") %>
+ <span class="people-row__text">
+ <span class="people-row__line">
+ <span class="people-row__name"><%= name %></span>
<% if entry.member? %>
- <span class="shrink-0 rounded border border-cream-300 px-1.5 text-[11px] text-cream-600"><%= t('views.organisations.people.index.member_badge') %></span>
+ <span class="people-badge"><%= t('views.organisations.people.index.member_badge') %></span>
<% end %>
- </div>
- <% meta = [person&.function, person&.company].compact_blank %>
- <% if meta.any? %>
- <p class="truncate text-xs text-muted"><%= meta.join(' · ') %></p>
+ </span>
+ <% sub = [person&.function, person&.company].compact_blank.join(' · ').presence || (entry.user&.email if entry.member?) %>
+ <% if sub %>
+ <span class="people-row__sub"><%= sub %></span>
<% end %>
- </div>
- <% if person.nil? && policy(Person).create? %>
- <%= link_to t('views.organisations.people.index.add_details'),
- organisation_people_path(@current_organisation, list_state.merge('new' => Organisations::PeopleController::NEW_STATE,
- 'user_id' => entry.user.id)),
- class: 'shrink-0 text-xs text-cobalt-600 hover:underline',
- data: {
- controller: 'lane-link',
- action: 'click->lane-link#click',
- lane_link_url_value: new_organisation_person_path(@current_organisation, user_id: entry.user.id),
- lane_link_frame_value: Organisations::PeopleController::DETAIL_FRAME_ID,
- lane_link_set_value: { new: Organisations::PeopleController::NEW_STATE, user_id: entry.user.id }.to_json,
- lane_link_remove_value: %w[person_id].to_json
- } %>
- <% end %>
+ </span>
+ <i class="bi bi-chevron-right people-row__chevron" aria-hidden="true"></i>
<% end %>
diff --git a/app/views/organisations/people/index.html.erb b/app/views/organisations/people/index.html.erb
index 33b2e39..083cd93 100644
--- a/app/views/organisations/people/index.html.erb
+++ b/app/views/organisations/people/index.html.erb
@@ -1,24 +1,25 @@
<%# The people directory (Organisations::PeopleController): the list on the
- left, the person or the form in the lane on the right, the shape of
- "Alle Meetings" without its filter bar. layout-toggle and index-page own
- the address (?person_id=, ?new=person); a save leaves the lane and lands
- here again with the saved person open. %>
+ left, the person, a member without a row, or the form in the lane on the
+ right, the shape of "Alle Meetings" without its filter bar. layout-toggle
+ and index-page own the address (?person_id=, ?member_id=, ?new=person); a
+ save leaves the lane and lands here again with the saved person open. %>
<% content_for :head do %>
<meta name="turbo-cache-control" content="no-cache">
<% end %>
-<% lane_state = if @form_person then :form elsif @lane_person then :detail end %>
+<% lane_state = if @form_person then :form elsif @lane_person then :detail elsif @lane_member then :member end %>
<% lane_person = @form_person || @lane_person %>
<div class="labor-layout-view people-page <%= 'show-content' if lane_state %> hide-panel"
- <%= tag.attributes(data: people_page_data(viewport_mode: @viewport_mode, selected: @lane_person,
+ <%= tag.attributes(data: people_page_data(viewport_mode: @viewport_mode, selected: @lane_person, member: @lane_member,
form_open: @form_person.present?)) %>>
<% list = capture do %>
- <%= render 'organisations/people/list_head' %>
- <%= render 'organisations/people/results', entries: @entries, selected: @lane_person %>
+ <%= render 'organisations/people/list_head', counts: @counts %>
+ <%= render 'organisations/people/results', entries: @entries, counts: @counts, selected: @lane_person, member: @lane_member %>
<% end %>
<% lane = capture do %>
- <%= render 'organisations/people/lane', state: lane_state || :empty, person: lane_person, message: @form_message %>
+ <%= render 'organisations/people/lane', state: lane_state || :empty, person: lane_person, member: @lane_member,
+ message: @form_message %>
<% end %>
<% if @viewport_mode == 'mobile' %>
diff --git a/config/locales/views/personen.de.yml b/config/locales/views/personen.de.yml
index 885ac75..9420768 100644
--- a/config/locales/views/personen.de.yml
+++ b/config/locales/views/personen.de.yml
@@ -16,41 +16,67 @@ de:
people:
index:
title: "Personen"
+ count_line:
+ one: "%{count} Person · %{members} Mitglieder, %{contacts} Kontakte"
+ other: "%{count} Personen · %{members} Mitglieder, %{contacts} Kontakte"
new_person: "Person anlegen"
search_label: "Personen durchsuchen"
- search_placeholder: "Name, Funktion, Firma, E-Mail …"
+ search_placeholder: "Name, Funktion oder Firma"
filter_label: "Anzeigen"
kinds:
all: "Alle"
members: "Mitglieder"
contacts: "Kontakte"
member_badge: "Mitglied"
- add_details: "Angaben ergänzen"
placeholder_title: "Keine Person gewählt"
placeholder_body: "Wähle links eine Person aus."
empty_title: "Noch keine Personen"
- empty_description: "Mitglieder der Organisation erscheinen hier von selbst. Personen ohne Konto legst du mit dem Plus an."
- empty_no_results: "Keine Person passt zur Suche."
+ empty_description: "Hier steht, wer wofür zuständig ist: Ansprechpartner, Vertretungen, der Hoster. Mitglieder erscheinen von selbst, sobald sie eingeladen sind."
+ empty_no_results: "Keine Person in dieser Auswahl."
+ empty_kind:
+ members: "Keine Mitglieder in der Liste."
+ contacts: "Noch keine Kontakte. Personen ohne Konto legst du mit „Person anlegen“ an."
+ no_hits_title: "Keine Person passt zu „%{query}“."
+ no_hits_text: "Gesucht wird in Name, Funktion, Abteilung, Firma und E-Mail."
+ clear_search: "Suche zurücksetzen"
back_to_list: "Personen"
show:
- type_label: "PERSON"
+ kind:
+ member: "Mitglied"
+ contact: "Kontakt"
close: "Schließen"
edit: "Bearbeiten"
- delete: "Löschen"
- delete_confirm: "Diese Person wirklich löschen? Die Angaben sind danach weg."
linked_member: "Mitglied: %{name}"
no_account: "Kein Konto"
former_member: "Früheres Mitglied"
contact_label: "Kontakt"
- duplicates_title: "Gleicher Name"
+ duplicate_prefix: "Gleicher Name:"
+ duplicate_link: "Verknüpfen …"
+ bare_text: "Name und E-Mail kommen vom Konto. Funktion, Abteilung, Telefon und eine Notiz fehlen noch, damit andere wissen, wofür %{first_name} zuständig ist."
+ add_details: "Angaben ergänzen"
+ call: "anrufen"
created_by: "Angelegt von %{name} am %{date}"
created_at: "Angelegt am %{date}"
+ from_account: "Aus dem Konto übernommen am %{date}"
+ read_only: "Du kannst Personen ansehen, aber nicht bearbeiten."
+ delete: "Löschen"
+ delete_confirm: "%{name} wird aus der Liste gelöscht. Das lässt sich nicht rückgängig machen."
+ remove_details: "Ergänzte Angaben entfernen"
+ remove_details_confirm: "Funktion, Abteilung, Telefon und Notiz von %{name} werden entfernt, das Konto bleibt. Das lässt sich nicht rückgängig machen."
form:
new_title: "Person anlegen"
- edit_title: "Person bearbeiten"
- no_member: "Kein Mitglied"
+ edit_title: "%{name} bearbeiten"
+ link_label: "Mit Mitglied verknüpfen (optional)"
+ no_member: "kein Mitglied"
former_member_option: "%{name} (früheres Mitglied)"
- member_hint: "Mit einem Mitglied verknüpft, zeigt die Liste den Namen aus seinem Konto."
+ placeholders:
+ name: "Vor- und Nachname"
+ function: "z. B. Technischer Ansprechpartner"
+ department: "z. B. IT"
+ company: "nur für Dritte, z. B. der Hoster"
+ phone: "+49 30 1234567"
+ notes: "Einfacher Text, z. B. Erreichbarkeit oder Zuständigkeit"
shared_hint: "Alle mit Zugriff auf Personen sehen diese Angaben, auch die Kundenseite."
save: "Speichern"
cancel: "Abbrechen"
diff --git a/config/locales/views/personen.en.yml b/config/locales/views/personen.en.yml
index 3115eda..af14cdd 100644
--- a/config/locales/views/personen.en.yml
+++ b/config/locales/views/personen.en.yml
@@ -16,41 +16,67 @@ en:
people:
index:
title: "People"
+ count_line:
+ one: "%{count} person · %{members} members, %{contacts} contacts"
+ other: "%{count} people · %{members} members, %{contacts} contacts"
new_person: "Add person"
search_label: "Search people"
- search_placeholder: "Name, function, company, email …"
+ search_placeholder: "Name, function or company"
filter_label: "Show"
kinds:
all: "All"
members: "Members"
contacts: "Contacts"
member_badge: "Member"
- add_details: "Add details"
placeholder_title: "No person selected"
placeholder_body: "Pick a person on the left."
empty_title: "No people yet"
- empty_description: "Members of the organisation show up here on their own. Add people without an account with the plus."
- empty_no_results: "No person matches the search."
+ empty_description: "This is where you keep who is responsible for what: contacts, cover, the hosting provider. Members show up on their own once they are invited."
+ empty_no_results: "No person in this selection."
+ empty_kind:
+ members: "No members in the list."
+ contacts: "No contacts yet. Add people without an account with “Add person”."
+ no_hits_title: "No person matches “%{query}”."
+ no_hits_text: "The search looks at name, function, department, company and email."
+ clear_search: "Clear search"
back_to_list: "People"
show:
- type_label: "PERSON"
+ kind:
+ member: "Member"
+ contact: "Contact"
close: "Close"
edit: "Edit"
- delete: "Delete"
- delete_confirm: "Really delete this person? The details will be gone."
linked_member: "Member: %{name}"
no_account: "No account"
former_member: "Former member"
contact_label: "Contact"
- duplicates_title: "Same name"
+ duplicate_prefix: "Same name:"
+ duplicate_link: "Link …"
+ bare_text: "Name and email come from the account. Function, department, phone and a note are still missing, so others know what %{first_name} is responsible for."
+ add_details: "Add details"
+ call: "call"
created_by: "Added by %{name} on %{date}"
created_at: "Added on %{date}"
+ from_account: "Taken from the account on %{date}"
+ read_only: "You can view people, but not edit them."
+ delete: "Delete"
+ delete_confirm: "%{name} will be deleted from the list. This cannot be undone."
+ remove_details: "Remove added details"
+ remove_details_confirm: "Function, department, phone and note of %{name} will be removed, the account stays. This cannot be undone."
form:
new_title: "Add person"
- edit_title: "Edit person"
- no_member: "No member"
+ edit_title: "Edit %{name}"
+ link_label: "Link to a member (optional)"
+ no_member: "no member"
former_member_option: "%{name} (former member)"
- member_hint: "When linked to a member, the list shows the name from their account."
+ placeholders:
+ name: "First and last name"
+ function: "e.g. technical contact"
+ department: "e.g. IT"
+ company: "third parties only, e.g. the hosting provider"
+ phone: "+49 30 1234567"
+ notes: "Plain text, e.g. availability or responsibility"
shared_hint: "Everyone with access to people sees these details, the customer's side too."
save: "Save"
cancel: "Cancel"
diff --git a/config/locales/views_extracted.de.yml b/config/locales/views_extracted.de.yml
index d8f0e13..db8387b 100644
--- a/config/locales/views_extracted.de.yml
+++ b/config/locales/views_extracted.de.yml
@@ -199,9 +199,8 @@ de:
assistant:
use_assistant: Erlaubt die Nutzung des organisationsweiten KI-Assistenten.
people:
- view_people: Erlaubt das Lesen der Personenliste der Organisation.
- manage_people: Erlaubt das Anlegen, Bearbeiten und Löschen von Personen
- in der Personenliste der Organisation.
+ view_people: Personen ansehen
+ manage_people: Personen bearbeiten (inkl. Löschen)
none_available: Keine Beschreibung verfügbar
categories:
assistant: Assistent
diff --git a/config/locales/views_extracted.en.yml b/config/locales/views_extracted.en.yml
index 5e6ae12..5e1639d 100644
--- a/config/locales/views_extracted.en.yml
+++ b/config/locales/views_extracted.en.yml
@@ -193,9 +193,8 @@ en:
assistant:
use_assistant: Allows using the org-wide AI assistant.
people:
- view_people: Allows reading the organisation's people directory.
- manage_people: Allows adding, editing and deleting people in the
- organisation's people directory.
+ view_people: View people
+ manage_people: Edit people (including delete)
none_available: No description available
categories:
assistant: Assistant
diff --git a/config/routes.rb b/config/routes.rb
index 9e2188b..89437cd 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -329,8 +329,11 @@ Rails.application.routes.draw do
# The shared people directory of the organisation (Person): one page with a
# lane, the list on the left, the person or the form in the lane. show, new
# and edit answer the lane frame; a full visit lands on the index with
- # ?person_id= or ?new=person.
- resources :people
+ # ?person_id= or ?new=person. A member without a row of their own opens
+ # through members/:user_id (?member_id= on the page).
+ resources :people do
+ get 'members/:user_id', on: :collection, action: :member, as: :member
+ end
# The column picker of "Alle Meetings" saves the overview's base view here:
# the controller of the project route (view_configuration under a project),
diff --git a/spec/components/neo/users/avatar_component_spec.rb b/spec/components/neo/users/avatar_component_spec.rb
index 41cd8c2..7e6837e 100644
--- a/spec/components/neo/users/avatar_component_spec.rb
+++ b/spec/components/neo/users/avatar_component_spec.rb
@@ -23,8 +23,8 @@ RSpec.describe Neo::Users::AvatarComponent, type: :component do
# removed size would get in production — the wrong size, no error.
# An entry removed from the map removes its example, so the two assertions
# below are what actually goes red.
- it 'offers the identity scales (xs 20 / small 26 / medium 32 / detail 34)' do
- expect(described_class::SIZES.keys).to contain_exactly(:xs, :small, :medium, :detail)
+ it 'offers the identity scales (xs 20 / small 26 / medium 32 / detail 34 / large 52)' do
+ expect(described_class::SIZES.keys).to contain_exactly(:xs, :small, :medium, :detail, :large)
end
it 'gives the two sizes genuinely different classes' do
diff --git a/spec/requests/organisations/people_spec.rb b/spec/requests/organisations/people_spec.rb
index 44142fa..f66f3fa 100644
--- a/spec/requests/organisations/people_spec.rb
+++ b/spec/requests/organisations/people_spec.rb
@@ -279,7 +279,7 @@ RSpec.describe 'Organisations::People', :ci_guard, type: :request do
get organisation_person_path(organisation, person), headers: frame_headers
- expect(response.body).to include(I18n.t('views.organisations.people.show.duplicates_title'),
+ expect(response.body).to include(I18n.t('views.organisations.people.show.duplicate_prefix'),
"person_id=#{twin.id}")
end
@@ -396,10 +396,10 @@ RSpec.describe 'Organisations::People', :ci_guard, type: :request do
sign_in admin
member = member_with(role_with, first_name: 'Ohne')
- get organisation_people_path(organisation)
+ get member_organisation_people_path(organisation, member.id), headers: frame_headers
- row = response.body[%r{<li[^>]*people-row[\s\S]*?Ohne[\s\S]*?</li>}]
- expect(row).to include(CGI.escapeHTML({ new: 'person', user_id: member.id }.to_json))
+ expect(response.body).to include(CGI.escapeHTML({ new: 'person', user_id: member.id }.to_json),
+ "user_id=#{member.id}", I18n.t('views.organisations.people.show.add_details'))
end
it 'opens the form with the member chosen on a full visit with ?new=person&user_id=' do
@@ -408,7 +408,8 @@ RSpec.describe 'Organisations::People', :ci_guard, type: :request do
get organisation_people_path(organisation, new: 'person', user_id: member.id)
- expect(response.body).to match(/<option selected="selected" value="#{member.id}">/)
+ expect(response.body).to include(%(type="hidden" value="#{member.id}" name="person[user_id]"))
+ expect(response.body[/<input[^>]*id="person_name"[^>]*>/]).to include('readonly', CGI.escapeHTML(member.display_name))
end
# Review round 2, finding 2: a raw user_id in the address named any account
@@ -542,7 +543,7 @@ RSpec.describe 'Organisations::People', :ci_guard, type: :request do
get organisation_people_path(organisation, user_id: 'x')
expect(response.body).to include(CGI.escapeHTML('"form":["new","user_id"]'),
- CGI.escapeHTML('["person_id","user_id"]'),
+ CGI.escapeHTML('["person_id","member_id","user_id"]'),
CGI.escapeHTML('{"user_id":"x"}'))
end
@@ -577,6 +578,112 @@ RSpec.describe 'Organisations::People', :ci_guard, type: :request do
expect(link).to include('data-turbo-frame="_top"')
end
+ # The design of 26.10.2026: a member without a row of their own opens in
+ # the lane too (?member_id=), with name and email from the account.
+ describe 'the lane of a member without a row' do
+ let(:project) { create(:project, organisation: organisation) }
+ let(:colleague) { member_with(role_with, first_name: 'Kolja') }
+ let(:stranger) { member_with(role_with, first_name: 'Sven') }
+
+ before do
+ create(:project_permission, user: viewer, project: project, tickets_access: :read_only)
+ create(:project_permission, user: colleague, project: project, tickets_access: :read_only)
+ create(:project_permission, user: stranger, project: create(:project, organisation: organisation),
+ tickets_access: :read_only)
+ end
+
+ it 'shows the account name, email and what is missing' do
+ sign_in viewer
+
+ get member_organisation_people_path(organisation, colleague.id), headers: frame_headers
+
+ expect(response).to have_http_status(:ok)
+ expect(response.body).to include(CGI.escapeHTML(colleague.display_name), colleague.email,
+ I18n.t('views.organisations.people.show.read_only'))
+ expect(response.body).not_to include(I18n.t('views.organisations.people.show.add_details'))
+ end
+
+ it 'answers 404 for a member the reader cannot see' do
+ sign_in viewer
+
+ get member_organisation_people_path(organisation, stranger.id), headers: frame_headers
+
+ expect(response).to have_http_status(:not_found)
+ end
+
+ it 'answers 403 without the right' do
+ sign_in nobody
+
+ get member_organisation_people_path(organisation, colleague.id), headers: frame_headers
+
+ expect(response).to have_http_status(:forbidden)
+ end
+
+ it 'opens the row of a member who has one' do
+ row = create(:person, organisation: organisation, user: colleague, function: 'Netzwerk')
+ sign_in viewer
+
+ get member_organisation_people_path(organisation, colleague.id)
+
+ expect(response).to redirect_to(organisation_people_path(organisation, person_id: row.id))
+ end
+
+ it 'opens on a full visit with ?member_id= and marks the row' do
+ sign_in viewer
+
+ get organisation_people_path(organisation, member_id: colleague.id)
+
+ expect(response.body).to include('show-content', I18n.t('views.organisations.people.show.bare_text', first_name: 'Kolja'))
+ expect(response.body).to match(/class="people-row selected-row"[^>]*>|data-list-row-id-value="#{colleague.id}"[^>]*class="people-row selected-row"/)
+ end
+
+ it 'drops an unreadable ?member_id= from the address' do
+ sign_in viewer
+
+ get organisation_people_path(organisation, member_id: stranger.id)
+
+ expect(response.body).not_to include('show-content')
+ expect(response.body).to include(CGI.escapeHTML({ member_id: stranger.id }.to_json))
+ end
+ end
+
+ it 'counts all people, members and contacts in the head and the filters' do
+ sign_in admin
+ admin
+
+ get organisation_people_path(organisation, kind: 'contacts')
+
+ members = Membership.where(organisation: organisation, active: true).count
+ expect(response.body).to include(I18n.t('views.organisations.people.index.count_line', count: members + 1, members: members, contacts: 1))
+ end
+
+ describe 'the row of an active member' do
+ let!(:row) { create(:person, organisation: organisation, user: viewer, function: 'IT', email: '[email protected]') }
+
+ before { sign_in admin }
+
+ it 'offers to remove the added details, not to delete the person' do
+ get organisation_person_path(organisation, row), headers: frame_headers
+
+ expect(response.body).to include(I18n.t('views.organisations.people.show.remove_details'))
+ expect(response.body).not_to include(">#{I18n.t('views.organisations.people.show.delete')}<")
+ end
+
+ it 'shows the email of the account, and locks name and email in the form' do
+ get edit_organisation_person_path(organisation, row), headers: frame_headers
+
+ expect(response.body[/<input[^>]*id="person_email"[^>]*>/]).to include('readonly', viewer.email)
+ expect(response.body).not_to include('name="person[user_id]"')
+ end
+
+ it 'keeps the link when the form is saved' do
+ patch organisation_person_path(organisation, row), params: { person: { function: 'Netz', lock_version: row.lock_version } }
+
+ expect(row.reload.user_id).to eq(viewer.id)
+ expect(row.function).to eq('Netz')
+ end
+ end
+
it 'has no missing translation on the page' do
sign_in admin
get organisation_people_path(organisation, person_id: person.id)