-# @project is present when viewing Project's milestone
- project = @project || record.project

%li{ id: dom_id(record, 'sortable'),  class: "#{dom_class(record)}-row", 'data-iid' => record.iid, 'data-url' => polymorphic_path(record) }
  %span
    - if show_project_name
      %strong #{project.name} &middot;
    - elsif show_full_project_name
      %strong #{project.name_with_namespace} &middot;
    = link_to_gfm record.title, [project.namespace.becomes(Namespace), project, record], title: record.title
  %div{class: "#{dom_class(record)}-detail"}
    = link_to [project.namespace.becomes(Namespace), project, record] do
      %span{ class: "#{dom_class(record)}-number" } ##{record.iid}
    - record.labels.each do |label|
      = render_colored_label(label)
    - if record.assignee
      = image_tag avatar_icon(record.assignee, 16), class: "avatar s16", alt: ''

-# @project is present when viewing Project's milestone
- project = @project || record.project
- record_type = record.class.table_name
- base_url_args = [project.namespace.becomes(Namespace), project, record_type]

%li{ id: dom_id(record, 'sortable'),  class: "#{dom_class(record)}-row", 'data-iid' => record.iid, 'data-url' => polymorphic_path(record) }
  %span
    - if show_project_name
      %strong #{project.name} &middot;
    - elsif show_full_project_name
      %strong #{project.name_with_namespace} &middot;
    = link_to_gfm record.title, [project.namespace.becomes(Namespace), project, record], title: record.title
  %div{class: "#{dom_class(record)}-detail"}
    = link_to [project.namespace.becomes(Namespace), project, record] do
      %span{ class: "#{dom_class(record)}-number" } ##{record.iid}

    - record.labels.each do |label|
      %a{ href: polymorphic_path(base_url_args, { milestone_title: @milestone.title, label_name: label.title, state: 'all' }) }<
        = render_colored_label(label)

    - if record.assignee
      %a{ href: polymorphic_path(base_url_args, { milestone_title: @milestone.title, assignee_id: record.assignee_id, state: 'all' }) }
        = image_tag(avatar_icon(record.assignee, 16), class: "avatar s16", alt: '')

Add link with filter by milestone for labels and avatar.
Add link with filter by milestone for labels and avatar.

Closes #13628
