Add snapshot format selection popup
--- a/include/controller/ControllerBase.class.php
+++ b/include/controller/ControllerBase.class.php
@@ -266,6 +266,8 @@
}
}
$this->tpl->assign('requestvars', $getvarsmapped);
+
+ $this->tpl->assign('snapshotformats', GitPHP_Archive::SupportedFormats());
}
/**
--- a/js/tooltips.js
+++ b/js/tooltips.js
@@ -9,6 +9,46 @@
*/
function initTooltips() {
+
+ $('a.snapshotTip').each(function()
+ {
+ var href = $(this).attr('href');
+
+ var content = '<div>' + GITPHP_RES_SNAPSHOT + ': ';
+ var first = true;
+ for (type in GITPHP_SNAPSHOT_FORMATS) {
+ if (!first) {
+ content += ' | ';
+ }
+ content += '<a href="' + href + '&fmt=' + type + '">' + GITPHP_SNAPSHOT_FORMATS[type] + '</a>';
+ first = false;
+ }
+ content += '</div>';
+
+ $(this).qtip(
+ {
+ content: {
+ text: content
+ },
+ show: {
+ event: 'click'
+ },
+ hide: {
+ fixed: true,
+ delay: 150
+ },
+ style: {
+ classes: 'ui-tooltip-light ui-tooltip-shadow'
+ },
+ position: {
+ adjust: {
+ screen: true
+ }
+ }
+ });
+
+ $(this).click(function() { return false; });
+ });
var project = window.location.href.match(/p=([^&]+)/);
if (!project) {
@@ -91,6 +131,7 @@
}
});
});
+
}
$(document).ready(function() {
--- a/templates/header.tpl
+++ b/templates/header.tpl
@@ -28,6 +28,12 @@
<script type="text/javascript">
var GITPHP_RES_LOADING="{t escape='js'}Loading…{/t}";
var GITPHP_RES_LOADING_BLAME_DATA="{t escape='js'}Loading blame data…{/t}";
+ var GITPHP_RES_SNAPSHOT="{t escape='js'}snapshot{/t}";
+ var GITPHP_SNAPSHOT_FORMATS = {ldelim}
+ {foreach from=$snapshotformats key=format item=extension name=formats}
+ "{$format}": "{$extension}"{if !$smarty.foreach.formats.last},{/if}
+ {/foreach}
+ {rdelim}
</script>
<link rel="stylesheet" href="css/ext/jquery.qtip.css" type="text/css" />
<script type="text/javascript" src="js/ext/jquery-1.4.2.min.js"></script>
--- a/templates/projectlist.tpl
+++ b/templates/projectlist.tpl
@@ -85,7 +85,7 @@
<a href="{$SCRIPT_NAME}?p={$proj->GetProject()|urlencode}&a=shortlog">{t}shortlog{/t}</a> |
<a href="{$SCRIPT_NAME}?p={$proj->GetProject()|urlencode}&a=log">{t}log{/t}</a> |
<a href="{$SCRIPT_NAME}?p={$proj->GetProject()|urlencode}&a=tree">{t}tree{/t}</a> |
- <a href="{$SCRIPT_NAME}?p={$proj->GetProject()|urlencode}&a=snapshot&h=HEAD">{t}snapshot{/t}</a>
+ <a href="{$SCRIPT_NAME}?p={$proj->GetProject()|urlencode}&a=snapshot&h=HEAD" class="snapshotTip">{t}snapshot{/t}</a>
{/if}
</td>
</tr>