Skip to content

Commit

Permalink
fizes templates
Browse files Browse the repository at this point in the history
  • Loading branch information
saxix committed Nov 15, 2024
1 parent e6a01cf commit 0e99abf
Show file tree
Hide file tree
Showing 9 changed files with 66 additions and 164 deletions.
2 changes: 1 addition & 1 deletion src/country_workspace/workspaces/admin/batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,4 @@ def has_add_permission(self, request: HttpRequest, obj: Optional[CountryBatch] =
def imported_records(self, btn: LinkButton) -> None:
base = reverse("workspace:workspaces_countryhousehold_changelist")
obj = btn.context["original"]
btn.href = f"{base}?batch__exact={obj.pk}&batch__program__exact={obj.program.pk}"
btn.href = f"{base}?batch__exact={obj.pk}"
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,10 @@
{% block coltype %}colM{% endblock %}

{% block bodyclass %}{{ block.super }} app-{{ opts.app_label }} model-{{ opts.model_name }} change-form{% endblock %}
{##}
{#{% if not is_popup %}#}
{# {% block breadcrumbs %}#}
{# <div class="breadcrumbs">#}
{#<a href="{% url 'workspace:index' %}">{% translate 'Home' %}</a>#}
{#&rsaquo; <a href="{% url 'workspace:app_list' app_label=opts.app_label %}">{{ opts.app_config.verbose_name }}</a>#}
{#&rsaquo; {% if has_view_permission %}{% url opts|workspace_urlname:'changelist' as wcl%}#}
{# <a href="{% add_preserved_filters wcl %}">{{ opts.verbose_name_plural|capfirst }}</a>{% else %}{{ opts.verbose_name_plural|capfirst }}{% endif %}#}
{# &rsaquo;#}
{# {% if add %}{% blocktranslate with name=opts.verbose_name %}Add {{ name }}{% endblocktranslate %}{% else %}#}
{# {{ original|truncatewords:"18" }}{% endif %}#}
{# </div>#}
{# {% endblock %}#}
{#{% endif %}#}

{% block content %}

<div id="content">
{% block object-tools %}
{% if change and not is_popup %}
<ul class="object-tools">
Expand All @@ -38,10 +26,9 @@
</ul>
{% endif %}
{% endblock %}
<div id="content">
<div id="content-main">
<form {% if has_file_field %}enctype="multipart/form-data" {% endif %}{% if form_url %}action="{{ form_url }}" {% endif %}method="post"
id="{{ opts.model_name }}_form" novalidate>{% csrf_token %}{% block form_top %}{% endblock %}
id="{{ opts.model_name }}_form" novalidate class="min-w-full">{% csrf_token %}{% block form_top %}{% endblock %}
<div class="min-w-full">
{% if is_popup %}<input type="hidden" name="{{ is_popup_var }}" value="1">{% endif %}
{% if to_field %}<input type="hidden" name="{{ to_field_var }}" value="{{ to_field }}">{% endif %}
Expand Down
110 changes: 48 additions & 62 deletions src/country_workspace/workspaces/templates/workspace/change_list.html
Original file line number Diff line number Diff line change
@@ -1,20 +1,7 @@
{% extends "workspace/_base.html" %}{% load i18n static workspace_urls workspace_list %}
{#{% block extrahead %}#}
{# {{ block.super }}#}
{# {{ media.js }}#}
{# <script src="{% static 'workspace/js/filters.js' %}" defer></script>#}
{#{% endblock %}#}
{#{% block breadcrumbs %}#}
{# <div class="breadcrumbs">#}
{# <a href="{% url 'workspace:index' %}">{% translate 'Workspace' %}</a>#}
{# &rsaquo; <a href="{% url 'workspace:app_list' app_label=cl.opts.app_label %}">{{ cl.opts.app_config.verbose_name }}</a>#}
{# &rsaquo; {{ active_program }}#}
{# &rsaquo; {{ cl.opts.verbose_name_plural|capfirst }}#}
{# </div>#}
{#{% endblock %}#}
{% block extrastyle %}
{{ block.super }}
<link rel="stylesheet" href="{% static "admin/css/changelists.css" %}">
{{ block.super }}
<link rel="stylesheet" href="{% static "admin/css/changelists.css" %}">
{% endblock %}
{% block content %}
<div id="content">
Expand All @@ -26,55 +13,54 @@
{% endblock %}
</ul>
{% endblock %}
<div id="content-main">
{% if cl.formset and cl.formset.errors %}
<p class="errornote">
{% blocktranslate count counter=cl.formset.total_error_count %}Please correct the error below.
{% plural %}Please correct the errors below.{% endblocktranslate %}
</p>
{{ cl.formset.non_form_errors }}
{% endif %}
<div class="module{% if cl.has_filters %} filtered{% endif %} min-w-full flex" id="changelist">
<div class="changelist-form-container flex-1">
{% block search %}{% search_form cl %}{% endblock %}
<form id="changelist-form" method="post"{% if cl.formset and cl.formset.is_multipart %}
enctype="multipart/form-data"{% endif %} novalidate>{% csrf_token %}
{% if cl.formset %}
<div>{{ cl.formset.management_form }}</div>
{% endif %}

{% block result_list %}
{% if action_form and actions_on_top and cl.show_admin_actions %}
{% admin_actions %}{% endif %}
{% result_list cl %}
{% if action_form and actions_on_bottom and cl.show_admin_actions %}
{% admin_actions %}{% endif %}
{% endblock %}
{% block pagination %}{% pagination cl %}{% endblock %}
</form>
<div id="content-main">
{% if cl.formset and cl.formset.errors %}
<p class="errornote">
{% blocktranslate count counter=cl.formset.total_error_count %}Please correct the error below.
{% plural %}Please correct the errors below.{% endblocktranslate %}
</p>
{{ cl.formset.non_form_errors }}
{% endif %}
<div class="module{% if cl.has_filters %} filtered{% endif %} min-w-full flex" id="changelist">
<div class="changelist-form-container flex-1">
{% block search %}{% search_form cl %}{% endblock %}
<form id="changelist-form" method="post"{% if cl.formset and cl.formset.is_multipart %}
enctype="multipart/form-data"{% endif %} novalidate>{% csrf_token %}
{% if cl.formset %}
<div>{{ cl.formset.management_form }}</div>
{% endif %}

{% block result_list %}
{% if action_form and actions_on_top and cl.show_admin_actions %}
{% admin_actions %}{% endif %}
{% result_list cl %}
{% if action_form and actions_on_bottom and cl.show_admin_actions %}
{% admin_actions %}{% endif %}
{% endblock %}
{% block pagination %}{% pagination cl %}{% endblock %}
</form>
</div>
{% block filters %}
{% if cl.has_filters %}
<nav id="changelist-filter" class="flex-none w-1/6" aria-labelledby="changelist-filter-header">
<h2 id="changelist-filter-header">{% translate 'Filter' %}</h2>
{% if cl.is_facets_optional or cl.has_active_filters %}
<div id="changelist-filter-extra-actions">
{% if cl.is_facets_optional %}<h3>
{% if cl.add_facets %}<a href="{{ cl.remove_facet_link }}"
class="hidelink">{% translate "Hide counts" %}</a>
{% else %}<a href="{{ cl.add_facet_link }}"
class="viewlink">{% translate "Show counts" %}</a>{% endif %}
</h3>{% endif %}
{% if cl.has_active_filters %}<h3>
<a href="{{ cl.clear_all_filters_qs }}">&#10006; {% translate "Clear all filters" %}</a>
</h3>{% endif %}
</div>{% endif %}
{% for spec in cl.filter_specs %}{% admin_list_filter cl spec %}{% endfor %}
</nav>
{% endif %}
{% endblock %}
</div>
{% block filters %}
{% if cl.has_filters %}
<nav id="changelist-filter" class="flex-none w-1/6" aria-labelledby="changelist-filter-header">
<h2 id="changelist-filter-header">{% translate 'Filter' %}</h2>
{% if cl.is_facets_optional or cl.has_active_filters %}
<div id="changelist-filter-extra-actions">
{% if cl.is_facets_optional %}<h3>
{% if cl.add_facets %}<a href="{{ cl.remove_facet_link }}"
class="hidelink">{% translate "Hide counts" %}</a>
{% else %}<a href="{{ cl.add_facet_link }}"
class="viewlink">{% translate "Show counts" %}</a>{% endif %}
</h3>{% endif %}
{% if cl.has_active_filters %}<h3>
<a href="{{ cl.clear_all_filters_qs }}">&#10006; {% translate "Clear all filters" %}</a>
</h3>{% endif %}
</div>{% endif %}
{% for spec in cl.filter_specs %}{% admin_list_filter cl spec %}{% endfor %}
</nav>
{% endif %}
{% endblock %}
</div>
</div>
</div>
{% endblock %}
Original file line number Diff line number Diff line change
@@ -1,41 +1,15 @@
{% extends "workspace/change_form.html" %}
{% load i18n static admin_modify workspace_urls workspace_modify %}
{% block content_title %}{% endblock %}
{% block coltype %}colMX{% endblock %}

{#{% if not is_popup %}#}
{# {% block breadcrumbs %}#}
{# <div class="breadcrumbs">#}
{# <a href="{% url 'workspace:index' %}">{% translate 'Workspaces' %}</a>#}
{# &rsaquo; <a#}
{# href="{% url 'workspace:app_list' app_label=opts.app_label %}">{{ opts.app_config.verbose_name }}</a>#}
{# &rsaquo; {% if has_view_permission %}#}
{# {% url opts|workspace_urlname:'changelist' as wcl %}#}
{# <a href="{% add_preserved_filters wcl %}">{{ opts.verbose_name_plural|capfirst }}</a>{% else %}#}
{# {{ opts.verbose_name_plural|capfirst }}{% endif %}#}
{##}
{# &rsaquo;#}
{# {% if add %}{% blocktranslate with name=opts.verbose_name %}Add {{ name }}{% endblocktranslate %}{% else %}#}
{# {{ original|truncatewords:"18" }}{% endif %}#}
{# </div>#}
{# {% endblock %}#}
{#{% endif %}#}
{#{% block coltype %}colMX{% endblock %}#}


{% block content %}
{% block object-tools %}
{{ block.super }}
{# {% if change and not is_popup %}#}
{# <ul class="object-tools">#}
{# {% block object-tools-items %}#}
{# {% change_form_object_tools %}#}
{# {% include "admin_extra_buttons/includes/change_form_buttons.html" %}#}
{# {% endblock %}#}
{# </ul>#}
{# {% endif %}#}
{% endblock %}
<div id="content" class="min-w-full">
<div id="content-main" class="min-w-full">
<div id="content">
<div id="content-main">
<form class="min-w-full beneficiary-form" {% if has_file_field %}enctype="multipart/form-data" {% endif %}{% if form_url %}action="{{ form_url }}" {% endif %}method="post"
id="{{ opts.model_name }}_form" novalidate>{% csrf_token %}{% block form_top %}{% endblock %}
<div class="min-w-full">
Expand Down Expand Up @@ -73,4 +47,5 @@
</div>
</form>
</div>
</div>
{% endblock %}
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
&rsaquo;{{ original }}{% admin_url original %}
{% else %}
&rsaquo; <a href="{% url "workspace:workspaces_countryhousehold_changelist" %}">Households</a>
&rsaquo; <a href="{% url "workspace:workspaces_countryhousehold_change" original.household.pk %}">{{ original.household }}</a>{% admin_url selected_household %}
&rsaquo; <a href="{% url "workspace:workspaces_countryindividual_changelist" %}?household__exact={{ original.household.pk }}">members</a> {% admin_url modeladmin household__exact=selected_household.pk %}
&rsaquo; <a href="{% url "workspace:workspaces_countryhousehold_change" original.household.pk %}">{{ original.household }}</a>{% admin_url original.household %}
&rsaquo; <a href="{% url "workspace:workspaces_countryindividual_changelist" %}?household__exact={{ original.household.pk }}">members</a> {% admin_url modeladmin household__exact=original.household.pk %}
&rsaquo;{{ original }}{% admin_url original %}
{% endif %}
{% endblock %}
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@
<span>{{ app.version }}</span>
<span>{{ app.build_date }}</span>
<span>{{ app.commit }}</span>
<span>(c) 2024 -UNICEF</span>
</div>
</div>
</main>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
{% endif %}
{% if show_delete_link and original %}
{% url opts|workspace_urlname:'delete' original.pk|admin_urlquote as delete_url %}
<a href="{% add_preserved_filters delete_url %}" class="deletelink">{% translate "Delete" %}</a>
<a href="{% add_preserved_filters delete_url %}" class="deletelink float-right">{% translate "Delete" %}</a>
{% endif %}
{% endblock %}
</div>
48 changes: 1 addition & 47 deletions src/country_workspace/workspaces/theme/static/css/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -686,7 +686,7 @@ form .helptext {
font-style: italic;
}

a.button, input[type=submit], button.button, a.closelink, a.deletelink {
a.button, input[type=submit], button.button, a.closelink, a.deletelink {
margin: 0;
color: white;
cursor: pointer;
Expand Down Expand Up @@ -1395,52 +1395,10 @@ video {
display: none;
}

.container {
width: 100%;
}

@media (min-width: 640px) {
.container {
max-width: 640px;
}
}

@media (min-width: 768px) {
.container {
max-width: 768px;
}
}

@media (min-width: 1024px) {
.container {
max-width: 1024px;
}
}

@media (min-width: 1280px) {
.container {
max-width: 1280px;
}
}

@media (min-width: 1536px) {
.container {
max-width: 1536px;
}
}

.static {
position: static;
}

.fixed {
position: fixed;
}

.sticky {
position: sticky;
}

.float-right {
float: right;
}
Expand Down Expand Up @@ -1578,10 +1536,6 @@ video {
flex-direction: column;
}

.content-start {
align-content: flex-start;
}

.items-center {
align-items: center;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ form {
}


a.button, input[type=submit], button.button, a.closelink, a.deletelink {
a.button, input[type=submit], button.button, a.closelink, a.deletelink {

margin: 0;
color: white;
Expand Down Expand Up @@ -38,7 +38,6 @@ a.button, input[type=submit], button.button, a.closelink, a.deletelink {
background-color: rgba(99, 92, 15, 0.53);
}


a.deletelink {
background-color: rgb(207, 34, 34);
float: right;
Expand Down Expand Up @@ -91,11 +90,13 @@ fieldset.module {
}
}
}
.beneficiary-form{
input[type=text], select{

.beneficiary-form {
input[type=text], select {
@apply min-w-full;
}
.validation-error{

.validation-error {
@apply italic;
}
}

0 comments on commit 0e99abf

Please sign in to comment.