<h1 class="unboxed">Project settings: {{project.label}}</h1>

<gn-settings-frame section="project" project="project">
  <form class="form-horizontal" role="form" name="editProject" ng-submit="update(editProject)">
      <div class="form-group" ng-class="{'has-error': editProject.label.$invalid}">
        <label class="col-sm-2 control-label" for="label">Project title</label>
        <div class="col-sm-10">
          <input type="text" class="form-control" id="label" name="label" ng-model="project.label"
            autofocus placeholder="Project label">
          <p class="help-block" ng-show="editProject.label.$invalid" ng-bind="editProject.label.$message"></p>
          <span class="help-block">Will be shown to visitors of your project.</span>
        </div>
      </div>

      <div class="form-group" ng-class="{'has-error': editProject.slug.$invalid}">
        <label class="col-sm-2 control-label" for="slug">Identifier</label>
        <div class="col-sm-10">
          <input type="text" class="form-control" id="slug" name="slug" ng-model="project.slug" disabled placeholder="project-slug">
          <p class="help-block" ng-show="editProject.slug.$invalid" ng-bind="editProject.slug.$message"></p>
          <span class="help-block">Will be used in URLs for this project. It cannot be changed once the project has been created.</span>
        </div>
      </div>

      <div class="form-group">
        <div class="col-sm-offset-2 col-sm-10">
          <div class="checkbox">
            <label>
              <input type="checkbox" ng-model="project.private"> Hide this project from the public.
            </label>
            <span class="help-block">The project will only be visible to those with specific <a href="#/p/{{project.slug}}/permissions">permissions</a>.</span>
          </div>
        </div>
      </div>
    </div>
    <div class="form-group">
      <div class="col-sm-offset-2 col-sm-10">
        <button type="submit" class="btn btn-primary" ng-click="update(editProject)">Save</button>
        <button type="submit" class="btn btn-default" ng-click="deleteProject()">Delete project</button>
        <button type="submit" class="btn btn-default" ng-click="truncateProject()">Delete entities and relations</button>
      </div>
    </div>
  </form>
</gn-settings>
