2015-12-09 09:11:41 +03:00
<div class="fitted item choose reference">
2016-08-11 15:48:08 +03:00
<div id="branch-dropdown" class="ui floating filter dropdown" data-no-results="{{.i18n.Tr "repo.pulls.no_results"}}">
<div class="ui basic small button">
2015-12-09 09:11:41 +03:00
<span class="text">
<i class="octicon octicon-git-branch"></i>
{{if .IsViewBranch}}{{.i18n.Tr "repo.branch"}}{{else}}{{.i18n.Tr "repo.tree"}}{{end}}:
<strong>{{if .IsViewBranch}}{{.BranchName}}{{else}}{{ShortSha .BranchName}}{{end}}</strong>
</span>
<i class="dropdown icon"></i>
</div>
<div class="menu">
<div class="ui icon search input">
<i class="filter icon"></i>
<input name="search" placeholder="{{.i18n.Tr "repo.filter_branch_and_tag"}}...">
</div>
<div class="header">
<div class="ui grid">
<div class="two column row">
<a class="reference column" href=" #" data-target=" #branch - list " >
2016-01-14 16:27:36 +03:00
<span class="text {{if not .IsViewTag}}black{{end}}">
2016-07-16 07:45:13 +03:00
<i class="octicon octicon-git-branch"></i> {{.i18n.Tr "repo.branches"}}
2015-12-09 09:11:41 +03:00
</span>
</a>
<a class="reference column" href=" #" data-target=" #tag - list " >
<span class="text {{if .IsViewTag}}black{{end}}">
<i class="reference tags icon"></i> {{.i18n.Tr "repo.tags"}}
</span>
</a>
</div>
</div>
</div>
<div id="branch-list" class="scrolling menu" {{if .IsViewTag}}style="display: none"{{end}}>
{{range .Branches}}
2016-08-11 15:48:08 +03:00
<div class="item {{if eq $.BranchName .}}selected{{end}}" data-url="{{$.RepoLink}}/{{if $.PageIsCommits}}commits{{else}}src{{end}}/{{EscapePound .}}{{if $.TreeName}}/{{EscapePound $.TreeName}}{{end}}">{{.}}</div>
{{end}}
{{if .IsWriter}}
<a href="javascript:void(0)" id="new-branch-item">
<i class="octicon octicon-git-branch"></i>
{{.i18n.Tr "repo.create_branch"}}: <span id="branch-name-text"></span>
<br/>
<span class="description">{{.i18n.Tr "repo.from"}} ‘ {{.BranchName}}’ </span>
<form accept-charset="UTF-8" action="{{.RepoLink}}/branches" method="post">
{{.CsrfTokenHtml}}
<input type="hidden" name="old_branch_name" value="{{.BranchName}}">
<input type="hidden" name="branch_name" id="branch-name" value="">
</form>
</a>
2015-12-09 09:11:41 +03:00
{{end}}
</div>
2016-01-14 16:27:36 +03:00
<div id="tag-list" class="scrolling menu" {{if not .IsViewTag}}style="display: none"{{end}}>
2015-12-09 09:11:41 +03:00
{{range .Tags}}
2016-08-11 15:48:08 +03:00
<div class="item {{if eq $.BranchName .}}selected{{end}}" data-url="{{$.RepoLink}}/{{if $.PageIsCommits}}commits{{else}}src{{end}}/{{EscapePound .}}{{if $.TreeName}}/{{EscapePound $.TreeName}}{{end}}">{{.}}</div>
2015-12-09 09:11:41 +03:00
{{end}}
</div>
</div>
</div>
</div>
2016-08-11 15:48:08 +03:00
{{if .IsWriter}}
<script type="text/javascript">
$(document).ready(function(){
$(' #branch - dropdown # new-branch-item').on('click', function(){
$(this).find('form').submit();
return true;
});
$(' #branch - dropdown input [ name = search ] ' ).on( ' keyup ' , function() {
var query = $(this).val().toLowerCase();
if(query.length){
var unique = true;
$(' #branch - dropdown # branch-list .item').each(function(i, item){
if($(item).text().toLowerCase() == query){
unique = false;
}
});
if(unique){
$(' #new - branch - item # branch-name-text').text(query);
$(' #new - branch - item # branch-name').val(query);
$(' #new - branch - item ' ).css( ' display ' , ' block ' );
return;
}
}
$(' #new - branch - item ' ).hide();
});
});
</script>
{{end}}