Use helper.html.dropdown() instead of the direct Bootstrap use.

This commit is contained in:
takezoe
2013-09-23 03:13:21 +09:00
parent d53619c247
commit 7b774aee1a
4 changed files with 101 additions and 116 deletions

View File

@@ -1,13 +1,13 @@
@(buttonValue: String = "", prefix: String = "")(body: Html) @(value: String = "", prefix: String = "", mini: Boolean = true, style: String = "")(body: Html)
<div class="btn-group"> <div class="btn-group"@if(style.nonEmpty){ style="@style"}>
<button class="btn btn-mini dropdown-toggle" data-toggle="dropdown"> <button class="btn dropdown-toggle@if(mini){ btn-mini}" data-toggle="dropdown">
@if(buttonValue.isEmpty){ @if(value.isEmpty){
<i class="icon-cog"></i> <i class="icon-cog"></i>
} else { } else {
@if(prefix.nonEmpty){ @if(prefix.nonEmpty){
<span class="muted">@prefix:</span> <span class="muted">@prefix:</span>
} }
<span class="strong">@buttonValue</span> <span class="strong">@value</span>
} }
<span class="caret"></span> <span class="caret"></span>
</button> </button>

View File

@@ -29,52 +29,49 @@
<a class="btn@if(condition.state == "open"){ active}" href="@condition.copy(state = "open").toURL">@openCount Open</a> <a class="btn@if(condition.state == "open"){ active}" href="@condition.copy(state = "open").toURL">@openCount Open</a>
<a class="btn@if(condition.state == "closed"){ active}" href="@condition.copy(state = "closed").toURL">@closedCount Closed</a> <a class="btn@if(condition.state == "closed"){ active}" href="@condition.copy(state = "closed").toURL">@closedCount Closed</a>
</div> </div>
<div class="btn-group"> @helper.html.dropdown(
<button class="btn dropdown-toggle" data-toggle="dropdown"> value = (condition.sort, condition.direction) match {
Sort: case ("created" , "desc") => "Newest"
<span class="strong"> case ("created" , "asc" ) => "Oldest"
@if(condition.sort == "created" && condition.direction == "desc"){ Newest } case ("comments", "desc") => "Most commented"
@if(condition.sort == "created" && condition.direction == "asc" ){ Oldest } case ("comments", "asc" ) => "Least commented"
@if(condition.sort == "comments" && condition.direction == "desc"){ Most commented } case ("updated" , "desc") => "Recently updated"
@if(condition.sort == "comments" && condition.direction == "asc" ){ Least commented } case ("updated" , "asc" ) => "Least recently updated"
@if(condition.sort == "updated" && condition.direction == "desc"){ Recently updated } },
@if(condition.sort == "updated" && condition.direction == "asc" ){ Least recently updated } prefix = "Sort",
</span> mini = false
<span class="caret"></span> ){
</button> <li>
<ul class="dropdown-menu"> <a href="@condition.copy(sort="created", direction="desc").toURL">
<li> @helper.html.checkicon(condition.sort == "created" && condition.direction == "desc") Newest
<a href="@condition.copy(sort="created", direction="desc").toURL"> </a>
@helper.html.checkicon(condition.sort == "created" && condition.direction == "desc") Newest </li>
</a> <li>
</li> <a href="@condition.copy(sort="created", direction="asc" ).toURL">
<li> @helper.html.checkicon(condition.sort == "created" && condition.direction == "asc") Oldest
<a href="@condition.copy(sort="created", direction="asc" ).toURL"> </a>
@helper.html.checkicon(condition.sort == "created" && condition.direction == "asc") Oldest </li>
</a> <li>
</li> <a href="@condition.copy(sort="comments", direction="desc").toURL">
<li> @helper.html.checkicon(condition.sort == "comments" && condition.direction == "desc") Most commented
<a href="@condition.copy(sort="comments", direction="desc").toURL"> </a>
@helper.html.checkicon(condition.sort == "comments" && condition.direction == "desc") Most commented </li>
</a> <li>
</li> <a href="@condition.copy(sort="comments", direction="asc" ).toURL">
<li> @helper.html.checkicon(condition.sort == "comments" && condition.direction == "asc") Least commented
<a href="@condition.copy(sort="comments", direction="asc" ).toURL"> </a>
@helper.html.checkicon(condition.sort == "comments" && condition.direction == "asc") Least commented </li>
</a> <li>
</li> <a href="@condition.copy(sort="updated", direction="desc").toURL">
<li> @helper.html.checkicon(condition.sort == "updated" && condition.direction == "desc") Recently updated
<a href="@condition.copy(sort="updated", direction="desc").toURL"> </a>
@helper.html.checkicon(condition.sort == "updated" && condition.direction == "desc") Recently updated </li>
</a> <li>
</li> <a href="@condition.copy(sort="updated", direction="asc" ).toURL">
<li> @helper.html.checkicon(condition.sort == "updated" && condition.direction == "asc") Least recently updated
<a href="@condition.copy(sort="updated", direction="asc" ).toURL"> </a>
@helper.html.checkicon(condition.sort == "updated" && condition.direction == "asc") Least recently updated </li>
</a> }
</li>
</ul>
</div>
<table class="table table-bordered table-hover table-issues"> <table class="table table-bordered table-hover table-issues">
@if(issues.isEmpty){ @if(issues.isEmpty){
<tr> <tr>

View File

@@ -20,52 +20,49 @@
<a class="btn@if(condition.state == "open"){ active}" href="@condition.copy(state = "open").toURL">@openCount Open</a> <a class="btn@if(condition.state == "open"){ active}" href="@condition.copy(state = "open").toURL">@openCount Open</a>
<a class="btn@if(condition.state == "closed"){ active}" href="@condition.copy(state = "closed").toURL">@closedCount Closed</a> <a class="btn@if(condition.state == "closed"){ active}" href="@condition.copy(state = "closed").toURL">@closedCount Closed</a>
</div> </div>
<div class="btn-group"> @helper.html.dropdown(
<button class="btn dropdown-toggle" data-toggle="dropdown"> value = (condition.sort, condition.direction) match {
Sort: case ("created" , "desc") => "Newest"
<span class="strong"> case ("created" , "asc" ) => "Oldest"
@if(condition.sort == "created" && condition.direction == "desc"){ Newest } case ("comments", "desc") => "Most commented"
@if(condition.sort == "created" && condition.direction == "asc" ){ Oldest } case ("comments", "asc" ) => "Least commented"
@if(condition.sort == "comments" && condition.direction == "desc"){ Most commented } case ("updated" , "desc") => "Recently updated"
@if(condition.sort == "comments" && condition.direction == "asc" ){ Least commented } case ("updated" , "asc" ) => "Least recently updated"
@if(condition.sort == "updated" && condition.direction == "desc"){ Recently updated } },
@if(condition.sort == "updated" && condition.direction == "asc" ){ Least recently updated } prefix = "Sort",
</span> mini = false
<span class="caret"></span> ){
</button> <li>
<ul class="dropdown-menu"> <a href="@condition.copy(sort="created", direction="desc").toURL">
<li> @helper.html.checkicon(condition.sort == "created" && condition.direction == "desc") Newest
<a href="@condition.copy(sort="created", direction="desc").toURL"> </a>
@helper.html.checkicon(condition.sort == "created" && condition.direction == "desc") Newest </li>
</a> <li>
</li> <a href="@condition.copy(sort="created", direction="asc" ).toURL">
<li> @helper.html.checkicon(condition.sort == "created" && condition.direction == "asc") Oldest
<a href="@condition.copy(sort="created", direction="asc" ).toURL"> </a>
@helper.html.checkicon(condition.sort == "created" && condition.direction == "asc") Oldest </li>
</a> <li>
</li> <a href="@condition.copy(sort="comments", direction="desc").toURL">
<li> @helper.html.checkicon(condition.sort == "comments" && condition.direction == "desc") Most commented
<a href="@condition.copy(sort="comments", direction="desc").toURL"> </a>
@helper.html.checkicon(condition.sort == "comments" && condition.direction == "desc") Most commented </li>
</a> <li>
</li> <a href="@condition.copy(sort="comments", direction="asc" ).toURL">
<li> @helper.html.checkicon(condition.sort == "comments" && condition.direction == "asc") Least commented
<a href="@condition.copy(sort="comments", direction="asc" ).toURL"> </a>
@helper.html.checkicon(condition.sort == "comments" && condition.direction == "asc") Least commented </li>
</a> <li>
</li> <a href="@condition.copy(sort="updated", direction="desc").toURL">
<li> @helper.html.checkicon(condition.sort == "updated" && condition.direction == "desc") Recently updated
<a href="@condition.copy(sort="updated", direction="desc").toURL"> </a>
@helper.html.checkicon(condition.sort == "updated" && condition.direction == "desc") Recently updated </li>
</a> <li>
</li> <a href="@condition.copy(sort="updated", direction="asc" ).toURL">
<li> @helper.html.checkicon(condition.sort == "updated" && condition.direction == "asc") Least recently updated
<a href="@condition.copy(sort="updated", direction="asc" ).toURL"> </a>
@helper.html.checkicon(condition.sort == "updated" && condition.direction == "asc") Least recently updated </li>
</a> }
</li>
</ul>
</div>
<table class="table table-bordered table-hover table-issues"> <table class="table table-bordered table-hover table-issues">
@if(issues.isEmpty){ @if(issues.isEmpty){
<tr> <tr>

View File

@@ -5,25 +5,16 @@
<ul class="nav nav-tabs"> <ul class="nav nav-tabs">
@if(!hideBranchPulldown){ @if(!hideBranchPulldown){
<li> <li>
<div class="btn-group" style="margin-right: 20px;"> @helper.html.dropdown(
<button class="btn dropdown-toggle" data-toggle="dropdown"> value = if(id.length == 40) id.substring(0, 10) else id,
@if(id.length == 40){ prefix = if(id.length == 40) "tree" else if(repository.branchList.contains(id)) "branch" else "tree",
tree: <span class="strong">@id.substring(0, 10)</span> mini = false,
} style = "margin-right: 20px;"
@if(repository.branchList.contains(id)){ ){
branch: <span class="strong">@id</span> @repository.branchList.map { branch =>
} <li><a href="@url(repository)/@if(active=="commits"){commits} else {tree}/@branch">@helper.html.checkicon(id == branch) @branch</a></li>
@if(repository.tags.exists(_.name == id)){ }
tag: <span class="strong">@id</span> }
}
<span class="caret"></span>
</button>
<ul class="dropdown-menu">
@repository.branchList.map { branch =>
<li><a href="@url(repository)/@if(active=="commits"){commits} else {tree}/@branch">@helper.html.checkicon(id == branch) @branch</a></li>
}
</ul>
</div>
</li> </li>
} }
<li@if(active=="files" ){ class="active"}><a href="@url(repository)/tree/@id">Files</a></li> <li@if(active=="files" ){ class="active"}><a href="@url(repository)/tree/@id">Files</a></li>