diff --git a/app/assets/javascripts/client_enrollment_trackings/form.coffee b/app/assets/javascripts/client_enrollment_trackings/form.coffee index 04c6a2f1f5..13391aad72 100644 --- a/app/assets/javascripts/client_enrollment_trackings/form.coffee +++ b/app/assets/javascripts/client_enrollment_trackings/form.coffee @@ -7,6 +7,7 @@ CIF.Client_enrolled_program_trackingsNew = CIF.Client_enrolled_program_trackings _preventRequireFileUploader() _toggleCheckingRadioButton() _initICheckBox() + _hideAnotherLanguageField() _initICheckBox = -> $('.i-checks').iCheck @@ -32,4 +33,7 @@ CIF.Client_enrolled_program_trackingsNew = CIF.Client_enrolled_program_trackings prevent = new CIF.PreventRequiredFileUploader() prevent.preventFileUploader() + _hideAnotherLanguageField = -> + $('.client-enrolled-program-tracking').find('.d-none').parent().addClass('hide') + { init: _init } diff --git a/app/assets/javascripts/program_streams/form.coffee b/app/assets/javascripts/program_streams/form.coffee index 2e950e7f99..ae6aba7f81 100644 --- a/app/assets/javascripts/program_streams/form.coffee +++ b/app/assets/javascripts/program_streams/form.coffee @@ -499,7 +499,9 @@ CIF.Program_streamsNew = CIF.Program_streamsEdit = CIF.Program_streamsCreate = C $('.links a').trigger('click') _handleInitProgramFields = -> + trackings = $('.tracking-builder') elements = ['#enrollment', '#exit-program'] + $.merge(elements, trackings) _initMultipleFormBuilder(0, elements) for element in elements if element.id == 'enrollment' and $('#program_stream_id').val() != '' @@ -507,8 +509,8 @@ CIF.Program_streamsNew = CIF.Program_streamsEdit = CIF.Program_streamsCreate = C else if element.id == 'exit-program' and $('#program_stream_id').val() != '' _preventRemoveField(EXIT_PROGRAM_URL, '#exit-program') - trackings = $('.tracking-builder') - _initMultipleFormBuilder(0, trackings) + # trackings = $('.tracking-builder') + # _initMultipleFormBuilder(0, trackings) _preventRemoveField(TRACKING_URL, '') if $('#program_stream_id').val() != '' _initButtonSave = -> @@ -521,7 +523,9 @@ CIF.Program_streamsNew = CIF.Program_streamsEdit = CIF.Program_streamsCreate = C $('#program_stream_rules').val(_handleStringfyRules(rules)) _handleSetValueToField = -> + console.log(@formBuilder) for formBuilder in @formBuilder + console.log(formBuilder.actions.save()) element = formBuilder.element specialCharacters = { "&": "&", "<": "<", ">": ">", '"': "&qoute;" } format = new CIF.FormatSpecialCharacters() diff --git a/app/models/concerns/update_field_labels_form_builder.rb b/app/models/concerns/update_field_labels_form_builder.rb index df8efb0d1c..61f22c04b6 100644 --- a/app/models/concerns/update_field_labels_form_builder.rb +++ b/app/models/concerns/update_field_labels_form_builder.rb @@ -2,6 +2,7 @@ module UpdateFieldLabelsFormBuilder def labels_update(new_fields, old_fields, objects) labels_changed = [] field_labels_changed = [] + old_fields = [] if old_fields.empty? fields_changed = new_fields - old_fields fields_changed.each do |field_changed| old_fields.each do |entity|