<div id="project_config_collaborators" ng-controller="CollaboratorsCtrl" class="well">
  <fieldset>
    <legend>Collaborators</legend>
    <div class="alert alert-success hide"></div>
    <p>
      Collaborators will be notified of build success/failure, be
      able to trigger test jobs and deploys, and access job
      details. They will not be permitted to add other new
      collaborators nor change any project configuration.
    </p>
    <div class="row-fluid">
      <div class="span6">
        <table>
          <tr class="collaborator" ng-repeat="collab in collaborators">
            <td class="image"><img ng-src="[[ collab.gravatar ]]&s=35" class="img-circle"></td>
            <td class="email">[[collab.email]]</td>
            <td class="remove" ng-switch="collab.loading">
              <i ng-switch-when="true" class="fa fa-circle-o-notch fa-spin"></i>
              <span ng-switch-default ng-hide="collab.owner || collab.yourself" class="clickable" ng-click="remove(collab)">
                <i class="fa fa-times"></i>
              </span>
            </td>
          </tr>
          <tr ng-hide="collaborators.length">
            <td colspan="3" class="no-collaborators">No collaborators. Add one!</td>
          </tr>
        </table>
      </div>
      <div class="span6">
        <form name="collabForm" class="control-group form-inline">
          <div class="controls">
              <input ng-model="new_email" type="email" required
                     name="new_collaborator" placeholder="email address"
                     class="collab-email span2 inline-input"/>
              <div class="btn-group access-toggle">
                <button class="btn" required ng-model="new_access" btn-radio="0">Read</button>
                <button class="btn" required ng-model="new_access" btn-radio="1">Run</button>
                <button class="btn" required ng-model="new_access" btn-radio="2">Admin</button>
              </div>
              <button ng-disabled="!collabForm.$valid" ng-click="add()" class="btn btn-add-collab">Add</button>
          </div>
        </form>
      </div>
    </div>
  </fieldset>
</div>
