-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Closes #123: Introduce template tags for branch action buttons
- Loading branch information
1 parent
b623e53
commit 76f5b67
Showing
7 changed files
with
87 additions
and
36 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
10 changes: 10 additions & 0 deletions
10
netbox_branching/templates/netbox_branching/buttons/branch_archive.html
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,10 @@ | ||
{% load i18n %} | ||
{% if perms.netbox_branching.archive_branch %} | ||
<a href="{% url 'plugins:netbox_branching:branch_archive' pk=branch.pk %}" class="btn btn-primary"> | ||
<i class="mdi mdi-archive-outline"></i> {% trans "Archive" %} | ||
</a> | ||
{% else %} | ||
<button type="button" class="btn btn-primary disabled" aria-disabled="true"> | ||
<i class="mdi mdi-archive-outline"></i> {% trans "Archive" %} | ||
</button> | ||
{% endif %} |
10 changes: 10 additions & 0 deletions
10
netbox_branching/templates/netbox_branching/buttons/branch_merge.html
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,10 @@ | ||
{% load i18n %} | ||
{% if perms.netbox_branching.merge_branch %} | ||
<a href="{% url 'plugins:netbox_branching:branch_merge' pk=branch.pk %}" class="btn btn-primary"> | ||
<i class="mdi mdi-merge"></i> {% trans "Merge" %} | ||
</a> | ||
{% else %} | ||
<button type="button" class="btn btn-primary disabled" aria-disabled="true"> | ||
<i class="mdi mdi-merge"></i> {% trans "Merge" %} | ||
</button> | ||
{% endif %} |
10 changes: 10 additions & 0 deletions
10
netbox_branching/templates/netbox_branching/buttons/branch_revert.html
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,10 @@ | ||
{% load i18n %} | ||
{% if perms.netbox_branching.revert_branch %} | ||
<a href="{% url 'plugins:netbox_branching:branch_revert' pk=branch.pk %}" class="btn btn-primary"> | ||
<i class="mdi mdi-arrow-u-left-top"></i> {% trans "Revert" %} | ||
</a> | ||
{% else %} | ||
<button type="button" class="btn btn-primary disabled" aria-disabled="true"> | ||
<i class="mdi mdi-arrow-u-left-top"></i> {% trans "Revert" %} | ||
</button> | ||
{% endif %} |
10 changes: 10 additions & 0 deletions
10
netbox_branching/templates/netbox_branching/buttons/branch_sync.html
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,10 @@ | ||
{% load i18n %} | ||
{% if perms.netbox_branching.sync_branch %} | ||
<a href="{% url 'plugins:netbox_branching:branch_sync' pk=branch.pk %}" class="btn btn-primary"> | ||
<i class="mdi mdi-sync"></i> {% trans "Sync" %} | ||
</a> | ||
{% else %} | ||
<button type="button" class="btn btn-primary disabled" aria-disabled="true"> | ||
<i class="mdi mdi-sync"></i> {% trans "Sync" %} | ||
</button> | ||
{% endif %} |
Empty file.
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,42 @@ | ||
from django import template | ||
|
||
__all__ = ( | ||
'branch_sync_button', | ||
'branch_merge_button', | ||
'branch_revert_button', | ||
'branch_archive_button', | ||
) | ||
|
||
register = template.Library() | ||
|
||
|
||
@register.inclusion_tag('netbox_branching/buttons/branch_sync.html', takes_context=True) | ||
def branch_sync_button(context, branch): | ||
return { | ||
'branch': branch, | ||
'perms': context.get('perms'), | ||
} | ||
|
||
|
||
@register.inclusion_tag('netbox_branching/buttons/branch_merge.html', takes_context=True) | ||
def branch_merge_button(context, branch): | ||
return { | ||
'branch': branch, | ||
'perms': context.get('perms'), | ||
} | ||
|
||
|
||
@register.inclusion_tag('netbox_branching/buttons/branch_revert.html', takes_context=True) | ||
def branch_revert_button(context, branch): | ||
return { | ||
'branch': branch, | ||
'perms': context.get('perms'), | ||
} | ||
|
||
|
||
@register.inclusion_tag('netbox_branching/buttons/branch_archive.html', takes_context=True) | ||
def branch_archive_button(context, branch): | ||
return { | ||
'branch': branch, | ||
'perms': context.get('perms'), | ||
} |