Add Settings page.

This commit is contained in:
takezoe
2013-05-18 14:14:41 +09:00
parent 2aaf9adf59
commit c71e18a4ef
6 changed files with 104 additions and 2 deletions

View File

@@ -8,6 +8,7 @@ class ScalatraBootstrap extends LifeCycle {
context.mount(new WikiController, "/*") context.mount(new WikiController, "/*")
context.mount(new CreateRepositoryController, "/*") context.mount(new CreateRepositoryController, "/*")
context.mount(new RepositoryViewerController, "/*") context.mount(new RepositoryViewerController, "/*")
context.mount(new SettingsController, "/*")
context.addListener(new ServletContextListener(){ context.addListener(new ServletContextListener(){
def contextInitialized(e: ServletContextEvent): Unit = { def contextInitialized(e: ServletContextEvent): Unit = {

View File

@@ -0,0 +1,14 @@
package app
import util.JGitUtil
class SettingsController extends ControllerBase {
get("/:owner/:repository/settings") {
val owner = params("owner")
val repository = params("repository")
html.settings(JGitUtil.getRepositoryInfo(owner, repository, servletContext))
}
}

View File

@@ -4,7 +4,7 @@
@diffs.zipWithIndex.map { case (diff, i) => @diffs.zipWithIndex.map { case (diff, i) =>
<table class="table table-bordered"> <table class="table table-bordered">
<tr> <tr>
<th style="font-weight: normal;"> <th style="font-weight: normal;" class="box-header">
@if(diff.changeType == ChangeType.COPY || diff.changeType == ChangeType.RENAME){ @if(diff.changeType == ChangeType.COPY || diff.changeType == ChangeType.RENAME){
@diff.oldPath -> @diff.newPath @diff.oldPath -> @diff.newPath
} }

View File

@@ -9,7 +9,7 @@
<li@if(active=="code"){ class="active"}><a href="@path/@repository.owner/@repository.name">Code</a></li> <li@if(active=="code"){ class="active"}><a href="@path/@repository.owner/@repository.name">Code</a></li>
<li@if(active=="issue"){ class="active"}><a href="#">Issue</a></li> <li@if(active=="issue"){ class="active"}><a href="#">Issue</a></li>
<li@if(active=="wiki"){ class="active"}><a href="@path/@repository.owner/@repository.name/wiki">Wiki</a></li> <li@if(active=="wiki"){ class="active"}><a href="@path/@repository.owner/@repository.name/wiki">Wiki</a></li>
<li@if(active=="settings"){ class="active"}><a href="#">Settings</a></li> <li@if(active=="settings"){ class="active"}><a href="@path/@repository.owner/@repository.name/settings">Settings</a></li>
</ul> </ul>
</div> </div>
</div> </div>

View File

@@ -0,0 +1,39 @@
@(repository: app.RepositoryInfo)(implicit context: app.Context)
@import context._
@main("Settings"){
@header("settings", repository)
<form id="form" method="post" action="@path/new" validate="true">
<div class="box">
<div class="box-header">Settings</div>
<div class="box-content">
<fieldset>
<label for="defaultBranch"><strong>Default Branch</strong></label>
<select name="defaultBranch" id="defaultBranch">
<option value="master">master</option>
</select>
</fieldset>
</div>
</div>
<div class="box">
<div class="box-header">Features</div>
<div class="box-content">
<dl>
<dt>
<label class="checkbox">
<input type="checkbox" name="wiki" id="wiki"/> <strong>Wiki</strong>
</label>
</dt>
<dt>
<label class="checkbox">
<input type="checkbox" name="issue" id="issue"/> <strong>Issue</strong>
</label>
</dt>
</dl>
</div>
</div>
<fieldset>
<input type="submit" class="btn btn-primary" value="Apply changes"/>
<input type="submit" class="btn btn-danger" value="Delete this repository"/>
</fieldset>
</form>
}

View File

@@ -73,4 +73,52 @@ h1.wiki-title {
background-color: white; background-color: white;
cursor: default; cursor: default;
width: 350px; width: 350px;
}
div.box {
background-color: #efefef;
padding: 2px;
margin-bottom: 20px;
}
div.box-header {
font-size: 120%;
font-weight: bold;
background-color: #e0e0e0;
background-image: -moz-linear-gradient(#fafafa, #e0e0e0);
background-image: -webkit-linear-gradient(#fafafa, #e0e0e0);
background-image: linear-gradient(#fafafa, #e0e0e0);
background-repeat: repeat-x;
margin: 0;
border-top-left-radius: 1px;
border-top-right-radius: 1px;
border: 1px solid #d8d8d8;
border-bottom: none;
padding: 10px 10px 11px 10px;
text-shadow: 0 1px 0 #fff
}
div.box-content {
background-color: white;
border: 1px solid silver;
padding: 4px;
}
th.box-header {
background-color: #e0e0e0;
background-image: -moz-linear-gradient(#fafafa, #e0e0e0);
background-image: -webkit-linear-gradient(#fafafa, #e0e0e0);
background-image: linear-gradient(#fafafa, #e0e0e0);
background-repeat: repeat-x;
margin: 0;
border-top-left-radius: 1px;
border-top-right-radius: 1px;
border: 1px solid #d8d8d8;
border-bottom: none;
text-shadow: 0 1px 0 #fff
}
dl {
margin: 0px;
} }