Implement repository url selector

This commit is contained in:
Naoki Takezoe
2016-02-16 01:41:48 +09:00
parent 62e9c0358a
commit 120d1c2fff
2 changed files with 39 additions and 25 deletions

View File

@@ -32,8 +32,29 @@
<a href="@{url(repository)}/archive/@{encodeRefName(branch)}.zip" class="btn btn-sm btn-default">Download ZIP</a>
</div>
<div class="pull-right">
<div style="width: 200px; margin-top: 2px; margin-right: 5px; margin-left: 5px;">
<div style="width: 240px; margin-top: 2px; margin-right: 5px; margin-left: 5px;">
@helper.html.copy("repository-url-copy", repository.httpUrl){
@if(repository.sshUrl.isDefined){
<div class="btn-group input-group-btn">
<button type="button" class="btn btn-sm btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span id="repository-url-proto">HTTP</span> <span class="caret"></span>
</button>
<ul class="dropdown-menu">
<li>
<a href="javascript:void(0);" id="repository-url-http">
<strong>HTTP (recommended)</strong><br>
Clone with Git using the repository's web address.
</a>
</li>
<li>
<a href="javascript:void(0);" id="repository-url-ssh">
<strong>SSH</strong><br>
Clone with an SSH key and passphrase from your GitBucket settings.
</a>
</li>
</ul>
</div>
}
<input type="text" value="@repository.httpUrl" id="repository-url" class="form-control input-sm" readonly>
}
</div>
@@ -158,3 +179,20 @@
}
}
}
<script>
@repository.sshUrl.map { sshUrl =>
$('#repository-url-http').click(function(){
$('#repository-url-proto').text('HTTP');
$('#repository-url').val('@repository.httpUrl');
$('#repository-clone-url').attr('href', '@openRepoUrl(repository.httpUrl)')
$('#repository-url-copy').attr('data-clipboard-text', $('#repository-url').val());
});
$('#repository-url-ssh').click(function(){
$('#repository-url-proto').text('SSH');
$('#repository-url').val('@sshUrl');
$('#repository-clone-url').attr('href', '@openRepoUrl(sshUrl)');
$('#repository-url-copy').attr('data-clipboard-text', $('#repository-url').val());
});
}
</script>

View File

@@ -1185,18 +1185,6 @@ a.absent {
color: #c00;
}
/*
div.wiki-index-header {
background-color: #f5f5f5;
color: #333333;
margin: 0;
border-top-left-radius: 3px;
border-top-right-radius: 3px;
border: 1px solid #d8d8d8;
padding: 8px 8px 8px 8px;
}
*/
div.wiki-sidebar {
background-color: white;
border: 1px solid #d8d8d8;
@@ -1226,18 +1214,6 @@ div.wiki-footer {
color: gray;
}
/*
div.wiki-index-content {
background-color: white;
border: 1px solid #d8d8d8;
padding: 0px;
border-bottom-left-radius: 3px;
border-bottom-right-radius: 3px;
margin-bottom: 20px;
border-top: none;
}
*/
/****************************************************************************/
/* Commit */
/****************************************************************************/