From 9437f0618a72d6201bbf0382f4237c678138ff43 Mon Sep 17 00:00:00 2001
From: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Date: Wed, 16 Sep 2015 20:16:44 +0200
Subject: [PATCH] Fix confusing behaviour of back link in CI sidebar

Back link should always be responsible for sidebar navigation below.
It should change sidebar navigation to one level up
---
 app/views/layouts/ci/_nav_build.html.haml   | 3 ---
 app/views/layouts/ci/_nav_commit.haml       | 3 ---
 app/views/layouts/ci/_nav_project.html.haml | 4 ++--
 app/views/layouts/ci/build.html.haml        | 2 +-
 app/views/layouts/ci/commit.html.haml       | 2 +-
 5 files changed, 4 insertions(+), 10 deletions(-)
 delete mode 100644 app/views/layouts/ci/_nav_build.html.haml
 delete mode 100644 app/views/layouts/ci/_nav_commit.haml

diff --git a/app/views/layouts/ci/_nav_build.html.haml b/app/views/layouts/ci/_nav_build.html.haml
deleted file mode 100644
index 732882726e7..00000000000
--- a/app/views/layouts/ci/_nav_build.html.haml
+++ /dev/null
@@ -1,3 +0,0 @@
-= render 'layouts/ci/nav_project',
-    back_title: 'Back to project commit',
-    back_url: ci_project_ref_commits_path(@project, @commit.ref, @commit.sha)
diff --git a/app/views/layouts/ci/_nav_commit.haml b/app/views/layouts/ci/_nav_commit.haml
deleted file mode 100644
index 19c526678d0..00000000000
--- a/app/views/layouts/ci/_nav_commit.haml
+++ /dev/null
@@ -1,3 +0,0 @@
-= render 'layouts/ci/nav_project',
-    back_title: 'Back to project commits',
-    back_url: ci_project_path(@project)
diff --git a/app/views/layouts/ci/_nav_project.html.haml b/app/views/layouts/ci/_nav_project.html.haml
index 10b87e3a2b1..d747679c8cf 100644
--- a/app/views/layouts/ci/_nav_project.html.haml
+++ b/app/views/layouts/ci/_nav_project.html.haml
@@ -1,8 +1,8 @@
 %ul.nav.nav-sidebar
   = nav_link do
-    = link_to defined?(back_url) ? back_url : ci_root_path, title: defined?(back_title) ? back_title : 'Back to Dashboard', data: {placement: 'right'}, class: 'back-link' do
+    = link_to ci_root_path, title: 'Back to CI projects', data: {placement: 'right'}, class: 'back-link' do
       = icon('caret-square-o-left fw')
-      %span= defined?(back_title) ? back_title : 'Back to Dashboard'
+      %span= 'Back to CI projects'
   %li.separate-item
   = nav_link path: ['projects#show', 'commits#show', 'builds#show'] do
     = link_to ci_project_path(@project) do
diff --git a/app/views/layouts/ci/build.html.haml b/app/views/layouts/ci/build.html.haml
index d404ecb894a..a1356f0dc2e 100644
--- a/app/views/layouts/ci/build.html.haml
+++ b/app/views/layouts/ci/build.html.haml
@@ -8,4 +8,4 @@
     - else
       = render "layouts/header/public", title: header_title
 
-    = render 'layouts/ci/page', sidebar: 'nav_build'
+    = render 'layouts/ci/page', sidebar: 'nav_project'
diff --git a/app/views/layouts/ci/commit.html.haml b/app/views/layouts/ci/commit.html.haml
index 5727f1b8e3e..a1356f0dc2e 100644
--- a/app/views/layouts/ci/commit.html.haml
+++ b/app/views/layouts/ci/commit.html.haml
@@ -8,4 +8,4 @@
     - else
       = render "layouts/header/public", title: header_title
 
-    = render 'layouts/ci/page', sidebar: 'nav_commit'
+    = render 'layouts/ci/page', sidebar: 'nav_project'
-- 
GitLab