Commit eb3e07a509d360922ff52c3634be7770104b0994
1 parent
8bf340f5
Exists in
master
and in
4 other branches
Use project owner if no namespace. Restyled team page
Showing
13 changed files
with
96 additions
and
79 deletions
Show diff stats
app/assets/stylesheets/sections/projects.scss
app/models/ability.rb
| ... | ... | @@ -18,7 +18,7 @@ class Ability |
| 18 | 18 | # Rules based on role in project |
| 19 | 19 | if project.master_access_for?(user) |
| 20 | 20 | # TODO: replace with master rules. |
| 21 | - # Only allow project administration for owners | |
| 21 | + # Only allow project administration for namespace owners | |
| 22 | 22 | rules << project_admin_rules |
| 23 | 23 | |
| 24 | 24 | elsif project.dev_access_for?(user) |
| ... | ... | @@ -31,15 +31,20 @@ class Ability |
| 31 | 31 | rules << project_guest_rules |
| 32 | 32 | end |
| 33 | 33 | |
| 34 | - # If user own project namespace (Ex. group owner or account owner) | |
| 35 | - if project.namespace && project.namespace.owner == user | |
| 36 | - rules << project_admin_rules | |
| 34 | + if project.namespace | |
| 35 | + # If user own project namespace | |
| 36 | + # (Ex. group owner or account owner) | |
| 37 | + if project.namespace.owner == user | |
| 38 | + rules << project_admin_rules | |
| 39 | + end | |
| 40 | + else | |
| 41 | + # For compatibility with global projects | |
| 42 | + # use projects.owner_id | |
| 43 | + if project.owner == user | |
| 44 | + rules << project_admin_rules | |
| 45 | + end | |
| 37 | 46 | end |
| 38 | 47 | |
| 39 | - # If user was set as direct project owner | |
| 40 | - if project.owner == user | |
| 41 | - rules << project_admin_rules | |
| 42 | - end | |
| 43 | 48 | |
| 44 | 49 | rules.flatten |
| 45 | 50 | end | ... | ... |
app/models/project.rb
app/views/admin/projects/_form.html.haml
| ... | ... | @@ -24,10 +24,6 @@ |
| 24 | 24 | = f.label :namespace_id |
| 25 | 25 | .input= f.select :namespace_id, namespaces_options(@project.namespace_id), {}, {class: 'chosen'} |
| 26 | 26 | |
| 27 | - .clearfix | |
| 28 | - = f.label :owner_id | |
| 29 | - .input= f.select :owner_id, User.all.map { |user| [user.name, user.id] }, {}, {class: 'chosen'} | |
| 30 | - | |
| 31 | 27 | - if project.repo_exists? |
| 32 | 28 | .clearfix |
| 33 | 29 | = f.label :default_branch, "Default Branch" | ... | ... |
app/views/admin/projects/show.html.haml
| ... | ... | @@ -28,13 +28,22 @@ |
| 28 | 28 | %tr |
| 29 | 29 | %td |
| 30 | 30 | %b |
| 31 | + Namespace: | |
| 32 | + %td | |
| 33 | + - if @project.namespace | |
| 34 | + = @project.namespace.human_name | |
| 35 | + - else | |
| 36 | + Global | |
| 37 | + %tr | |
| 38 | + %td | |
| 39 | + %b | |
| 31 | 40 | Path: |
| 32 | 41 | %td |
| 33 | 42 | %code= @project.path_to_repo |
| 34 | 43 | %tr |
| 35 | 44 | %td |
| 36 | 45 | %b |
| 37 | - Owner: | |
| 46 | + Created by: | |
| 38 | 47 | %td |
| 39 | 48 | = @project.owner_name || '(deleted)' |
| 40 | 49 | %tr | ... | ... |
app/views/groups/people.html.haml
| ... | ... | @@ -15,10 +15,6 @@ |
| 15 | 15 | = image_tag gravatar_icon(user.email, 16), class: "avatar s16" |
| 16 | 16 | %strong= user.name |
| 17 | 17 | %span.cgray= user.email |
| 18 | - - if @project | |
| 19 | - - if @project.owner == user | |
| 20 | - %span.btn.btn-small.disabled.right Project Owner | |
| 21 | - - else | |
| 22 | - - if @group.owner == user | |
| 23 | - %span.btn.btn-small.disabled.right Group Owner | |
| 18 | + - if @group.owner == user | |
| 19 | + %span.btn.btn-small.disabled.right Group Owner | |
| 24 | 20 | ... | ... |
app/views/layouts/project_resource.html.haml
| ... | ... | @@ -4,7 +4,8 @@ |
| 4 | 4 | %body{class: "#{app_theme} project"} |
| 5 | 5 | = render "layouts/flash" |
| 6 | 6 | = render "layouts/head_panel", title: @project.name |
| 7 | - = render 'shared/no_ssh' | |
| 7 | + - if can?(current_user, :download_code, @project) | |
| 8 | + = render 'shared/no_ssh' | |
| 8 | 9 | .container |
| 9 | 10 | %ul.main_menu |
| 10 | 11 | = nav_link(html_options: {class: "home #{project_tab_class}"}) do | ... | ... |
app/views/projects/empty.html.haml
| 1 | 1 | = render 'clone_panel' |
| 2 | 2 | |
| 3 | 3 | %div.git-empty |
| 4 | - %h4 Git global setup: | |
| 5 | - %pre.dark | |
| 6 | - = preserve do | |
| 7 | - git config --global user.name "#{current_user.name}" | |
| 8 | - git config --global user.email "#{current_user.email}" | |
| 4 | + %fieldset | |
| 5 | + %legend Git global setup: | |
| 6 | + %pre.dark | |
| 7 | + = preserve do | |
| 8 | + git config --global user.name "#{current_user.name}" | |
| 9 | + git config --global user.email "#{current_user.email}" | |
| 9 | 10 | |
| 10 | - %h4.prepend-top-20 Create Repository | |
| 11 | - %pre.dark | |
| 12 | - = preserve do | |
| 13 | - mkdir #{@project.path} | |
| 14 | - cd #{@project.path} | |
| 15 | - git init | |
| 16 | - touch README | |
| 17 | - git add README | |
| 18 | - git commit -m 'first commit' | |
| 19 | - git remote add origin #{@project.url_to_repo} | |
| 20 | - git push -u origin master | |
| 11 | + %fieldset | |
| 12 | + %legend Create Repository | |
| 13 | + %pre.dark | |
| 14 | + = preserve do | |
| 15 | + mkdir #{@project.path} | |
| 16 | + cd #{@project.path} | |
| 17 | + git init | |
| 18 | + touch README | |
| 19 | + git add README | |
| 20 | + git commit -m 'first commit' | |
| 21 | + git remote add origin #{@project.url_to_repo} | |
| 22 | + git push -u origin master | |
| 21 | 23 | |
| 22 | - %h4.prepend-top-20 Existing Git Repo? | |
| 23 | - %pre.dark | |
| 24 | - = preserve do | |
| 25 | - cd existing_git_repo | |
| 26 | - git remote add origin #{@project.url_to_repo} | |
| 27 | - git push -u origin master | |
| 24 | + %fieldset | |
| 25 | + %legend Existing Git Repo? | |
| 26 | + %pre.dark | |
| 27 | + = preserve do | |
| 28 | + cd existing_git_repo | |
| 29 | + git remote add origin #{@project.url_to_repo} | |
| 30 | + git push -u origin master | |
| 28 | 31 | |
| 29 | 32 | - if can? current_user, :admin_project, @project |
| 30 | 33 | .prepend-top-20 | ... | ... |
app/views/shared/_clone_panel.html.haml
| 1 | 1 | .input-prepend.project_clone_holder |
| 2 | 2 | %button{class: "btn active", :"data-clone" => @project.ssh_url_to_repo} SSH |
| 3 | 3 | %button{class: "btn", :"data-clone" => @project.http_url_to_repo}= Gitlab.config.web_protocol.upcase |
| 4 | - = text_field_tag :project_clone, @project.url_to_repo, class: "one_click_select span5" | |
| 4 | + = text_field_tag :project_clone, @project.url_to_repo, class: "one_click_select input-xxlarge" | ... | ... |
app/views/team_members/_show.html.haml
| 1 | 1 | - user = member.user |
| 2 | 2 | - allow_admin = can? current_user, :admin_project, @project |
| 3 | -%tr{id: dom_id(member), class: "team_member_row user_#{user.id}"} | |
| 4 | - %td.span6 | |
| 5 | - = link_to project_team_member_path(@project, member), title: user.name, class: "dark" do | |
| 6 | - = image_tag gravatar_icon(user.email, 40), class: "avatar s32" | |
| 7 | - = link_to project_team_member_path(@project, member), title: user.name, class: "dark" do | |
| 8 | - %strong= truncate(user.name, lenght: 40) | |
| 9 | - %br | |
| 10 | - %small.cgray= user.email | |
| 3 | +%li.wll{id: dom_id(member), class: "team_member_row user_#{user.id}"} | |
| 4 | + .row | |
| 5 | + .span6 | |
| 6 | + = link_to project_team_member_path(@project, member), title: user.name, class: "dark" do | |
| 7 | + = image_tag gravatar_icon(user.email, 40), class: "avatar s32" | |
| 8 | + = link_to project_team_member_path(@project, member), title: user.name, class: "dark" do | |
| 9 | + %strong= truncate(user.name, lenght: 40) | |
| 10 | + %br | |
| 11 | + %small.cgray= user.email | |
| 11 | 12 | |
| 12 | - %td.span5 | |
| 13 | - .right | |
| 14 | - - if current_user == user | |
| 15 | - %span.btn.disabled This is you! | |
| 16 | - - if @project.owner == user | |
| 17 | - %span.btn.disabled.success Owner | |
| 18 | - - elsif user.blocked | |
| 19 | - %span.btn.disabled.blocked Blocked | |
| 20 | - - elsif allow_admin | |
| 21 | - = link_to project_team_member_path(project_id: @project, id: member.id), confirm: remove_from_team_message(@project, member), method: :delete, class: "very_small btn danger" do | |
| 22 | - %i.icon-minus.icon-white | |
| 13 | + .span5.right | |
| 14 | + - if allow_admin | |
| 15 | + .left | |
| 16 | + = form_for(member, as: :team_member, url: project_team_member_path(@project, member)) do |f| | |
| 17 | + = f.select :project_access, options_for_select(UsersProject.access_roles, member.project_access), {}, class: "medium project-access-select span2" | |
| 18 | + .right | |
| 19 | + - if current_user == user | |
| 20 | + %span.btn.disabled This is you! | |
| 21 | + - if @project.namespace_owner == user | |
| 22 | + %span.btn.disabled.success Owner | |
| 23 | + - elsif user.blocked | |
| 24 | + %span.btn.disabled.blocked Blocked | |
| 25 | + - elsif allow_admin | |
| 26 | + = link_to project_team_member_path(project_id: @project, id: member.id), confirm: remove_from_team_message(@project, member), method: :delete, class: "very_small btn danger" do | |
| 27 | + %i.icon-minus.icon-white | |
| 23 | 28 | |
| 24 | - - if allow_admin | |
| 25 | - = form_for(member, as: :team_member, url: project_team_member_path(@project, member)) do |f| | |
| 26 | - = f.select :project_access, options_for_select(UsersProject.access_roles, member.project_access), {}, class: "medium project-access-select span2" | ... | ... |
app/views/team_members/_team.html.haml
| 1 | 1 | - grouper_project_members(@project).each do |access, members| |
| 2 | - %table.low | |
| 3 | - %thead | |
| 4 | - %tr | |
| 5 | - %th.span7 | |
| 6 | - = Project.access_options.key(access).pluralize | |
| 7 | - %th | |
| 8 | - %tbody | |
| 2 | + %fieldset | |
| 3 | + %legend | |
| 4 | + = Project.access_options.key(access).pluralize | |
| 5 | + %small= members.size | |
| 6 | + %ul.unstyled | |
| 9 | 7 | - members.each do |up| |
| 10 | 8 | = render(partial: 'team_members/show', locals: {member: up}) |
| 11 | 9 | ... | ... |
app/views/team_members/index.html.haml
| 1 | 1 | = render "projects/project_head" |
| 2 | 2 | %h3.page_title |
| 3 | 3 | Team Members |
| 4 | - %small (#{@project.users_projects.count}) | |
| 5 | - | |
| 6 | -- if can? current_user, :admin_team_member, @project | |
| 7 | - %p.slead | |
| 4 | + (#{@project.users_projects.count}) | |
| 5 | + %small | |
| 8 | 6 | Read more about project permissions |
| 9 | 7 | %strong= link_to "here", help_permissions_path, class: "vlink" |
| 10 | 8 | |
| 9 | + - if can? current_user, :admin_team_member, @project | |
| 11 | 10 | %span.right |
| 12 | 11 | = link_to import_project_team_members_path(@project), class: "btn small grouped", title: "Import team from another project" do |
| 13 | 12 | Import team from another project |
| 14 | 13 | = link_to new_project_team_member_path(@project), class: "btn success small grouped", title: "New Team Member" do |
| 15 | 14 | New Team Member |
| 15 | +%hr | |
| 16 | + | |
| 16 | 17 | |
| 17 | - .clearfix | |
| 18 | -= render partial: "team_members/team", locals: {project: @project} | |
| 18 | +.clearfix | |
| 19 | +%div.team-table | |
| 20 | + = render partial: "team_members/team", locals: {project: @project} | ... | ... |
app/views/tree/_head.html.haml