From eb162c2b2741bfd1ea8dd1b49e12027f7ed03594 Mon Sep 17 00:00:00 2001
From: Jacob Schatz <jacobschatz@Jacobs-MBP.fios-router.home>
Date: Wed, 23 Dec 2015 22:01:38 -0500
Subject: [PATCH] adds settings menu to the top for editting and leaving
 projects

---
 app/assets/stylesheets/pages/projects.scss |  7 +++++++
 app/views/projects/_home_panel.html.haml   | 21 +++++++++++++++++----
 app/views/projects/show.html.haml          |  6 +-----
 3 files changed, 25 insertions(+), 9 deletions(-)

diff --git a/app/assets/stylesheets/pages/projects.scss b/app/assets/stylesheets/pages/projects.scss
index cff3edb7ed2..be6ef43e49c 100644
--- a/app/assets/stylesheets/pages/projects.scss
+++ b/app/assets/stylesheets/pages/projects.scss
@@ -26,6 +26,13 @@
 }
 
 .project-home-panel {
+
+  .cover-controls {
+    .project-settings-dropdown {
+      margin-left: 10px;
+    }
+  }
+
   .project-identicon-holder {
     margin-bottom: 16px;
 
diff --git a/app/views/projects/_home_panel.html.haml b/app/views/projects/_home_panel.html.haml
index e92115b9b98..c3f710fa3fb 100644
--- a/app/views/projects/_home_panel.html.haml
+++ b/app/views/projects/_home_panel.html.haml
@@ -18,13 +18,26 @@
       = visibility_level_label(@project.visibility_level)
 
   .cover-controls
-    - if can?(current_user, :admin_project, @project)
-      = link_to edit_project_path(@project), class: 'btn btn-gray' do
-        = icon('pencil')
     - if current_user
-      &nbsp;
       = link_to namespace_project_path(@project.namespace, @project, format: :atom, private_token: current_user.private_token), class: 'btn btn-gray' do
         = icon('rss')
+      - access = user_max_access_in_project(current_user.id, @project)
+      - can_edit = can?(current_user, :admin_project, @project)
+      - if access || can_edit
+        %span.dropdown.project-settings-dropdown
+          %a.dropdown-new.btn.btn-gray.notifications-btn#notifications-button{href: '#', 'data-toggle' => 'dropdown'}
+            = icon('cog')
+            = icon('angle-down')
+          %ul.dropdown-menu.dropdown-menu-right
+            - if can_edit
+              %li
+                = link_to edit_project_path(@project) do
+                  Edit Project
+            - if access
+              %li
+                = link_to leave_namespace_project_project_members_path(@project.namespace, @project),
+                  data: { confirm: leave_project_message(@project) }, method: :delete, title: 'Leave project' do
+                  Leave project
 
   .project-repo-buttons
     .split-one.count-buttons
diff --git a/app/views/projects/show.html.haml b/app/views/projects/show.html.haml
index 7466a098e24..5d04776f7f4 100644
--- a/app/views/projects/show.html.haml
+++ b/app/views/projects/show.html.haml
@@ -75,8 +75,4 @@
   - if access
     .prepend-top-20.project-footer
       .gray-content-block.footer-block.center
-        You have #{access} access to this project.
-        - if @project.project_member_by_id(current_user)
-          = link_to leave_namespace_project_project_members_path(@project.namespace, @project),
-            data: { confirm: leave_project_message(@project) }, method: :delete, title: 'Leave project', class: 'cred' do
-            Leave this project
+        You have #{access} access to this project.
\ No newline at end of file
-- 
GitLab