fix: version badge rendering, Jinja2 scoping, navbar i18n, missing GET task endpoint

- Fix version badge showing [object Object] or Python dict dump in
  select_recipe, task_list, and task_complete templates by accessing
  current_version.version_number instead of the whole object
- Fix recipe_editor.html Internal Server Error caused by Jinja2 block
  scoping: {% set %} variables from block content were invisible in
  block extra_js, replaced with direct recipe.* references
- Fix task_editor.html SyntaxError from Italian apostrophe in
  nell'eliminazione breaking JS string literals, switched to |tojson
- Add i18n {{ _() }} wrappers to all hardcoded navbar strings (desktop
  and mobile menus) so language toggle works correctly
- Add app title text "TieMeasureFlow" next to logo in navbar
- Add missing GET /api/tasks/{task_id} endpoint on server that caused
  405 Method Not Allowed when starting measurements

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Adriano
2026-02-07 20:44:33 +01:00
parent 2453e552fb
commit d262ef68af
7 changed files with 40 additions and 26 deletions
+6 -6
View File
@@ -585,8 +585,8 @@
function recipeEditor() {
return {
// ---- Mode ----
isNew: {{ 'true' if is_new else 'false' }},
recipeId: {{ recipe_id|tojson if recipe_id else 'null' }},
isNew: {{ 'true' if recipe is none else 'false' }},
recipeId: {{ recipe.id|tojson if recipe else 'null' }},
// ---- Form data ----
code: {{ (recipe.code if recipe else '')|tojson }},
@@ -595,12 +595,12 @@ function recipeEditor() {
changeNotes: '',
// ---- File upload ----
currentFilePath: {{ (current_version.tasks[0].file_path if current_version and current_version.tasks and current_version.tasks|length > 0 else None)|tojson }},
currentFilePath: {{ (recipe.current_version.tasks[0].file_path if recipe and recipe.current_version and recipe.current_version.tasks and recipe.current_version.tasks|length > 0 else None)|tojson }},
uploadingFile: false,
dragOver: false,
// ---- Annotation state (managed by annotation-editor.js) ----
annotationsJson: {{ (current_version.tasks[0].annotations_json if current_version and current_version.tasks and current_version.tasks|length > 0 and current_version.tasks[0].annotations_json else None)|tojson }},
annotationsJson: {{ (recipe.current_version.tasks[0].annotations_json if recipe and recipe.current_version and recipe.current_version.tasks and recipe.current_version.tasks|length > 0 and recipe.current_version.tasks[0].annotations_json else None)|tojson }},
annoTool: 'select',
annoSelected: false,
@@ -610,8 +610,8 @@ function recipeEditor() {
errorMessage: '',
// ---- Versioning ----
versions: {{ versions|tojson }},
currentVersion: {{ (current_version.version_number if current_version else 0)|tojson }},
versions: {{ (recipe.versions if recipe and recipe.versions else [])|tojson }},
currentVersion: {{ (recipe.current_version.version_number if recipe and recipe.current_version else 0)|tojson }},
// ============================================================
// Init
+2 -2
View File
@@ -1227,7 +1227,7 @@ function taskEditor() {
this.successMessage = '{{ _("Task eliminato") }}';
} else {
const data = await resp.json();
this.errorMessage = data.detail || '{{ _("Errore nell\'eliminazione del task") }}';
this.errorMessage = data.detail || {{ _("Errore nell'eliminazione del task")|tojson }};
}
} catch (err) {
console.error('deleteTask error:', err);
@@ -1510,7 +1510,7 @@ function taskEditor() {
this.successMessage = '{{ _("Misurazione eliminata") }}';
} else {
const data = await resp.json();
this.errorMessage = data.detail || '{{ _("Errore nell\'eliminazione della misurazione") }}';
this.errorMessage = data.detail || {{ _("Errore nell'eliminazione della misurazione")|tojson }};
}
} catch (err) {
console.error('deleteSubtask error:', err);