Skip to content

Commit

Permalink
Merge pull request #2683 from kprajapatii/master
Browse files Browse the repository at this point in the history
Image meta not saved properly when multiple file fields on add/edit listing page - FIXED
  • Loading branch information
kprajapatii authored Sep 18, 2024
2 parents 144a72a + de6acd0 commit 8f2f1ef
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 15 deletions.
10 changes: 5 additions & 5 deletions assets/aui/js/geodirectory-plupload.js
Original file line number Diff line number Diff line change
Expand Up @@ -450,16 +450,16 @@ function gd_edit_image_meta(inputId, orderId) {
html = html + "<div class='form-group mb-3'><label for='gd-image-meta-title' class='text-left text-start form-label'>" + geodir_params.label_title + "</label><input id='gd-image-meta-title' value='" + image_title + "' class='form-control'></div>"; // title value
html = html + "<div class='form-group mb-3'><label for='gd-image-meta-caption' class='text-left text-start form-label'>" + geodir_params.label_caption + "</label><input id='gd-image-meta-caption' value='" + image_caption + "' class='form-control'></div>"; // caption value
hBtn = "<span class='btn btn-primary c-pointer' onclick='gd_set_image_meta(\"" + inputId + "\"," + orderId + ")'>" + geodir_params.button_set + "</span>"; // set button
jQuery('#gd-image-meta-input .modal-body').html(html);
jQuery('#gd-image-meta-input .modal-footer').html(hBtn);
jQuery('#gd-image-meta-input').modal('show');
jQuery('#gd_image_meta_' + inputId + ' .modal-body').html(html);
jQuery('#gd_image_meta_' + inputId + ' .modal-footer').html(hBtn);
jQuery('#gd_image_meta_' + inputId).modal('show');
}

function gd_set_image_meta(inputId, orderId) {
var imagesS = jQuery("#" + inputId, jQuery('#' + inputId + 'plupload-upload-ui').parent()).val(), images = imagesS.split("::"), img_arr = images[orderId].split("|"), image_url = img_arr[0], image_id = img_arr[1], image_title = geodir_esc_entities(jQuery('#gd-image-meta-title').val()), image_caption = geodir_esc_entities(jQuery('#gd-image-meta-caption').val());
var imagesS = jQuery("#" + inputId, jQuery('#' + inputId + 'plupload-upload-ui').parent()).val(), images = imagesS.split("::"), img_arr = images[orderId].split("|"), image_url = img_arr[0], image_id = img_arr[1], image_title = geodir_esc_entities(jQuery('#gd_image_meta_' + inputId + ' #gd-image-meta-title').val()), image_caption = geodir_esc_entities(jQuery('#gd_image_meta_' + inputId + ' #gd-image-meta-caption').val());
images[orderId] = image_url + "|" + image_id + "|" + image_title + "|" + image_caption;
imagesS = images.join("::");
jQuery("#" + inputId, jQuery('#' + inputId + 'plupload-upload-ui').parent()).val(imagesS).trigger('change');
plu_show_thumbs(inputId);
jQuery('#gd-image-meta-input').modal('hide');
jQuery('#gd_image_meta_' + inputId).modal('hide');
}
2 changes: 1 addition & 1 deletion assets/aui/js/geodirectory-plupload.min.js

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions assets/js/geodirectory-plupload.js
Original file line number Diff line number Diff line change
Expand Up @@ -451,8 +451,8 @@ function gd_edit_image_meta(input, order_id) {
html = html + "<div class='gd-modal-text'><label for='gd-image-meta-title'>" + geodir_params.label_title + "</label><input id='gd-image-meta-title' value='" + image_title + "'></div>"; // title value
html = html + "<div class='gd-modal-text'><label for='gd-image-meta-caption'>" + geodir_params.label_caption + "</label><input id='gd-image-meta-caption' value='" + image_caption + "'></div>"; // caption value
html = html + "<div class='gd-modal-button'><button class='button button-primary button-large' onclick='gd_set_image_meta(\"" + input.id + "\"," + order_id + ")'>" + geodir_params.button_set + "</button></div>"; // caption value
jQuery('#gd-image-meta-input').html(html);
lity('#gd-image-meta-input');
jQuery('#gd_image_meta_' + input.id).html(html);
lity('#gd_image_meta_' + input.id);

}

