Add button to 'Add Attachment to Description'

This commit is contained in:
2016-11-02 16:16:13 +01:00
parent ae859d3ea7
commit 4bd334e403
2 changed files with 17 additions and 0 deletions

View File

@@ -155,6 +155,15 @@ $(function () {
})
.on('file-upload:activated', on_file_upload_activated)
.on('file-upload:finished', on_file_upload_finished)
.on('click', '.js-append-attachment', function(e) {
e.preventDefault();
// Append widget @[slug-name] to the post's description
// 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;
})
;
function inject_project_id_into_url(index, element) {