diff options
author | Stan Hu <stanhu@gmail.com> | 2017-04-24 08:58:15 -0700 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2017-04-24 09:33:12 -0700 |
commit | 68bb2a53383d79e5e3e38f9894f0ea61c3701f46 (patch) | |
tree | 4ef407cf2d8e4e8364cf094e216f3ea9c7cf2f9a /app | |
parent | bbcb7e5e96b030b4b2a3d03ee9c715853e6528be (diff) | |
download | gitlab-ce-68bb2a53383d79e5e3e38f9894f0ea61c3701f46.tar.gz |
Optimize project namespace lookup for milestones and add specssh-optimize-milestone-polymorphic-url
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/projects/milestones_controller.rb | 1 | ||||
-rw-r--r-- | app/views/shared/milestones/_issuable.html.haml | 13 |
2 files changed, 9 insertions, 5 deletions
diff --git a/app/controllers/projects/milestones_controller.rb b/app/controllers/projects/milestones_controller.rb index 408c0c60cb0..d0dd524c484 100644 --- a/app/controllers/projects/milestones_controller.rb +++ b/app/controllers/projects/milestones_controller.rb @@ -23,6 +23,7 @@ class Projects::MilestonesController < Projects::ApplicationController respond_to do |format| format.html do + @project_namespace = @project.namespace.becomes(Namespace) @milestones = @milestones.includes(:project) @milestones = @milestones.page(params[:page]) end diff --git a/app/views/shared/milestones/_issuable.html.haml b/app/views/shared/milestones/_issuable.html.haml index 13a4175fd33..5247d6a51e6 100644 --- a/app/views/shared/milestones/_issuable.html.haml +++ b/app/views/shared/milestones/_issuable.html.haml @@ -1,11 +1,14 @@ -# @project is present when viewing Project's milestone - project = @project || issuable.project +- namespace = @project_namespace || project.namespace.becomes(Namespace) - assignee = issuable.assignee - issuable_type = issuable.class.table_name -- base_url_args = [project.namespace.becomes(Namespace), project, issuable_type] +- base_url_args = [namespace, project] +- issuable_type_args = base_url_args + [issuable_type] +- issuable_url_args = base_url_args + [issuable] - can_update = can?(current_user, :"update_#{issuable.to_ability_name}", issuable) -%li{ id: dom_id(issuable, 'sortable'), class: "issuable-row #{'is-disabled' unless can_update}", 'data-iid' => issuable.iid, 'data-id' => issuable.id, 'data-url' => polymorphic_path([project.namespace.becomes(Namespace), project, issuable]) } +%li{ id: dom_id(issuable, 'sortable'), class: "issuable-row #{'is-disabled' unless can_update}", 'data-iid' => issuable.iid, 'data-id' => issuable.id, 'data-url' => polymorphic_path(issuable_url_args) } %span - if show_project_name %strong #{project.name} · @@ -13,17 +16,17 @@ %strong #{project.name_with_namespace} · - if issuable.is_a?(Issue) = confidential_icon(issuable) - = link_to_gfm issuable.title, [project.namespace.becomes(Namespace), project, issuable], title: issuable.title + = link_to_gfm issuable.title, issuable_url_args, title: issuable.title .issuable-detail = link_to [project.namespace.becomes(Namespace), project, issuable] do %span.issuable-number= issuable.to_reference - issuable.labels.each do |label| - = link_to polymorphic_path(base_url_args, { milestone_title: @milestone.title, label_name: label.title, state: 'all' }) do + = link_to polymorphic_path(issuable_type_args, { milestone_title: @milestone.title, label_name: label.title, state: 'all' }) do - render_colored_label(label) %span.assignee-icon - if assignee - = link_to polymorphic_path(base_url_args, { milestone_title: @milestone.title, assignee_id: issuable.assignee_id, state: 'all' }), + = link_to polymorphic_path(issuable_type_args, { milestone_title: @milestone.title, assignee_id: issuable.assignee_id, state: 'all' }), class: 'has-tooltip', title: "Assigned to #{assignee.name}", data: { container: 'body' } do - image_tag(avatar_icon(issuable.assignee, 16), class: "avatar s16", alt: '') |