mirror of
https://github.com/klaussilveira/gitlist.git
synced 2025-11-18 03:30:55 +01:00
Merge pull request #688 from Hologos/feature/clone-button
Displays remote URL for SSH and/or HTTP(s).
This commit is contained in:
@@ -17,6 +17,19 @@ cache = true
|
||||
theme = "default"
|
||||
title = ""
|
||||
|
||||
[clone_button]
|
||||
; ssh remote
|
||||
show_ssh_remote = false ; display remote URL for SSH
|
||||
ssh_user = 'git' ; user to use for cloning via SSH
|
||||
|
||||
; http remote
|
||||
show_http_remote = false ; display remote URL for HTTP
|
||||
use_https = true ; generate URL with https://
|
||||
url_subdir = 'git/' ; if cloning via HTTP is triggered using virtual dir (e.g. https://example.com/git/repo.git)
|
||||
; has to end with trailing slash
|
||||
http_user = '' ; user to use for cloning via HTTP (default: none)
|
||||
http_user_dynamic = false ; when enabled, http_user is set to $_SERVER['PHP_AUTH_USER']
|
||||
|
||||
; If you need to specify custom filetypes for certain extensions, do this here
|
||||
[filetypes]
|
||||
; extension = type
|
||||
|
||||
@@ -39,6 +39,12 @@ class Application extends SilexApplication
|
||||
$this['cache.archives'] = $this->getCachePath() . 'archives';
|
||||
$this['avatar.url'] = $config->get('avatar', 'url');
|
||||
$this['avatar.query'] = $config->get('avatar', 'query');
|
||||
$this['show_http_remote'] = $config->get('clone_button', 'show_http_remote');
|
||||
$this['use_https'] = $config->get('clone_button', 'use_https');
|
||||
$this['url_subdir'] = $config->get('clone_button', 'url_subdir');
|
||||
$this['http_user'] = $config->get('clone_button', 'http_user_dynamic') ? $_SERVER['PHP_AUTH_USER'] : $config->get('clone_button', 'http_user');
|
||||
$this['show_ssh_remote'] = $config->get('clone_button', 'show_ssh_remote');
|
||||
$this['ssh_user'] = $config->get('clone_button', 'ssh_user');
|
||||
|
||||
// Register services
|
||||
$this->register(new TwigServiceProvider(), array(
|
||||
|
||||
4
themes/bootstrap3/css/fontawesome.css
vendored
4
themes/bootstrap3/css/fontawesome.css
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -25,6 +25,48 @@ $(function () {
|
||||
$('#md-content').html(converter.makeHtml($('#md-content').text()));
|
||||
}
|
||||
|
||||
var clonePopup = $('#clone-popup')
|
||||
var cloneButtonShow = $('#clone-button-show');
|
||||
var cloneButtonHide = $('#clone-button-hide');
|
||||
var cloneButtonSSH = $('#clone-button-ssh');
|
||||
var cloneButtonHTTP = $('#clone-button-http');
|
||||
var cloneInputSSH = $('#clone-input-ssh');
|
||||
var cloneInputHTTP = $('#clone-input-http');
|
||||
|
||||
cloneButtonShow.click(function()
|
||||
{
|
||||
clonePopup.fadeIn();
|
||||
});
|
||||
|
||||
cloneButtonHide.click(function()
|
||||
{
|
||||
clonePopup.fadeOut();
|
||||
});
|
||||
|
||||
cloneButtonSSH.click(function()
|
||||
{
|
||||
if(cloneButtonSSH.hasClass('active'))
|
||||
return;
|
||||
|
||||
cloneButtonSSH.addClass('active');
|
||||
cloneInputSSH.show();
|
||||
|
||||
cloneButtonHTTP.removeClass('active');
|
||||
cloneInputHTTP.hide();
|
||||
});
|
||||
|
||||
cloneButtonHTTP.click(function()
|
||||
{
|
||||
if(cloneButtonHTTP.hasClass('active'))
|
||||
return;
|
||||
|
||||
cloneButtonHTTP.addClass('active');
|
||||
cloneInputHTTP.show();
|
||||
|
||||
cloneButtonSSH.removeClass('active');
|
||||
cloneInputSSH.hide();
|
||||
});
|
||||
|
||||
function paginate() {
|
||||
var $pager = $('.pager');
|
||||
|
||||
|
||||
48
themes/bootstrap3/less/clone-button.less
Normal file
48
themes/bootstrap3/less/clone-button.less
Normal file
@@ -0,0 +1,48 @@
|
||||
#clone-popup
|
||||
{
|
||||
display: none;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background:rgba(0, 0, 0, 0.60);
|
||||
z-index: 9999;
|
||||
}
|
||||
|
||||
#clone-popup > #clone-popup-inner-wrapper
|
||||
{
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
margin: -60px 0 0 -300px;
|
||||
padding: 20px;
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 5px;
|
||||
box-sizing: content-box;
|
||||
width: 560px;
|
||||
height: 80px;
|
||||
text-align: center;
|
||||
background-color: white;
|
||||
}
|
||||
|
||||
#clone-popup > #clone-popup-inner-wrapper > .btn-group
|
||||
{
|
||||
display: inline-block;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
#clone-popup > #clone-popup-inner-wrapper > .form-control
|
||||
{
|
||||
width: 95%
|
||||
}
|
||||
|
||||
#clone-popup > #clone-popup-inner-wrapper > .form-control
|
||||
{
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
#clone-popup > #clone-popup-inner-wrapper > .form-control:not(.visible)
|
||||
{
|
||||
display: none;
|
||||
}
|
||||
@@ -8,6 +8,7 @@
|
||||
@import "gitlist.less";
|
||||
@import "codemirror.less";
|
||||
@import "network.less";
|
||||
@import "clone-button.less";
|
||||
|
||||
|
||||
.header {
|
||||
|
||||
@@ -9,6 +9,9 @@
|
||||
{% block extra %}
|
||||
<div class="pull-right">
|
||||
<div class="btn-group download-buttons">
|
||||
{% if app.show_http_remote or app.show_ssh_remote %}
|
||||
<a type="button" href="#" class="btn btn-default btn-xs" title="Show remotes to clone this repository." id="clone-button-show">Clone</a>
|
||||
{% endif %}
|
||||
<a type="button" href="{{ path('archive', {repo: repo, branch: branch, format: 'zip'}) }}" class="btn btn-default btn-xs" title="Download '{{ branch }}' as a ZIP archive">ZIP</a>
|
||||
<a type="button" href="{{ path('archive', {repo: repo, branch: branch, format: 'tar'}) }}" class="btn btn-default btn-xs" title="Download '{{ branch }}' as a TAR archive">TAR</a>
|
||||
</div>
|
||||
@@ -16,6 +19,27 @@
|
||||
<a href="{{ path('rss', {repo: repo, branch: branch}) }}"><span class="fa fa-rss rss-icon"></span></a>
|
||||
</div>
|
||||
</div>
|
||||
{% if app.show_http_remote or app.show_ssh_remote %}
|
||||
<div id="clone-popup">
|
||||
<div id="clone-popup-inner-wrapper">
|
||||
<a class="close" href="#" id="clone-button-hide">×</a>
|
||||
<div class="btn-group">
|
||||
{% if app.show_ssh_remote %}
|
||||
<button type="button" class="btn btn-default{{ app.show_ssh_remote and app.show_http_remote ? ' active' }}" id="clone-button-ssh">SSH</button>
|
||||
{% endif %}
|
||||
{% if app.show_http_remote %}
|
||||
<button type="button" class="btn btn-default" id="clone-button-http">HTTPS</button>
|
||||
{% endif %}
|
||||
</div><br />
|
||||
{% if app.show_ssh_remote %}
|
||||
<input type="text" class="form-control{{ app.show_ssh_remote ? ' visible' }}" id="clone-input-ssh" value="git clone {{ app.ssh_user }}@{{ app.request.host }}:{{ repo }}">
|
||||
{% endif %}
|
||||
{% if app.show_http_remote %}
|
||||
<input type="text" class="form-control{{ app.show_ssh_remote is empty and app.show_http_remote ? ' visible' }}" id="clone-input-http" value="git clone http{{ app.use_https ? 's' }}://{{ app.http_user }}{{ app.http_user ? '@' }}{{ app.request.host }}/{{ app.url_subdir }}{{ repo }}">
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
{% endembed %}
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -27,6 +27,48 @@ $(function () {
|
||||
md_content.html(converter.makeHtml(md_content.text()));
|
||||
}
|
||||
|
||||
var clonePopup = $('#clone-popup')
|
||||
var cloneButtonShow = $('#clone-button-show');
|
||||
var cloneButtonHide = $('#clone-button-hide');
|
||||
var cloneButtonSSH = $('#clone-button-ssh');
|
||||
var cloneButtonHTTP = $('#clone-button-http');
|
||||
var cloneInputSSH = $('#clone-input-ssh');
|
||||
var cloneInputHTTP = $('#clone-input-http');
|
||||
|
||||
cloneButtonShow.click(function()
|
||||
{
|
||||
clonePopup.fadeIn();
|
||||
});
|
||||
|
||||
cloneButtonHide.click(function()
|
||||
{
|
||||
clonePopup.fadeOut();
|
||||
});
|
||||
|
||||
cloneButtonSSH.click(function()
|
||||
{
|
||||
if(cloneButtonSSH.hasClass('active'))
|
||||
return;
|
||||
|
||||
cloneButtonSSH.addClass('active');
|
||||
cloneInputSSH.show();
|
||||
|
||||
cloneButtonHTTP.removeClass('active');
|
||||
cloneInputHTTP.hide();
|
||||
});
|
||||
|
||||
cloneButtonHTTP.click(function()
|
||||
{
|
||||
if(cloneButtonHTTP.hasClass('active'))
|
||||
return;
|
||||
|
||||
cloneButtonHTTP.addClass('active');
|
||||
cloneInputHTTP.show();
|
||||
|
||||
cloneButtonSSH.removeClass('active');
|
||||
cloneInputSSH.hide();
|
||||
});
|
||||
|
||||
function paginate() {
|
||||
var $pager = $('.pager');
|
||||
|
||||
|
||||
3
themes/default/less/bootstrap.less
vendored
3
themes/default/less/bootstrap.less
vendored
@@ -60,6 +60,9 @@
|
||||
@import "carousel.less";
|
||||
@import "hero-unit.less";
|
||||
|
||||
// Clone button
|
||||
@import "clone-button.less";
|
||||
|
||||
// Utility classes
|
||||
@import "utilities.less"; // Has to be last to override when necessary
|
||||
@import "codemirror.less";
|
||||
|
||||
46
themes/default/less/clone-button.less
Normal file
46
themes/default/less/clone-button.less
Normal file
@@ -0,0 +1,46 @@
|
||||
#clone-popup
|
||||
{
|
||||
display: none;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background:rgba(0, 0, 0, 0.60);
|
||||
}
|
||||
|
||||
#clone-popup > #clone-popup-inner-wrapper
|
||||
{
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
margin: -55px 0 0 -300px;
|
||||
padding: 20px;
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 5px;
|
||||
width: 560px;
|
||||
height: 70px;
|
||||
text-align: center;
|
||||
background-color: white;
|
||||
}
|
||||
|
||||
#clone-popup > #clone-popup-inner-wrapper > .btn-group
|
||||
{
|
||||
display: inline-block;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
#clone-popup > #clone-popup-inner-wrapper > .form-control
|
||||
{
|
||||
width: 95%
|
||||
}
|
||||
|
||||
#clone-popup > #clone-popup-inner-wrapper > .form-control
|
||||
{
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
#clone-popup > #clone-popup-inner-wrapper > .form-control:not(.visible)
|
||||
{
|
||||
display: none;
|
||||
}
|
||||
@@ -9,11 +9,35 @@
|
||||
{% block extra %}
|
||||
<div class="pull-right">
|
||||
<div class="btn-group download-buttons">
|
||||
{% if app.show_http_remote or app.show_ssh_remote %}
|
||||
<a href="#" class="btn btn-mini" title="Show remotes to clone this repository." id="clone-button-show">Clone</a>
|
||||
{% endif %}
|
||||
<a href="{{ path('archive', {repo: repo, branch: branch, format: 'zip'}) }}" class="btn btn-mini" title="Download '{{ branch }}' as a ZIP archive">ZIP</a>
|
||||
<a href="{{ path('archive', {repo: repo, branch: branch, format: 'tar'}) }}" class="btn btn-mini" title="Download '{{ branch }}' as a TAR archive">TAR</a>
|
||||
</div>
|
||||
<a href="{{ path('rss', {repo: repo, branch: branch}) }}" class="rss-icon"><i class="rss"></i></a>
|
||||
</div>
|
||||
{% if app.show_http_remote or app.show_ssh_remote %}
|
||||
<div id="clone-popup">
|
||||
<div id="clone-popup-inner-wrapper">
|
||||
<a class="close" href="#" id="clone-button-hide">×</a>
|
||||
<div class="btn-group">
|
||||
{% if app.show_ssh_remote %}
|
||||
<button class="btn{{ app.show_ssh_remote and app.show_http_remote ? ' active' }}" id="clone-button-ssh">SSH</button>
|
||||
{% endif %}
|
||||
{% if app.show_http_remote %}
|
||||
<button class="btn" id="clone-button-http">HTTPS</button>
|
||||
{% endif %}
|
||||
</div><br />
|
||||
{% if app.show_ssh_remote %}
|
||||
<input type="text" class="form-control{{ app.show_ssh_remote ? ' visible' }}" id="clone-input-ssh" value="git clone {{ app.ssh_user }}@{{ app.request.host }}:{{ repo }}">
|
||||
{% endif %}
|
||||
{% if app.show_http_remote %}
|
||||
<input type="text" class="form-control{{ app.show_ssh_remote is empty and app.show_http_remote ? ' visible' }}" id="clone-input-http" value="git clone http{{ app.use_https ? 's' }}://{{ app.http_user }}{{ app.http_user ? '@' }}{{ app.request.host }}/{{ app.url_subdir }}{{ repo }}">
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
{% endembed %}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user