Upgrade sweetalert to sweetalert2

pull/3064/head
Julio 5 years ago
parent a3e8e4945a
commit d56c3b8e09
  1. 3
      assets/js/app.js
  2. 2
      assets/js/vendor.js
  3. 2
      package.json
  4. 49
      src/ThemeBundle/Resources/views/Layout/base-layout.html.twig
  5. 21
      yarn.lock

@ -22,6 +22,9 @@ require('./main');
require('webpack-jquery-ui');
require('webpack-jquery-ui/css');
import Swal from 'sweetalert2';
window.Swal = Swal;
// @todo rework url naming
const homePublicUrl = Routing.generate('home');
const mainUrl = homePublicUrl + 'main/';

@ -23,7 +23,7 @@ require('jquery.scrollbar');
require('blueimp-file-upload');
require('select2');
require('timeago');
require('sweetalert/dist/sweetalert.min');
require('sweetalert2');
require('bootstrap-select/dist/js/bootstrap-select.js');
require('bootstrap-daterangepicker');
require('fullcalendar/dist/fullcalendar.js');

@ -58,7 +58,7 @@
"qtip2": "^3.0.3",
"readmore-js": "^2.2.1",
"select2": "^4.0",
"sweetalert": "^2.1.2",
"sweetalert2": "^9.5.3",
"timeago": "^1.6.7",
"timepicker": "^1.11.14",
"uglifyjs-webpack-plugin": "^1.3.0",

@ -15,7 +15,6 @@
{% include "@ChamiloTheme/Layout/head.html.twig" %}
</head>
{% endblock %}
<body
class="{{ section_name }} app header-fixed sidebar-fixed aside-menu-fixed sidebar-lg-show"
{{ sonata_seo_html_attributes() }}
@ -24,15 +23,13 @@
data-session-id="{{ session ? session.id : '' }}"
>
<noscript> {{ "NoJavascript" | trans }} </noscript>
<!-- PAGE -->
{% block chamilo_wrap %}
<!-- HEADER -->
<!-- PAGE -->
{% block page_header %}
<!-- HEADER -->
{% include '@ChamiloTheme/Layout/header.html.twig' %}
<!-- END HEADER -->
{% endblock %}
<!-- END HEADER -->
<div class="app-body">
<!-- SIDEBAR -->
{% block page_sidebar %}
@ -51,14 +48,14 @@
<!-- END CONTENT -->
</main>
</div>
<!-- END PAGE -->
{% endblock %}
<!-- END PAGE -->
<!-- FOOTER -->
{% block chamilo_footer %}
<!-- FOOTER -->
{% include '@ChamiloTheme/Layout/footer.html.twig' %}
<!-- END FOOTER -->
{% endblock %}
<!-- END FOOTER -->
<div class="modal fade" id="expand-image-modal" tabindex="-1" role="dialog" aria-labelledby="expand-image-modal-title" aria-hidden="true">
<div class="modal-dialog modal-lg">
@ -97,23 +94,29 @@
// MODAL DELETE CONFIRM
$('.delete-swal').click(function (e) {
e.preventDefault(); // Prevent the href from redirecting directly
var linkURL = $(this).attr("href");
var url = $(this).attr("href");
var title = $(this).attr("title");
deleteConfirm(linkURL, title);
});
function deleteConfirm(linkURL, title) {
swal({
//title: '{{ 'Warning'|trans }}',
text: title,
icon: "warning",
buttons: true,
dangerMode: true,
}).then((willDelete) => {
if (willDelete) {
window.location.href = linkURL;
Swal.fire({
title: title,
text: '',
icon: 'warning',
showCancelButton: true,
cancelButtonText: '{{ 'Cancel' | trans }}',
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: '{{ 'Yes' | trans }}',
}).then((result) => {
if (result.value) {
/*Swal.fire(
'Deleted!',
'Your file has been deleted.',
'success'
)*/
window.location.href = url;
}
});
}
});
</script>
</body>

@ -2962,11 +2962,6 @@ es6-iterator@2.0.3, es6-iterator@~2.0.3:
es5-ext "^0.10.35"
es6-symbol "^3.1.1"
es6-object-assign@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/es6-object-assign/-/es6-object-assign-1.1.0.tgz#c2c3582656247c39ea107cb1e6652b6f9f24523c"
integrity sha1-wsNYJlYkfDnqEHyx5mUrb58kUjw=
es6-symbol@^3.1.1, es6-symbol@~3.1.3:
version "3.1.3"
resolved "https://registry.yarnpkg.com/es6-symbol/-/es6-symbol-3.1.3.tgz#bad5d3c1bcdac28269f4cb331e431c78ac705d18"
@ -6345,11 +6340,6 @@ promise-inflight@^1.0.1:
resolved "https://registry.yarnpkg.com/promise-inflight/-/promise-inflight-1.0.1.tgz#98472870bf228132fcbdd868129bad12c3c029e3"
integrity sha1-mEcocL8igTL8vdhoEputEsPAKeM=
promise-polyfill@^6.0.2:
version "6.1.0"
resolved "https://registry.yarnpkg.com/promise-polyfill/-/promise-polyfill-6.1.0.tgz#dfa96943ea9c121fca4de9b5868cb39d3472e057"
integrity sha1-36lpQ+qcEh/KTem1hoyznTRy4Fc=
prop-types@^15.6.2:
version "15.7.2"
resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.7.2.tgz#52c41e75b8c87e72b9d9360e0206b99dcbffa6c5"
@ -7575,13 +7565,10 @@ svgo@^1.0.0:
unquote "~1.1.1"
util.promisify "~1.0.0"
sweetalert@^2.1.2:
version "2.1.2"
resolved "https://registry.yarnpkg.com/sweetalert/-/sweetalert-2.1.2.tgz#010baaa80d0dbdc86f96bfcaa96b490728594b79"
integrity sha512-iWx7X4anRBNDa/a+AdTmvAzQtkN1+s4j/JJRWlHpYE8Qimkohs8/XnFcWeYHH2lMA8LRCa5tj2d244If3S/hzA==
dependencies:
es6-object-assign "^1.1.0"
promise-polyfill "^6.0.2"
sweetalert2@^9.5.3:
version "9.5.3"
resolved "https://registry.yarnpkg.com/sweetalert2/-/sweetalert2-9.5.3.tgz#b280e218dc387a96fa2b6175b50d75421a708f7d"
integrity sha512-4wzLUCmVby3NPQC8XHp0HRJgTm5tbAO7OOaqabATNe0U6JN/oyBTS7iJJG9V83MpcP6MLDUEWcGO/Y8i6g2jYw==
tapable@^1.0.0, tapable@^1.1.3:
version "1.1.3"

Loading…
Cancel
Save