function helper.html.dropdown supports filter placeholder
developer can specify filter input placeholder in dropdown menu.
1 parent 4fc221f commit e919505f4e448113e1fdb6a9ba75cb385d24d727
@Yasuhiro Takagi Yasuhiro Takagi authored on 17 May 2017
Showing 2 changed files
View
6
src/main/twirl/gitbucket/core/helper/dropdown.scala.html
@(value : String = "",
prefix: String = "",
style : String = "",
right : Boolean = false,
filter: String = "")(body: Html)
@defining(if(filter.isEmpty) "" else filter + "-" + scala.util.Random.alphanumeric.take(4).mkString){ filterId =>
filter: (String, String) = ("",""))(body: Html)
@defining(if(filter._1.isEmpty) "" else filter._1 + "-" + scala.util.Random.alphanumeric.take(4).mkString){ filterId =>
<div class="btn-group" @if(style.nonEmpty){style="@style"}>
<button
class="dropdown-toggle btn btn-default btn-sm" data-toggle="dropdown">
@if(value.isEmpty){
<span class="caret"></span>
</button>
<ul class="dropdown-menu@if(right){ pull-right}">
@if(filterId.nonEmpty) {
<li><input id="@filterId-input" type="text" class="form-control input-sm dropdown-filter-input" placeholder="@filter"/></li>
<li><input id="@filterId-input" type="text" class="form-control input-sm dropdown-filter-input" placeholder="@filter._2"/></li>
}
@body
</ul>
</div>
View
6
src/main/twirl/gitbucket/core/issues/issueinfo.scala.html
<div style="margin-bottom: 14px;">
<span class="muted small strong">Labels</span>
@if(isManageable){
<div class="pull-right">
@gitbucket.core.helper.html.dropdown("Edit", right = true, filter = "labels") {
@gitbucket.core.helper.html.dropdown("Edit", right = true, filter = ("labels", "Filter Labels")) {
@labels.map { label =>
<li>
<a href="#" class="toggle-label" data-label-id="@label.labelId">
@gitbucket.core.helper.html.checkicon(issueLabels.exists(_.labelId == label.labelId))
<div style="margin-bottom: 14px;">
<span class="muted small strong">Milestone</span>
@if(isManageable){
<div class="pull-right">
@gitbucket.core.helper.html.dropdown("Edit", right = true, filter = "milestone") {
@gitbucket.core.helper.html.dropdown("Edit", right = true, filter = ("milestone", "Filter Milestone")) {
<li><a href="javascript:void(0);" class="milestone" data-id=""><i class="octicon octicon-x"></i> Clear this milestone</a></li>
@milestones.filter(_._1.closedDate.isEmpty).map { case (milestone, _, _) =>
<li>
<a href="javascript:void(0);" class="milestone" data-id="@milestone.milestoneId" data-title="@milestone.title">
<div style="margin-bottom: 14px;">
<span class="muted small strong">Assignee</span>
@if(isManageable){
<div class="pull-right">
@gitbucket.core.helper.html.dropdown("Edit", right = true, filter = "assignee") {
@gitbucket.core.helper.html.dropdown("Edit", right = true, filter = ("assignee", "Filter Assignee")) {
<li><a href="javascript:void(0);" class="assign" data-name=""><i class="octicon octicon-x"></i> Clear assignee</a></li>
@collaborators.map { collaborator =>
<li>
<a href="javascript:void(0);" class="assign" data-name="@collaborator">