Skip to content

Commit

Permalink
Release 2.30 (#2168)
Browse files Browse the repository at this point in the history
This release adds the ability to change the entry creator from the Edit
Entry screen, improves upload handling, fixes various bugs, and updates
internal components.

#### 🚀 Added
* Entry creator can now be changed from the Edit Entry screen.
* `{now}`, `{yesterday}`, and `{tomorrow}` relative date merge tags.

#### ✨ Improved
* Handling of multi-file uploads on the Edit Entry screen.

#### 🐛 Fixed
* Entry loading inside a lightbox did not work in some cases when
BuddyPress was active.
* Resending notifications from the Entries screen did not work when
sending to all entries filtered by approval status.
* Conflict with the Wordfence plugin caused a fatal error when
redirecting users after deleting an entry.
* Fatal error when rendering a GravityView View field with a
non-existent View ID.
* Survey field (Rating type) values were displayed in reverse order when
a View was embedded inside another View.
* Unexpected scrolling in the View editor after adding a field.
* PHP notice when rendering a View with a field associated with an
inactive add-on.

#### 🔧 Updated
* [Foundation](https://www.gravitykit.com/foundation/) to version
1.2.19.

💾 [Build
file](https://www.dropbox.com/scl/fi/d0d50mffwhk00zvsortkd/gravityview-2.30-337c11b94.zip?rlkey=753c9m53zqqq8gxjxs8y00uqw&dl=1)
(337c11b).
  • Loading branch information
mrcasual authored Oct 14, 2024
2 parents 428a604 + 655f9a2 commit 2f005f6
Show file tree
Hide file tree
Showing 21 changed files with 1,067 additions and 519 deletions.
16 changes: 14 additions & 2 deletions assets/js/admin-views.js
Original file line number Diff line number Diff line change
Expand Up @@ -2043,7 +2043,19 @@

viewConfiguration.setTooltipLayout( activate_layout );

$focus_item.trigger('focus');
// Smooth scroll to focus.
$focus_item[ 0 ].focus( { preventScroll: true } );
const box = $focus_item[ 0 ].getBoundingClientRect();

if ( box.y < 0 || box.y > document.body.getBoundingClientRect().height ) {
window.scrollTo(
{
left: window.scrollX,
top: window.scrollY + box.y + ( box.y < 0 ? -60 : 60 ),
behavior: 'smooth'
}
);
}
},
closeOnEscape: true,
disabled: true, // Don't open on hover
Expand Down Expand Up @@ -3253,4 +3265,4 @@
.fail( on_fail );
} );
} );
}(jQuery));
}(jQuery));
83 changes: 83 additions & 0 deletions assets/js/fe-views.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,95 @@ jQuery( function ( $ ) {
$( '.gv-search-clear' ).on( 'click', this.clear_search );

$( 'a.gv-sort' ).on( 'click', this.multiclick_sort );

this.disable_upload_file_when_limit_reached();

this.fix_updating_files_after_edit();

this.number_range();

this.iframe();
},

/**
* Fix the issue of updating files after edit where the previous value still exists in the uploaded field.
*/
fix_updating_files_after_edit: function(){
$.each($('.ginput_preview_list'), function(index, element){
if ($(element).children().length > 0) {
return true;
}

$(element).parents('form').find('[name=gform_uploaded_files]').val('');
});
},

/**
* Fix the issue for file upload fields where the button is not disabled and show message for multi upload file.
*/
disable_upload_file_when_limit_reached: function(){

var checkUploaders = setInterval(function() {
if (typeof gfMultiFileUploader !== 'undefined' && gfMultiFileUploader.uploaders) {
clearInterval(checkUploaders);
$.each(gfMultiFileUploader.uploaders, function(index, uploader){
uploader.bind('Init', function(up, params) {
var data = up.settings;
var max = data.gf_vars.max_files;
var fieldId = data.multipart_params.field_id;
var existingFilesCount = $('#preview_existing_files_'+fieldId).children().length;
var limitReached = existingFilesCount >= max;
gfMultiFileUploader.toggleDisabled(data, limitReached);
});

uploader.bind('FilesAdded', function(up, files) {
var data = up.settings;
var max = data.gf_vars.max_files;
var fieldId = data.multipart_params.field_id;
var formId = data.multipart_params.form_id;
var newFilesCount = $('#gform_preview_'+formId+'_'+fieldId).children().length;
var existingFilesCount = $('#preview_existing_files_'+fieldId).children().length;
var limitReached = existingFilesCount + newFilesCount >= max;

$.each(files, function(i, file) {
if (max > 0 && existingFilesCount >= max){
up.removeFile(file);
$('#'+file.id).remove();
return;
}

existingFilesCount++;
});

gfMultiFileUploader.toggleDisabled(data, limitReached);


// Only show message if max is greater than 1
if(max <= 1){
return true;
}

// Check if message already exists

if($("#" + up.settings.gf_vars.message_id).children().length > 0){
return true;
}
$( "#" + up.settings.gf_vars.message_id ).prepend( "<li class='gfield_description gfield_validation_message'>" +
$('<div/>').text(gform_gravityforms.strings.max_reached).html()
+
"</li>" );
// Announce errors.
setTimeout(function () {
wp.a11y.speak( $( "#" + up.settings.gf_vars.message_id ).text() );
}, 1000 );

});

});
}
}, 1);
},

/**
* Triggered when the search form changes
* - Adds 'data-form-changed' attribute to <form> wrapper
Expand Down
Loading

0 comments on commit 2f005f6

Please sign in to comment.