Skip to content

Commit

Permalink
Fixed issue #13798: Ajaxmode : default save/reload button unfonctional
Browse files Browse the repository at this point in the history
Dev: event selector moved to $('#limesurvey [type=submit]:not([data-confirmedby])')
Dev: adding ls-js-hidden to the label for clearall checkbox confirm
  • Loading branch information
Shnoulle committed Jun 21, 2018
1 parent e730c59 commit 133d094
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion application/config/version.php
Expand Up @@ -16,5 +16,5 @@
$config['dbversionnumber'] = 351;
$config['buildnumber'] = '';
$config['updatable'] = true;
$config['assetsversionnumber'] = '30041';
$config['assetsversionnumber'] = '30042';
return $config;
1 change: 1 addition & 0 deletions application/models/TemplateConfig.php
Expand Up @@ -717,6 +717,7 @@ public function getClassAndAttributes()
$aClassAndAttributes['attr']['clearalllinks'] = $aClassAndAttributes['attr']['clearalllink'] = ' ';
// Clearall Buttons
$aClassAndAttributes['class']['clearallwrapper'] = $aClassAndAttributes['class']['clearallconfirm'] = ""; // No need, adding it if need something after
$aClassAndAttributes['class']['clearalllabel'] = "ls-js-hidden";
$aClassAndAttributes['attr']['clearallconfirm'] = 'value="confirm" name="confirm-clearall" type="checkbox"';
$aClassAndAttributes['attr']['clearallbutton'] = 'type="submit" value="clearall" name="move" data-confirmedby="confirm-clearall"';
$aClassAndAttributes['class']['clearallbutton'] = "ls-clearaction ls-clearall"; // Not needed, keep it (and adding to twig to be most compatible in future)
Expand Down
5 changes: 4 additions & 1 deletion themes/survey/vanilla/scripts/ajaxify.js
Expand Up @@ -92,7 +92,10 @@ var AjaxSubmitObject = function () {
scriptloadtimeout: 1500,
});
// Always bind to document to not need to bind again
$(document).on('click', '.ls-move-btn',function (e) {
// Restrict to [type=submit]:not([data-confirmedby])
// - :submit is the default if button don't have type (reset button on slider for example),
// - confirmedby have their own javascript system
$(document).on('click', '#limesurvey [type=submit]:not([data-confirmedby])',function (e) {
$('#limesurvey').append('<input name=\''+$(this).attr('name')+'\' value=\''+$(this).attr('value')+'\' type=\'hidden\' />');
if(isIE10 || /Edge\/\d+\.\d+/.test(navigator.userAgent)) {
e.preventDefault();
Expand Down
Expand Up @@ -5,7 +5,7 @@
#}

<div class="{{ aSurveyInfo.class.clearallwrapper }} form-inline">
<label class="form-group">
<label class="form-group {{ aSurveyInfo.class.clearalllabel }}">
<input {{ aSurveyInfo.attr.clearallconfirm }} class="{{ aSurveyInfo.class.clearallconfirm }}"><span class="control-label">{{gT("Please confirm you want to clear your response?")}}</span>
</label>
<button {{ aSurveyInfo.attr.clearallbutton }} class="{{ aSurveyInfo.class.clearallbutton }} btn btn-link" title="{{ gT('This action need confirmation.') }}">{{gT("Exit and clear survey")}}</button>
Expand Down

0 comments on commit 133d094

Please sign in to comment.