Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#3702-Added Check For Mark As Blank On Save #3714

Merged
merged 2 commits into from
Jul 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions app/views/transcribe/display_page.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,47 @@ h2.legend =t('.notes_and_questions')
});
});

$(function() {
$('form').submit(function() {
var isMarkedBlank = $('#page_mark_blank').is(':checked');
var hasTranscribedText = $('.page-editarea_textarea').length > 0 && $('.page-editarea_textarea').val().trim().length > 0;
var hasFieldContent = false;
var hasFilledCells = false;

// Check if spreadsheet have content
if (typeof hot !== 'undefined') {
var data = hot.getData();
for (var i = 0; i < data.length; i++) {
for (var j = 0; j < data[i].length; j++) {
if (data[i][j] !== null && data[i][j] !== '') {
hasFilledCells = true;
break;
}
}
if (hasFilledCells) {
break;
}
}
}

// Check if fields have content
$('.field-wrapper .field-input').each(function() {
var content = $(this).val().trim();
if (content !== '') {
hasFieldContent = true;
return false;
}
});

if (isMarkedBlank && (hasTranscribedText || hasFieldContent || hasFilledCells)) {
var confirmation = confirm("#{j(t('.mark_blank_warning'))}");

if (!confirmation) {
return false;
}
}
});
});

// TODO change the parameter name for the HOT data to the name of the spreadsheet field
// TODO change the way we access the HOT data to allow more than one spreadsheet
1 change: 1 addition & 0 deletions config/locales/transcribe/transcribe-de.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ de:
image_at_the_top: Bild oben
layout: Layout
mark_as_blank: Als leer markieren
mark_blank_warning: Diese Seite enthält transkribierte Daten, aber Sie markieren sie als leer. Möchten Sie fortfahren?
microphone: Mikrofon
more_help: Mehr Hilfe....
needs_review: Überprüfung erforderlich
Expand Down
1 change: 1 addition & 0 deletions config/locales/transcribe/transcribe-en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ en:
image_at_the_top: Image at the top
layout: Layout
mark_as_blank: Mark as blank
mark_blank_warning: This page has transcribed data but you are marking it as blank. Do you want to continue?
microphone: Microphone
more_help: More help....
needs_review: Needs Review
Expand Down
1 change: 1 addition & 0 deletions config/locales/transcribe/transcribe-es.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ es:
image_at_the_top: Imagen hacia arriba
layout: Diseño
mark_as_blank: Marcar como en blanco
mark_blank_warning: Esta página contiene datos transcritos pero la está marcando como vacía. ¿Desea continuar?
microphone: Micrófono
more_help: Más ayuda....
needs_review: Necesita Revisión
Expand Down
1 change: 1 addition & 0 deletions config/locales/transcribe/transcribe-fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ fr:
image_at_the_top: Image en haut
layout: Disposition
mark_as_blank: Marquer comme vierge
mark_blank_warning: Cette page contient des données transcrites, mais vous la marquez comme vide. Voulez-vous continuer ?
microphone: Microphone
more_help: Plus de conseils...
needs_review: À besoin d'une révision
Expand Down
1 change: 1 addition & 0 deletions config/locales/transcribe/transcribe-pt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ pt:
image_at_the_top: Imagem superior
layout: Esquema
mark_as_blank: Marcar como em branco
mark_blank_warning: Esta página contém dados transcritos, mas você a está marcando como vazia. Deseja continuar?
microphone: Microfone
more_help: Mais ajuda....
needs_review: Precisa de Revisão
Expand Down