Use static values instead of magic number.

This commit is contained in:
takezoe
2013-06-04 20:16:17 +09:00
parent 4ef5fddaf5
commit e58282a532
4 changed files with 12 additions and 8 deletions

View File

@@ -1,5 +1,6 @@
@(account: Option[model.Account])(implicit context: app.Context) @(account: Option[model.Account])(implicit context: app.Context)
@import context._ @import context._
@import service.AccountService._
@html.main(if(account.isEmpty) "New User" else "Update User"){ @html.main(if(account.isEmpty) "New User" else "Update User"){
<form method="POST" action="@if(account.isEmpty){@path/admin/users/_new} else {@path/admin/users/@account.get.userName/_edit}" validate="true"> <form method="POST" action="@if(account.isEmpty){@path/admin/users/_new} else {@path/admin/users/@account.get.userName/_edit}" validate="true">
<fieldset> <fieldset>
@@ -20,10 +21,10 @@
<fieldset> <fieldset>
<label><strong>User Type</strong></label> <label><strong>User Type</strong></label>
<label for="userType_Normal"> <label for="userType_Normal">
<input type="radio" name="userType" id="userType_Normal" value="0"@if(account.isEmpty || account.get.userType==0){ checked}/> Normal <input type="radio" name="userType" id="userType_Normal" value="@Normal"@if(account.isEmpty || account.get.userType==Normal){ checked}/> Normal
</label> </label>
<label for="userType_Admin"> <label for="userType_Admin">
<input type="radio" name="userType" id="userType_Admin" value="1"@if(account.isDefined && account.get.userType==1){ checked}/> Administrator <input type="radio" name="userType" id="userType_Admin" value="@Administrator"@if(account.isDefined && account.get.userType==Administrator){ checked}/> Administrator
</label> </label>
</fieldset> </fieldset>
<fieldset> <fieldset>

View File

@@ -1,10 +1,11 @@
@(users: List[model.Account])(implicit context: app.Context) @(users: List[model.Account])(implicit context: app.Context)
@import context._ @import context._
@import service.AccountService._
@html.main("Manage Users"){ @html.main("Manage Users"){
<div style="text-align: right; margin-bottom: 4px;"> <div style="text-align: right; margin-bottom: 4px;">
<a href="@path/admin/users/_new" class="btn">New User</a> <a href="@path/admin/users/_new" class="btn">New User</a>
</div> </div>
<table class="table table-borderd"> <table class="table table-borderd table-hover">
<tr> <tr>
<th>Username</th> <th>Username</th>
<th>Mail Address</th> <th>Mail Address</th>
@@ -19,10 +20,10 @@
<td><a href="@path/admin/users/@account.userName/_edit">@account.userName</a></td> <td><a href="@path/admin/users/@account.userName/_edit">@account.userName</a></td>
<td>@account.mailAddress</td> <td>@account.mailAddress</td>
<td> <td>
@if(account.userType == service.AccountService.Normal){ @if(account.userType == Normal){
Normal Normal
} }
@if(account.userType == service.AccountService.Administrator){ @if(account.userType == Administrator){
Administrator Administrator
} }
</td> </td>

View File

@@ -1,5 +1,6 @@
@(active: String, repository: service.RepositoryService.RepositoryInfo)(implicit context: app.Context) @(active: String, repository: service.RepositoryService.RepositoryInfo)(implicit context: app.Context)
@import context._ @import context._
@import service.AccountService._
<div class="head"> <div class="head">
<a href="@path/@repository.owner">@repository.owner</a> / <a href="@path/@repository.owner/@repository.name">@repository.name</a> <a href="@path/@repository.owner">@repository.owner</a> / <a href="@path/@repository.owner/@repository.name">@repository.name</a>
</div> </div>
@@ -14,7 +15,7 @@
<th class="box-header@if(active=="wiki"){ active}"> <th class="box-header@if(active=="wiki"){ active}">
<a href="@path/@repository.owner/@repository.name/wiki">Wiki</a> <a href="@path/@repository.owner/@repository.name/wiki">Wiki</a>
</th> </th>
@if(loginAccount.isDefined && (loginAccount.get.userType == 1 || loginAccount.get.userName == repository.owner)){ @if(loginAccount.isDefined && (loginAccount.get.userType == Administrator || loginAccount.get.userName == repository.owner)){
<th class="box-header@if(active=="settings"){ active}"> <th class="box-header@if(active=="settings"){ active}">
<a href="@path/@repository.owner/@repository.name/settings">Settings</a> <a href="@path/@repository.owner/@repository.name/settings">Settings</a>
</th> </th>

View File

@@ -1,5 +1,6 @@
@(repository: service.RepositoryService.RepositoryInfo)(implicit context: app.Context) @(repository: service.RepositoryService.RepositoryInfo)(implicit context: app.Context)
@import context._ @import context._
@import service.RepositoryService._
@html.main("Settings"){ @html.main("Settings"){
@html.header("settings", repository) @html.header("settings", repository)
@menu("options", repository){ @menu("options", repository){
@@ -24,11 +25,11 @@
<fieldset> <fieldset>
<label><strong>Repository Type</strong></label> <label><strong>Repository Type</strong></label>
<label> <label>
<input type="radio" name="repositoryType" value="0"@if(repository.repository.repositoryType==0){ checked}> <input type="radio" name="repositoryType" value="@Public"@if(repository.repository.repositoryType==Public){ checked}>
<strong>Public</strong> - All users and guests can read this repository. <strong>Public</strong> - All users and guests can read this repository.
</label> </label>
<label> <label>
<input type="radio" name="repositoryType" value="1"@if(repository.repository.repositoryType==1){ checked}> <input type="radio" name="repositoryType" value="@Private"@if(repository.repository.repositoryType==Private){ checked}>
<strong>Private</strong> - Only collaborators can read this repository. <strong>Private</strong> - Only collaborators can read this repository.
</label> </label>
</fieldset> </fieldset>