templates: add copy to clipboard for repository clone.

This commit is contained in:
Marcin Kuzminski 2017-07-20 22:29:35 +02:00
parent ff79205313
commit 8bfe9e6306
3 changed files with 20 additions and 3 deletions

View file

@ -58,12 +58,12 @@
}
#clone_url {
width: ~"calc(100% - 96px)";
width: ~"calc(100% - 103px)";
padding: @padding/4;
}
#clone_url_id {
width: ~"calc(100% - 118px)";
width: ~"calc(100% - 125px)";
padding: @padding/4;
}
@ -106,7 +106,7 @@
#clone_by_name, #clone_by_id{
display: inline-block;
margin-left: @padding;
margin-left: 0px;
}
.codeblock {

View file

@ -50,9 +50,14 @@
</div>
<div class="right-content disabled">
<input type="text" class="input-monospace" id="clone_url" disabled value="${c.clone_repo_url}"/>
<i id="clone_by_name_copy" class="tooltip icon-clipboard clipboard-action" data-clipboard-text="${c.clone_repo_url}" title="${_('Copy the clone url')}"></i>
<input type="text" class="input-monospace" id="clone_url_id" disabled value="${c.clone_repo_url_id}" style="display: none;"/>
<i id="clone_by_id_copy" class="tooltip icon-clipboard clipboard-action" data-clipboard-text="${c.clone_repo_url_id}" title="${_('Copy the clone by id url')}" style="display: none"></i>
<a id="clone_by_name" class="clone" style="display: none;">${_('Show by Name')}</a>
<a id="clone_by_id" class="clone">${_('Show by ID')}</a>
<p class="help-block">${_('SVN Protocol is disabled. To enable it, see the')} <a href="${h.route_url('enterprise_svn_setup')}" target="_blank">${_('documentation here')}</a>.</p>
</div>
%else:
@ -61,7 +66,11 @@
</div>
<div class="right-content">
<input type="text" class="input-monospace" id="clone_url" readonly="readonly" value="${c.clone_repo_url}"/>
<i id="clone_by_name_copy" class="tooltip icon-clipboard clipboard-action" data-clipboard-text="${c.clone_repo_url}" title="${_('Copy the clone url')}"></i>
<input type="text" class="input-monospace" id="clone_url_id" readonly="readonly" value="${c.clone_repo_url_id}" style="display: none;"/>
<i id="clone_by_id_copy" class="tooltip icon-clipboard clipboard-action" data-clipboard-text="${c.clone_repo_url_id}" title="${_('Copy the clone by id url')}" style="display: none"></i>
<a id="clone_by_name" class="clone" style="display: none;">${_('Show by Name')}</a>
<a id="clone_by_id" class="clone">${_('Show by ID')}</a>
</div>

View file

@ -69,6 +69,10 @@ $(document).ready(function(){
$('#clone_by_id').show();
$('#clone_url_id').hide();
// hide copy by id
$('#clone_by_name_copy').show();
$('#clone_by_id_copy').hide();
});
$('#clone_by_id').on('click',function(e){
@ -79,6 +83,10 @@ $(document).ready(function(){
// hide url by name and show id button
$('#clone_by_name').show();
$('#clone_url').hide();
// hide copy by id
$('#clone_by_id_copy').show();
$('#clone_by_name_copy').hide();
});
var initialCommitData = {