Commit 45bd3237 authored by Leo Iannacone's avatar Leo Iannacone

Merge remote-tracking branch 'github/master' into portable

parents 83be6895 00f97b25
...@@ -123,12 +123,12 @@ function Page_Distrubion(socket) { ...@@ -123,12 +123,12 @@ function Page_Distrubion(socket) {
label = ''; label = '';
var window_title = null; var window_title = null;
if (Utils.check_view_file(view)) { if (Utils.check_view_file(view)) {
var complete_name = view.package.orig_name + '.' + view.file.name; var complete_name = view.file.orig_name;
window_title = complete_name; window_title = complete_name;
label = complete_name; label = complete_name;
if (!view.file.path) if (!view.file.path)
view.file.path = config.paths.debomatic + '/' + view.distribution.name + '/pool/' + view.package.orig_name + '/' + complete_name; view.file.path = config.paths.debomatic + '/' + view.distribution.name + '/pool/' + view.package.orig_name + '/' + complete_name;
label += ' <a class="btn btn-link btn-lg" data-toggle="tooltip" title="Download" href="' + view.file.path + '"> ' + label += ' <a id="download-file" class="btn btn-link btn-lg" data-toggle="tooltip" title="Download"> ' +
'<span class="glyphicon glyphicon-download-alt"></span></a>'; '<span class="glyphicon glyphicon-download-alt"></span></a>';
if (current_file_in_preview) { if (current_file_in_preview) {
var view_all = $('<a id="get-whole-file" data-toggle="tooltip" class="btn btn-link btn-lg" title="View the whole file"></a>'); var view_all = $('<a id="get-whole-file" data-toggle="tooltip" class="btn btn-link btn-lg" title="View the whole file"></a>');
...@@ -151,6 +151,21 @@ function Page_Distrubion(socket) { ...@@ -151,6 +151,21 @@ function Page_Distrubion(socket) {
file.get(true); file.get(true);
$(this).fadeOut('fast'); $(this).fadeOut('fast');
}); });
// set onclick downlaod file
$('#download-file').on('click', function (event) {
var url = view.file.path;
if (!current_file_in_preview) {
url = 'data:text/plain;charset=utf-8,' + encodeURIComponent($('#file .content').text());
}
$(this)
.attr({
'download': view.file.orig_name,
'href': url,
'target': '_blank'
});
});
}, },
clean: function () { clean: function () {
$('#title').html(''); $('#title').html('');
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment