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

View File

@@ -29,20 +29,18 @@
<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>
</div>
<div class="btn-group">
<button class="btn dropdown-toggle" data-toggle="dropdown">
Sort:
<span class="strong">
@if(condition.sort == "created" && condition.direction == "desc"){ Newest }
@if(condition.sort == "created" && condition.direction == "asc" ){ Oldest }
@if(condition.sort == "comments" && condition.direction == "desc"){ Most commented }
@if(condition.sort == "comments" && condition.direction == "asc" ){ Least commented }
@if(condition.sort == "updated" && condition.direction == "desc"){ Recently updated }
@if(condition.sort == "updated" && condition.direction == "asc" ){ Least recently updated }
</span>
<span class="caret"></span>
</button>
<ul class="dropdown-menu">
@helper.html.dropdown(
value = (condition.sort, condition.direction) match {
case ("created" , "desc") => "Newest"
case ("created" , "asc" ) => "Oldest"
case ("comments", "desc") => "Most commented"
case ("comments", "asc" ) => "Least commented"
case ("updated" , "desc") => "Recently updated"
case ("updated" , "asc" ) => "Least recently updated"
},
prefix = "Sort",
mini = false
){
<li>
<a href="@condition.copy(sort="created", direction="desc").toURL">
@helper.html.checkicon(condition.sort == "created" && condition.direction == "desc") Newest
@@ -73,8 +71,7 @@
@helper.html.checkicon(condition.sort == "updated" && condition.direction == "asc") Least recently updated
</a>
</li>
</ul>
</div>
}
<table class="table table-bordered table-hover table-issues">
@if(issues.isEmpty){
<tr>

View File

@@ -20,20 +20,18 @@
<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>
</div>
<div class="btn-group">
<button class="btn dropdown-toggle" data-toggle="dropdown">
Sort:
<span class="strong">
@if(condition.sort == "created" && condition.direction == "desc"){ Newest }
@if(condition.sort == "created" && condition.direction == "asc" ){ Oldest }
@if(condition.sort == "comments" && condition.direction == "desc"){ Most commented }
@if(condition.sort == "comments" && condition.direction == "asc" ){ Least commented }
@if(condition.sort == "updated" && condition.direction == "desc"){ Recently updated }
@if(condition.sort == "updated" && condition.direction == "asc" ){ Least recently updated }
</span>
<span class="caret"></span>
</button>
<ul class="dropdown-menu">
@helper.html.dropdown(
value = (condition.sort, condition.direction) match {
case ("created" , "desc") => "Newest"
case ("created" , "asc" ) => "Oldest"
case ("comments", "desc") => "Most commented"
case ("comments", "asc" ) => "Least commented"
case ("updated" , "desc") => "Recently updated"
case ("updated" , "asc" ) => "Least recently updated"
},
prefix = "Sort",
mini = false
){
<li>
<a href="@condition.copy(sort="created", direction="desc").toURL">
@helper.html.checkicon(condition.sort == "created" && condition.direction == "desc") Newest
@@ -64,8 +62,7 @@
@helper.html.checkicon(condition.sort == "updated" && condition.direction == "asc") Least recently updated
</a>
</li>
</ul>
</div>
}
<table class="table table-bordered table-hover table-issues">
@if(issues.isEmpty){
<tr>

View File

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