##// END OF EJS Templates
templates: switched most of confirm dialogs to sweetalert2
ergo -
r4313:4bf03e9f default
parent child Browse files
Show More
@@ -246,7 +246,7 b''
246 246 box-sizing: border-box;
247 247 flex-direction: column;
248 248 justify-content: center;
249 width: 32em;
249 width: 38em;
250 250 max-width: 100%;
251 251 padding: 1.25em;
252 252 border: none;
@@ -594,7 +594,15 b' var CommentsController = function() {'
594 594 showCancelButton: true,
595 595 confirmButtonColor: '#84a5d2',
596 596 cancelButtonColor: '#e85e4d',
597 confirmButtonText: _gettext('Yes, delete comment #{0}!').format(comment_id)
597 confirmButtonText: _gettext('Yes, delete comment #{0}!').format(comment_id),
598 showClass: {
599 popup: 'swal2-noanimation',
600 backdrop: 'swal2-noanimation'
601 },
602 hideClass: {
603 popup: '',
604 backdrop: ''
605 }
598 606 }).then(function(result) {
599 607 if (result.value) {
600 608 self._deleteComment(node);
@@ -120,4 +120,40 b' function ajaxErrorSwal(message) {'
120 120 backdrop: ''
121 121 }
122 122 })
123 }
124
125 /*
126 * use in onclick attributes e.g
127 * onclick="submitConfirm(event, this, _gettext('Confirm to delete '), _gettext('Confirm Delete'), 'what we delete')">
128 * */
129 function submitConfirm(event, self, question, confirmText, htmlText) {
130 if (htmlText === "undefined") {
131 htmlText = null;
132 }
133 if (confirmText === "undefined") {
134 confirmText = _gettext('Delete')
135 }
136 event.preventDefault();
137
138 Swal.fire({
139 title: question,
140 icon: 'warning',
141 html: htmlText,
142 showClass: {
143 popup: 'swal2-noanimation',
144 backdrop: 'swal2-noanimation'
145 },
146 hideClass: {
147 popup: '',
148 backdrop: ''
149 },
150 showCancelButton: true,
151 confirmButtonColor: '#84a5d2',
152 cancelButtonColor: '#e85e4d',
153 confirmButtonText: confirmText
154 }).then(function(result) {
155 if (result.value) {
156 $(self).closest("form").submit();
157 }
158 })
123 159 } No newline at end of file
@@ -54,7 +54,10 b''
54 54 %if c.is_super_admin or c.gist.gist_owner == c.rhodecode_user.user_id:
55 55 <div class="pull-right remove_gist">
56 56 ${h.secure_form(h.route_path('gist_delete', gist_id=c.gist.gist_access_id), request=request)}
57 ${h.submit('remove_gist', _('Delete'),class_="btn btn-mini btn-danger",onclick="return confirm('"+_('Confirm to delete this Gist')+"');")}
57 <input class="btn btn-mini btn-danger" id="remove_gist" name="remove_gist"
58 onclick="submitConfirm(event, this, _gettext('Confirm to delete this gist'), _gettext('Delete'), '${c.gist.gist_access_id}')"
59 type="submit" value="${_('Delete')}"
60 >
58 61 ${h.end_form()}
59 62 </div>
60 63 %endif
@@ -46,7 +46,8 b''
46 46 ${h.secure_form(h.route_path('my_account_auth_tokens_delete'), request=request)}
47 47 ${h.hidden('del_auth_token', auth_token.user_api_key_id)}
48 48 <button class="btn btn-link btn-danger" type="submit"
49 onclick="return confirm('${_('Confirm to remove this auth token: %s') % auth_token.token_obfuscated}');">
49 onclick="submitConfirm(event, this, _gettext('Confirm to delete this auth token'), _gettext('Delete'), '${auth_token.token_obfuscated}')"
50 >
50 51 ${_('Delete')}
51 52 </button>
52 53 ${h.end_form()}
@@ -28,7 +28,8 b''
28 28 ${h.secure_form(h.route_path('my_account_emails_delete'), request=request)}
29 29 ${h.hidden('del_email_id',em.email_id)}
30 30 <button class="btn btn-link btn-danger" type="submit" id="${'remove_email_%s'.format(em.email_id)}"
31 onclick="return confirm('${_('Confirm to delete this email: {}').format(em.email)}');">
31 onclick="submitConfirm(event, this, _gettext('Confirm to delete this email'), _gettext('Delete'), '${em.email}')"
32 >
32 33 ${_('Delete')}
33 34 </button>
34 35 ${h.end_form()}
@@ -29,7 +29,8 b''
29 29 ${h.secure_form(h.route_path('my_account_ssh_keys_delete'), request=request)}
30 30 ${h.hidden('del_ssh_key', ssh_key.ssh_key_id)}
31 31 <button class="btn btn-link btn-danger" type="submit"
32 onclick="return confirm('${_('Confirm to remove ssh key %s') % ssh_key.ssh_key_fingerprint}');">
32 onclick="submitConfirm(event, this, _gettext('Confirm to delete this ssh key'), _gettext('Delete'), '${ssh_key.ssh_key_fingerprint}')"
33 >
33 34 ${_('Delete')}
34 35 </button>
35 36 ${h.end_form()}
@@ -93,14 +93,16 b''
93 93 %if c.rhodecode_db_repo.locked[0]:
94 94 ${h.hidden('set_unlock', '1')}
95 95 <button class="btn btn-small" type="submit"
96 onclick="return confirm('${_('Confirm to unlock repository.')}');">
96 onclick="submitConfirm(event, this, _gettext('Confirm to unlock this repository'), _gettext('Unlock'), '${c.rhodecode_db_repo.repo_name}')"
97 >
97 98 <i class="icon-unlock"></i>
98 99 ${_('Unlock repository')}
99 100 </button>
100 101 %else:
101 102 ${h.hidden('set_lock', '1')}
102 103 <button class="btn btn-small" type="submit"
103 onclick="return confirm('${_('Confirm to lock repository.')}');">
104 onclick="submitConfirm(event, this, _gettext('Confirm to lock this repository'), _gettext('lock'), '${c.rhodecode_db_repo.repo_name}')"
105 >
104 106 <i class="icon-lock"></i>
105 107 ${_('Lock repository')}
106 108 </button>
@@ -166,7 +168,8 b''
166 168
167 169 <div class="field">
168 170 <button class="btn btn-small btn-warning" type="submit"
169 onclick="return confirm('${_('Confirm to archive this repository: %s') % c.repo_name}');">
171 onclick="submitConfirm(event, this, _gettext('Confirm to archive this repository'), _gettext('Archive'), '${c.rhodecode_db_repo.repo_name}')"
172 >
170 173 ${_('Archive this repository')}
171 174 </button>
172 175 </div>
@@ -221,7 +224,8 b''
221 224
222 225 <div class="field">
223 226 <button class="btn btn-small btn-danger" type="submit"
224 onclick="return confirm('${_('Confirm to delete this repository: %s') % c.repo_name}');">
227 onclick="submitConfirm(event, this, _gettext('Confirm to delete this repository'), _gettext('Delete'), '${c.rhodecode_db_repo.repo_name}')"
228 >
225 229 ${_('Delete this repository')}
226 230 </button>
227 231 </div>
@@ -17,7 +17,11 b''
17 17 ${h.secure_form(h.route_path('edit_repo_caches', repo_name=c.repo_name), request=request)}
18 18 <div class="form">
19 19 <div class="fields">
20 ${h.submit('reset_cache_%s' % c.rhodecode_db_repo.repo_name,_('Invalidate repository cache'),class_="btn btn-small",onclick="return confirm('"+_('Confirm to invalidate repository cache')+"');")}
20 <input class="btn btn-small" id="reset_cache_${c.rhodecode_db_repo.repo_id}"
21 name="reset_cache_${c.rhodecode_db_repo.repo_id}"
22 onclick="submitConfirm(event, this, _gettext('Confirm to invalidate repository cache'), _gettext('Invalidate Cache'), '${c.rhodecode_db_repo.repo_name}')"
23 type="submit" value="${_('Invalidate repository cache')}"
24 >
21 25 </div>
22 26 </div>
23 27 ${h.end_form()}
@@ -37,7 +37,12 b''
37 37 ${h.secure_form(h.route_path('edit_repo_remote_pull', repo_name=c.repo_name), request=request)}
38 38 <div class="form">
39 39 <div class="fields">
40 ${h.submit('remote_pull_%s' % c.rhodecode_db_repo.repo_name,_('Pull changes from remote location'),class_="btn btn-small",onclick="return confirm('"+_('Confirm to pull changes from remote side')+"');")}
40 <input class="btn btn-small"
41 id="remote_pull_${c.rhodecode_db_repo.repo_id}"
42 name="remote_pull_${c.rhodecode_db_repo.repo_id}"
43 onclick="submitConfirm(event, this, _gettext('Confirm pull changes from remote side'), _gettext('Pull changes'), '${c.rhodecode_db_repo.clone_uri_hidden}')"
44 type="submit" value="${_('Pull changes from remote location')}"
45 >
41 46 </div>
42 47 </div>
43 48 ${h.end_form()}
@@ -35,7 +35,7 b''
35 35
36 36 <div class="field">
37 37 <button class="btn btn-small btn-danger" type="submit"
38 onclick="return confirm('${_('Confirm to delete this exception')}');">
38 onclick="submitConfirm(event, this, _gettext('Confirm to delete this exception'), _gettext('Delete'), ${c.exception_id})">
39 39 <i class="icon-remove"></i>
40 40 ${_('Delete This Exception')}
41 41 </button>
@@ -16,7 +16,8 b''
16 16 <input type="hidden" name="type_filter", value="${c.type_filter}">
17 17 <div class="field">
18 18 <button class="btn btn-small btn-danger" type="submit"
19 onclick="return confirm('${_('Confirm to delete all exceptions')}');">
19 onclick="submitConfirm(event, this, _gettext('Confirm to delete all exceptions'), _gettext('Delete'), '${'total:{}'.format(c.exception_list_count)}')"
20 >
20 21 <i class="icon-remove"></i>
21 22 % if c.type_filter:
22 23 ${_('Delete All `{}`').format(c.type_filter)}
@@ -176,8 +176,10 b''
176 176 </div>
177 177 <div class="grid_delete">
178 178 ${h.secure_form(h.route_path('edit_repo_advanced_delete', repo_name=repo_name), request=request)}
179 ${h.submit('remove_%s' % repo_name,_('Delete'),class_="btn btn-link btn-danger",
180 onclick="return confirm('"+_('Confirm to delete this repository: %s') % repo_name+"');")}
179 <input class="btn btn-link btn-danger" id="remove_${repo_name}" name="remove_${repo_name}"
180 onclick="submitConfirm(event, this, _gettext('Confirm to delete this repository'), _gettext('Delete'), '${repo_name}')"
181 type="submit" value="Delete"
182 >
181 183 ${h.end_form()}
182 184 </div>
183 185 </div>
@@ -250,8 +252,10 b''
250 252 </div>
251 253 <div class="grid_delete">
252 254 ${h.secure_form(h.route_path('edit_repo_group_advanced_delete', repo_group_name=repo_group_name), request=request)}
253 ${h.submit('remove_%s' % repo_group_name,_('Delete'),class_="btn btn-link btn-danger",
254 onclick="return confirm('"+_ungettext('Confirm to delete this group: %s with %s repository','Confirm to delete this group: %s with %s repositories',gr_count) % (repo_group_name, gr_count)+"');")}
255 <input class="btn btn-link btn-danger" id="remove_${repo_group_name}" name="remove_${repo_group_name}"
256 onclick="submitConfirm(event, this, _gettext('Confirm to delete this repository group'), _gettext('Delete'), '${_ungettext('`{}` with {} repository','`{}` with {} repositories',gr_count).format(repo_group_name, gr_count)}')"
257 type="submit" value="Delete"
258 >
255 259 ${h.end_form()}
256 260 </div>
257 261 </%def>
@@ -265,8 +269,10 b''
265 269 </div>
266 270 <div class="grid_delete">
267 271 ${h.secure_form(h.route_path('user_delete', user_id=user_id), request=request)}
268 ${h.submit('remove_',_('Delete'),id="remove_user_%s" % user_id, class_="btn btn-link btn-danger",
269 onclick="return confirm('"+_('Confirm to delete this user: %s') % username+"');")}
272 <input class="btn btn-link btn-danger" id="remove_user_${user_id}" name="remove_user_${user_id}"
273 onclick="submitConfirm(event, this, _gettext('Confirm to delete this user'), _gettext('Delete'), '${username}')"
274 type="submit" value="Delete"
275 >
270 276 ${h.end_form()}
271 277 </div>
272 278 </%def>
@@ -277,8 +283,10 b''
277 283 </div>
278 284 <div class="grid_delete">
279 285 ${h.secure_form(h.route_path('user_groups_delete', user_group_id=user_group_id), request=request)}
280 ${h.submit('remove_',_('Delete'),id="remove_group_%s" % user_group_id, class_="btn btn-link btn-danger",
281 onclick="return confirm('"+_('Confirm to delete this user group: %s') % user_group_name+"');")}
286 <input class="btn btn-link btn-danger" id="remove_group_${user_group_id}" name="remove_group_${user_group_id}"
287 onclick="submitConfirm(event, this, _gettext('Confirm to delete this user group'), _gettext('Delete'), '${user_group_name}')"
288 type="submit" value="Delete"
289 >
282 290 ${h.end_form()}
283 291 </div>
284 292 </%def>
@@ -423,8 +431,10 b''
423 431 % if h.HasRepoPermissionAny('repository.admin')(c.repo_name):
424 432 <div class="grid_delete">
425 433 ${h.secure_form(h.route_path('repo_artifacts_delete', repo_name=repo_name, uid=file_store_id), request=request)}
426 ${h.submit('remove_',_('Delete'),id="remove_artifact_%s" % file_store_id, class_="btn btn-link btn-danger",
427 onclick="return confirm('"+_('Confirm to delete this artifact: %s') % file_uid+"');")}
434 <input class="btn btn-link btn-danger" id="remove_artifact_${file_store_id}" name="remove_artifact_${file_store_id}"
435 onclick="submitConfirm(event, this, _gettext('Confirm to delete this artifact'), _gettext('Delete'), '${file_uid}')"
436 type="submit" value="${_('Delete')}"
437 >
428 438 ${h.end_form()}
429 439 </div>
430 440 % endif
@@ -63,8 +63,9 b''
63 63 <div id="delete_pullrequest" class="action_button pr-save ${('' if c.allowed_to_delete else 'disabled' )}" style="display: none;">
64 64 % if c.allowed_to_delete:
65 65 ${h.secure_form(h.route_path('pullrequest_delete', repo_name=c.pull_request.target_repo.repo_name, pull_request_id=c.pull_request.pull_request_id), request=request)}
66 ${h.submit('remove_%s' % c.pull_request.pull_request_id, _('Delete pull request'),
67 class_="btn btn-link btn-danger no-margin",onclick="return confirm('"+_('Confirm to delete this pull request')+"');")}
66 <input class="btn btn-link btn-danger no-margin" id="remove_${c.pull_request.pull_request_id}" name="remove_${c.pull_request.pull_request_id}"
67 onclick="submitConfirm(event, this, _gettext('Confirm to delete this pull request'), _gettext('Delete'), '${'!{}'.format(c.pull_request.pull_request_id)}')"
68 type="submit" value="${_('Delete pull request')}">
68 69 ${h.end_form()}
69 70 % else:
70 71 <span class="tooltip" title="${_('Not allowed to delete this pull request')}">${_('Delete pull request')}</span>
General Comments 0
You need to be logged in to leave comments. Login now