Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
csentry
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Anders Harrisson
csentry
Commits
ba27ff55
Commit
ba27ff55
authored
7 years ago
by
Benjamin Bertrand
Browse files
Options
Downloads
Patches
Plain Diff
Add confirmation dialog to delete
Create macro to add delete button with modal dialog to cancel or confirm deletion.
parent
7327009c
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
app/templates/_helpers.html
+23
-0
23 additions, 0 deletions
app/templates/_helpers.html
app/templates/network/view_host.html
+3
-4
3 additions, 4 deletions
app/templates/network/view_host.html
app/templates/users/profile.html
+3
-4
3 additions, 4 deletions
app/templates/users/profile.html
with
29 additions
and
8 deletions
app/templates/_helpers.html
+
23
−
0
View file @
ba27ff55
...
@@ -43,3 +43,26 @@
...
@@ -43,3 +43,26 @@
{% macro format_datetime(dt) -%}
{% macro format_datetime(dt) -%}
{{ dt.strftime("%Y-%m-%d %H:%M") }}
{{ dt.strftime("%Y-%m-%d %H:%M") }}
{%- endmacro %}
{%- endmacro %}
{% macro delete_button_with_confirmation(title, modal_id, message) -%}
<button
type=
"button"
class=
"btn btn-light"
data-toggle=
"modal"
data-target=
{{
"
#
%
s
"
|
format
(
modal_id
)
}}
>
<span
class=
"oi oi-trash"
title=
"{{ title }}"
aria-hidden=
"true"
></span>
</button>
<!-- Modal -->
<div
class=
"modal fade"
id=
"{{ modal_id }}"
tabindex=
"-1"
role=
"dialog"
aria-labelledby=
"delete-confirmation"
aria-hidden=
"true"
>
<div
class=
"modal-dialog"
role=
"document"
>
<div
class=
"modal-content"
>
<div
class=
"modal-header"
>
<h6
class=
"modal-title"
>
{{ message }}
</h6>
<button
type=
"button"
class=
"close"
data-dismiss=
"modal"
aria-label=
"Close"
>
<span
aria-hidden=
"true"
>
×
</span>
</button>
</div>
<div
class=
"modal-footer"
>
<button
type=
"button"
class=
"btn btn-secondary"
data-dismiss=
"modal"
>
Cancel
</button>
<button
type=
"submit"
class=
"btn btn-primary"
>
OK
</button>
</div>
</div>
</div>
</div>
{%- endmacro %}
This diff is collapsed.
Click to expand it.
app/templates/network/view_host.html
+
3
−
4
View file @
ba27ff55
{% extends "network/hosts.html" %}
{% extends "network/hosts.html" %}
{% from "_helpers.html" import link_to_item %}
{% from "_helpers.html" import link_to_item
, delete_button_with_confirmation
%}
{% block title %}View Host - CSEntry{% endblock %}
{% block title %}View Host - CSEntry{% endblock %}
...
@@ -50,9 +50,8 @@
...
@@ -50,9 +50,8 @@
</a>
</a>
<form
method=
"POST"
action=
"/network/interfaces/delete"
>
<form
method=
"POST"
action=
"/network/interfaces/delete"
>
<input
id=
"interface_id"
name=
"interface_id"
type=
"hidden"
value=
"{{ interface.id }}"
>
<input
id=
"interface_id"
name=
"interface_id"
type=
"hidden"
value=
"{{ interface.id }}"
>
<button
type=
"submit"
class=
"btn btn-light"
>
{{ delete_button_with_confirmation("Delete interface", "deleteConfirmation-%s" | format(interface.id),
<span
class=
"oi oi-trash"
title=
"Delete interface"
aria-hidden=
"true"
></span>
"Are you sure you want to delete interface %s?" | format(interface.name)) }}
</button>
</form>
</form>
</td>
</td>
<td>
{{ interface.name }}
</td>
<td>
{{ interface.name }}
</td>
...
...
This diff is collapsed.
Click to expand it.
app/templates/users/profile.html
+
3
−
4
View file @
ba27ff55
{% extends "base.html" %}
{% extends "base.html" %}
{% from "_helpers.html" import render_field %}
{% from "_helpers.html" import render_field
, delete_button_with_confirmation
%}
{% block title %}Profile - CSEntry{% endblock %}
{% block title %}Profile - CSEntry{% endblock %}
...
@@ -50,9 +50,8 @@
...
@@ -50,9 +50,8 @@
<form
method=
"POST"
action=
"/users/tokens/revoke"
>
<form
method=
"POST"
action=
"/users/tokens/revoke"
>
<input
id=
"token_id"
name=
"token_id"
type=
"hidden"
value=
"{{ token.id }}"
>
<input
id=
"token_id"
name=
"token_id"
type=
"hidden"
value=
"{{ token.id }}"
>
<input
id=
"jti"
name=
"jti"
type=
"hidden"
value=
"{{ token.jti }}"
>
<input
id=
"jti"
name=
"jti"
type=
"hidden"
value=
"{{ token.jti }}"
>
<button
type=
"submit"
class=
"btn btn-danger"
>
{{ delete_button_with_confirmation("Revoke token", "revokeConfirmation-%s" | format(token.id),
<span
class=
"oi oi-trash"
title=
"Revoke token"
aria-hidden=
"true"
></span>
"Are you sure you want to revoke token %s?" | format(token.jti)) }}
</button>
</form>
</form>
</td>
</td>
<td>
{{ token.jti }}
</td>
<td>
{{ token.jti }}
</td>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment