Newer
Older
GitBucket / src / main / twirl / gitbucket / core / settings / options.scala.html
@Naoki Takezoe Naoki Takezoe on 4 Nov 2016 6 KB (refs #1286) Update controllers
@(repository: gitbucket.core.service.RepositoryService.RepositoryInfo, info: Option[Any])(implicit context: gitbucket.core.controller.Context)
@import gitbucket.core.view.helpers
@gitbucket.core.html.main("Settings", Some(repository)){
  @gitbucket.core.html.menu("settings", repository){
    @gitbucket.core.settings.html.menu("options", repository){
      @gitbucket.core.helper.html.information(info)
      <form id="form" method="post" action="@helpers.url(repository)/settings/options" validate="true">
        <div class="panel panel-default">
          <div class="panel-heading strong">Settings</div>
          <div class="panel-body">
            <fieldset class="form-group">
              <label for="repositoryName" class="strong">Repository Name:</label>
              <input type="text" name="repositoryName" id="repositoryName" class="form-control" value="@repository.name"/>
              <span id="error-repositoryName" class="error"></span>
            </fieldset>
            <fieldset class="border-top form-group">
              <label for="description" class="strong">Description:</label>
              <input type="text" name="description" id="description" class="form-control" value="@repository.repository.description"/>
            </fieldset>
            <fieldset class="border-top">
              <label class="radio">
                <input type="radio" name="isPrivate" value="false"
                  @if(!repository.repository.isPrivate              ){ checked  }
                  @if(repository.repository.parentUserName.isDefined){ disabled }
                >
                <span class="strong"><i class="octicon octicon-repo"></i> Public</span><br>
                <div class="normal muted">
                  Anyone can see this repository. You choose who can commit.
                </div>
              </label>
              <label class="radio">
                <input type="radio" name="isPrivate" value="true"
                  @if(repository.repository.isPrivate               ){ checked  }
                  @if(repository.repository.parentUserName.isDefined){ disabled }
                >
                <span class="strong"><i class="octicon octicon-lock"></i> Private</span><br>
                <div class="normal muted">
                  You choose who can see and commit to this repository.
                </div>
              </label>
            </fieldset>
            <fieldset class="form-group">
              <label class="checkbox" for="allowFork">
                <input type="checkbox" id="allowFork" name="allowFork"@if(repository.repository.options.allowFork){ checked}/>
                Forks<br>
                <div class="normal muted">
                  Allow repository forking to users who can access this repository.
                </div>
              </label>
            </fieldset>
          </div>
        </div>
        <div class="panel panel-default">
          <div class="panel-heading strong">Issues</div>
          <div class="panel-body">
            <fieldset class="form-group">
              <div class="radio">
                <label>
                  <input type="radio" name="issuesOption" value="DISABLE" @if(repository.repository.options.issuesOption == "DISABLE"){ checked}> Disables issues tracking system
                </label>
              </div>
              <div class="radio">
                <label>
                  <input type="radio" name="issuesOption" value="PRIVATE" @if(repository.repository.options.issuesOption == "PRIVATE"){ checked}> Writable users can view, create and comment on issues
                </label>
              </div>
              <div class="radio">
                <label>
                  <input type="radio" name="issuesOption" value="PUBLIC" @if(repository.repository.options.issuesOption == "PUBLIC"){ checked}> Readable users can view, create and comment on isues
                </label>
              </div>
              <label for="externalIssuesUrl" class="strong">External URL:
                <span class="normal muted">(Put if you have the external issue tracking system for this project)</span>
              </label>
              <input type="text" class="form-control" id="externalIssuesUrl" name="externalIssuesUrl" value="@repository.repository.options.externalIssuesUrl"/>
            </fieldset>
          </div>
        </div>
        <div class="panel panel-default">
          <div class="panel-heading strong">Wiki</div>
          <div class="panel-body">
            <fieldset class="form-group">
              <div class="radio">
                <label>
                  <input type="radio" name="wikiOption" value="DISABLE" @if(repository.repository.options.wikiOption == "DISABLE"){ checked}> Disables wiki
                </label>
              </div>
              <div class="radio">
                <label>
                  <input type="radio" name="wikiOption" value="PRIVATE" @if(repository.repository.options.wikiOption == "PRIVATE"){ checked}> Writable users can view, create and edit wiki pages
                </label>
              </div>
              <div class="radio">
                <label>
                  <input type="radio" name="wikiOption" value="PUBLIC" @if(repository.repository.options.wikiOption == "PUBLIC"){ checked}> Readable users can view, create and edit wiki pages
                </label>
              </div>
              <label for="externalWikiUrl" class="strong">External URL:
                <span class="normal muted">(Put if you have the external Wiki for this project)</span>
              </label>
              <input type="text" class="form-control" id="externalWikiUrl" name="externalWikiUrl" value="@repository.repository.options.externalWikiUrl"/>
            </fieldset>
          </div>
        </div>
        <div class="align-right" style="margin-top: 20px;">
          <input type="submit" class="btn btn-success" value="Apply changes"/>
        </div>
      </form>
    }
  }
}
<script>
$(function(){
  updateFeatures();

  $('input[name=issuesOption], input[name=wikiOption]').click(function(){
    updateFeatures();
  });
});

function updateFeatures() {
  $('#externalIssuesUrl').prop('disabled', !$('input[name=issuesOption]').select('[value=DISABLE]').prop('checked'));
  $('#externalWikiUrl').prop('disabled', !$('input[name=wikiOption]').select('[value=DISABLE]').prop('checked'));
}
</script>