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.5 KB
Raw Blame
<%# The display chooser (Handout §4): one surface that opens the three toggles
    deciding what each booking SHOWS, rather than three pills competing with the
    filter panel above for the reader's attention.

    ⚠️ Rendered through _filter_pill, the same partial the four filter choices
    use. They look alike because they behave alike -- a surface that opens a
    menu of links -- and building a second one here is how the two would drift
    apart on what "open" looks like. What differs is stated, not restyled: this
    one is never "set" and never clearable, because it narrows nothing. It
    changes how the answer is drawn, not what the answer is.

    ⚠️ TWO options, not three: "mit Summe" is gone. The result row states the
    sum on every render, so the switch offered to show something that is always
    shown.

    Multi-select on purpose: the two are independent, so more than one option
    can carry its check at once. That is why the surface keeps its own name
    instead of showing a value -- there may be three values, or none.

    query_toggle semantics as everywhere here: the href is the page-load
    fallback, `owns` is the live rewrite against the address in the browser. %>
<%
  display_toggles = {
    show_creator: 'display_with_creator',
    expand_all: 'display_all_details'
  }

  display_options = display_toggles.map do |key, word|
    on = request.query_parameters[key.to_s] == '1'
    change = { key.to_s => on ? nil : '1' }
    { value: key.to_s,
      label: t("views.organisations.time_sessions.index.#{word}"),
      url: time_list_filter_url(change),
      owns: time_filter_owns_pairs(change),
      selected: on }
  end
%>

<%# ⚠️ Its OWN handle. It is drawn by the filter partial because it behaves the
    same, but it is not a filter -- and data-filter-pill on it made a page-wide
    list of "the filters" find five, which a spec had to scope defensively
    around. The partial names its handle now, so the shared surface can be worn
    by something that is not a filter without lying about what it is. %>
<%# align: :end - this one sits at the right end of the tool row, so its menu
    hangs from that end. With the default it opened rightwards from a pill that
    is already at the page edge, and ran off the screen. %>
<%= render 'shared/filter_pill',
           key: :display, set: false, handle: 'display-pill', align: :end,
           label: t('views.organisations.time_sessions.index.display_label'),
           options: display_options %>