Commit e6713cd9 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

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
parents 99148939 61805603
......@@ -26,6 +26,13 @@
}
.project-home-panel {
.cover-controls {
.project-settings-dropdown {
margin-left: 10px;
}
}
.project-identicon-holder {
margin-bottom: 16px;
......
......@@ -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
 
= 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
......
......@@ -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
......@@ -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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment