jquery/no-delegate: [2]
jquery/no-each: [0]
jquery/no-extend: [2]
- jquery/no-fade: [0]
+ jquery/no-fade: [2]
jquery/no-filter: [0]
jquery/no-find: [0]
jquery/no-global-eval: [2]
jquery/no-is-function: [2]
jquery/no-is: [0]
jquery/no-load: [2]
- jquery/no-map: [0]
+ jquery/no-map: [2]
jquery/no-merge: [2]
jquery/no-param: [2]
jquery/no-parent: [0]
no-jquery/no-load: [2]
no-jquery/no-map-collection: [0]
no-jquery/no-map-util: [2]
- no-jquery/no-map: [0]
+ no-jquery/no-map: [2]
no-jquery/no-merge: [2]
no-jquery/no-node-name: [2]
no-jquery/no-noop: [2]
}
export function initRepoCommitLastCommitLoader() {
- const entryMap = {};
-
- const entries = $('table#repo-files-table tr.notready')
- .map((_, v) => {
- entryMap[$(v).attr('data-entryname')] = $(v);
- return $(v).attr('data-entryname');
- })
- .get();
+ const notReadyEls = document.querySelectorAll('table#repo-files-table tr.notready');
+ if (!notReadyEls.length) return;
- if (entries.length === 0) {
- return;
+ const entryMap = {};
+ const entries = [];
+ for (const el of notReadyEls) {
+ const entryname = el.getAttribute('data-entryname');
+ entryMap[entryname] = $(el);
+ entries.push(entryname);
}
const lastCommitLoaderURL = $('table#repo-files-table').data('lastCommitLoaderUrl');
}
};
- const saveAndRefresh = (dz, $dropzone) => {
+ const saveAndRefresh = (dz) => {
showElem($renderContent);
hideElem($editContentZone);
- const $attachments = $dropzone.find('.files').find('[name=files]').map(function () {
- return $(this).val();
- }).get();
$.post($editContentZone.attr('data-update-url'), {
_csrf: csrfToken,
content: comboMarkdownEditor.value(),
context: $editContentZone.attr('data-context'),
- files: $attachments,
+ files: dz.files.map((file) => file.uuid),
}, (data) => {
if (!data.content) {
$renderContent.html($('#no-content').html());
});
$editContentZone.find('.save.button').on('click', (e) => {
e.preventDefault();
- saveAndRefresh(dz, $dropzone);
+ saveAndRefresh(dz);
});
} else {
comboMarkdownEditor = getComboMarkdownEditor($editContentZone.find('.combo-markdown-editor'));