|
|
|
@ -980,7 +980,9 @@ async function initRepository() { |
|
|
|
|
$editContentZone.find('.cancel.button').on('click', () => { |
|
|
|
|
$renderContent.show(); |
|
|
|
|
$editContentZone.hide(); |
|
|
|
|
dz.emit('reload'); |
|
|
|
|
if (dz) { |
|
|
|
|
dz.emit('reload'); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
$editContentZone.find('.save.button').on('click', () => { |
|
|
|
|
$renderContent.show(); |
|
|
|
@ -994,7 +996,7 @@ async function initRepository() { |
|
|
|
|
context: $editContentZone.data('context'), |
|
|
|
|
files: $attachments |
|
|
|
|
}, (data) => { |
|
|
|
|
if (data.length === 0) { |
|
|
|
|
if (data.length === 0 || data.content.length === 0) { |
|
|
|
|
$renderContent.html($('#no-content').html()); |
|
|
|
|
} else { |
|
|
|
|
$renderContent.html(data.content); |
|
|
|
@ -1002,21 +1004,27 @@ async function initRepository() { |
|
|
|
|
highlight(this); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
const $content = $segment.parent(); |
|
|
|
|
if (!$content.find('.ui.small.images').length) { |
|
|
|
|
const $content = $segment; |
|
|
|
|
if (!$content.find('.dropzone-attachments').length) { |
|
|
|
|
if (data.attachments !== '') { |
|
|
|
|
$content.append( |
|
|
|
|
'<div class="ui bottom attached segment"><div class="ui small images"></div></div>' |
|
|
|
|
); |
|
|
|
|
$content.find('.ui.small.images').html(data.attachments); |
|
|
|
|
$content.append(` |
|
|
|
|
<div class="dropzone-attachments"> |
|
|
|
|
<div class="ui clearing divider"></div> |
|
|
|
|
<div class="ui middle aligned padded grid"> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
`);
|
|
|
|
|
$content.find('.dropzone-attachments .grid').html(data.attachments); |
|
|
|
|
} |
|
|
|
|
} else if (data.attachments === '') { |
|
|
|
|
$content.find('.ui.small.images').parent().remove(); |
|
|
|
|
$content.find('.dropzone-attachments').remove(); |
|
|
|
|
} else { |
|
|
|
|
$content.find('.ui.small.images').html(data.attachments); |
|
|
|
|
$content.find('.dropzone-attachments .grid').html(data.attachments); |
|
|
|
|
} |
|
|
|
|
if (dz) { |
|
|
|
|
dz.emit('submit'); |
|
|
|
|
dz.emit('reload'); |
|
|
|
|
} |
|
|
|
|
dz.emit('submit'); |
|
|
|
|
dz.emit('reload'); |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
} else { |
|
|
|
|