summaryrefslogtreecommitdiff
path: root/app/views/admin/groups/show.html.haml
blob: 6ae8a75d696992efd65e7e1cf812d50b5714e7a3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
%h3.page_title
  Group: #{@group.name}

%br
%table.zebra-striped
  %thead
    %tr
      %th Group
      %th
  %tr
    %td
      %b
        Name:
    %td
      = @group.name
       
      = link_to edit_admin_group_path(@group), class: "btn btn-small pull-right" do
        %i.icon-edit
        Rename
  %tr
    %td
      %b
        Path:
    %td
      %span.monospace= File.join(Gitlab.config.gitolite.repos_path, @group.path)
  %tr
    %td
      %b
        Owner:
    %td
      = @group.owner_name
      .pull-right
        = link_to "#", class: "btn btn-small change-owner-link" do
          %i.icon-edit
          Change owner

  %tr.change-owner-holder.hide
    %td.bgred
      %b.cred
        New Owner:
    %td.bgred
      = form_for [:admin, @group] do |f|
        = f.select :owner_id, User.all.map { |user| [user.name, user.id] }, {}, {class: 'chosen'}
        %div
          = f.submit 'Change Owner', class: "btn btn-remove"
          = link_to "Cancel", "#", class: "btn change-owner-cancel-link"

- if @group.projects.any?
  %fieldset
    %legend Projects (#{@group.projects.count})
    %table
      %thead
        %tr
          %th Project name
          %th Path
          %th Users
          %th.cred Danger Zone!
      - @group.projects.each do |project|
        %tr
          %td
            = link_to project.name_with_namespace, [:admin, project]
          %td
            %span.monospace= project.path_with_namespace + ".git"
          %td= project.users.count
          %td.bgred
            = link_to 'Transfer project to global namespace', remove_project_admin_group_path(@group, project_id: project.id), confirm: 'Remove project from group and move to global namespace. Are you sure?', method: :delete, class: "btn btn-remove small"

  = form_tag project_teams_update_admin_group_path(@group), id: "new_team_member", class: "bulk_import", method: :put  do
    %table.zebra-striped
      %thead
        %tr
          %th Users
          %th Project Access:

      - @group.users.each do |user|
        - next unless user
        %tr{class: "user_#{user.id}"}
          %td.name= link_to user.name, admin_user_path(user)
          %td.projects_access
            - user.authorized_projects.in_namespace(@group).each do |project|
              - u_p = user.users_projects.in_project(project).first
              - next unless u_p
              %span
                = project.name_with_namespace
                = link_to "(#{ u_p.project_access_human })", edit_admin_project_member_path(project, user)
      %tr
        %td.input= select_tag :user_ids, options_from_collection_for_select(@users , :id, :name), multiple: true, data: {placeholder: 'Select users'}, class: 'chosen span5'
        %td= select_tag :project_access, options_for_select(Project.access_options), {class: "project-access-select chosen span3"}

      %tr
        %td= submit_tag 'Add user to projects in group', class: "btn btn-primary"
        %td
          Read more about project permissions
          %strong= link_to "here", help_permissions_path, class: "vlink"

- else
  %fieldset
    %legend Group is empty

= form_tag project_update_admin_group_path(@group), class: "bulk_import", method: :put  do
  %fieldset
    %legend Move projects to group
    .alert
      You can move only projects with existing repos
      %br
      Group projects will be moved in group directory and will not be accessible by old path
    .clearfix
      = label_tag :project_ids do
        Projects
      .input
        = select_tag :project_ids, options_from_collection_for_select(@projects , :id, :name_with_namespace), multiple: true, data: {placeholder: 'Select projects'}, class: 'chosen span5'
    .form-actions
      = submit_tag 'Add', class: "btn btn-primary"

:javascript
  $(function(){
    var modal = $('.change-owner-holder');
    $('.change-owner-link').bind("click", function(){
      $(this).hide();
      modal.show();
    });
    $('.change-owner-cancel-link').bind("click", function(){
      modal.hide();
      $('.change-owner-link').show();
    })
  })