Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LUT-29358: Ensure the button to delete the progress is only displayed if there is saved progress #409

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ public final class FormsConstants
public static final String MARK_REGEX_URL = "regex_url";
public static final String MARK_UPLOAD_HANDLER = "uploadHandler";
public static final String MARK_DEFAULT_VALUE_WORKGROUP_KEY = "workgroup_key_default_value";
public static final String MARK_HAS_BACKUP_RESPONSE = "hasBackupResponse";

// Parameters
public static final String PARAMETER_PAGE = "page";
Expand Down
4 changes: 4 additions & 0 deletions src/java/fr/paris/lutece/plugins/forms/web/FormXPage.java
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,7 @@ public synchronized XPage getStepView( HttpServletRequest request ) throws SiteM
Object [ ] args = {
_formResponseManager.getFormResponseUpdateDate(),
};

model.put( FormsConstants.MARK_INFO, I18nService.getLocalizedString( FormsConstants.MESSAGE_LOAD_BACKUP, args, getLocale( request ) ) );
}

Expand Down Expand Up @@ -444,7 +445,10 @@ private void getFormStepModel( Form form, HttpServletRequest request, Map<String
{
Map<String, Object> modelForStep = _breadcrumb.getModelForCurrentStep( request, _formResponseManager );
modelForStep.put( SecurityTokenService.MARK_TOKEN, SecurityTokenService.getInstance( ).getToken( request, ACTION_SAVE_FORM_RESPONSE ) );
// Set whether the current form's responses are from a backed up save or not
modelForStep.put( FormsConstants.MARK_HAS_BACKUP_RESPONSE, _formResponseManager.getFormResponse( ).isFromSave( ) );
_stepDisplayTree.addModel( modelForStep );

FormsResponseUtils.populateFormWithLogoAndNumberResponse(form);
model.put( FormsConstants.MARK_FORM, form );
model.put( STEP_HTML_MARKER,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,8 @@ public String getStepView( HttpServletRequest request )

Map<String, Object> modelForStep = _breadcrumb.getModelForCurrentStep( request, _formResponseManager );
modelForStep.put( SecurityTokenService.MARK_TOKEN, SecurityTokenService.getInstance( ).getToken( request, ACTION_SAVE_FORM_RESPONSE ) );
// Set whether the current form's responses are from a backed up save or not
modelForStep.put( FormsConstants.MARK_HAS_BACKUP_RESPONSE, _formResponseManager.getFormResponse( ).isFromSave( ) );
_stepDisplayTree.addModel( modelForStep );

getFormStepModel( form, request, model );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@
<button class="btn btn-primary btn-sm" name="action_doSaveStep" type="submit">#i18n{forms.step.next}</button>
</#if>
<#if form.backupEnabled>
<button class="btn btn-info btn-sm pull-right" name="action_doResetBackup" type="submit" >#i18n{forms.step.resetResponse}</button>
<#if hasBackupResponse>
<button class="btn btn-info btn-sm pull-right" name="action_doResetBackup" type="submit" >#i18n{forms.step.resetResponse}</button>
</#if>
<button class="btn btn-info btn-sm pull-right" name="action_doSaveForBackup" type="submit" >#i18n{forms.step.saveResponse}</button>
</#if>
</@boxBody>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ <h3 class="card-header">${step.title}</h3>
</#if>
<#if user?? && form.backupEnabled>
<div class="d-grid d-md-flex justify-content-md-end">
<button class="btn btn-info btn-sm me-md-1" name="action_doResetBackup" type="submit" >#i18n{forms.step.resetResponse}</button>
<#if hasBackupResponse>
<button class="btn btn-info btn-sm me-md-1" name="action_doResetBackup" type="submit" >#i18n{forms.step.resetResponse}</button>
</#if>
<button class="btn btn-info btn-sm" name="action_doSaveForBackup" type="submit" >#i18n{forms.step.saveResponse}</button>
</div>
</#if>
Expand Down