Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed issue #13803: Deprecated confirm box since 3.0 alpha
- Loading branch information
Showing
11 changed files
with
160 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
assets/packages/bootstrap/plugins/bootstrapconfirm/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#bsconfirm instead of jsconfirm | ||
|
||
usage is really easy, instead of | ||
|
||
```javascript | ||
if(confirm(confirmText)) { | ||
//do something | ||
} | ||
``` | ||
|
||
Just do | ||
|
||
```javascript | ||
$.bsconfirm(confirmText, LSvar.lang, function onClickOK(){ | ||
//do something | ||
} | ||
); | ||
``` | ||
|
||
If you like you may even add a "on click cancel button" function | ||
|
||
```javascript | ||
$.bsconfirm(confirmText, LSvar.lang, function onClickOK(){ | ||
//do something | ||
}, function onClickCancelButton(){ | ||
//do something | ||
} | ||
); | ||
``` | ||
|
||
To compile this please install babel and unglifyjs. | ||
|
37 changes: 37 additions & 0 deletions
37
assets/packages/bootstrap/plugins/bootstrapconfirm/bootstrapconfirm.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
'use strict'; | ||
|
||
jQuery.extend({ | ||
bsconfirm: function bsconfirm(text, i18n, cbok, cbcancel) { | ||
|
||
cbok = cbok || function () { | ||
$('#identity__bsconfirmModal').modal('hide'); | ||
}; | ||
cbcancel = cbcancel || function () { | ||
$('#identity__bsconfirmModal').modal('hide'); | ||
}; | ||
i18n = i18n || {}; | ||
|
||
var modal = $('\n <div id="identity__bsconfirmModal" class="modal fade">\n <div class="modal-dialog">\n <div class="modal-content">\n <div class="modal-body">\n <button type="button" class="close" data-dismiss="modal">×</button>\n ' + text + '\n </div>\n <div class="modal-footer">\n <button id="identity__bsconfirmModal_button_cancel" type="button" class="btn btn-default">' + (i18n.confirm_cancel || '<i class="fa fa-times"></i>') + '</button>\n <button id="identity__bsconfirmModal_button_ok" type="button" class="btn btn-danger">' + (i18n.confirm_ok || '<i class="fa fa-check"></i>') + '</button>\n </div>\n </div>\n </div>\n </div>\n '); | ||
|
||
if ($('body').find('#identity__bsconfirmModal').length == 0) { | ||
$('body').append(modal); | ||
} else { | ||
$('body').find('#identity__bsconfirmModal').remove(); | ||
$('body').append(modal); | ||
} | ||
|
||
modal.modal({ | ||
backdrop: "static", | ||
show: true | ||
}); | ||
|
||
modal.on('hidden.bs.modal', function () { | ||
modal.remove(); | ||
}); | ||
modal.on('shown.bs.modal', function () { | ||
$('#identity__bsconfirmModal_button_ok').on('click', cbok); | ||
$('#identity__bsconfirmModal_button_cancel').on('click', cbcancel); | ||
}); | ||
} | ||
}); | ||
|
1 change: 1 addition & 0 deletions
1
assets/packages/bootstrap/plugins/bootstrapconfirm/bootstrapconfirm.min.js
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
45 changes: 45 additions & 0 deletions
45
assets/packages/bootstrap/plugins/bootstrapconfirm/bootstrapconfirm.src.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
jQuery.extend({ | ||
bsconfirm : function(text, i18n, cbok, cbcancel){ | ||
|
||
cbok = cbok || function(){$('#identity__bsconfirmModal').modal('hide');}; | ||
cbcancel = cbcancel || function(){$('#identity__bsconfirmModal').modal('hide');}; | ||
i18n = i18n || {}; | ||
|
||
const modal = $(` | ||
<div id="identity__bsconfirmModal" class="modal fade"> | ||
<div class="modal-dialog"> | ||
<div class="modal-content"> | ||
<div class="modal-body"> | ||
<button type="button" class="close" data-dismiss="modal">×</button> | ||
${text} | ||
</div> | ||
<div class="modal-footer"> | ||
<button id="identity__bsconfirmModal_button_cancel" type="button" class="btn btn-default">${i18n.confirm_cancel || '<i class="fa fa-times"></i>'}</button> | ||
<button id="identity__bsconfirmModal_button_ok" type="button" class="btn btn-danger">${i18n.confirm_ok || '<i class="fa fa-check"></i>'}</button> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
`); | ||
|
||
if($('body').find('#identity__bsconfirmModal').length == 0) { | ||
$('body').append(modal); | ||
} else { | ||
$('body').find('#identity__bsconfirmModal').remove(); | ||
$('body').append(modal); | ||
} | ||
|
||
modal.modal({ | ||
backdrop: "static", | ||
show: true, | ||
}); | ||
|
||
modal.on('hidden.bs.modal', function(){ | ||
modal.remove(); | ||
}); | ||
modal.on('shown.bs.modal', function(){ | ||
$('#identity__bsconfirmModal_button_ok').on('click', cbok); | ||
$('#identity__bsconfirmModal_button_cancel').on('click', cbcancel); | ||
}); | ||
} | ||
}); |
2 changes: 2 additions & 0 deletions
2
assets/packages/bootstrap/plugins/bootstrapconfirm/compile.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
babel bootstrapconfirm.src.js > bootstrapconfirm.js | ||
uglifyjs --compress -- bootstrapconfirm.js > bootstrapconfirm.min.js |
7 changes: 7 additions & 0 deletions
7
assets/packages/bootstrap/plugins/bootstrapconfirm/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"dependencies": { | ||
"babel-preset-env": "^1.7.0", | ||
"babel-cli": "^6.26.0", | ||
"uglifyjs": "^2.4.11" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Just for information , previously : https://bugs.limesurvey.org/view.php?id=11977 it's not in «default/base» template, but only for advanced template. Like alert …
And there was some discussion about this part …