/* global ListColumnHelper ChecklistColumnHelper Status SmartAnnotation I18n GLOBAL_CONSTANTS */ $.fn.dataTable.render.editRowName = function(formId, cell) { let $cell = $(cell.node()); let text = $cell.find('a').first().text(); $cell.html(`
`); }; $.fn.dataTable.render.editRepositoryAssetValue = function(formId, columnId, cell) { let $cell = $(cell.node()); let empty = $cell.is(':empty'); let fileName = $cell.find('a.file-preview-link').text(); $cell.html(`
${fileName}
`); }; $.fn.dataTable.render.editRepositoryTextValue = function(formId, columnId, cell) { let $cell = $(cell.node()); let text = $cell.text(); $cell.html(`
`); SmartAnnotation.init($cell.find('input')); }; $.fn.dataTable.render.editRepositoryListValue = function(formId, columnId, cell) { var $cell = $(cell.node()); var currentElement = $cell.find('.list-label'); var currentValue = null; if (currentElement.length) { currentValue = { value: currentElement.attr('data-value-id'), label: currentElement.text() }; } ListColumnHelper.initialListEditMode(formId, columnId, $cell, currentValue); }; $.fn.dataTable.render.editRepositoryStatusValue = function(formId, columnId, cell) { let $cell = $(cell.node()); let currentValueId = $cell.find('.status-label').attr('data-value-id'); let url = $cell.closest('table').data('status-items-path'); let hiddenField = ` `; $cell.html(hiddenField + Status.initialStatusItemsRequest(columnId, currentValueId, formId, url)); Status.initStatusSelectPicker($cell.find('select'), $cell.find(`[name='repository_cells[${columnId}]']`)); }; $.fn.dataTable.render.editRepositoryDateTimeValue = function(formId, columnId, cell) { return ''; }; $.fn.dataTable.render.editRepositoryDateValue = function(formId, columnId, cell) { return ''; }; $.fn.dataTable.render.editRepositoryTimeValue = function(formId, columnId, cell) { return ''; }; $.fn.dataTable.render.editRepositoryDateTimeRangeValue = function(formId, columnId, cell) { return ''; }; $.fn.dataTable.render.editRepositoryDateRangeValue = function(formId, columnId, cell) { return ''; }; $.fn.dataTable.render.editRepositoryTimeRangeValue = function(formId, columnId, cell) { return ''; }; $.fn.dataTable.render.editRepositoryChecklistValue = function(formId, columnId, cell) { var $cell = $(cell.node()); var currentValue = $cell.find('.checklist-options').data('checklist-items'); ChecklistColumnHelper.initialChecklistEditMode(formId, columnId, $cell, currentValue); }; $.fn.dataTable.render.editRepositoryNumberValue = function(formId, columnId, cell, $header) { let $cell = $(cell.node()); let decimals = Number($header.data('metadata-decimals')); let number = parseFloat(Number($cell.text()).toFixed(decimals)); $cell.html(`
`); };