Newer
Older
GitBucket / src / main / twirl / gitbucket / core / account / application.scala.html
@Takashi Sugimoto Takashi Sugimoto on 27 Nov 2016 2 KB Enable copy button without flash
@(account: gitbucket.core.model.Account,
  personalTokens: List[gitbucket.core.model.AccessToken],
  gneratedToken: Option[(gitbucket.core.model.AccessToken, String)])(implicit context: gitbucket.core.controller.Context)
@gitbucket.core.html.main("Applications"){
<div class="container body">
  @gitbucket.core.account.html.menu("application", context.settings.ssh){
    <div class="panel panel-default">
      <div class="panel-heading strong">Personal access tokens</div>
      <div class="panel-body">
        @if(personalTokens.isEmpty && gneratedToken.isEmpty){
          No tokens.
        } else {
          Tokens you have generated that can be used to access the GitBucket API.
          <hr style="margin-top: 10px;">
        }
        @gneratedToken.map { case (token, tokenString) =>
          <div class="alert alert-info">
            Make sure to copy your new personal access token now. You won't be able to see it again!
          </div>
          <a href="@context.path/@account.userName/_personalToken/delete/@token.accessTokenId" class="btn btn-sm btn-danger pull-right">Delete</a>
          <div style="width: 50%;">
            @gitbucket.core.helper.html.copy("generated-token-copy", tokenString, targetTextId = "generated-token"){
              <input type="text" value="@tokenString" class="form-control input-sm" id="generated-token" readonly>
            }
          </div>
          <hr style="margin-top: 10px;">
        }
        @personalTokens.zipWithIndex.map { case (token, i) =>
          @if(i != 0){
            <hr>
          }
          <strong style="line-height: 30px;">@token.note</strong>
          <a href="@context.path/@account.userName/_personalToken/delete/@token.accessTokenId" class="btn btn-sm btn-danger pull-right">Delete</a>
        }
      </div>
    </div>
    <form method="POST" action="@context.path/@account.userName/_personalToken" validate="true">
      <div class="panel panel-default">
        <div class="panel-heading strong">Generate new token</div>
        <div class="panel-body">
          <fieldset>
            <label for="note" class="strong">Token description</label>
            <div><span id="error-note" class="error"></span></div>
            <input type="text" name="note" id="note" class="form-control"/>
            <p class="muted">What's this token for?</p>
          </fieldset>
          <input type="submit" class="btn btn-success" value="Generate token"/>
        </div>
      </div>
    </form>
  }
</div>
}