From 70028d36bee51a9ed86d20fe5d6c895772cc476a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20D=C3=A1vila?= Date: Mon, 22 Feb 2016 20:39:36 -0500 Subject: [PATCH] Recator Issues Tab into a custom partial. --- app/views/groups/milestones/show.html.haml | 15 ++------------- app/views/projects/milestones/show.html.haml | 9 +-------- .../milestones/_issue.html.haml | 5 +++-- .../milestones/_issues.html.haml | 2 +- app/views/shared/milestones/_issues_tab.html.haml | 7 +++++++ 5 files changed, 14 insertions(+), 24 deletions(-) rename app/views/{projects => shared}/milestones/_issue.html.haml (63%) rename app/views/{projects => shared}/milestones/_issues.html.haml (80%) create mode 100644 app/views/shared/milestones/_issues_tab.html.haml diff --git a/app/views/groups/milestones/show.html.haml b/app/views/groups/milestones/show.html.haml index 405df1d3433..0114e68b19d 100644 --- a/app/views/groups/milestones/show.html.haml +++ b/app/views/groups/milestones/show.html.haml @@ -68,20 +68,9 @@ Participants %span.badge= @milestone.participants.count -.tab-content +.tab-content.milestone-content .tab-pane.active#tab-issues - .gray-content-block.middle-block - .pull-right - = link_to 'Browse Issues', issues_group_path(@group, milestone_title: @milestone.title), class: "btn btn-grouped" - - .oneline - All issues in this milestone - - .row.prepend-top-default - .col-md-6 - = render 'issues', title: "Open", issues: @milestone.opened_issues - .col-md-6 - = render 'issues', title: "Closed", issues: @milestone.closed_issues + = render 'shared/milestones/issues_tab', unassigned: @milestone.opened_issues.unassigned, assigned: @milestone.opened_issues.assigned, closed: @milestone.closed_issues .tab-pane#tab-merge-requests .gray-content-block.middle-block diff --git a/app/views/projects/milestones/show.html.haml b/app/views/projects/milestones/show.html.haml index 2cae1ac4e2c..2322946894e 100644 --- a/app/views/projects/milestones/show.html.haml +++ b/app/views/projects/milestones/show.html.haml @@ -94,14 +94,7 @@ .tab-content.milestone-content .tab-pane.active#tab-issues - .row.prepend-top-default - .col-md-4 - = render('issues', title: 'Unstarted Issues (open and unassigned)', issues: @issues.opened.unassigned, id: 'unassigned') - .col-md-4 - = render('issues', title: 'Ongoing Issues (open and assigned)', issues: @issues.opened.assigned, id: 'ongoing') - .col-md-4 - = render('issues', title: 'Completed Issues (closed)', issues: @issues.closed, id: 'closed') - + = render 'shared/milestones/issues_tab', unassigned: @issues.opened.unassigned, assigned: @issues.opened.assigned, closed: @issues.closed .tab-pane#tab-merge-requests .row.prepend-top-default .col-md-3 diff --git a/app/views/projects/milestones/_issue.html.haml b/app/views/shared/milestones/_issue.html.haml similarity index 63% rename from app/views/projects/milestones/_issue.html.haml rename to app/views/shared/milestones/_issue.html.haml index ca51b8c745d..07880404c9a 100644 --- a/app/views/projects/milestones/_issue.html.haml +++ b/app/views/shared/milestones/_issue.html.haml @@ -1,8 +1,9 @@ +- project = issue.project %li{ id: dom_id(issue, 'sortable'), class: 'issue-row', 'data-iid' => issue.iid, 'data-url' => issue_path(issue) } %span - = link_to_gfm issue.title, [@project.namespace.becomes(Namespace), @project, issue], title: issue.title + = link_to_gfm issue.title, [project.namespace.becomes(Namespace), project, issue], title: issue.title .issue-detail - = link_to [@project.namespace.becomes(Namespace), @project, issue] do + = link_to [project.namespace.becomes(Namespace), project, issue] do %span.issue-number ##{issue.iid} - issue.labels.each do |label| = render_colored_label(label) diff --git a/app/views/projects/milestones/_issues.html.haml b/app/views/shared/milestones/_issues.html.haml similarity index 80% rename from app/views/projects/milestones/_issues.html.haml rename to app/views/shared/milestones/_issues.html.haml index 6f8a341e478..e1b5c2eb66c 100644 --- a/app/views/projects/milestones/_issues.html.haml +++ b/app/views/shared/milestones/_issues.html.haml @@ -4,4 +4,4 @@ .pull-right= issues.size %ul{ class: "well-list issues-sortable-list", id: "issues-list-#{id}", "data-state" => id } - issues.sort_by(&:position).each do |issue| - = render 'issue', issue: issue + = render 'shared/milestones/issue', issue: issue diff --git a/app/views/shared/milestones/_issues_tab.html.haml b/app/views/shared/milestones/_issues_tab.html.haml new file mode 100644 index 00000000000..3e98a809ad5 --- /dev/null +++ b/app/views/shared/milestones/_issues_tab.html.haml @@ -0,0 +1,7 @@ +.row.prepend-top-default + .col-md-4 + = render('shared/milestones/issues', title: 'Unstarted Issues (open and unassigned)', issues: unassigned, id: 'unassigned') + .col-md-4 + = render('shared/milestones/issues', title: 'Ongoing Issues (open and assigned)', issues: assigned, id: 'ongoing') + .col-md-4 + = render('shared/milestones/issues', title: 'Completed Issues (closed)', issues: closed, id: 'closed') -- GitLab