From 43b89b3e46173fb559d7d69f307819c807329013 Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Thu, 29 Oct 2015 23:24:35 +0000 Subject: [PATCH] webstaff: tweak how element IDs in MARC editor are generated For new records (or records that for whatever reason lack a 901 field), use '0' as a dummy value for the record ID when constructing element IDs (e.g., r0f5, r0f10sf0value, etc.). This fixes a problem where setCaret() couldn't successfully change focus after adding a field or subfield to a new record. Signed-off-by: Galen Charlton Signed-off-by: Kathy Lussier --- Open-ILS/web/js/ui/default/staff/cat/services/marcedit.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Open-ILS/web/js/ui/default/staff/cat/services/marcedit.js b/Open-ILS/web/js/ui/default/staff/cat/services/marcedit.js index a81f7d8942..0a420540a0 100644 --- a/Open-ILS/web/js/ui/default/staff/cat/services/marcedit.js +++ b/Open-ILS/web/js/ui/default/staff/cat/services/marcedit.js @@ -331,7 +331,7 @@ angular.module('egMarcMod', ['egCoreMod', 'ui.bootstrap']) restrict: 'E', template: ''+ ''+ ''+ '', scope: { field: "=", subfield: "=", onKeydown: '=' }, @@ -386,7 +386,7 @@ angular.module('egMarcMod', ['egCoreMod', 'ui.bootstrap']) 'max="1" '+ 'on-keydown="onKeydown" '+ 'context-item-generator="ind_val_options" '+ - 'id="r{{field.record.subfield(\'901\',\'c\')[1]}}f{{field.position}}i{{indNumber}}"'+ + 'id="r{{field.record.subfield(\'901\',\'c\')[1] || 0}}f{{field.position}}i{{indNumber}}"'+ '/>', scope: { ind : '=', field: '=', onKeydown: '=', indNumber: '@' }, replace: true, @@ -415,7 +415,7 @@ angular.module('egMarcMod', ['egCoreMod', 'ui.bootstrap']) 'max="3" '+ 'on-keydown="onKeydown" '+ 'context-item-generator="tag_options" '+ - 'id="r{{field.record.subfield(\'901\',\'c\')[1]}}f{{field.position}}tag"'+ + 'id="r{{field.record.subfield(\'901\',\'c\')[1] || 0}}f{{field.position}}tag"'+ '/>', scope: { tag : '=', field: '=', onKeydown: '=', contextFunctions: '=' }, replace: true, @@ -530,7 +530,7 @@ angular.module('egMarcMod', ['egCoreMod', 'ui.bootstrap']) 'class="marcedit marcdata" '+ 'content="field.data" '+ 'on-keydown="onKeydown" '+ - 'id="r{{field.record.subfield(\'901\',\'c\')[1]}}f{{field.position}}data"'+ + 'id="r{{field.record.subfield(\'901\',\'c\')[1] || 0}}f{{field.position}}data"'+ '/>'+ // TODO: move to TT2 template '