Skip to content
This repository was archived by the owner on Dec 18, 2018. It is now read-only.

Commit 65b4342

Browse files
committed
Merge branch 'hotfix/DEICH-434_feil_i_lagring_av_publicationPart'
2 parents a18aa5d + aa253ad commit 65b4342

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

redef/catalinker/client/src/main.js

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2998,11 +2998,12 @@
29982998
let subInputs = ractive.get(grandParentOf(grandParentOf(event.keypath)))
29992999
_.each(subInputs, function (subInput) {
30003000
if (typeof subInput.input.values[ event.index.inputValueIndex ].searchable === 'boolean') {
3001-
subInput.input.values[ event.index.inputValueIndex ].searchable = true
3001+
ractive.set(`${subInput.input.keypath}.values.${event.index.inputValueIndex}.searchable`, true)
30023002
}
30033003
if (typeof subInput.input.values[ event.index.inputValueIndex ].suggested === 'object') {
3004-
subInput.input.values[ event.index.inputValueIndex ].suggested = null
3004+
ractive.set(`${subInput.input.keypath}.values.${event.index.inputValueIndex}.suggested`, null)
30053005
}
3006+
ractive.set(`${subInput.input.keypath}.values.${event.index.inputValueIndex}.nonEditable`, null)
30063007
})
30073008
ractive.update()
30083009
},
@@ -3068,7 +3069,16 @@
30683069

30693070
ractive.observe('inputGroups.*.inputs.*.subInputs.*.input.values.*.current.value', function (newValue, oldValue, keypath) {
30703071
checkRequiredSubInput(newValue, keypath)
3071-
})
3072+
}, { init: false })
3073+
3074+
ractive.observe('inputGroups.*.inputs.*.subInputs.*.input.values.*.nonEditable', function (newValue, oldValue, keypath) {
3075+
let compoundInputKeypath = grandParentOf(grandParentOf(grandParentOf(keypath)))
3076+
let valueIndex = _.last(parentOf(keypath).split('.'))
3077+
let nonEditableTarget = `${compoundInputKeypath}.subInputs.0.input.values.${valueIndex}.nonEditable`
3078+
if (newValue === true && ractive.get(nonEditableTarget) !== true) {
3079+
ractive.set(nonEditableTarget, true)
3080+
}
3081+
}, { init: false })
30723082

30733083
ractive.observe('inputGroups.*.inputs.*.values.0.current.value', function (newValue, oldValue, keypath) {
30743084
if (Boolean(newValue) !== Boolean(oldValue)) {
@@ -3080,7 +3090,7 @@
30803090
})
30813091
}
30823092
}
3083-
})
3093+
}, { init: false })
30843094

30853095
ractive.observe('inputGroups.*.inputs.*.values.*', function (newValue, oldValue, keypath) {
30863096
if (newValue && newValue.current) {

0 commit comments

Comments
 (0)