#project-buildstatus
  - if buildresults.blank?
    - if project.remoteurl
      %p
        %i This project is just used to get referenced for using remote resources.
    - elsif project.repositories.empty?
      %p
        %i
          This project currently has no
          = link_to(new_project_distribution_path(project_name: project)) do
            build targets
          defined.
    - else
      %p
        %i No build result available
  - else
    - buildresults.each do |repository, build_results|
      - repository_name = repository.tr('.', '_')
      - expanded = repository_expanded?(collapsed_repositories, repository_name)
      .d-flex.flex-column
        .d-flex.flex-row.py-1.buildresult_repo_header.ps-1.ps-sm-2
          = link_to(word_break(repository, 12),
            project_repository_state_path(project: project.name, repository: repository),
            title: "Repository #{repository}")
          = collapse_link(expanded, 'project', repository_name)

        .collapse{ class: "collapse-project-#{repository_name}#{expanded ? ' show' : ''}", data: { repository: repository_name } }
          - build_results.sort_by(&:architecture).each do |build_result|
            .d-flex.flex-row.flex-nowrap.py-1
              .repository-state
                = repository_status_icon(status: build_result.state, details: build_result.details)
                %span.ms-1
                  = link_to(build_result.architecture, { action: :monitor,
                                                  "#{valid_xml_id("repo_#{repository}")}": 1,
                                                  "arch_#{build_result.architecture}": 1,
                                                  project: project.name,
                                                  succeeded: 1,
                                                  failed: 1,
                                                  unresolvable: 1,
                                                  broken: 1,
                                                  blocked: 1,
                                                  dispatching: 1,
                                                  scheduled: 1,
                                                  building: 1,
                                                  finished: 1,
                                                  signing: 1,
                                                  locked: 1,
                                                  deleting: 1,
                                                  defaults: 0 }, rel: 'nofollow', class: 'nowrap')

              .build-state.d-flex.flex-column
                - build_result.summary.each do |status_count|
                  .toggle-build-info-parent.text-nowrap
                    %i.fa.fa-question-circle.text-info.px-2.ps-lg-1.toggle-build-info{ title: 'Click to keep it open' }
                    = link_to("#{status_count.code}: #{status_count.count}",
                      { action: :monitor,
                        "#{valid_xml_id("repo_#{repository}")}": 1,
                        "arch_#{build_result.architecture}": 1,
                        project: params[:project],
                        "#{status_count.code}": 1,
                        defaults: 0 }, rel: 'nofollow', class: "nowrap build-state-#{status_count.code}")
                  .build-info.p2.mb-2.mt-1.me-sm-3.collapsed
                    .triangle.left
                    .build-info-content
                      %p.py-1= Buildresult.status_description(status_count.code)
                      %div
                        = repository_status_icon(status: build_result.state)
                        %span.ps-1= repository_info(build_result.state)

:javascript
  toggleBuildInfo();
