From 4e2b9d703f3b3d3f64a25ff9ae33eb56210c1715 Mon Sep 17 00:00:00 2001 From: Berna Castro Date: Thu, 15 Dec 2016 13:07:35 +0100 Subject: Don't group projects on dashboard#issues --- app/views/shared/_issues.html.haml | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/app/views/shared/_issues.html.haml b/app/views/shared/_issues.html.haml index 26b349e8a62..f4401300ceb 100644 --- a/app/views/shared/_issues.html.haml +++ b/app/views/shared/_issues.html.haml @@ -1,16 +1,10 @@ - if @issues.to_a.any? - - @issues.group_by(&:project).each do |group| - .panel.panel-default.panel-small - - project = group[0] - .panel-heading - = link_to project.name_with_namespace, namespace_project_issues_path(project.namespace, project) - - if can?(current_user, :create_issue, project) - .pull-right - = link_to 'New issue', new_namespace_project_issue_path(project.namespace, project) + .panel.panel-default.panel-small + %ul.content-list.issues-list + - @issues.each do |issue| + - project = issue.project - %ul.content-list.issues-list - - group[1].each do |issue| - = render 'projects/issues/issue', issue: issue + = render 'projects/issues/issue', issue: issue = paginate @issues, theme: "gitlab" - else = render 'shared/empty_states/issues' -- cgit v1.2.1 From c85c681505b3d52f8ffa6729ebbbf2846e73cf30 Mon Sep 17 00:00:00 2001 From: Berna Castro Date: Thu, 15 Dec 2016 13:09:07 +0100 Subject: Add the group path to the issue ID if applicable --- app/models/project.rb | 16 ++++++++++++---- app/views/projects/issues/_issue.html.haml | 2 +- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/app/models/project.rb b/app/models/project.rb index 59faf35e051..b6ec54af3f3 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -591,10 +591,18 @@ class Project < ActiveRecord::Base end end - def to_reference(from_project = nil, full: false) - if full || cross_namespace_reference?(from_project) - path_with_namespace - elsif cross_project_reference?(from_project) + def to_reference(from_project = nil, from_group = nil) + if from_group.nil? + if cross_namespace_reference?(from_project) + path_with_namespace + elsif cross_project_reference?(from_project) + path + elsif self == from_project + nil + else + path_with_namespace + end + else path end end diff --git a/app/views/projects/issues/_issue.html.haml b/app/views/projects/issues/_issue.html.haml index bd46af339cf..8bb3fe6ba26 100644 --- a/app/views/projects/issues/_issue.html.haml +++ b/app/views/projects/issues/_issue.html.haml @@ -34,7 +34,7 @@ = note_count .issue-info - #{issue.to_reference} · + #{issue.to_reference(@project, @group)} · opened #{time_ago_with_tooltip(issue.created_at, placement: 'bottom')} by #{link_to_member(@project, issue.author, avatar: false)} - if issue.milestone -- cgit v1.2.1 From 1c749880e51b641e0e3385c58a3aa289fd1bbbb6 Mon Sep 17 00:00:00 2001 From: Berna Castro Date: Thu, 15 Dec 2016 13:29:05 +0100 Subject: Refactor code when rendering a collection of issues --- app/views/shared/_issues.html.haml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/app/views/shared/_issues.html.haml b/app/views/shared/_issues.html.haml index f4401300ceb..69e6ee8ec40 100644 --- a/app/views/shared/_issues.html.haml +++ b/app/views/shared/_issues.html.haml @@ -1,10 +1,7 @@ - if @issues.to_a.any? .panel.panel-default.panel-small %ul.content-list.issues-list - - @issues.each do |issue| - - project = issue.project - - = render 'projects/issues/issue', issue: issue + = render partial: 'projects/issues/issue', collection: @issues = paginate @issues, theme: "gitlab" - else = render 'shared/empty_states/issues' -- cgit v1.2.1 From 78c8bce1ff0017a1f1b8129bb5c6cb31992cf5d9 Mon Sep 17 00:00:00 2001 From: Berna Castro Date: Thu, 15 Dec 2016 13:50:28 +0100 Subject: Fix and add specs for Issue#to_reference --- spec/models/issue_spec.rb | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/spec/models/issue_spec.rb b/spec/models/issue_spec.rb index 40c0a75c364..5c37141e3ad 100644 --- a/spec/models/issue_spec.rb +++ b/spec/models/issue_spec.rb @@ -27,7 +27,11 @@ describe Issue, models: true do let(:issue) { build(:issue, iid: 1, project: project) } it 'returns a String reference to the object' do - expect(issue.to_reference).to eq "#1" + expect(issue.to_reference).to eq "#{project.namespace.name}/sample-project#1" + end + + it 'supports a project reference' do + expect(issue.to_reference(project)).to eq "#1" end it 'returns a String reference with the full path' do @@ -38,6 +42,11 @@ describe Issue, models: true do another_project = build(:empty_project, name: 'another-project', namespace: project.namespace) expect(issue.to_reference(another_project)).to eq "sample-project#1" end + + it 'supports a group reference' do + group = build(:group, name: 'sample-group') + expect(issue.to_reference(nil, group)).to eq("sample-project#1") + end end describe '#is_being_reassigned?' do -- cgit v1.2.1 From 08481a710319073065776fb6297b337dc1dc7ae8 Mon Sep 17 00:00:00 2001 From: Berna Castro Date: Thu, 15 Dec 2016 14:06:08 +0100 Subject: Fix and add specs for Project#to_reference --- spec/models/project_spec.rb | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb index 646a1311462..d99c18ebe1e 100644 --- a/spec/models/project_spec.rb +++ b/spec/models/project_spec.rb @@ -287,8 +287,8 @@ describe Project, models: true do let(:project) { create(:empty_project, path: 'sample-project', namespace: namespace) } context 'when nil argument' do - it 'returns nil' do - expect(project.to_reference).to be_nil + it 'returns complete path to the project' do + expect(project.to_reference).to eq 'sample-namespace/sample-project' end end @@ -309,10 +309,16 @@ describe Project, models: true do context 'when same namespace / cross-project argument' do let(:another_project) { create(:empty_project, namespace: namespace) } - it 'returns complete path to the project' do + it 'returns path to the project' do expect(project.to_reference(another_project)).to eq 'sample-project' end end + + context 'when group argument' do + it 'returns path to the project' do + expect(project.to_reference(nil, namespace)).to eq 'sample-project' + end + end end describe '#to_human_reference' do -- cgit v1.2.1 From ac66268443b05029cbc45cc358f62b764f1ff165 Mon Sep 17 00:00:00 2001 From: Berna Castro Date: Thu, 15 Dec 2016 15:51:50 +0100 Subject: Refactor Project#to_reference and make full_path a keyword argument Refactor overall code and fix failing specs Fix Project#to_reference Fix wrong spaces and update changelog Refactor #to_reference for Project & Issue Fix and improves Project#to_reference --- app/models/issue.rb | 4 +- app/models/project.rb | 46 +++++++-------- app/views/projects/issues/_issue.html.haml | 8 ++- .../unreleased/23634-remove-project-grouping.yml | 4 ++ spec/models/issue_spec.rb | 66 ++++++++++++++++++---- spec/models/project_spec.rb | 38 +++++++++++-- 6 files changed, 124 insertions(+), 42 deletions(-) create mode 100644 changelogs/unreleased/23634-remove-project-grouping.yml diff --git a/app/models/issue.rb b/app/models/issue.rb index 65638d9a299..41cca47b015 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -97,10 +97,10 @@ class Issue < ActiveRecord::Base end end - def to_reference(from_project = nil, full: false) + def to_reference(from = nil, full_path: false) reference = "#{self.class.reference_prefix}#{iid}" - "#{project.to_reference(from_project, full: full)}#{reference}" + "#{project.to_reference(from, full_path: full_path)}#{reference}" end def referenced_merge_requests(current_user = nil) diff --git a/app/models/project.rb b/app/models/project.rb index b6ec54af3f3..52df648ede6 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -591,20 +591,10 @@ class Project < ActiveRecord::Base end end - def to_reference(from_project = nil, from_group = nil) - if from_group.nil? - if cross_namespace_reference?(from_project) - path_with_namespace - elsif cross_project_reference?(from_project) - path - elsif self == from_project - nil - else - path_with_namespace - end - else - path - end + def to_reference(from = nil, full_path: false) + return path_with_namespace if full_path + + path_from(from) end def to_human_reference(from_project = nil) @@ -1299,21 +1289,33 @@ class Project < ActiveRecord::Base private + def path_from(from) + if cross_namespace_reference?(from) + path_with_namespace + elsif cross_project_reference?(from) + path + end + end + + def cross_namespace_reference?(from) + if from.is_a?(Project) + from && namespace != from.namespace + else + from && namespace != from + end + end + # Check if a reference is being done cross-project - # - # from_project - Refering Project object - def cross_project_reference?(from_project) - from_project && self != from_project + def cross_project_reference?(from) + return true if from.is_a?(Namespace) + + from && self != from end def pushes_since_gc_redis_key "projects/#{id}/pushes_since_gc" end - def cross_namespace_reference?(from_project) - from_project && namespace != from_project.namespace - end - def default_branch_protected? current_application_settings.default_branch_protection == Gitlab::Access::PROTECTION_FULL || current_application_settings.default_branch_protection == Gitlab::Access::PROTECTION_DEV_CAN_MERGE diff --git a/app/views/projects/issues/_issue.html.haml b/app/views/projects/issues/_issue.html.haml index 8bb3fe6ba26..6cfbab92f0f 100644 --- a/app/views/projects/issues/_issue.html.haml +++ b/app/views/projects/issues/_issue.html.haml @@ -34,7 +34,13 @@ = note_count .issue-info - #{issue.to_reference(@project, @group)} · + - if controller_name == "dashboard" + #{issue.to_reference(full_path: true)} + - else + #{issue.to_reference(@group || @project)} + + · + opened #{time_ago_with_tooltip(issue.created_at, placement: 'bottom')} by #{link_to_member(@project, issue.author, avatar: false)} - if issue.milestone diff --git a/changelogs/unreleased/23634-remove-project-grouping.yml b/changelogs/unreleased/23634-remove-project-grouping.yml new file mode 100644 index 00000000000..dde8b2d1815 --- /dev/null +++ b/changelogs/unreleased/23634-remove-project-grouping.yml @@ -0,0 +1,4 @@ +--- +title: Don't group issues by project on group-level and dashboard issue indexes. +merge_request: 8111 +author: Bernardo Castro diff --git a/spec/models/issue_spec.rb b/spec/models/issue_spec.rb index 5c37141e3ad..623238e9d86 100644 --- a/spec/models/issue_spec.rb +++ b/spec/models/issue_spec.rb @@ -23,19 +23,37 @@ describe Issue, models: true do end describe '#to_reference' do - let(:project) { build(:empty_project, name: 'sample-project') } - let(:issue) { build(:issue, iid: 1, project: project) } + let(:namespace) { build(:namespace, path: 'sample-namespace') } + let(:project) { build(:empty_project, name: 'sample-project', namespace: namespace) } + let(:issue) { build(:issue, iid: 1, project: project) } + let(:group) { create(:group, name: 'Group', path: 'sample-group') } + + context 'when nil argument' do + it 'returns issue id' do + expect(issue.to_reference).to eq "#1" + end + end - it 'returns a String reference to the object' do - expect(issue.to_reference).to eq "#{project.namespace.name}/sample-project#1" + context 'when full_path is true' do + it 'returns complete path to the issue' do + expect(issue.to_reference(full_path: true)).to eq 'sample-namespace/sample-project#1' + expect(issue.to_reference(project, full_path: true)).to eq 'sample-namespace/sample-project#1' + expect(issue.to_reference(group, full_path: true)).to eq 'sample-namespace/sample-project#1' + end end - it 'supports a project reference' do - expect(issue.to_reference(project)).to eq "#1" + context 'when same project argument' do + it 'returns issue id' do + expect(issue.to_reference(project)).to eq("#1") + end end - it 'returns a String reference with the full path' do - expect(issue.to_reference(full: true)).to eq(project.path_with_namespace + '#1') + context 'when cross namespace project argument' do + let(:another_namespace_project) { create(:empty_project, name: 'another-project') } + + it 'returns complete path to the issue' do + expect(issue.to_reference(another_namespace_project)).to eq 'sample-namespace/sample-project#1' + end end it 'supports a cross-project reference' do @@ -43,9 +61,35 @@ describe Issue, models: true do expect(issue.to_reference(another_project)).to eq "sample-project#1" end - it 'supports a group reference' do - group = build(:group, name: 'sample-group') - expect(issue.to_reference(nil, group)).to eq("sample-project#1") + context 'when same namespace / cross-project argument' do + let(:another_project) { create(:empty_project, namespace: namespace) } + + it 'returns path to the issue with the project name' do + expect(issue.to_reference(another_project)).to eq 'sample-project#1' + end + end + + context 'when different namespace / cross-project argument' do + let(:another_namespace) { create(:namespace, path: 'another-namespace') } + let(:another_project) { create(:empty_project, path: 'another-project', namespace: another_namespace) } + + it 'returns full path to the issue' do + expect(issue.to_reference(another_project)).to eq 'sample-namespace/sample-project#1' + end + end + + context 'when argument is a namespace' do + context 'with same project path' do + it 'returns path to the issue with the project name' do + expect(issue.to_reference(namespace)).to eq 'sample-project#1' + end + end + + context 'with different project path' do + it 'returns full path to the issue' do + expect(issue.to_reference(group)).to eq 'sample-namespace/sample-project#1' + end + end end end diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb index d99c18ebe1e..7d61c26a6e9 100644 --- a/spec/models/project_spec.rb +++ b/spec/models/project_spec.rb @@ -282,13 +282,22 @@ describe Project, models: true do end describe '#to_reference' do - let(:owner) { create(:user, name: 'Gitlab') } + let(:owner) { create(:user, name: 'Gitlab') } let(:namespace) { create(:namespace, path: 'sample-namespace', owner: owner) } - let(:project) { create(:empty_project, path: 'sample-project', namespace: namespace) } + let(:project) { create(:empty_project, path: 'sample-project', namespace: namespace) } + let(:group) { create(:group, name: 'Group', path: 'sample-group', owner: owner) } context 'when nil argument' do + it 'returns nil' do + expect(project.to_reference).to be_nil + end + end + + context 'when full_path is true' do it 'returns complete path to the project' do - expect(project.to_reference).to eq 'sample-namespace/sample-project' + expect(project.to_reference(full_path: true)).to eq 'sample-namespace/sample-project' + expect(project.to_reference(project, full_path: true)).to eq 'sample-namespace/sample-project' + expect(project.to_reference(group, full_path: true)).to eq 'sample-namespace/sample-project' end end @@ -314,9 +323,26 @@ describe Project, models: true do end end - context 'when group argument' do - it 'returns path to the project' do - expect(project.to_reference(nil, namespace)).to eq 'sample-project' + context 'when different namespace / cross-project argument' do + let(:another_namespace) { create(:namespace, path: 'another-namespace', owner: owner) } + let(:another_project) { create(:empty_project, path: 'another-project', namespace: another_namespace) } + + it 'returns full path to the project' do + expect(project.to_reference(another_project)).to eq 'sample-namespace/sample-project' + end + end + + context 'when argument is a namespace' do + context 'with same project path' do + it 'returns path to the project' do + expect(project.to_reference(namespace)).to eq 'sample-project' + end + end + + context 'with different project path' do + it 'returns full path to the project' do + expect(project.to_reference(group)).to eq 'sample-namespace/sample-project' + end end end end -- cgit v1.2.1 From aeb9db6753cfdd56f82d80c0e2c01f63d65b705d Mon Sep 17 00:00:00 2001 From: Oswaldo Ferreira Date: Tue, 10 Jan 2017 21:52:25 -0200 Subject: Present group and dashboard MR list without grouping by project --- app/controllers/dashboard_controller.rb | 5 ++++ app/models/issue.rb | 4 ++-- app/models/project.rb | 27 +++++++++------------- app/views/projects/issues/_issue.html.haml | 7 +----- .../merge_requests/_merge_request.html.haml | 3 ++- app/views/shared/_merge_requests.html.haml | 14 +++-------- spec/models/issue_spec.rb | 8 +++---- spec/models/project_spec.rb | 8 +++---- 8 files changed, 32 insertions(+), 44 deletions(-) diff --git a/app/controllers/dashboard_controller.rb b/app/controllers/dashboard_controller.rb index 4dda4e51f6a..79d420a32d3 100644 --- a/app/controllers/dashboard_controller.rb +++ b/app/controllers/dashboard_controller.rb @@ -4,6 +4,7 @@ class DashboardController < Dashboard::ApplicationController before_action :event_filter, only: :activity before_action :projects, only: [:issues, :merge_requests] + before_action :set_show_full_reference, only: [:issues, :merge_requests] respond_to :html @@ -34,4 +35,8 @@ class DashboardController < Dashboard::ApplicationController @events = @event_filter.apply_filter(@events).with_associations @events = @events.limit(20).offset(params[:offset] || 0) end + + def set_show_full_reference + @show_full_reference = true + end end diff --git a/app/models/issue.rb b/app/models/issue.rb index 41cca47b015..ab7473d23c3 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -97,10 +97,10 @@ class Issue < ActiveRecord::Base end end - def to_reference(from = nil, full_path: false) + def to_reference(from = nil, full: false) reference = "#{self.class.reference_prefix}#{iid}" - "#{project.to_reference(from, full_path: full_path)}#{reference}" + "#{project.to_reference(from, full: full)}#{reference}" end def referenced_merge_requests(current_user = nil) diff --git a/app/models/project.rb b/app/models/project.rb index 52df648ede6..23b98916b2e 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -591,10 +591,12 @@ class Project < ActiveRecord::Base end end - def to_reference(from = nil, full_path: false) - return path_with_namespace if full_path - - path_from(from) + def to_reference(from = nil, full: false) + if full || cross_namespace_reference?(from) + path_with_namespace + elsif cross_project_reference?(from) + path + end end def to_human_reference(from_project = nil) @@ -1289,19 +1291,12 @@ class Project < ActiveRecord::Base private - def path_from(from) - if cross_namespace_reference?(from) - path_with_namespace - elsif cross_project_reference?(from) - path - end - end - def cross_namespace_reference?(from) - if from.is_a?(Project) - from && namespace != from.namespace - else - from && namespace != from + case from + when Project + namespace != from.namespace + when Namespace + namespace != from end end diff --git a/app/views/projects/issues/_issue.html.haml b/app/views/projects/issues/_issue.html.haml index 6cfbab92f0f..6173d9e21f6 100644 --- a/app/views/projects/issues/_issue.html.haml +++ b/app/views/projects/issues/_issue.html.haml @@ -34,13 +34,8 @@ = note_count .issue-info - - if controller_name == "dashboard" - #{issue.to_reference(full_path: true)} - - else - #{issue.to_reference(@group || @project)} - + = @show_full_reference ? issue.to_reference(full: true) : issue.to_reference(@group || @project) · - opened #{time_ago_with_tooltip(issue.created_at, placement: 'bottom')} by #{link_to_member(@project, issue.author, avatar: false)} - if issue.milestone diff --git a/app/views/projects/merge_requests/_merge_request.html.haml b/app/views/projects/merge_requests/_merge_request.html.haml index e3b0aa7e644..a1e6d09612c 100644 --- a/app/views/projects/merge_requests/_merge_request.html.haml +++ b/app/views/projects/merge_requests/_merge_request.html.haml @@ -46,7 +46,8 @@ = note_count .merge-request-info - #{merge_request.to_reference} · + = @show_full_reference ? merge_request.to_reference(full: true) : merge_request.to_reference(@group || @project) + · opened #{time_ago_with_tooltip(merge_request.created_at, placement: 'bottom')} by #{link_to_member(@project, merge_request.author, avatar: false)} - if merge_request.target_project.default_branch != merge_request.target_branch diff --git a/app/views/shared/_merge_requests.html.haml b/app/views/shared/_merge_requests.html.haml index 2f3605b4d27..773f71802c0 100644 --- a/app/views/shared/_merge_requests.html.haml +++ b/app/views/shared/_merge_requests.html.haml @@ -1,16 +1,8 @@ - if @merge_requests.to_a.any? - - @merge_requests.group_by(&:target_project).each do |group| - .panel.panel-default.panel-small - - project = group[0] - .panel-heading - = link_to project.name_with_namespace, namespace_project_merge_requests_path(project.namespace, project) - - if can?(current_user, :create_merge_request, project) - .pull-right - = link_to 'New merge request', new_namespace_project_merge_request_path(project.namespace, project) + .panel.panel-default.panel-small + %ul.content-list.mr-list + = render partial: 'projects/merge_requests/merge_request', collection: @merge_requests - %ul.content-list.mr-list - - group[1].each do |merge_request| - = render 'projects/merge_requests/merge_request', merge_request: merge_request = paginate @merge_requests, theme: "gitlab" - else diff --git a/spec/models/issue_spec.rb b/spec/models/issue_spec.rb index 623238e9d86..bba9058f394 100644 --- a/spec/models/issue_spec.rb +++ b/spec/models/issue_spec.rb @@ -34,11 +34,11 @@ describe Issue, models: true do end end - context 'when full_path is true' do + context 'when full is true' do it 'returns complete path to the issue' do - expect(issue.to_reference(full_path: true)).to eq 'sample-namespace/sample-project#1' - expect(issue.to_reference(project, full_path: true)).to eq 'sample-namespace/sample-project#1' - expect(issue.to_reference(group, full_path: true)).to eq 'sample-namespace/sample-project#1' + expect(issue.to_reference(full: true)).to eq 'sample-namespace/sample-project#1' + expect(issue.to_reference(project, full: true)).to eq 'sample-namespace/sample-project#1' + expect(issue.to_reference(group, full: true)).to eq 'sample-namespace/sample-project#1' end end diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb index 7d61c26a6e9..527eb704036 100644 --- a/spec/models/project_spec.rb +++ b/spec/models/project_spec.rb @@ -293,11 +293,11 @@ describe Project, models: true do end end - context 'when full_path is true' do + context 'when full is true' do it 'returns complete path to the project' do - expect(project.to_reference(full_path: true)).to eq 'sample-namespace/sample-project' - expect(project.to_reference(project, full_path: true)).to eq 'sample-namespace/sample-project' - expect(project.to_reference(group, full_path: true)).to eq 'sample-namespace/sample-project' + expect(project.to_reference(full: true)).to eq 'sample-namespace/sample-project' + expect(project.to_reference(project, full: true)).to eq 'sample-namespace/sample-project' + expect(project.to_reference(group, full: true)).to eq 'sample-namespace/sample-project' end end -- cgit v1.2.1 From 441501e4bf57e663d8259695845d75b5b6d50684 Mon Sep 17 00:00:00 2001 From: Oswaldo Ferreira Date: Tue, 10 Jan 2017 21:53:51 -0200 Subject: Present TODO's list without grouping by project --- app/models/commit.rb | 4 +-- app/models/todo.rb | 4 +-- app/views/dashboard/todos/index.html.haml | 8 ++---- features/steps/dashboard/todos.rb | 45 ++++++++++++++++++------------- spec/features/todos/todos_spec.rb | 2 +- spec/models/todo_spec.rb | 8 +++--- 6 files changed, 38 insertions(+), 33 deletions(-) diff --git a/app/models/commit.rb b/app/models/commit.rb index 316bd2e512b..46f06733da1 100644 --- a/app/models/commit.rb +++ b/app/models/commit.rb @@ -100,8 +100,8 @@ class Commit commit_reference(from_project, id, full: full) end - def reference_link_text(from_project = nil) - commit_reference(from_project, short_id) + def reference_link_text(from_project = nil, full: false) + commit_reference(from_project, short_id, full: full) end def diff_line_count diff --git a/app/models/todo.rb b/app/models/todo.rb index 4c99aa0d3be..2adf494ce11 100644 --- a/app/models/todo.rb +++ b/app/models/todo.rb @@ -103,9 +103,9 @@ class Todo < ActiveRecord::Base def target_reference if for_commit? - target.short_id + target.reference_link_text(full: true) else - target.to_reference + target.to_reference(full: true) end end diff --git a/app/views/dashboard/todos/index.html.haml b/app/views/dashboard/todos/index.html.haml index f4efcfb27b2..0b471f142d0 100644 --- a/app/views/dashboard/todos/index.html.haml +++ b/app/views/dashboard/todos/index.html.haml @@ -70,15 +70,11 @@ .prepend-top-default - if @todos.any? .js-todos-options{ data: {per_page: @todos.limit_value, current_page: @todos.current_page, total_pages: @todos.total_pages} } - - @todos.group_by(&:project).each do |group| .panel.panel-default.panel-small - - project = group[0] - .panel-heading - = link_to project.name_with_namespace, namespace_project_path(project.namespace, project) - %ul.content-list.todos-list - = render group[1] + = render @todos = paginate @todos, theme: "gitlab" + - elsif current_user.todos.any? .todos-all-done = render "shared/empty_states/todos_all_done.svg" diff --git a/features/steps/dashboard/todos.rb b/features/steps/dashboard/todos.rb index 344b6fda9a6..2bbc43b491f 100644 --- a/features/steps/dashboard/todos.rb +++ b/features/steps/dashboard/todos.rb @@ -25,15 +25,18 @@ class Spinach::Features::DashboardTodos < Spinach::FeatureSteps end step 'I should see todos assigned to me' do + merge_request_reference = merge_request.to_reference(full: true) + issue_reference = issue.to_reference(full: true) + page.within('.todos-pending-count') { expect(page).to have_content '4' } expect(page).to have_content 'To do 4' expect(page).to have_content 'Done 0' expect(page).to have_link project.name_with_namespace - should_see_todo(1, "John Doe assigned you merge request #{merge_request.to_reference}", merge_request.title) - should_see_todo(2, "John Doe mentioned you on issue #{issue.to_reference}", "#{current_user.to_reference} Wdyt?") - should_see_todo(3, "John Doe assigned you issue #{issue.to_reference}", issue.title) - should_see_todo(4, "Mary Jane mentioned you on issue #{issue.to_reference}", issue.title) + should_see_todo(1, "John Doe assigned you merge request #{merge_request_reference}", merge_request.title) + should_see_todo(2, "John Doe mentioned you on issue #{issue_reference}", "#{current_user.to_reference} Wdyt?") + should_see_todo(3, "John Doe assigned you issue #{issue_reference}", issue.title) + should_see_todo(4, "Mary Jane mentioned you on issue #{issue_reference}", issue.title) end step 'I mark the todo as done' do @@ -44,10 +47,13 @@ class Spinach::Features::DashboardTodos < Spinach::FeatureSteps page.within('.todos-pending-count') { expect(page).to have_content '3' } expect(page).to have_content 'To do 3' expect(page).to have_content 'Done 1' - should_not_see_todo "John Doe assigned you merge request #{merge_request.to_reference}" + should_not_see_todo "John Doe assigned you merge request #{merge_request.to_reference(full: true)}" end step 'I mark all todos as done' do + merge_request_reference = merge_request.to_reference(full: true) + issue_reference = issue.to_reference(full: true) + click_link 'Mark all as done' page.within('.todos-pending-count') { expect(page).to have_content '0' } @@ -55,27 +61,30 @@ class Spinach::Features::DashboardTodos < Spinach::FeatureSteps expect(page).to have_content 'Done 4' expect(page).to have_content "You're all done!" expect('.prepend-top-default').not_to have_link project.name_with_namespace - should_not_see_todo "John Doe assigned you merge request #{merge_request.to_reference}" - should_not_see_todo "John Doe mentioned you on issue #{issue.to_reference}" - should_not_see_todo "John Doe assigned you issue #{issue.to_reference}" - should_not_see_todo "Mary Jane mentioned you on issue #{issue.to_reference}" + should_not_see_todo "John Doe assigned you merge request #{merge_request_reference}" + should_not_see_todo "John Doe mentioned you on issue #{issue_reference}" + should_not_see_todo "John Doe assigned you issue #{issue_reference}" + should_not_see_todo "Mary Jane mentioned you on issue #{issue_reference}" end step 'I should see the todo marked as done' do click_link 'Done 1' expect(page).to have_link project.name_with_namespace - should_see_todo(1, "John Doe assigned you merge request #{merge_request.to_reference}", merge_request.title, false) + should_see_todo(1, "John Doe assigned you merge request #{merge_request.to_reference(full: true)}", merge_request.title, false) end step 'I should see all todos marked as done' do + merge_request_reference = merge_request.to_reference(full: true) + issue_reference = issue.to_reference(full: true) + click_link 'Done 4' expect(page).to have_link project.name_with_namespace - should_see_todo(1, "John Doe assigned you merge request #{merge_request.to_reference}", merge_request.title, false) - should_see_todo(2, "John Doe mentioned you on issue #{issue.to_reference}", "#{current_user.to_reference} Wdyt?", false) - should_see_todo(3, "John Doe assigned you issue #{issue.to_reference}", issue.title, false) - should_see_todo(4, "Mary Jane mentioned you on issue #{issue.to_reference}", issue.title, false) + should_see_todo(1, "John Doe assigned you merge request #{merge_request_reference}", merge_request.title, false) + should_see_todo(2, "John Doe mentioned you on issue #{issue_reference}", "#{current_user.to_reference} Wdyt?", false) + should_see_todo(3, "John Doe assigned you issue #{issue_reference}", issue.title, false) + should_see_todo(4, "Mary Jane mentioned you on issue #{issue_reference}", issue.title, false) end step 'I filter by "Enterprise"' do @@ -111,16 +120,16 @@ class Spinach::Features::DashboardTodos < Spinach::FeatureSteps end step 'I should not see todos related to "Mary Jane" in the list' do - should_not_see_todo "Mary Jane mentioned you on issue #{issue.to_reference}" + should_not_see_todo "Mary Jane mentioned you on issue #{issue.to_reference(full: true)}" end step 'I should not see todos related to "Merge Requests" in the list' do - should_not_see_todo "John Doe assigned you merge request #{merge_request.to_reference}" + should_not_see_todo "John Doe assigned you merge request #{merge_request.to_reference(full: true)}" end step 'I should not see todos related to "Assignments" in the list' do - should_not_see_todo "John Doe assigned you merge request #{merge_request.to_reference}" - should_not_see_todo "John Doe assigned you issue #{issue.to_reference}" + should_not_see_todo "John Doe assigned you merge request #{merge_request.to_reference(full: true)}" + should_not_see_todo "John Doe assigned you issue #{issue.to_reference(full: true)}" end step 'I click on the todo' do diff --git a/spec/features/todos/todos_spec.rb b/spec/features/todos/todos_spec.rb index 3850e930b6d..1b352be9331 100644 --- a/spec/features/todos/todos_spec.rb +++ b/spec/features/todos/todos_spec.rb @@ -171,7 +171,7 @@ describe 'Dashboard Todos', feature: true do it 'links to the pipelines for the merge request' do href = pipelines_namespace_project_merge_request_path(project.namespace, project, todo.target) - expect(page).to have_link "merge request #{todo.target.to_reference}", href + expect(page).to have_link "merge request #{todo.target.to_reference(full: true)}", href end end end diff --git a/spec/models/todo_spec.rb b/spec/models/todo_spec.rb index 8017d1c3324..581305ad39f 100644 --- a/spec/models/todo_spec.rb +++ b/spec/models/todo_spec.rb @@ -109,7 +109,7 @@ describe Todo, models: true do end describe '#target_reference' do - it 'returns the short commit id for commits' do + it 'returns commit full reference with short id' do project = create(:project, :repository) commit = project.commit @@ -117,12 +117,12 @@ describe Todo, models: true do subject.target_type = 'Commit' subject.commit_id = commit.id - expect(subject.target_reference).to eq commit.short_id + expect(subject.target_reference).to eq commit.reference_link_text(full: true) end - it 'returns reference for issuables' do + it 'returns full reference for issuables' do subject.target = issue - expect(subject.target_reference).to eq issue.to_reference + expect(subject.target_reference).to eq issue.to_reference(full: true) end end end -- cgit v1.2.1 From 660a755cad8c6540ec4154f4785b1abb67b6beaf Mon Sep 17 00:00:00 2001 From: Oswaldo Ferreira Date: Wed, 11 Jan 2017 10:45:49 -0200 Subject: Change argument name assuming its always a Project --- app/models/merge_request.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb index 6753504acff..67d4c70dc3a 100644 --- a/app/models/merge_request.rb +++ b/app/models/merge_request.rb @@ -179,10 +179,10 @@ class MergeRequest < ActiveRecord::Base work_in_progress?(title) ? title : "WIP: #{title}" end - def to_reference(from_project = nil, full: false) + def to_reference(from = nil, full: false) reference = "#{self.class.reference_prefix}#{iid}" - "#{project.to_reference(from_project, full: full)}#{reference}" + "#{project.to_reference(from, full: full)}#{reference}" end def first_commit -- cgit v1.2.1 From 0e14a2f21dbfe20c980562dd47ab9878c023eac2 Mon Sep 17 00:00:00 2001 From: Oswaldo Ferreira Date: Wed, 11 Jan 2017 10:44:12 -0200 Subject: Add commment to Issue, Project and MergeRequest #to_reference --- app/models/issue.rb | 1 + app/models/merge_request.rb | 1 + app/models/project.rb | 1 + 3 files changed, 3 insertions(+) diff --git a/app/models/issue.rb b/app/models/issue.rb index ab7473d23c3..d8826b65fcc 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -97,6 +97,7 @@ class Issue < ActiveRecord::Base end end + # `from` argument can be a Namespace or Project. def to_reference(from = nil, full: false) reference = "#{self.class.reference_prefix}#{iid}" diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb index 67d4c70dc3a..082adcafcc8 100644 --- a/app/models/merge_request.rb +++ b/app/models/merge_request.rb @@ -179,6 +179,7 @@ class MergeRequest < ActiveRecord::Base work_in_progress?(title) ? title : "WIP: #{title}" end + # `from` argument can be a Namespace or Project. def to_reference(from = nil, full: false) reference = "#{self.class.reference_prefix}#{iid}" diff --git a/app/models/project.rb b/app/models/project.rb index 23b98916b2e..4396ea9ef36 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -591,6 +591,7 @@ class Project < ActiveRecord::Base end end + # `from` argument can be a Namespace or Project. def to_reference(from = nil, full: false) if full || cross_namespace_reference?(from) path_with_namespace -- cgit v1.2.1 From 78b0106878fa1b2e2062e2c4ebb0a63375825879 Mon Sep 17 00:00:00 2001 From: Oswaldo Ferreira Date: Thu, 12 Jan 2017 10:28:37 -0200 Subject: Move issuable reference display to a helper method --- app/helpers/issuables_helper.rb | 4 +++ app/views/projects/issues/_issue.html.haml | 3 +- .../merge_requests/_merge_request.html.haml | 3 +- spec/helpers/issuables_helper_spec.rb | 40 ++++++++++++++++++++++ 4 files changed, 46 insertions(+), 4 deletions(-) diff --git a/app/helpers/issuables_helper.rb b/app/helpers/issuables_helper.rb index e5bb8b93e76..03354c235eb 100644 --- a/app/helpers/issuables_helper.rb +++ b/app/helpers/issuables_helper.rb @@ -162,6 +162,10 @@ module IssuablesHelper ] end + def issuable_reference(issuable) + @show_full_reference ? issuable.to_reference(full: true) : issuable.to_reference(@group || @project) + end + def issuable_filter_present? issuable_filter_params.any? { |k| params.key?(k) } end diff --git a/app/views/projects/issues/_issue.html.haml b/app/views/projects/issues/_issue.html.haml index 6173d9e21f6..f3be343daae 100644 --- a/app/views/projects/issues/_issue.html.haml +++ b/app/views/projects/issues/_issue.html.haml @@ -34,8 +34,7 @@ = note_count .issue-info - = @show_full_reference ? issue.to_reference(full: true) : issue.to_reference(@group || @project) - · + #{issuable_reference(issue)} · opened #{time_ago_with_tooltip(issue.created_at, placement: 'bottom')} by #{link_to_member(@project, issue.author, avatar: false)} - if issue.milestone diff --git a/app/views/projects/merge_requests/_merge_request.html.haml b/app/views/projects/merge_requests/_merge_request.html.haml index a1e6d09612c..513f0818169 100644 --- a/app/views/projects/merge_requests/_merge_request.html.haml +++ b/app/views/projects/merge_requests/_merge_request.html.haml @@ -46,8 +46,7 @@ = note_count .merge-request-info - = @show_full_reference ? merge_request.to_reference(full: true) : merge_request.to_reference(@group || @project) - · + #{issuable_reference(merge_request)} · opened #{time_ago_with_tooltip(merge_request.created_at, placement: 'bottom')} by #{link_to_member(@project, merge_request.author, avatar: false)} - if merge_request.target_project.default_branch != merge_request.target_branch diff --git a/spec/helpers/issuables_helper_spec.rb b/spec/helpers/issuables_helper_spec.rb index a4f08dc4af0..df71680e44c 100644 --- a/spec/helpers/issuables_helper_spec.rb +++ b/spec/helpers/issuables_helper_spec.rb @@ -115,6 +115,46 @@ describe IssuablesHelper do end end + describe '#issuable_reference' do + context 'when show_full_reference truthy' do + it 'display issuable full reference' do + assign(:show_full_reference, true) + issue = build_stubbed(:issue) + + expect(helper.issuable_reference(issue)).to eql(issue.to_reference(full: true)) + end + end + + context 'when show_full_reference falsey' do + context 'when @group present' do + it 'display issuable reference to @group' do + project = build_stubbed(:project) + + assign(:show_full_reference, nil) + assign(:group, project.namespace) + + issue = build_stubbed(:issue) + + expect(helper.issuable_reference(issue)).to eql(issue.to_reference(project.namespace)) + end + end + + context 'when @project present' do + it 'display issuable reference to @project' do + project = build_stubbed(:project) + + assign(:show_full_reference, nil) + assign(:group, nil) + assign(:project, project) + + issue = build_stubbed(:issue) + + expect(helper.issuable_reference(issue)).to eql(issue.to_reference(project)) + end + end + end + end + describe '#issuable_filter_present?' do it 'returns true when any key is present' do allow(helper).to receive(:params).and_return( -- cgit v1.2.1 From ed3cf83a634525996c76190ce06dd6298017484b Mon Sep 17 00:00:00 2001 From: Oswaldo Ferreira Date: Thu, 26 Jan 2017 10:16:26 -0200 Subject: Remove bold weight from TODOs action name font --- app/assets/stylesheets/pages/todos.scss | 4 ++++ app/views/dashboard/todos/_todo.html.haml | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/app/assets/stylesheets/pages/todos.scss b/app/assets/stylesheets/pages/todos.scss index 01675acc62e..0d5604aae69 100644 --- a/app/assets/stylesheets/pages/todos.scss +++ b/app/assets/stylesheets/pages/todos.scss @@ -76,6 +76,10 @@ font-size: 14px; } + .action-name { + font-weight: normal; + } + .todo-body { .todo-note { word-wrap: break-word; diff --git a/app/views/dashboard/todos/_todo.html.haml b/app/views/dashboard/todos/_todo.html.haml index 9d7bcdb9d16..605bfd0cf8d 100644 --- a/app/views/dashboard/todos/_todo.html.haml +++ b/app/views/dashboard/todos/_todo.html.haml @@ -11,8 +11,11 @@ = link_to_author(todo) - else (removed) - %span.todo-label + + %span.action-name = todo_action_name(todo) + + %span.todo-label - if todo.target = todo_target_link(todo) - else -- cgit v1.2.1 From 6a5a5d0ec0ad08fafc007a88d2cd558f3c7add1b Mon Sep 17 00:00:00 2001 From: Oswaldo Ferreira Date: Thu, 26 Jan 2017 11:10:04 -0200 Subject: Remove border from issues, todos and MR pages --- app/assets/stylesheets/framework/tw_bootstrap.scss | 4 ++++ app/views/dashboard/todos/index.html.haml | 2 +- app/views/shared/_issues.html.haml | 2 +- app/views/shared/_merge_requests.html.haml | 2 +- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/app/assets/stylesheets/framework/tw_bootstrap.scss b/app/assets/stylesheets/framework/tw_bootstrap.scss index 12d56359d7d..ea2d26dd5a0 100644 --- a/app/assets/stylesheets/framework/tw_bootstrap.scss +++ b/app/assets/stylesheets/framework/tw_bootstrap.scss @@ -162,6 +162,10 @@ } } } + + &.panel-without-border { + border: 0; + } } .panel-succes .panel-heading, diff --git a/app/views/dashboard/todos/index.html.haml b/app/views/dashboard/todos/index.html.haml index 0b471f142d0..32b4350b8e0 100644 --- a/app/views/dashboard/todos/index.html.haml +++ b/app/views/dashboard/todos/index.html.haml @@ -70,7 +70,7 @@ .prepend-top-default - if @todos.any? .js-todos-options{ data: {per_page: @todos.limit_value, current_page: @todos.current_page, total_pages: @todos.total_pages} } - .panel.panel-default.panel-small + .panel.panel-default.panel-small.panel-without-border %ul.content-list.todos-list = render @todos = paginate @todos, theme: "gitlab" diff --git a/app/views/shared/_issues.html.haml b/app/views/shared/_issues.html.haml index 69e6ee8ec40..3a49227961f 100644 --- a/app/views/shared/_issues.html.haml +++ b/app/views/shared/_issues.html.haml @@ -1,5 +1,5 @@ - if @issues.to_a.any? - .panel.panel-default.panel-small + .panel.panel-default.panel-small.panel-without-border %ul.content-list.issues-list = render partial: 'projects/issues/issue', collection: @issues = paginate @issues, theme: "gitlab" diff --git a/app/views/shared/_merge_requests.html.haml b/app/views/shared/_merge_requests.html.haml index 773f71802c0..b7982b7fe9b 100644 --- a/app/views/shared/_merge_requests.html.haml +++ b/app/views/shared/_merge_requests.html.haml @@ -1,5 +1,5 @@ - if @merge_requests.to_a.any? - .panel.panel-default.panel-small + .panel.panel-default.panel-small.panel-without-border %ul.content-list.mr-list = render partial: 'projects/merge_requests/merge_request', collection: @merge_requests -- cgit v1.2.1 From 27a794914e9a9a9f979b89d26d0297f677e2946a Mon Sep 17 00:00:00 2001 From: Oswaldo Ferreira Date: Thu, 26 Jan 2017 11:22:16 -0200 Subject: Remove unnecessary extra margin on issues, mr and todo pages --- app/views/dashboard/issues.html.haml | 4 +- app/views/dashboard/merge_requests.html.haml | 4 +- app/views/dashboard/todos/index.html.haml | 73 ++++++++++++++-------------- app/views/groups/issues.html.haml | 3 +- app/views/groups/merge_requests.html.haml | 3 +- 5 files changed, 40 insertions(+), 47 deletions(-) diff --git a/app/views/dashboard/issues.html.haml b/app/views/dashboard/issues.html.haml index 3caaf827ff5..653052f7c54 100644 --- a/app/views/dashboard/issues.html.haml +++ b/app/views/dashboard/issues.html.haml @@ -15,6 +15,4 @@ = render 'shared/new_project_item_select', path: 'issues/new', label: "New Issue" = render 'shared/issuable/filter', type: :issues - -.prepend-top-default - = render 'shared/issues' += render 'shared/issues' diff --git a/app/views/dashboard/merge_requests.html.haml b/app/views/dashboard/merge_requests.html.haml index fb016599fef..e64c78c4cb8 100644 --- a/app/views/dashboard/merge_requests.html.haml +++ b/app/views/dashboard/merge_requests.html.haml @@ -7,6 +7,4 @@ = render 'shared/new_project_item_select', path: 'merge_requests/new', label: "New Merge Request" = render 'shared/issuable/filter', type: :merge_requests - -.prepend-top-default - = render 'shared/merge_requests' += render 'shared/merge_requests' diff --git a/app/views/dashboard/todos/index.html.haml b/app/views/dashboard/todos/index.html.haml index 32b4350b8e0..6f7141de12c 100644 --- a/app/views/dashboard/todos/index.html.haml +++ b/app/views/dashboard/todos/index.html.haml @@ -67,41 +67,40 @@ = sort_title_oldest_created -.prepend-top-default - - if @todos.any? - .js-todos-options{ data: {per_page: @todos.limit_value, current_page: @todos.current_page, total_pages: @todos.total_pages} } - .panel.panel-default.panel-small.panel-without-border - %ul.content-list.todos-list - = render @todos - = paginate @todos, theme: "gitlab" +- if @todos.any? + .js-todos-options{ data: {per_page: @todos.limit_value, current_page: @todos.current_page, total_pages: @todos.total_pages} } + .panel.panel-default.panel-small.panel-without-border + %ul.content-list.todos-list + = render @todos + = paginate @todos, theme: "gitlab" - - elsif current_user.todos.any? - .todos-all-done - = render "shared/empty_states/todos_all_done.svg" - - if todos_filter_empty? - %h4.text-center - = Gitlab.config.gitlab.no_todos_messages.sample - %p.text-center - Are you looking for things to do? Take a look at - = succeed "," do - = link_to "the opened issues", issues_dashboard_path - contribute to - = link_to "merge requests", merge_requests_dashboard_path - or mention someone in a comment to assign a new todo automatically. - - else - %h4.text-center - There are no todos to show. - - else - .todos-empty - .todos-empty-hero - = render "shared/empty_states/todos_empty.svg" - .todos-empty-content - %h4 - Todos let you see what you should do next. - %p - When an issue or merge request is assigned to you, or when you - %strong - @mention - in a comment, this will trigger a new item in your todo list, automatically. - %p - You will always know what to work on next. +- elsif current_user.todos.any? + .todos-all-done + = render "shared/empty_states/todos_all_done.svg" + - if todos_filter_empty? + %h4.text-center + = Gitlab.config.gitlab.no_todos_messages.sample + %p.text-center + Are you looking for things to do? Take a look at + = succeed "," do + = link_to "the opened issues", issues_dashboard_path + contribute to + = link_to "merge requests", merge_requests_dashboard_path + or mention someone in a comment to assign a new todo automatically. + - else + %h4.text-center + There are no todos to show. +- else + .todos-empty + .todos-empty-hero + = render "shared/empty_states/todos_empty.svg" + .todos-empty-content + %h4 + Todos let you see what you should do next. + %p + When an issue or merge request is assigned to you, or when you + %strong + @mention + in a comment, this will trigger a new item in your todo list, automatically. + %p + You will always know what to work on next. diff --git a/app/views/groups/issues.html.haml b/app/views/groups/issues.html.haml index 6ad03a60b3a..83edb719692 100644 --- a/app/views/groups/issues.html.haml +++ b/app/views/groups/issues.html.haml @@ -23,7 +23,6 @@ - if current_user To see all issues you should visit #{link_to 'dashboard', issues_dashboard_path} page. - .prepend-top-default - = render 'shared/issues' + = render 'shared/issues' - else = render 'shared/empty_states/issues', project_select_button: true diff --git a/app/views/groups/merge_requests.html.haml b/app/views/groups/merge_requests.html.haml index af73554086b..6ad76d23df5 100644 --- a/app/views/groups/merge_requests.html.haml +++ b/app/views/groups/merge_requests.html.haml @@ -15,5 +15,4 @@ - if current_user To see all merge requests you should visit #{link_to 'dashboard', merge_requests_dashboard_path} page. -.prepend-top-default - = render 'shared/merge_requests' += render 'shared/merge_requests' -- cgit v1.2.1 From 80a7c369083246fe689959906cab493a518ff980 Mon Sep 17 00:00:00 2001 From: Oswaldo Ferreira Date: Thu, 26 Jan 2017 16:08:35 -0200 Subject: Do not rely on style class for changing DOM state on "Mark all as done" --- app/assets/javascripts/todos.js.es6 | 2 +- app/views/dashboard/todos/index.html.haml | 73 ++++++++++++++++--------------- 2 files changed, 38 insertions(+), 37 deletions(-) diff --git a/app/assets/javascripts/todos.js.es6 b/app/assets/javascripts/todos.js.es6 index ef9c0a885fb..05622916ff8 100644 --- a/app/assets/javascripts/todos.js.es6 +++ b/app/assets/javascripts/todos.js.es6 @@ -85,7 +85,7 @@ }, success: (data) => { $target.remove(); - $('.prepend-top-default').html('
You\'re all done!
'); + $('.js-todos-all').html('
You\'re all done!
'); return this.updateBadges(data); } }); diff --git a/app/views/dashboard/todos/index.html.haml b/app/views/dashboard/todos/index.html.haml index 6f7141de12c..153d0885063 100644 --- a/app/views/dashboard/todos/index.html.haml +++ b/app/views/dashboard/todos/index.html.haml @@ -67,40 +67,41 @@ = sort_title_oldest_created -- if @todos.any? - .js-todos-options{ data: {per_page: @todos.limit_value, current_page: @todos.current_page, total_pages: @todos.total_pages} } - .panel.panel-default.panel-small.panel-without-border - %ul.content-list.todos-list - = render @todos - = paginate @todos, theme: "gitlab" +.js-todos-all + - if @todos.any? + .js-todos-options{ data: {per_page: @todos.limit_value, current_page: @todos.current_page, total_pages: @todos.total_pages} } + .panel.panel-default.panel-small.panel-without-border + %ul.content-list.todos-list + = render @todos + = paginate @todos, theme: "gitlab" -- elsif current_user.todos.any? - .todos-all-done - = render "shared/empty_states/todos_all_done.svg" - - if todos_filter_empty? - %h4.text-center - = Gitlab.config.gitlab.no_todos_messages.sample - %p.text-center - Are you looking for things to do? Take a look at - = succeed "," do - = link_to "the opened issues", issues_dashboard_path - contribute to - = link_to "merge requests", merge_requests_dashboard_path - or mention someone in a comment to assign a new todo automatically. - - else - %h4.text-center - There are no todos to show. -- else - .todos-empty - .todos-empty-hero - = render "shared/empty_states/todos_empty.svg" - .todos-empty-content - %h4 - Todos let you see what you should do next. - %p - When an issue or merge request is assigned to you, or when you - %strong - @mention - in a comment, this will trigger a new item in your todo list, automatically. - %p - You will always know what to work on next. + - elsif current_user.todos.any? + .todos-all-done + = render "shared/empty_states/todos_all_done.svg" + - if todos_filter_empty? + %h4.text-center + = Gitlab.config.gitlab.no_todos_messages.sample + %p.text-center + Are you looking for things to do? Take a look at + = succeed "," do + = link_to "the opened issues", issues_dashboard_path + contribute to + = link_to "merge requests", merge_requests_dashboard_path + or mention someone in a comment to assign a new todo automatically. + - else + %h4.text-center + There are no todos to show. + - else + .todos-empty + .todos-empty-hero + = render "shared/empty_states/todos_empty.svg" + .todos-empty-content + %h4 + Todos let you see what you should do next. + %p + When an issue or merge request is assigned to you, or when you + %strong + @mention + in a comment, this will trigger a new item in your todo list, automatically. + %p + You will always know what to work on next. -- cgit v1.2.1