Expand All @@ -463,8 +463,8 @@ function gd_set_image_meta(input_id, order_id) {
var img_arr = images[order_id].split("|");
var image_url = img_arr[0];
var image_id = img_arr[1];
var image_title = geodir_esc_entities(jQuery('#gd-image-meta-title').val());
var image_caption = geodir_esc_entities(jQuery('#gd-image-meta-caption').val());
var image_title = geodir_esc_entities(jQuery('#gd_image_meta_' + input_id + ' #gd-image-meta-title').val());
var image_caption = geodir_esc_entities(jQuery('#gd_image_meta_' + input_id + ' #gd-image-meta-caption').val());
images[order_id] = image_url + "|" + image_id + "|" + image_title + "|" + image_caption;
imagesS = images.join("::");
jQuery("#" + input_id, jQuery('#' + input_id + 'plupload-upload-ui').parent()).val(imagesS).trigger("change");
Expand Down
2 changes: 1 addition & 1 deletion assets/js/geodirectory-plupload.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions includes/admin/class-geodir-admin-post-view.php
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ class="plupload-upload-uic hide-if-no-js <?php if ( $multiple ): ?>plupload-uplo
<span id="upload-msg"><?php _e( 'Please drag & drop the images to rearrange the order', 'geodirectory' ); ?></span>
<span class="geodir-regenerate-thumbnails bsui" style="margin:25px 0 10px 0;display:block;"><button type="button" class="button-secondary" aria-label="<?php esc_attr_e( 'Regenerate Thumbnails', 'geodirectory' );?>" aria-expanded="false" data-action="geodir-regenerate-thumbnails" data-post-id="<?php echo $post_id; ?>"><?php _e( 'Regenerate Thumbnails', 'geodirectory' );?></button><span style="margin-top:5px;display:block;"><?php _e( 'Regenerate thumbnails & metadata.', 'geodirectory' ); ?></span></span>
<?php if ( geodir_design_style() ) { ?>
<div class="modal fade bsui" id="gd-image-meta-input" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal fade bsui" id="gd_image_meta_<?php echo esc_attr( $id ); ?>" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
Expand All @@ -403,7 +403,7 @@ class="plupload-upload-uic hide-if-no-js <?php if ( $multiple ): ?>plupload-uplo
</div>
<?php } else { ?>
<span id="<?php echo $id; ?>upload-error" style="display:none"></span>
<span style="display: none" id="gd-image-meta-input" class="lity-hide lity-show"></span>
<span style="display: none" id="gd_image_meta_<?php echo esc_attr( $id ); ?>" class="lity-hide lity-show"></span>
<?php } ?>
</div>

Expand Down
3 changes: 3 additions & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,9 @@ We don't offer free trials, but we have a 30-day money-back guarantee if you are

__WARNING: GDv2 is a significant update over GDv1 and may require manual work, such as adding widgets to sidebars to recreate your current layout. As always, we recommend trying this on a staging site first. [Learn more](https://docs.wpgeodirectory.com/article/260-upgrading-from-gdv1-to-gdv2)__

= GeoDirectory v2.3.79 - TBD =
* Image meta not saved properly when multiple file fields on add/edit listing page - FIXED

= GeoDirectory v2.3.78 - 2024-09-12 =
* GD > Post Content read more link don't scrolls to tab content when tab is not placed at first - FIXED
* geodir_template_page_options() function updated to use custom query for better memory usage - CHANGED
Expand Down
2 changes: 1 addition & 1 deletion templates/bootstrap/file-upload.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
<span id="upload-msg" class="text-muted"><?php _e( 'Please drag &amp; drop the files to rearrange the order', 'geodirectory' ); ?></span>
<?php } ?>
<span id="<?php echo esc_attr( $id ); ?>upload-error" class="d-none alert alert-danger" role="alert"></span>
<div class="modal bsui fade" id="gd-image-meta-input" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal bsui fade" id="gd_image_meta_<?php echo esc_attr( $id ); ?>" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
Expand Down
2 changes: 1 addition & 1 deletion templates/file-upload.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,6 @@
<span id="upload-msg"><?php _e( 'Please drag & drop the files to rearrange the order', 'geodirectory' ); ?></span>
<?php } ?>
<span id="<?php echo esc_attr( $id ); ?>upload-error" style="display:none"></span>
<span style="display: none" id="gd-image-meta-input" class="lity-hide lity-show"></span>
<span style="display: none" id="gd_image_meta_<?php echo esc_attr( $id ); ?>" class="lity-hide lity-show"></span>
</div>
</div>

0 comments on commit 8f2f1ef

Please sign in to comment.