Newer
Older
gitbucket_jkp / src / main / twirl / admin / users / edit.scala.html
@(account: Option[model.Account])(implicit context: app.Context)
@import context._
@html.main(if(account.isEmpty) "New User" else "Update User"){
  @admin.html.menu("users"){
    <form method="POST" action="@if(account.isEmpty){@path/admin/users/_new} else {@path/admin/users/@account.get.userName/_edit}" validate="true">
      <div class="row-fluid">
        <div class="span6">
          <fieldset>
            <label for="userName"><strong>Username</strong></label>
            <input type="text" name="userName" id="userName" value="@account.map(_.userName)"@if(account.isDefined){ readonly}/>
            <span id="error-userName" class="error"></span>
          </fieldset>
          <fieldset>
            <label for="password"><strong>Password</strong>
              @if(account.isDefined){
                (Input to change password)
              }
            </label>
            <input type="password" name="password" id="password" value="" autocomplete="off"/>
            <span id="error-password" class="error"></span>
          </fieldset>
          <fieldset>
            <label for="mailAddress"><strong>Mail Address</strong></label>
            <input type="text" name="mailAddress" id="mailAddress" value="@account.map(_.mailAddress)"/>
            <span id="error-mailAddress" class="error"></span>
          </fieldset>
          <fieldset>
            <label><strong>User Type</strong></label>
            <label for="userType_Normal">
              <input type="radio" name="isAdmin" id="userType_Normal" value="false"@if(account.isEmpty || !account.get.isAdmin){ checked}/> Normal
            </label>
            <label for="userType_Admin">
              <input type="radio" name="isAdmin" id="userType_Admin" value="true"@if(account.isDefined && account.get.isAdmin){ checked}/> Administrator
            </label>
          </fieldset>
          <fieldset>
            <label><strong>URL (Optional)</strong></label>
            <input type="text" name="url" id="url" style="width: 400px;" value="@account.map(_.url)"/>
            <span id="error-url" class="error"></span>
          </fieldset>
        </div>
        <div class="span6">
          <fieldset>
            <label for="avatar"><strong>Image (Optional)</strong></label>
            @helper.html.uploadavatar(account)
          </fieldset>
        </div>
      </div>
      <fieldset class="margin">
        <input type="submit" class="btn btn-success" value="@if(account.isEmpty){Create User} else {Update User}"/>
        <a href="@path/admin/users" class="btn">Cancel</a>
      </fieldset>
    </form>
  }
}