This repository has been archived by the owner on Jul 29, 2022. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* release/1.1: updates CHANGES fixes button ordering @action now has 'exclude_if_adding' to hide a button in add mode updtes README
- Loading branch information
Showing
11 changed files
with
136 additions
and
23 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
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
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
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
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
13 changes: 13 additions & 0 deletions
13
src/admin_extra_urls/templates/admin_extra_urls/grappelli/change_form.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,13 @@ | ||
{% extends "admin/change_form.html" %} | ||
{% load extra_urls i18n admin_static admin_list admin_urls %} | ||
|
||
{% block object-tools %} | ||
|
||
<ul class="object-tools grp-object-tools"> | ||
{% block object-tools-items %} | ||
{{ block.super }} | ||
{% include "admin_extra_urls/grappelli/includes/change_form_buttons.html" %} | ||
{% endblock %} | ||
</ul> | ||
|
||
{% endblock %} |
19 changes: 19 additions & 0 deletions
19
src/admin_extra_urls/templates/admin_extra_urls/grappelli/change_list.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,19 @@ | ||
{% extends "admin/change_list.html" %} | ||
{% load extra_urls i18n admin_static admin_list admin_urls %} | ||
|
||
{% block object-tools %} | ||
|
||
<ul class="object-tools grp-object-tools"> | ||
{% block object-tools-items %} | ||
{% if has_add_permission %} | ||
<li> <a href="{% url cl.opts|admin_urlname:'add' %}{% if is_popup %}?_popup=1{% endif %}" | ||
class="btn btn-success grp-add-link grp-state-focus"> | ||
<i class="icon-plus-sign icon-white"></i> | ||
{% blocktrans with cl.opts.verbose_name as name %}Add {{ name }}{% endblocktrans %} | ||
</a></li> | ||
{% endif %} | ||
{% include "admin_extra_urls/grappelli/includes/change_list_buttons.html" %} | ||
{% endblock %} | ||
</ul> | ||
|
||
{% endblock %} |
40 changes: 40 additions & 0 deletions
40
src/admin_extra_urls/templates/admin_extra_urls/grappelli/includes/change_form_buttons.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,40 @@ | ||
{% load extra_urls i18n admin_static admin_list admin_urls %} | ||
|
||
{% for method_name, urlattrs in adminform.model_admin.extra_detail_buttons %} | ||
{% has_permission urlattrs.perm as authorized %} | ||
{% if authorized and urlattrs.visible%} | ||
{% nlless %} | ||
<li>{% if original.pk %} | ||
<a id="btn-{{method_name}}" | ||
href="{% url opts|admin_urlname:method_name original.pk %}{% if is_popup %}?_popup=1{% endif %}" | ||
class="extra-link {{urlattrs.css_class}} {{urlattrs.method_name}}"> | ||
{% if icon %} | ||
<i class="{{ urlattrs.icon }}"></i> | ||
{% endif %} | ||
{{ urlattrs.label }} | ||
</a> | ||
{% else %} | ||
{% if not urlsattrs.exclude_if_adding %} | ||
<a id="btn-{{method_name}}" href="#" | ||
class="extra-link disabled {{urlattrs.css_class}} {{urlattrs.method_name}}"> | ||
{% if icon %} | ||
<i class="{{ urlattrs.icon }}"></i> | ||
{% endif %} | ||
{{ urlattrs.label }} | ||
</a> | ||
{%endif %} | ||
{% endif %} | ||
</li> | ||
{% endnlless %} | ||
{% endif %} | ||
{% endfor %} | ||
|
||
<script> | ||
grp.jQuery('.btn').click(function (e) { | ||
if ($(this).hasClass("disabled")) { | ||
e.preventDefault(); | ||
} else { | ||
$(this).removeClass('btn-success').addClass('disabled'); | ||
} | ||
}); | ||
</script> |
26 changes: 26 additions & 0 deletions
26
src/admin_extra_urls/templates/admin_extra_urls/grappelli/includes/change_list_buttons.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,26 @@ | ||
{% load extra_urls i18n admin_static admin_list admin_urls %} | ||
|
||
{% for method_name,urlattrs in cl.model_admin.extra_buttons %} | ||
{% has_permission urlattrs.perm as authorized %} | ||
{% if authorized and urlattrs.visible %} | ||
{% spaceless %} | ||
<li><a id="btn-{{method_name}}" href="{% url cl.opts|admin_urlname:method_name %}{% if is_popup %}?_popup=1{% endif %}" | ||
class="extra-link {{urlattrs.css_class}} {{method_name}}"> | ||
{% if urlattrs.icon %} | ||
<i class="{{ urlattrs.icon }} icon-white"></i> | ||
{% endif %} | ||
{{ urlattrs.label }} | ||
</a></li> | ||
{% endspaceless %} | ||
{% endif %} | ||
{% endfor %} | ||
|
||
<script> | ||
grp.jQuery('.btn').click(function(e) { | ||
if ($(this).hasClass( "disabled" )){ | ||
e.preventDefault(); | ||
}else{ | ||
$(this).removeClass('btn-success').addClass('disabled'); | ||
} | ||
}); | ||
</script> |
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
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