Compare commits
No commits in common. "ee4218c901644778e162da7d12f16c2fc98cf401" and "599742b3e351e585c4917a49c1b1ef42c1f56ffe" have entirely different histories.
ee4218c901
...
599742b3e3
|
@ -119,17 +119,7 @@ ul.actions li {
|
|||
.form-control {
|
||||
border: 1px solid #ccc;
|
||||
box-shadow: inset 0 1px 1px rgba(0,0,0,.075);
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.checkbox .form-control {
|
||||
min-width: auto;
|
||||
width: auto;
|
||||
}
|
||||
|
||||
.checkbox label {
|
||||
padding-right: 1em;
|
||||
}
|
||||
}
|
||||
|
||||
.errorlist {
|
||||
display: block;;
|
||||
|
@ -161,7 +151,7 @@ textarea {
|
|||
}
|
||||
|
||||
.form-inline .form-group {
|
||||
vertical-align: top;
|
||||
vertical-align: middle;
|
||||
display: inline-block;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
@ -170,6 +160,14 @@ textarea {
|
|||
min-width: 15em;
|
||||
}
|
||||
|
||||
.form-inline .checkbox .form-control {
|
||||
min-width: auto;
|
||||
}
|
||||
|
||||
.form-inline .checkbox label {
|
||||
padding-right: 1em;
|
||||
}
|
||||
|
||||
.form-inline .form-control.select2 {
|
||||
display: inline-block;
|
||||
}
|
||||
|
|
|
@ -74,20 +74,6 @@
|
|||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
{% block actions %}
|
||||
{% if actions %}
|
||||
<ul class="actions">
|
||||
{% for target_url, icon, label in actions %}
|
||||
{% if icon %}
|
||||
<li><a href="{{ target_url }}"><i class="fas {{ icon }}" title="{{ label }}"></i></a></li>
|
||||
{% else %}
|
||||
<li><a href="{{ target_url }}">{{ label }}</a></li>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
{% endblock %}
|
||||
</div>
|
||||
|
|
|
@ -15,10 +15,8 @@
|
|||
{% endfor %}
|
||||
{% endblock %}
|
||||
|
||||
{% block extra_form %}{% endblock %}
|
||||
|
||||
<ul class="actions">
|
||||
{% block form_actions %}
|
||||
{% block actions %}
|
||||
{% if not is_popup %}
|
||||
<li><a href="{{ view.get_success_url }}">{% trans "Cancel" %}</a></li>
|
||||
{% endif %}
|
||||
|
@ -28,8 +26,8 @@
|
|||
{% if not is_popup %}
|
||||
<li><button name="save_and_continue" type="submit">{% trans "Save and continue" %}</button>
|
||||
{% endif %}
|
||||
{% block extra_form_actions %}{% endblock %}
|
||||
{% endblock form_actions %}
|
||||
{% block extra_actions %}{% endblock %}
|
||||
{% endblock actions %}
|
||||
</ul>
|
||||
</form>
|
||||
{% endblock %}
|
||||
|
|
|
@ -4,6 +4,16 @@
|
|||
{% load form_tags %}
|
||||
|
||||
{% block content %}
|
||||
{% block actions %}
|
||||
{% if actions %}
|
||||
<ul class="actions">
|
||||
{% for target_url, icon, label in actions %}
|
||||
<li><a href="{{ target_url }}"><i class="fas {{ icon }}" title="{{ label }}"></i></a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
{% block filter_form %}
|
||||
{% if filter_form %}
|
||||
<form class="filter-form form-inline" action="." method="GET">
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
{% if field.field.required %} required{% endif %}
|
||||
{% if field.errors %} has-error{% endif %}
|
||||
">
|
||||
<label for="{{ field.id_for_label }}">{{ field.label }}</label>
|
||||
<label>{{ field.label }}</label>
|
||||
{% add_widget_attrs field placeholder=field.label %}
|
||||
{{ field }}
|
||||
|
||||
|
|
|
@ -7,13 +7,12 @@ from django.urls import reverse
|
|||
register = template.Library()
|
||||
|
||||
|
||||
def base_form_field(field, css=None, container_class='', add_another_url=None, field_template=None):
|
||||
def base_form_field(field, css='form-control', container_class='', add_another_url=None, field_template=None):
|
||||
if field.is_hidden:
|
||||
return str(field)
|
||||
|
||||
|
||||
classes = field.field.widget.attrs.get('class', '').split(' ')
|
||||
classes.append('form-control')
|
||||
if css:
|
||||
classes.append(css)
|
||||
|
||||
|
|
10
gas/views.py
10
gas/views.py
|
@ -44,7 +44,6 @@ class GASMixin:
|
|||
help_text = ''
|
||||
success_message = _("Operation successful.")
|
||||
breadcrumbs = []
|
||||
actions = None
|
||||
|
||||
def dispatch(self, *args, **kwargs):
|
||||
user = self.request.user
|
||||
|
@ -94,9 +93,6 @@ class GASMixin:
|
|||
" Returns a list of (url, label) tuples for the breadcrumbs "
|
||||
return self.breadcrumbs
|
||||
|
||||
def get_actions(self):
|
||||
return self.actions or []
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
ctx = super().get_context_data(**kwargs)
|
||||
ctx.update({
|
||||
|
@ -105,7 +101,6 @@ class GASMixin:
|
|||
'title': self.get_title(),
|
||||
'help_text': self.get_help_text(),
|
||||
'breadcrumbs': self.get_breadcrumbs(),
|
||||
'actions': self.get_actions(),
|
||||
'gas_title': gas_settings.TITLE,
|
||||
'logo_static_url': gas_settings.LOGO,
|
||||
'css': gas_settings.MEDIA['css'],
|
||||
|
@ -117,6 +112,7 @@ class GASMixin:
|
|||
class GASListView(GASMixin, ListView):
|
||||
""" ListView, permite indicar un formulario para filtrar contenido. """
|
||||
filter_form_class = None
|
||||
actions = None
|
||||
|
||||
def get_filter_form(self):
|
||||
if self.filter_form_class is None:
|
||||
|
@ -135,10 +131,14 @@ class GASListView(GASMixin, ListView):
|
|||
qs = super().get_queryset()
|
||||
return self.filter_queryset(qs)
|
||||
|
||||
def get_actions(self):
|
||||
return self.actions or []
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
ctx = super().get_context_data(**kwargs)
|
||||
ctx.update({
|
||||
'filter_form': self.filter_form,
|
||||
'actions': self.get_actions(),
|
||||
})
|
||||
return ctx
|
||||
|
||||
|
|
Loading…
Reference in New Issue