From ac4d8d064f879910d743a71b312ffc614d5f92de Mon Sep 17 00:00:00 2001 From: Jakub Onderka Date: Fri, 23 Sep 2022 11:44:26 +0200 Subject: [PATCH] fix: [UI] Template for group attributes into object --- .../Objects/group_attributes_into_object.ctp | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/app/View/Objects/group_attributes_into_object.ctp b/app/View/Objects/group_attributes_into_object.ctp index eae85f210..45987fc3f 100644 --- a/app/View/Objects/group_attributes_into_object.ctp +++ b/app/View/Objects/group_attributes_into_object.ctp @@ -59,22 +59,22 @@ echo $this->Form->create('Object', array('url' => $baseurl . '/objects/groupAttr - + - + - :: - + - + Time->date($attribute['Attribute']['timestamp']); ?> @@ -126,7 +126,7 @@ echo $this->Form->create('Object', array('url' => $baseurl . '/objects/groupAttr - ' . ($hard_delete_attribute ? __('hard') : __('soft')) . ''); ?> + ' . ($hard_delete_attribute ? __('hard') : __('soft')) . ''); ?> @@ -135,25 +135,31 @@ $(".Object_distribution_select").change(function() { checkAndEnable($(this).parent().find('.Object_sharing_group_id_select'), $(this).val() == 4); }); +$(".attributeMapping").change(function() { + var $select = $(this); + var text = $select.find(":selected").attr('title'); + $select.parent().parent().find('.objectRelationDescription').text(text); +}); + function submitMergeAttributeIntoObjectForm(btn) { var $btn = $(btn); var $form = $('#ObjectGroupAttributesIntoObjectForm'); var attribute_mapping = {}; $('#attributeMappingBody').find('tr').each(function() { var $tr = $(this); - var attr_id = $tr.find('#isAttributeId').text(); - var attr_mapping = $tr.find('#isAttributeMapping').val(); + var attr_id = $tr.find('.attributeId').text(); + var attr_mapping = $tr.find('.attributeMapping').val(); attribute_mapping[attr_id] = attr_mapping; }); $('#ObjectSelectedObjectRelationMapping').val(JSON.stringify(attribute_mapping)); var btn_text_backup = ''; $.ajax({ data: $form.serialize(), - beforeSend: function (XMLHttpRequest) { + beforeSend: function () { btn_text_backup = $btn.text(); $btn.html(''); }, - success:function (data, textStatus) { + success: function (data) { if (data.errors !== undefined) { showMessage('fail', responseArray.errors); $btn.text(btn_text_backup); @@ -162,18 +168,12 @@ function submitMergeAttributeIntoObjectForm(btn) { location.reload(); } }, - error:function() { + error: function() { showMessage('fail', 'Could not merge Attributes into an Object.'); showObjectProposition(); }, - type:"post", + type: "post", url: $form.attr('action') }); } - -function updateObjectRelationDescription(changed) { - var $select = $(changed); - var text = $select.find(":selected").attr('title'); - $select.parent().parent().find('#objectRelationDescription').text(text); -}