Warn if there's no slug to append

This commit is contained in:
Pablo Vazquez 2016-11-02 16:21:10 +01:00
parent 4bd334e403
commit 9ac2f38042

View File

@ -162,7 +162,13 @@ $(function () {
// Note: Heavily connected to HTML in _node_edit_form.jade
var slug = $(this).parent().find("input[id*='slug']").val();
var widget = '@[' + slug + ']\n';
document.getElementById('description').value += widget;
if (slug) {
document.getElementById('description').value += widget;
statusBarSet('success', 'Attachment appended to description', 'pi-check');
} else {
statusBarSet('error', 'Slug is empty, upload something first', 'pi-warning');
}
})
;