edit.html.haml 3.07 KB
.row
  .span3
    %ul.nav.nav-pills.nav-stacked
      %li.active
        = link_to 'Projects', '#tab-projects', 'data-toggle' => 'tab'
      %li
        = link_to 'Edit Team', '#tab-edit', 'data-toggle' => 'tab'
      - if can? current_user, :admin_user_team, @team
        %li
          = link_to 'Remove', '#tab-remove', 'data-toggle' => 'tab'

  .span9
    .tab-content
      .tab-pane.active#tab-projects
        .ui-box.projects-table
          %h5.title Projects
          %ul.well-list
            - @projects.each do |project|
              %li
                - if project.public
                  %i.icon-share
                - else
                  %i.icon-lock.cgreen
                = link_to project.name_with_namespace, project
                .pull-right
                  = link_to 'Edit max access', edit_team_project_path(@team, project), class: "btn btn-small"
                  = link_to 'Relegate', team_project_path(@team, project), confirm: 'Remove project from team and move to global namespace. Are you sure?', method: :delete, class: "btn btn-remove small"
        .form-holder
          = form_tag team_projects_path(@team), id: "assign_projects", class: "bulk_import", method: :post  do
            %table.headless
              %tr
                %td= select_tag :project_ids, options_from_collection_for_select(@avaliable_projects , :id, :name_with_namespace), multiple: true, data: {placeholder: 'Select projects'}, class: 'chosen span4'
                %td= select_tag :greatest_project_access, options_for_select(UserTeam.access_roles), {class: "project-access-select chosen" }
                %td= submit_tag 'Add Project', class: "btn btn-create", id: :assign_projects_to_team


      .tab-pane#tab-edit
        .ui-box
          %h5.title Edit Team
          %div.form-holder
            = form_for @team, url: team_path(@team) do |f|
              - if @team.errors.any?
                .alert.alert-error
                  %span= @team.errors.full_messages.first
              .clearfix
                = f.label :name do
                  Team name is
                .input
                  = f.text_field :name, placeholder: "Ex. OpenSource", class: "xlarge left"

              .clearfix.team-description-holder
                = f.label :description, "Details"
                .input
                  = f.text_area :description, maxlength: 250, class: "xlarge js-gfm-input", rows: 4

              .clearfix
                = f.label :path do
                  Team path is
                .input
                  = f.text_field :path, placeholder: "opensource", class: "xlarge left"

              .form-actions
                = f.submit 'Save team changes', class: "btn btn-primary"

      .tab-pane#tab-remove
        .ui-box.ui-box-danger
          %h5.title Remove team
          .ui-box-body
            %p
              Remove of team will cause removing members access to projects.
            %p
              %strong Removed team can not be restored!

            = link_to 'Remove team', team_path(@team), method: :delete, confirm: "You are sure?", class: "btn btn-remove btn-small"