##// 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 box-sizing: border-box;
246 box-sizing: border-box;
247 flex-direction: column;
247 flex-direction: column;
248 justify-content: center;
248 justify-content: center;
249 width: 32em;
249 width: 38em;
250 max-width: 100%;
250 max-width: 100%;
251 padding: 1.25em;
251 padding: 1.25em;
252 border: none;
252 border: none;
@@ -594,7 +594,15 b' var CommentsController = function() {'
594 showCancelButton: true,
594 showCancelButton: true,
595 confirmButtonColor: '#84a5d2',
595 confirmButtonColor: '#84a5d2',
596 cancelButtonColor: '#e85e4d',
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 }).then(function(result) {
606 }).then(function(result) {
599 if (result.value) {
607 if (result.value) {
600 self._deleteComment(node);
608 self._deleteComment(node);
@@ -120,4 +120,40 b' function ajaxErrorSwal(message) {'
120 backdrop: ''
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 } No newline at end of file
159 }
@@ -54,7 +54,10 b''
54 %if c.is_super_admin or c.gist.gist_owner == c.rhodecode_user.user_id:
54 %if c.is_super_admin or c.gist.gist_owner == c.rhodecode_user.user_id:
55 <div class="pull-right remove_gist">
55 <div class="pull-right remove_gist">
56 ${h.secure_form(h.route_path('gist_delete', gist_id=c.gist.gist_access_id), request=request)}
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 ${h.end_form()}
61 ${h.end_form()}
59 </div>
62 </div>
60 %endif
63 %endif
@@ -46,7 +46,8 b''
46 ${h.secure_form(h.route_path('my_account_auth_tokens_delete'), request=request)}
46 ${h.secure_form(h.route_path('my_account_auth_tokens_delete'), request=request)}
47 ${h.hidden('del_auth_token', auth_token.user_api_key_id)}
47 ${h.hidden('del_auth_token', auth_token.user_api_key_id)}
48 <button class="btn btn-link btn-danger" type="submit"
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 ${_('Delete')}
51 ${_('Delete')}
51 </button>
52 </button>
52 ${h.end_form()}
53 ${h.end_form()}
@@ -28,7 +28,8 b''
28 ${h.secure_form(h.route_path('my_account_emails_delete'), request=request)}
28 ${h.secure_form(h.route_path('my_account_emails_delete'), request=request)}
29 ${h.hidden('del_email_id',em.email_id)}
29 ${h.hidden('del_email_id',em.email_id)}
30 <button class="btn btn-link btn-danger" type="submit" id="${'remove_email_%s'.format(em.email_id)}"
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 ${_('Delete')}
33 ${_('Delete')}
33 </button>
34 </button>
34 ${h.end_form()}
35 ${h.end_form()}
@@ -29,7 +29,8 b''
29 ${h.secure_form(h.route_path('my_account_ssh_keys_delete'), request=request)}
29 ${h.secure_form(h.route_path('my_account_ssh_keys_delete'), request=request)}
30 ${h.hidden('del_ssh_key', ssh_key.ssh_key_id)}
30 ${h.hidden('del_ssh_key', ssh_key.ssh_key_id)}
31 <button class="btn btn-link btn-danger" type="submit"
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 ${_('Delete')}
34 ${_('Delete')}
34 </button>
35 </button>
35 ${h.end_form()}
36 ${h.end_form()}
@@ -93,14 +93,16 b''
93 %if c.rhodecode_db_repo.locked[0]:
93 %if c.rhodecode_db_repo.locked[0]:
94 ${h.hidden('set_unlock', '1')}
94 ${h.hidden('set_unlock', '1')}
95 <button class="btn btn-small" type="submit"
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 <i class="icon-unlock"></i>
98 <i class="icon-unlock"></i>
98 ${_('Unlock repository')}
99 ${_('Unlock repository')}
99 </button>
100 </button>
100 %else:
101 %else:
101 ${h.hidden('set_lock', '1')}
102 ${h.hidden('set_lock', '1')}
102 <button class="btn btn-small" type="submit"
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 <i class="icon-lock"></i>
106 <i class="icon-lock"></i>
105 ${_('Lock repository')}
107 ${_('Lock repository')}
106 </button>
108 </button>
@@ -166,7 +168,8 b''
166
168
167 <div class="field">
169 <div class="field">
168 <button class="btn btn-small btn-warning" type="submit"
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 ${_('Archive this repository')}
173 ${_('Archive this repository')}
171 </button>
174 </button>
172 </div>
175 </div>
@@ -221,7 +224,8 b''
221
224
222 <div class="field">
225 <div class="field">
223 <button class="btn btn-small btn-danger" type="submit"
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 ${_('Delete this repository')}
229 ${_('Delete this repository')}
226 </button>
230 </button>
227 </div>
231 </div>
@@ -17,7 +17,11 b''
17 ${h.secure_form(h.route_path('edit_repo_caches', repo_name=c.repo_name), request=request)}
17 ${h.secure_form(h.route_path('edit_repo_caches', repo_name=c.repo_name), request=request)}
18 <div class="form">
18 <div class="form">
19 <div class="fields">
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 </div>
25 </div>
22 </div>
26 </div>
23 ${h.end_form()}
27 ${h.end_form()}
@@ -37,7 +37,12 b''
37 ${h.secure_form(h.route_path('edit_repo_remote_pull', repo_name=c.repo_name), request=request)}
37 ${h.secure_form(h.route_path('edit_repo_remote_pull', repo_name=c.repo_name), request=request)}
38 <div class="form">
38 <div class="form">
39 <div class="fields">
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 </div>
46 </div>
42 </div>
47 </div>
43 ${h.end_form()}
48 ${h.end_form()}
@@ -35,7 +35,7 b''
35
35
36 <div class="field">
36 <div class="field">
37 <button class="btn btn-small btn-danger" type="submit"
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 <i class="icon-remove"></i>
39 <i class="icon-remove"></i>
40 ${_('Delete This Exception')}
40 ${_('Delete This Exception')}
41 </button>
41 </button>
@@ -16,7 +16,8 b''
16 <input type="hidden" name="type_filter", value="${c.type_filter}">
16 <input type="hidden" name="type_filter", value="${c.type_filter}">
17 <div class="field">
17 <div class="field">
18 <button class="btn btn-small btn-danger" type="submit"
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 <i class="icon-remove"></i>
21 <i class="icon-remove"></i>
21 % if c.type_filter:
22 % if c.type_filter:
22 ${_('Delete All `{}`').format(c.type_filter)}
23 ${_('Delete All `{}`').format(c.type_filter)}
@@ -176,8 +176,10 b''
176 </div>
176 </div>
177 <div class="grid_delete">
177 <div class="grid_delete">
178 ${h.secure_form(h.route_path('edit_repo_advanced_delete', repo_name=repo_name), request=request)}
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",
179 <input class="btn btn-link btn-danger" id="remove_${repo_name}" name="remove_${repo_name}"
180 onclick="return confirm('"+_('Confirm to delete this repository: %s') % repo_name+"');")}
180 onclick="submitConfirm(event, this, _gettext('Confirm to delete this repository'), _gettext('Delete'), '${repo_name}')"
181 type="submit" value="Delete"
182 >
181 ${h.end_form()}
183 ${h.end_form()}
182 </div>
184 </div>
183 </div>
185 </div>
@@ -250,8 +252,10 b''
250 </div>
252 </div>
251 <div class="grid_delete">
253 <div class="grid_delete">
252 ${h.secure_form(h.route_path('edit_repo_group_advanced_delete', repo_group_name=repo_group_name), request=request)}
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",
255 <input class="btn btn-link btn-danger" id="remove_${repo_group_name}" name="remove_${repo_group_name}"
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)+"');")}
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 ${h.end_form()}
259 ${h.end_form()}
256 </div>
260 </div>
257 </%def>
261 </%def>
@@ -265,8 +269,10 b''
265 </div>
269 </div>
266 <div class="grid_delete">
270 <div class="grid_delete">
267 ${h.secure_form(h.route_path('user_delete', user_id=user_id), request=request)}
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",
272 <input class="btn btn-link btn-danger" id="remove_user_${user_id}" name="remove_user_${user_id}"
269 onclick="return confirm('"+_('Confirm to delete this user: %s') % username+"');")}
273 onclick="submitConfirm(event, this, _gettext('Confirm to delete this user'), _gettext('Delete'), '${username}')"
274 type="submit" value="Delete"
275 >
270 ${h.end_form()}
276 ${h.end_form()}
271 </div>
277 </div>
272 </%def>
278 </%def>
@@ -277,8 +283,10 b''
277 </div>
283 </div>
278 <div class="grid_delete">
284 <div class="grid_delete">
279 ${h.secure_form(h.route_path('user_groups_delete', user_group_id=user_group_id), request=request)}
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",
286 <input class="btn btn-link btn-danger" id="remove_group_${user_group_id}" name="remove_group_${user_group_id}"
281 onclick="return confirm('"+_('Confirm to delete this user group: %s') % user_group_name+"');")}
287 onclick="submitConfirm(event, this, _gettext('Confirm to delete this user group'), _gettext('Delete'), '${user_group_name}')"
288 type="submit" value="Delete"
289 >
282 ${h.end_form()}
290 ${h.end_form()}
283 </div>
291 </div>
284 </%def>
292 </%def>
@@ -423,8 +431,10 b''
423 % if h.HasRepoPermissionAny('repository.admin')(c.repo_name):
431 % if h.HasRepoPermissionAny('repository.admin')(c.repo_name):
424 <div class="grid_delete">
432 <div class="grid_delete">
425 ${h.secure_form(h.route_path('repo_artifacts_delete', repo_name=repo_name, uid=file_store_id), request=request)}
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",
434 <input class="btn btn-link btn-danger" id="remove_artifact_${file_store_id}" name="remove_artifact_${file_store_id}"
427 onclick="return confirm('"+_('Confirm to delete this artifact: %s') % file_uid+"');")}
435 onclick="submitConfirm(event, this, _gettext('Confirm to delete this artifact'), _gettext('Delete'), '${file_uid}')"
436 type="submit" value="${_('Delete')}"
437 >
428 ${h.end_form()}
438 ${h.end_form()}
429 </div>
439 </div>
430 % endif
440 % endif
@@ -63,8 +63,9 b''
63 <div id="delete_pullrequest" class="action_button pr-save ${('' if c.allowed_to_delete else 'disabled' )}" style="display: none;">
63 <div id="delete_pullrequest" class="action_button pr-save ${('' if c.allowed_to_delete else 'disabled' )}" style="display: none;">
64 % if c.allowed_to_delete:
64 % if c.allowed_to_delete:
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)}
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'),
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 class_="btn btn-link btn-danger no-margin",onclick="return confirm('"+_('Confirm to delete this pull request')+"');")}
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 ${h.end_form()}
69 ${h.end_form()}
69 % else:
70 % else:
70 <span class="tooltip" title="${_('Not allowed to delete this pull request')}">${_('Delete pull request')}</span>
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