2019-12-16 22:21:50 +08:00
|
|
|
/* global ListColumnHelper ChecklistColumnHelper Status SmartAnnotation I18n GLOBAL_CONSTANTS DateTimeHelper formatJS */
|
2019-12-05 16:19:19 +08:00
|
|
|
|
|
|
|
$.fn.dataTable.render.newRowName = function(formId, $cell) {
|
|
|
|
$cell.html(`
|
|
|
|
<div class="form-group">
|
|
|
|
<input class="form-control editing"
|
|
|
|
form="${formId}"
|
|
|
|
type="text"
|
2019-12-10 15:41:09 +08:00
|
|
|
name="repository_row[name]"
|
2019-12-05 16:19:19 +08:00
|
|
|
value=""
|
|
|
|
data-type="RowName">
|
|
|
|
</div>
|
|
|
|
`);
|
2019-11-18 21:04:53 +08:00
|
|
|
};
|
|
|
|
|
2019-12-05 16:19:19 +08:00
|
|
|
$.fn.dataTable.render.newRepositoryAssetValue = function(formId, columnId, $cell) {
|
|
|
|
$cell.html(`
|
|
|
|
<div class="file-editing">
|
|
|
|
<div class="file-hidden-field-container hidden"></div>
|
|
|
|
<input class=""
|
|
|
|
id="repository_file_${columnId}"
|
|
|
|
form="${formId}"
|
|
|
|
type="file"
|
|
|
|
data-col-id="${columnId}"
|
|
|
|
data-is-empty="true"
|
|
|
|
value=""
|
|
|
|
data-type="RepositoryAssetValue">
|
|
|
|
<div class="file-upload-button new-file">
|
|
|
|
<label for="repository_file_${columnId}">${I18n.t('repositories.table.assets.select_file_btn', { max_size: GLOBAL_CONSTANTS.FILE_MAX_SIZE_MB })}</label>
|
|
|
|
<span class="icon"><i class="fas fa-paperclip"></i></span><span class="label-asset"></span>
|
|
|
|
<span class="delete-action fas fa-trash"> </span>
|
|
|
|
</div>
|
|
|
|
</div>`);
|
2019-11-18 21:04:53 +08:00
|
|
|
};
|
|
|
|
|
2019-12-05 16:19:19 +08:00
|
|
|
$.fn.dataTable.render.newRepositoryTextValue = function(formId, columnId, $cell) {
|
|
|
|
$cell.html(`
|
|
|
|
<div class="form-group">
|
|
|
|
<input class="form-control editing"
|
|
|
|
form="${formId}"
|
|
|
|
type="text"
|
|
|
|
name="repository_cells[${columnId}]"
|
|
|
|
value=""
|
|
|
|
data-type="RepositoryTextValue">
|
|
|
|
</div>`);
|
|
|
|
|
|
|
|
SmartAnnotation.init($cell.find('input'));
|
2019-11-18 21:04:53 +08:00
|
|
|
};
|
|
|
|
|
2019-12-05 16:19:19 +08:00
|
|
|
$.fn.dataTable.render.newRepositoryListValue = function(formId, columnId, $cell) {
|
2019-12-11 21:49:14 +08:00
|
|
|
ListColumnHelper.initialListEditMode(formId, columnId, $cell);
|
2019-11-18 21:04:53 +08:00
|
|
|
};
|
|
|
|
|
2019-12-05 16:19:19 +08:00
|
|
|
$.fn.dataTable.render.newRepositoryStatusValue = function(formId, columnId, $cell) {
|
|
|
|
let url = $cell.closest('table').data('status-items-path');
|
|
|
|
let hiddenField = `
|
|
|
|
<input form="${formId}"
|
|
|
|
type="hidden"
|
|
|
|
name="repository_cells[${columnId}]"
|
|
|
|
value=""
|
|
|
|
data-type="RepositoryStatusValue">`;
|
|
|
|
|
|
|
|
$cell.html(hiddenField + Status.initialStatusItemsRequest(columnId, '', formId, url));
|
|
|
|
|
|
|
|
Status.initStatusSelectPicker($cell.find('select'), $cell.find(`[name='repository_cells[${columnId}]']`));
|
2019-11-18 21:04:53 +08:00
|
|
|
};
|
2019-12-06 20:18:35 +08:00
|
|
|
|
2019-12-10 22:48:53 +08:00
|
|
|
$.fn.dataTable.render.newRepositoryChecklistValue = function(formId, columnId, $cell) {
|
2019-12-11 21:49:14 +08:00
|
|
|
ChecklistColumnHelper.initialChecklistEditMode(formId, columnId, $cell);
|
2019-12-06 20:18:35 +08:00
|
|
|
};
|
2019-12-18 18:55:12 +08:00
|
|
|
|
|
|
|
$.fn.dataTable.render.newRepositoryNumberValue = function(formId, columnId, $cell, $header) {
|
|
|
|
let decimals = Number($header.data('metadata-decimals'));
|
|
|
|
|
|
|
|
$cell.html(`
|
|
|
|
<div class="form-group">
|
|
|
|
<input class="form-control editing"
|
|
|
|
form="${formId}"
|
|
|
|
type="number"
|
|
|
|
name="repository_cells[${columnId}]"
|
|
|
|
value=""
|
|
|
|
onchange="if (this.value !== '') { this.value = parseFloat(Number(this.value).toFixed(${decimals})); }"
|
|
|
|
data-type="RepositoryNumberValue">
|
|
|
|
</div>`);
|
|
|
|
|
|
|
|
SmartAnnotation.init($cell.find('input'));
|
|
|
|
};
|
2019-12-16 22:21:50 +08:00
|
|
|
|
|
|
|
$.fn.dataTable.render.newRepositoryDateTimeValue = function(formId, columnId, $cell) {
|
|
|
|
DateTimeHelper.initDateTimeEditMode(formId, columnId, $cell, '', '', '');
|
|
|
|
};
|
|
|
|
|
|
|
|
$.fn.dataTable.render.newRepositoryTimeValue = function(formId, columnId, $cell) {
|
|
|
|
DateTimeHelper.initTimeEditMode(formId, columnId, $cell, '', '');
|
|
|
|
};
|
|
|
|
|
|
|
|
$.fn.dataTable.render.newRepositoryDateValue = function(formId, columnId, $cell) {
|
|
|
|
DateTimeHelper.initDateEditMode(formId, columnId, $cell, '', '');
|
|
|
|
};
|
|
|
|
|
2019-12-17 18:27:07 +08:00
|
|
|
$.fn.dataTable.render.newRepositoryDateTimeRangeValue = function(formId, columnId, $cell) {
|
|
|
|
DateTimeHelper.initDateTimeRangeEditMode(formId, columnId, $cell, '', '', '', '', '', '');
|
|
|
|
};
|
|
|
|
|
2019-12-17 20:42:25 +08:00
|
|
|
$.fn.dataTable.render.newRepositoryDateRangeValue = function(formId, columnId, $cell) {
|
|
|
|
DateTimeHelper.initDateRangeEditMode(formId, columnId, $cell, '', '', '', '');
|
|
|
|
};
|
|
|
|
|
|
|
|
$.fn.dataTable.render.newRepositoryTimeRangeValue = function(formId, columnId, $cell) {
|
|
|
|
DateTimeHelper.initTimeRangeEditMode(formId, columnId, $cell, '', '', '', '');
|
|
|
|
};
|
|
|
|
|
2019-12-16 22:21:50 +08:00
|
|
|
$.fn.dataTable.render.newRepositoryCheckboxValue = function(formId, columnId) {
|
|
|
|
return '';
|
|
|
|
};
|