summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2016-01-05 09:34:13 +0000
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2016-01-05 09:34:13 +0000
commite6713cd945e68e6732d27d9e335b82abbf226155 (patch)
treece03f8658eaf48bb7ceae287ecd87b3873b2c2b6
parent99148939545f734e8d2404e90661172a378bd225 (diff)
parent618056031827727ff1928b125569dae2e05f9bd1 (diff)
downloadgitlab-ce-e6713cd945e68e6732d27d9e335b82abbf226155.tar.gz
Merge branch 'improved-leave-project' into 'master'
Adds settings menu to the top for editting and leaving projects @creamzy @skyruler @dzaporozhets Menu contents depends on user's rights. Fixes #4221 ![Screen_Shot_2015-12-23_at_10.02.47_PM](/uploads/daeaef937bf9d9f4db7ccb674e344ac1/Screen_Shot_2015-12-23_at_10.02.47_PM.png) ![Screen_Shot_2015-12-23_at_10.02.41_PM](/uploads/58eb4eea7d640f01d7f05c2a408a2c04/Screen_Shot_2015-12-23_at_10.02.41_PM.png) ![Screen_Shot_2015-12-23_at_10.02.55_PM](/uploads/4b2ae027a13efcbad3eb81b04f134c4f/Screen_Shot_2015-12-23_at_10.02.55_PM.png) ![Screen_Shot_2015-12-23_at_10.04.47_PM](/uploads/bd5d9d8ddd72d16d74c32c6c1f569776/Screen_Shot_2015-12-23_at_10.04.47_PM.png) See merge request !2195
-rw-r--r--app/assets/stylesheets/pages/projects.scss7
-rw-r--r--app/views/projects/_home_panel.html.haml21
-rw-r--r--app/views/projects/show.html.haml13
-rw-r--r--spec/features/projects_spec.rb6
4 files changed, 29 insertions, 18 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..0f61e623396 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#project-settings-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..ffbe445b447 100644
--- a/app/views/projects/show.html.haml
+++ b/app/views/projects/show.html.haml
@@ -68,15 +68,4 @@
= render 'projects/last_commit', commit: @repository.commit, project: @project
%div{class: "project-show-#{default_project_view}"}
- = render default_project_view
-
-- if current_user
- - access = user_max_access_in_project(current_user.id, @project)
- - 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
+ = render default_project_view \ No newline at end of file
diff --git a/spec/features/projects_spec.rb b/spec/features/projects_spec.rb
index 74b148f5d17..9a01c89ae2a 100644
--- a/spec/features/projects_spec.rb
+++ b/spec/features/projects_spec.rb
@@ -80,8 +80,10 @@ feature 'Project', feature: true do
visit namespace_project_path(project.namespace, project)
end
- it { expect(page).to have_content('You have Master access to this project.') }
- it { expect(page).to have_link('Leave this project') }
+ it 'click project-settings and find leave project' do
+ find('#project-settings-button').click
+ expect(page).to have_link('Leave Project')
+ end
end
def remove_with_confirm(button_text, confirm_with)