class TesseractOCRPipelineModelList extends RessourceList { static autoInit() { for (let tesseractOCRPipelineModelListElement of document.querySelectorAll('.tesseract-ocr-pipeline-model-list:not(.no-autoinit)')) { new TesseractOCRPipelineModelList(tesseractOCRPipelineModelListElement); } } static options = { initialHtmlGenerator: (id) => { return `
search
Title Description Biblio
`.trim(); }, item: ` (), , delete send `.trim(), ressourceMapper: (tesseractOCRPipelineModel) => { return { 'id': tesseractOCRPipelineModel.id, 'creation-date': tesseractOCRPipelineModel.creation_date, 'description': tesseractOCRPipelineModel.description, 'publisher': tesseractOCRPipelineModel.publisher, 'publisher-url': tesseractOCRPipelineModel.publisher_url, 'publishing-url': tesseractOCRPipelineModel.publishing_url, 'publishing-url-2': tesseractOCRPipelineModel.publishing_url, 'publishing-year': tesseractOCRPipelineModel.publishing_year, 'title': tesseractOCRPipelineModel.title, 'title-2': tesseractOCRPipelineModel.title, 'version': tesseractOCRPipelineModel.version }; }, sortArgs: ['creation-date', {order: 'desc'}], valueNames: [ {data: ['id']}, {data: ['creation-date']}, {name: 'publisher-url', attr: 'href'}, {name: 'publishing-url', attr: 'href'}, 'description', 'publisher', 'publishing-url-2', 'publishing-year', 'title', 'title-2', 'version' ] }; constructor(listElement, options = {}) { super(listElement, {...TesseractOCRPipelineModelList.options, ...options}); } init (user) { this._init(user.tesseract_ocr_pipeline_models); } onClick(event) { let actionButtonElement = event.target.closest('.action-button'); let action = actionButtonElement === null ? 'view' : actionButtonElement.dataset.action; let tesseractOCRPipelineModelElement = event.target.closest('tr'); let tesseractOCRPipelineModelId = tesseractOCRPipelineModelElement.dataset.id; switch (action) { case 'delete-request': { Utils.deleteTesseractOCRPipelineModelRequest(this.userId, tesseractOCRPipelineModelId); break; } case 'view': { window.location.href = `/contributions/tesseract-ocr-pipeline-models/${tesseractOCRPipelineModelId}`; break; } default: { break; } } } }