mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-07 22:15:51 +01:00
Add copy to clipboard clone URL
This commit is contained in:
@@ -26,6 +26,7 @@
|
|||||||
<script src="@assets/datepicker/js/bootstrap-datepicker.js"></script>
|
<script src="@assets/datepicker/js/bootstrap-datepicker.js"></script>
|
||||||
<script src="@assets/colorpicker/js/bootstrap-colorpicker.js"></script>
|
<script src="@assets/colorpicker/js/bootstrap-colorpicker.js"></script>
|
||||||
<script src="@assets/google-code-prettify/prettify.js"></script>
|
<script src="@assets/google-code-prettify/prettify.js"></script>
|
||||||
|
<script src="@assets/zclip/ZeroClipboard.min.js"></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="navbar">
|
<div class="navbar">
|
||||||
|
|||||||
@@ -30,9 +30,10 @@
|
|||||||
<li@if(active=="commits"){ class="active"}><a href="@url(repository)/commits/@id">Commits</a></li>
|
<li@if(active=="commits"){ class="active"}><a href="@url(repository)/commits/@id">Commits</a></li>
|
||||||
<li@if(active=="tags"){ class="active"}><a href="@url(repository)/tags">Tags@if(repository.tags.length > 0){ <span class="badge">@repository.tags.length</span>}</a></li>
|
<li@if(active=="tags"){ class="active"}><a href="@url(repository)/tags">Tags@if(repository.tags.length > 0){ <span class="badge">@repository.tags.length</span>}</a></li>
|
||||||
<li class="pull-right">
|
<li class="pull-right">
|
||||||
<div class="input-prepend">
|
<div class="input-prepend input-append">
|
||||||
<span class="add-on">HTTP</span>
|
<span class="add-on">HTTP</span>
|
||||||
<input type="text" value="@repository.url" id="repository-url" readonly>
|
<input type="text" value="@repository.url" id="repository-url" readonly>
|
||||||
|
<span id="repository-url-copy" class="add-on" data-clipboard-text="@repository.url" data-placement="bottom" title="copy to clipboard"><i class="icon-check"></i></span>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|||||||
@@ -6,9 +6,10 @@
|
|||||||
<li@if(active == "pages"){ class="active"}><a href="@url(repository)/wiki/_pages">Pages</a></li>
|
<li@if(active == "pages"){ class="active"}><a href="@url(repository)/wiki/_pages">Pages</a></li>
|
||||||
<li@if(active == "history"){ class="active"}><a href="@url(repository)/wiki/_history">Wiki History</a></li>
|
<li@if(active == "history"){ class="active"}><a href="@url(repository)/wiki/_history">Wiki History</a></li>
|
||||||
<li class="pull-right">
|
<li class="pull-right">
|
||||||
<div class="input-prepend">
|
<div class="input-prepend input-append">
|
||||||
<span class="add-on">HTTP</span>
|
<span class="add-on">HTTP</span>
|
||||||
<input type="text" value="@repository.url.replaceFirst("\\.git$", ".wiki.git")" readonly id="repository-url">
|
<input type="text" value="@repository.url.replaceFirst("\\.git$", ".wiki.git")" readonly id="repository-url">
|
||||||
|
<span id="repository-url-copy" class="add-on" data-clipboard-text="@repository.url.replaceFirst("\\.git$", ".wiki.git")" data-placement="bottom" title="copy to clipboard"><i class="icon-check"></i></span>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|||||||
@@ -8,5 +8,34 @@ $(function(){
|
|||||||
$('img[data-toggle=tooltip]').tooltip();
|
$('img[data-toggle=tooltip]').tooltip();
|
||||||
$('a[data-toggle=tooltip]').tooltip();
|
$('a[data-toggle=tooltip]').tooltip();
|
||||||
|
|
||||||
|
// copy to clipboard
|
||||||
|
(function() {
|
||||||
|
// Find ZeroClipboard.swf file URI from ZeroClipboard JavaScript file path.
|
||||||
|
// NOTE(tanacasino) I think this way is wrong... but i don't know correct way.
|
||||||
|
var moviePath = (function() {
|
||||||
|
var zclipjs = "ZeroClipboard.min.js";
|
||||||
|
var scripts = document.getElementsByTagName("script");
|
||||||
|
var i = scripts.length;
|
||||||
|
while(i--) {
|
||||||
|
var match = scripts[i].src.match(zclipjs + "$");
|
||||||
|
if(match) {
|
||||||
|
return match.input.substr(0, match.input.length - 6) + 'swf';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
var clip = new ZeroClipboard($("#repository-url-copy"), {
|
||||||
|
moviePath: moviePath
|
||||||
|
});
|
||||||
|
var title = $('#repository-url-copy').attr('title');
|
||||||
|
clip.on('complete', function(client, args) {
|
||||||
|
$(clip.htmlBridge).attr('title', 'copied!').tooltip('fixTitle').tooltip('show');
|
||||||
|
$(clip.htmlBridge).attr('title', title).tooltip('fixTitle');
|
||||||
|
});
|
||||||
|
$(clip.htmlBridge).tooltip({
|
||||||
|
title: title,
|
||||||
|
placement: $('#repository-url-copy').attr('data-placement')
|
||||||
|
});
|
||||||
|
})();
|
||||||
|
|
||||||
prettyPrint();
|
prettyPrint();
|
||||||
});
|
});
|
||||||
|
|||||||
8
src/main/webapp/assets/zclip/ZeroClipboard.min.js
vendored
Normal file
8
src/main/webapp/assets/zclip/ZeroClipboard.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
BIN
src/main/webapp/assets/zclip/ZeroClipboard.swf
Normal file
BIN
src/main/webapp/assets/zclip/ZeroClipboard.swf
Normal file
Binary file not shown.
Reference in New Issue
Block a user