summaryrefslogtreecommitdiff
path: root/app/views/admin/teams/show.html.haml
blob: a7470c2d6e0ba4835518b7d68982d9a7a4c5733f (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
%h3.page_title
  Team: #{@team.name}

%br
%table.zebra-striped
  %thead
    %tr
      %th Team
      %th
  %tr
    %td
      %b
        Name:
    %td
      = @team.name
       
      = link_to edit_admin_team_path(@team), class: "btn btn-small right" do
        %i.icon-edit
        Rename
  %tr
    %td
      %b
        Owner:
    %td
      = @team.owner.name
      .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 @team, url: admin_team_path(@team) do |f|
        = f.select :owner_id, User.all.map { |user| [user.name, user.id] }, {}, {class: 'chosen'}
        %div
          = f.submit 'Change Owner', class: "btn danger"
          = link_to "Cancel", "#", class: "btn change-owner-cancel-link"

%fieldset
  %legend
    Members (#{@team.members.count})
    %span= link_to 'Add members', new_admin_team_member_path(@team), class: "btn success small right", id: :add_members_to_team
  - if @team.members.any?
    %table#members_list
      %thead
        %tr
          %th User name
          %th Default project access
          %th Team access
          %th.cred.span3 Danger Zone!
      - @team.members.each do |member|
        %tr.member
          %td
            = link_to [:admin, member] do
              = member.name
              %small= "(#{member.email})"
          %td= @team.human_default_projects_access(member)
          %td= @team.admin?(member) ? "Admin" : "Member"
          %td.bgred
            = link_to 'Edit', edit_admin_team_member_path(@team, member), class: "btn small"
             
            = link_to 'Remove', admin_team_member_path(@team, member), confirm: 'Remove member from team. Are you sure?', method: :delete, class: "btn danger small"

%fieldset
  %legend
    Projects (#{@team.projects.count})
    %span= link_to 'Add projects', new_admin_team_project_path(@team), class: "btn success small right", id: :assign_projects_to_team
  - if @team.projects.any?
    %table#projects_list
      %thead
        %tr
          %th Project name
          %th Max access
          %th.cred.span3 Danger Zone!
      - @team.projects.each do |project|
        %tr.project
          %td
            = link_to project.name_with_namespace, [:admin, project]
          %td
            %span= @team.human_max_project_access(project)
          %td.bgred
            = link_to 'Edit', edit_admin_team_project_path(@team, project), class: "btn small"
             
            = link_to 'Relegate', admin_team_project_path(@team, project), confirm: 'Remove project from team. Are you sure?', method: :delete, class: "btn danger small"

: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();
    })
  })