Buttons are healthier than <a>, in particular here to avoid ugly js in the middle of the template

This commit is contained in:
Alexandre Aubin 2019-10-16 22:45:44 +02:00
parent e054675230
commit e5ce0ac19d
2 changed files with 13 additions and 4 deletions

View file

@ -133,6 +133,15 @@
"log": log,
"next_number": log.logs.length == number ? number * 10:false,
"locale": y18n.locale
}, function() {
// Configure behavior for the button to share log on Yunohost (it calls display --share)
$("#share-with-yunopaste").on("click", function() {
c.api('GET', '/logs/display?path='+$(this).data('log-id')+'&share', {},
function(data) {
$('div.loader').remove();
window.open(data.url, '_blank');
});
});
});
});
});

View file

@ -10,9 +10,9 @@
</div>
<div class="actions-group">
<a href="javascript:void(null);" onclick="c.api('GET', '/logs/display?path={{#if log.name}}{{ log.name }}{{else}}{{ log.log_path }}{{/if}}&share', {}, function(data) { $('div.loader').remove(); window.open(data.url, '_blank'); });" class="btn btn-success">
<button id="share-with-yunopaste" class="btn btn-success" data-log-id="{{#if log.name}}{{ log.name }}{{else}}{{ log.log_path }}{{/if}}">
<span class="fa-cloud-upload"></span> {{t 'logs_share_with_yunopaste'}}
</a>
</button>
</div>
<div class="separator"></div>