In a form with a multi-instance-template and the save-and-continue button this button is not switched on in all situations where it should be:
- adding a new instance
- removing an existing instance
- changing the order via drag-and-drop
In a form with a multi-instance-template and the save-and-continue button this button is not switched on in all situations where it should be:
@Emwiemaikel: Thanks for taking a look at the code! You are very welcome to use developer access to submit the proposed code changes as a Git branch directly into Gerrit (repository: mediawiki/extensions/PageForms). If you don't want to set up Git/Gerrit, you can also use the Gerrit Patch Uploader. Thanks again!
@Aklapper I really have problems with the gerrit setup here. I followed the Gerrit-Tutorial which is partially good.
Overall this work experience is really bad. Will copy and paste the patch to my next comment :|
diff --git a/libs/PF_submit.js b/libs/PF_submit.js index 0120f361..94b33ca4 100644 --- a/libs/PF_submit.js +++ b/libs/PF_submit.js @@ -87,7 +87,7 @@ var oldsummary = summaryfield.attr( 'value' ); - if ( oldsummary !== '' ) { + if ( oldsummary !== undefined && oldsummary !== '' ) { summaryfield.attr( 'value', oldsummary + ' (' + saveAndContinueSummary + ')' ); } else { summaryfield.attr( 'value', saveAndContinueSummary ); diff --git a/libs/PageForms.js b/libs/PageForms.js index 7b6e9951..b0086097 100644 --- a/libs/PageForms.js +++ b/libs/PageForms.js @@ -1167,6 +1167,10 @@ $.fn.addInstance = function( addAboveCurInstance ) { // Global variable. num_elements++; + // Enable save and continue since the form changes + $("#wpSaveAndContinue").addClass('pf-save_and_continue-changed'); + $("#wpSaveAndContinue").removeAttr("disabled"); + // Create the new instance var new_div = wrapper .find(".multipleTemplateStarter") @@ -1490,6 +1494,11 @@ $.fn.initializeJSElements = function( partOfMultiple ) { $(this).remove(); }); }); + + // Enable save and continue since the form has changed + $("#wpSaveAndContinue").addClass('pf-save_and_continue-changed'); + $("#wpSaveAndContinue").removeAttr("disabled"); + return false; }); @@ -1681,6 +1690,12 @@ $(document).ready( function() { } }); + // Enable save and continue since the form has changed + $( ".multipleTemplateList" ).on( "sortupdate", function( event, ui ) { + $("#wpSaveAndContinue").addClass('pf-save_and_continue-changed'); + $("#wpSaveAndContinue").removeAttr("disabled"); + } ); + // If the form is submitted, validate everything! $('#pfForm').submit( function() { return validateAll();
@Emwiemaikel: Thanks for the feedback! Would you be willing to bring up and discuss these issues at https://www.mediawiki.org/wiki/Talk:Gerrit/Tutorial (and provide more info what exactly went wrong) so we can try to improve the documentation?
@Yaron_Koren: There is a patch pasted in this task, would you maybe have time to take a look at it? TIA! :)
@Aklapper - thanks for re-finding this. I have no memory of this task!
@Emwiemaikel - is this patch still relevant?